@comprehend/telemetry-node 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,7 +12,7 @@ export declare class ComprehendMetricsExporter implements PushMetricExporter {
12
12
  private sendTimeSeriesData;
13
13
  private sendCumulativeData;
14
14
  private getServiceSubject;
15
- selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality;
15
+ selectAggregationTemporality(_instrumentType: InstrumentType): AggregationTemporality;
16
16
  forceFlush(): Promise<void>;
17
17
  shutdown(): Promise<void>;
18
18
  }
@@ -141,14 +141,8 @@ class ComprehendMetricsExporter {
141
141
  const idString = `service:${name}:${namespace ?? ''}:${environment ?? ''}`;
142
142
  return hashIdString(idString);
143
143
  }
144
- selectAggregationTemporality(instrumentType) {
145
- switch (instrumentType) {
146
- case sdk_metrics_1.InstrumentType.COUNTER:
147
- case sdk_metrics_1.InstrumentType.HISTOGRAM:
148
- return sdk_metrics_1.AggregationTemporality.DELTA;
149
- default:
150
- return sdk_metrics_1.AggregationTemporality.CUMULATIVE;
151
- }
144
+ selectAggregationTemporality(_instrumentType) {
145
+ return sdk_metrics_1.AggregationTemporality.CUMULATIVE;
152
146
  }
153
147
  async forceFlush() {
154
148
  }
@@ -234,25 +234,17 @@ describe('ComprehendMetricsExporter', () => {
234
234
  });
235
235
  });
236
236
  describe('Aggregation Temporality', () => {
237
- it('should return DELTA for COUNTER', () => {
238
- expect(exporter.selectAggregationTemporality(sdk_metrics_1.InstrumentType.COUNTER))
239
- .toBe(sdk_metrics_1.AggregationTemporality.DELTA);
240
- });
241
- it('should return DELTA for HISTOGRAM', () => {
242
- expect(exporter.selectAggregationTemporality(sdk_metrics_1.InstrumentType.HISTOGRAM))
243
- .toBe(sdk_metrics_1.AggregationTemporality.DELTA);
244
- });
245
- it('should return CUMULATIVE for OBSERVABLE_GAUGE', () => {
246
- expect(exporter.selectAggregationTemporality(sdk_metrics_1.InstrumentType.OBSERVABLE_GAUGE))
247
- .toBe(sdk_metrics_1.AggregationTemporality.CUMULATIVE);
248
- });
249
- it('should return CUMULATIVE for OBSERVABLE_COUNTER', () => {
250
- expect(exporter.selectAggregationTemporality(sdk_metrics_1.InstrumentType.OBSERVABLE_COUNTER))
251
- .toBe(sdk_metrics_1.AggregationTemporality.CUMULATIVE);
252
- });
253
- it('should return CUMULATIVE for GAUGE', () => {
254
- expect(exporter.selectAggregationTemporality(sdk_metrics_1.InstrumentType.GAUGE))
255
- .toBe(sdk_metrics_1.AggregationTemporality.CUMULATIVE);
237
+ it('should return CUMULATIVE for all instrument types', () => {
238
+ for (const instrumentType of [
239
+ sdk_metrics_1.InstrumentType.COUNTER,
240
+ sdk_metrics_1.InstrumentType.HISTOGRAM,
241
+ sdk_metrics_1.InstrumentType.OBSERVABLE_GAUGE,
242
+ sdk_metrics_1.InstrumentType.OBSERVABLE_COUNTER,
243
+ sdk_metrics_1.InstrumentType.GAUGE,
244
+ ]) {
245
+ expect(exporter.selectAggregationTemporality(instrumentType))
246
+ .toBe(sdk_metrics_1.AggregationTemporality.CUMULATIVE);
247
+ }
256
248
  });
257
249
  });
258
250
  describe('Lifecycle', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comprehend/telemetry-node",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Integration of comprehend.dev with OpenTelemetry in Node.js and similar environemnts.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -296,29 +296,17 @@ describe('ComprehendMetricsExporter', () => {
296
296
  });
297
297
 
298
298
  describe('Aggregation Temporality', () => {
299
- it('should return DELTA for COUNTER', () => {
300
- expect(exporter.selectAggregationTemporality(InstrumentType.COUNTER))
301
- .toBe(AggregationTemporality.DELTA);
302
- });
303
-
304
- it('should return DELTA for HISTOGRAM', () => {
305
- expect(exporter.selectAggregationTemporality(InstrumentType.HISTOGRAM))
306
- .toBe(AggregationTemporality.DELTA);
307
- });
308
-
309
- it('should return CUMULATIVE for OBSERVABLE_GAUGE', () => {
310
- expect(exporter.selectAggregationTemporality(InstrumentType.OBSERVABLE_GAUGE))
311
- .toBe(AggregationTemporality.CUMULATIVE);
312
- });
313
-
314
- it('should return CUMULATIVE for OBSERVABLE_COUNTER', () => {
315
- expect(exporter.selectAggregationTemporality(InstrumentType.OBSERVABLE_COUNTER))
316
- .toBe(AggregationTemporality.CUMULATIVE);
317
- });
318
-
319
- it('should return CUMULATIVE for GAUGE', () => {
320
- expect(exporter.selectAggregationTemporality(InstrumentType.GAUGE))
321
- .toBe(AggregationTemporality.CUMULATIVE);
299
+ it('should return CUMULATIVE for all instrument types', () => {
300
+ for (const instrumentType of [
301
+ InstrumentType.COUNTER,
302
+ InstrumentType.HISTOGRAM,
303
+ InstrumentType.OBSERVABLE_GAUGE,
304
+ InstrumentType.OBSERVABLE_COUNTER,
305
+ InstrumentType.GAUGE,
306
+ ]) {
307
+ expect(exporter.selectAggregationTemporality(instrumentType))
308
+ .toBe(AggregationTemporality.CUMULATIVE);
309
+ }
322
310
  });
323
311
  });
324
312
 
@@ -183,14 +183,8 @@ export class ComprehendMetricsExporter implements PushMetricExporter {
183
183
  return hashIdString(idString);
184
184
  }
185
185
 
186
- selectAggregationTemporality(instrumentType: InstrumentType): AggregationTemporality {
187
- switch (instrumentType) {
188
- case InstrumentType.COUNTER:
189
- case InstrumentType.HISTOGRAM:
190
- return AggregationTemporality.DELTA;
191
- default:
192
- return AggregationTemporality.CUMULATIVE;
193
- }
186
+ selectAggregationTemporality(_instrumentType: InstrumentType): AggregationTemporality {
187
+ return AggregationTemporality.CUMULATIVE;
194
188
  }
195
189
 
196
190
  async forceFlush(): Promise<void> {