-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstrument.js
More file actions
34 lines (30 loc) · 1.2 KB
/
instrument.js
File metadata and controls
34 lines (30 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
*
*
*
* Use this file as a reference for your own instrumentation, but try to figure it out yourself
*
*
*
*/
const opentelemetry = require("@opentelemetry/sdk-node");
const { getNodeAutoInstrumentations } = require("@opentelemetry/auto-instrumentations-node");
const { OTLPTraceExporter } = require("@opentelemetry/exporter-trace-otlp-grpc");
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-grpc');
const { PeriodicExportingMetricReader, MeterProvider, ConsoleMetricExporter } = require('@opentelemetry/sdk-metrics')
const { Resource } = require('@opentelemetry/resources');
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
const sdk = new opentelemetry.NodeSDK({
resource: new Resource({
// [SemanticResourceAttributes.SERVICE_NAME]: 'frontend',
// [SemanticResourceAttributes.SERVICE_VERSION]: '0.1.0',
["my-org-service-version"]: '2.0.1',
}),
traceExporter: new OTLPTraceExporter(),
metricReader: new PeriodicExportingMetricReader({
exporter: new OTLPMetricExporter(),
// exporter: new ConsoleMetricExporter()
}),
instrumentations: [getNodeAutoInstrumentations()]
});
sdk.start()