MCPcopy
hub / github.com/Unleash/unleash / sendMetrics

Function sendMetrics

src/lib/features/metrics/impact/impact-metrics.e2e.test.ts:21–35  ·  view source on GitHub ↗
(data: ImpactMetricsBody = {}, status = 202)

Source from the content-addressed store, hash-verified

19};
20
21const sendMetrics = async (data: ImpactMetricsBody = {}, status = 202) => {
22 const { impactMetrics = [] } = data;
23 const body: Record<string, unknown> = {
24 appName: 'impact-metrics-app',
25 instanceId: 'instance-id',
26 impactMetrics,
27 };
28 // bucket defaults to null when the key is omitted; passing `bucket: undefined`
29 // explicitly drops it from the body.
30 const bucket = 'bucket' in data ? data.bucket : null;
31 if (bucket !== undefined) {
32 body.bucket = bucket;
33 }
34 return app.request.post('/api/client/metrics').send(body).expect(status);
35};
36
37const sendBulkMetricsWithImpact = async (
38 impactMetrics: (NumericMetric | BucketMetric)[],

Callers 1

Calls 1

postMethod · 0.80

Tested by

no test coverage detected