-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathinstrumentation.node.ts
More file actions
22 lines (19 loc) · 1015 Bytes
/
instrumentation.node.ts
File metadata and controls
22 lines (19 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { resourceFromAttributes, detectResources } from "@opentelemetry/resources";
import { NodeSDK } from "@opentelemetry/sdk-node";
import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
import { SimpleSpanProcessor } from "@opentelemetry/sdk-trace-node";
import { AWSXRayPropagator } from "@opentelemetry/propagator-aws-xray";
import { awsEcsDetector } from "@opentelemetry/resource-detector-aws";
import { AwsInstrumentation } from "@opentelemetry/instrumentation-aws-sdk";
import { FetchInstrumentation } from "@vercel/otel";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
const resource = resourceFromAttributes({
[ATTR_SERVICE_NAME]: "gc-forms-app",
}).merge(detectResources({ detectors: [awsEcsDetector] }));
const sdk = new NodeSDK({
resource,
spanProcessor: new SimpleSpanProcessor(new OTLPTraceExporter()),
textMapPropagator: new AWSXRayPropagator(),
instrumentations: [new FetchInstrumentation(), new AwsInstrumentation()],
});
sdk.start();