@prairielearn/opentelemetry 2.1.8 → 2.1.9
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.
- package/CHANGELOG.md +7 -0
- package/dist/metrics.test.js +1 -0
- package/dist/metrics.test.js.map +1 -1
- package/package.json +23 -23
package/CHANGELOG.md
CHANGED
package/dist/metrics.test.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {} from '@opentelemetry/api';
|
|
1
2
|
import { InMemoryMetricExporter, AggregationTemporality, MeterProvider, PeriodicExportingMetricReader, } from '@opentelemetry/sdk-metrics';
|
|
2
3
|
import { use as chaiUse, assert } from 'chai';
|
|
3
4
|
import chaiAsPromised from 'chai-as-promised';
|
package/dist/metrics.test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.test.js","sourceRoot":"","sources":["../src/metrics.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"metrics.test.js","sourceRoot":"","sources":["../src/metrics.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,aAAa,EACb,6BAA6B,GAE9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,CAAC,cAAc,CAAC,CAAC;AAExB,KAAK,UAAU,oBAAoB,CAAC,QAAgC;IAClE,OAAO,QAAQ,CAAC,UAAU,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC1D,CA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AAK,EAAE,CAAC,CAAC,CAAC;QAEnD,MAAM,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC;QAC3B,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAC/D,MAAM,CAAC,KAAK,CAAE,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,KAAmB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { type Meter } from '@opentelemetry/api';\nimport {\n InMemoryMetricExporter,\n AggregationTemporality,\n MeterProvider,\n PeriodicExportingMetricReader,\n type Histogram,\n} from '@opentelemetry/sdk-metrics';\nimport { use as chaiUse, assert } from 'chai';\nimport chaiAsPromised from 'chai-as-promised';\n\nimport { instrumentedWithMetrics } from './metrics.js';\n\nchaiUse(chaiAsPromised);\n\nasync function waitForMetricsExport(exporter: InMemoryMetricExporter) {\n while (exporter.getMetrics().length === 0) {\n await new Promise((resolve) => setTimeout(resolve, 50));\n }\n}\n\ndescribe('instrumentedWithMetrics', () => {\n let exporter: InMemoryMetricExporter;\n let metricReader: PeriodicExportingMetricReader;\n let meter: Meter;\n\n beforeEach(async () => {\n const meterProvider = new MeterProvider();\n meter = meterProvider.getMeter('test');\n exporter = new InMemoryMetricExporter(AggregationTemporality.DELTA);\n metricReader = new PeriodicExportingMetricReader({\n exporter,\n exportIntervalMillis: 50,\n });\n meterProvider.addMetricReader(metricReader);\n });\n\n afterEach(async () => {\n await exporter.shutdown();\n await metricReader.shutdown();\n });\n\n it('records a histogram for the function duration', async () => {\n await instrumentedWithMetrics(meter, 'test', async () => {});\n\n await waitForMetricsExport(exporter);\n const exportedMetrics = exporter.getMetrics();\n const { scope, metrics } = exportedMetrics[0].scopeMetrics[0];\n\n // We won't see an exported metric for the error counter because the\n // Metrics SDK no longer exports metrics with no data points.\n // https://github.com/open-telemetry/opentelemetry-js/pull/4135\n assert.lengthOf(metrics, 1);\n const [histogramMetric] = metrics;\n\n assert.equal(scope.name, 'test');\n\n assert.ok(histogramMetric);\n assert.equal(histogramMetric.descriptor.name, 'test.duration');\n assert.equal((histogramMetric.dataPoints[0].value as Histogram).count, 1);\n });\n\n it('records an error count', async () => {\n await assert.isRejected(\n instrumentedWithMetrics(meter, 'test', async () => {\n throw new Error('error for test');\n }),\n 'error for test',\n );\n\n await waitForMetricsExport(exporter);\n const exportedMetrics = exporter.getMetrics();\n const { metrics, scope } = exportedMetrics[0].scopeMetrics[0];\n\n // An error was reported above, so there will be both the error counter\n // and histogram metrics.\n assert.lengthOf(metrics, 2);\n const [counterMetric, histogramMetric] = metrics;\n\n assert.ok(scope);\n assert.equal(scope.name, 'test');\n\n assert.ok(counterMetric);\n assert.equal(counterMetric.descriptor.name, 'test.error');\n assert.equal(counterMetric.dataPoints[0].value, 1);\n\n assert.ok(histogramMetric);\n assert.equal(histogramMetric.descriptor.name, 'test.duration');\n assert.equal((histogramMetric.dataPoints[0].value as Histogram).count, 1);\n });\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prairielearn/opentelemetry",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -16,39 +16,39 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@grpc/grpc-js": "^1.12.5",
|
|
18
18
|
"@opentelemetry/api": "^1.9.0",
|
|
19
|
-
"@opentelemetry/core": "^1.
|
|
20
|
-
"@opentelemetry/exporter-metrics-otlp-grpc": "^0.
|
|
21
|
-
"@opentelemetry/exporter-trace-otlp-grpc": "^0.
|
|
22
|
-
"@opentelemetry/exporter-trace-otlp-http": "^0.
|
|
23
|
-
"@opentelemetry/instrumentation": "^0.
|
|
24
|
-
"@opentelemetry/instrumentation-aws-sdk": "^0.
|
|
25
|
-
"@opentelemetry/instrumentation-connect": "^0.
|
|
26
|
-
"@opentelemetry/instrumentation-dns": "^0.
|
|
27
|
-
"@opentelemetry/instrumentation-express": "^0.
|
|
28
|
-
"@opentelemetry/instrumentation-http": "^0.
|
|
29
|
-
"@opentelemetry/instrumentation-ioredis": "^0.
|
|
30
|
-
"@opentelemetry/instrumentation-pg": "^0.
|
|
31
|
-
"@opentelemetry/instrumentation-redis": "^0.
|
|
32
|
-
"@opentelemetry/resource-detector-aws": "^1.
|
|
33
|
-
"@opentelemetry/resources": "^1.
|
|
34
|
-
"@opentelemetry/sdk-metrics": "^1.
|
|
35
|
-
"@opentelemetry/sdk-node": "^0.
|
|
36
|
-
"@opentelemetry/sdk-trace-base": "^1.
|
|
37
|
-
"@opentelemetry/sdk-trace-node": "^1.
|
|
19
|
+
"@opentelemetry/core": "^1.30.1",
|
|
20
|
+
"@opentelemetry/exporter-metrics-otlp-grpc": "^0.57.1",
|
|
21
|
+
"@opentelemetry/exporter-trace-otlp-grpc": "^0.57.1",
|
|
22
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.57.1",
|
|
23
|
+
"@opentelemetry/instrumentation": "^0.57.1",
|
|
24
|
+
"@opentelemetry/instrumentation-aws-sdk": "^0.49.0",
|
|
25
|
+
"@opentelemetry/instrumentation-connect": "^0.43.0",
|
|
26
|
+
"@opentelemetry/instrumentation-dns": "^0.43.0",
|
|
27
|
+
"@opentelemetry/instrumentation-express": "^0.47.0",
|
|
28
|
+
"@opentelemetry/instrumentation-http": "^0.57.1",
|
|
29
|
+
"@opentelemetry/instrumentation-ioredis": "^0.47.0",
|
|
30
|
+
"@opentelemetry/instrumentation-pg": "^0.50.0",
|
|
31
|
+
"@opentelemetry/instrumentation-redis": "^0.46.0",
|
|
32
|
+
"@opentelemetry/resource-detector-aws": "^1.11.0",
|
|
33
|
+
"@opentelemetry/resources": "^1.30.1",
|
|
34
|
+
"@opentelemetry/sdk-metrics": "^1.30.1",
|
|
35
|
+
"@opentelemetry/sdk-node": "^0.57.1",
|
|
36
|
+
"@opentelemetry/sdk-trace-base": "^1.30.1",
|
|
37
|
+
"@opentelemetry/sdk-trace-node": "^1.30.1",
|
|
38
38
|
"@opentelemetry/semantic-conventions": "^1.28.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@opentelemetry/context-async-hooks": "^1.
|
|
41
|
+
"@opentelemetry/context-async-hooks": "^1.30.1",
|
|
42
42
|
"@prairielearn/tsconfig": "^0.0.0",
|
|
43
43
|
"@types/chai": "^5.0.1",
|
|
44
44
|
"@types/mocha": "^10.0.10",
|
|
45
|
-
"@types/node": "^20.17.
|
|
45
|
+
"@types/node": "^20.17.16",
|
|
46
46
|
"c8": "^10.1.3",
|
|
47
47
|
"chai": "^5.1.2",
|
|
48
48
|
"chai-as-promised": "^8.0.1",
|
|
49
49
|
"mocha": "^10.8.2",
|
|
50
50
|
"tsx": "^4.19.2",
|
|
51
|
-
"typescript": "^5.7.
|
|
51
|
+
"typescript": "^5.7.3"
|
|
52
52
|
},
|
|
53
53
|
"c8": {
|
|
54
54
|
"reporter": [
|