-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.js
28 lines (25 loc) · 843 Bytes
/
setup.js
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
const opentelemetry = require('.');
/** @type {opentelemetry.TracingOptions | undefined} */
let tracing = undefined;
if (process.env.OPENTELEMETRY_TRACING_ENDPOINT) {
tracing = {
authorizationHeader: process.env.OPENTELEMETRY_AUTHORIZATION_HEADER,
endpoint: process.env.OPENTELEMETRY_TRACING_ENDPOINT,
samplePercentage: process.env.OPENTELEMETRY_TRACING_SAMPLE_PERCENTAGE
? Number(process.env.OPENTELEMETRY_TRACING_SAMPLE_PERCENTAGE)
: undefined
};
}
/** @type {opentelemetry.MetricsOptions | undefined} */
let metrics = undefined;
if (process.env.OPENTELEMETRY_METRICS_ENDPOINT) {
metrics = {
apiGatewayKey: process.env.OPENTELEMETRY_API_GATEWAY_KEY,
endpoint: process.env.OPENTELEMETRY_METRICS_ENDPOINT
};
}
opentelemetry.setup({
logInternals: Boolean(process.env.OPENTELEMETRY_LOG_INTERNALS),
metrics,
tracing
});