-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.ts
76 lines (69 loc) · 2.38 KB
/
constants.ts
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { DiagLogLevel } from "@opentelemetry/api";
import { defaultServiceName } from "@opentelemetry/resources";
import { getEnv, getEnvBoolean, getEnvNumber, getServiceDetails } from "./internal";
import { PropagationFormat, SpanProcessor, TracingConfig, TracingOptions } from "./types";
export const DEFAULT_SERVICE_NAME = defaultServiceName();
export const SERVICE_DETAILS = getServiceDetails(DEFAULT_SERVICE_NAME);
export const REQUEST_ID_PROPERTY = "requestId";
export const REQUEST_ID_HEADER = "x-request-id";
export const DEFAULT_IGNORED_PATHS = ["/ping", "/metrics", "/live", "/ready", /^\/health\/?.*$/];
export const DEFAULT_TRACING_OPTIONS: TracingOptions = {
enabled: false,
serviceName: SERVICE_DETAILS.name,
serviceVersion: SERVICE_DETAILS.version,
propagationFormat: PropagationFormat.JAEGER,
tracerConfig: {},
setRequestId: true,
jaeger: {
enabled: true,
host: "localhost",
port: 6832,
spanProcessor: {
type: SpanProcessor.BATCH
}
},
console: {
enabled: false
},
diagnostics: {
enabled: false,
logLevel: DiagLogLevel.ALL
},
methodInvocations: {
enabled: true
},
http: {
enabled: true,
ignoreIncomingPaths: DEFAULT_IGNORED_PATHS
},
instrumentations: []
};
export const ENV_TRACING_CONFIG: TracingConfig = {
enabled: getEnvBoolean("TRACING_ENABLED"),
serviceName: getEnv("TRACING_SERVICE_NAME"),
serviceVersion: getEnv("TRACING_SERVICE_VERSION"),
propagationFormat: getEnv<PropagationFormat>("TRACING_PROPAGATION_FORMAT"),
setRequestId: getEnvBoolean("TRACING_SET_REQUEST_ID"),
jaeger: {
enabled: getEnvBoolean("TRACING_JAEGER_ENABLED"),
host: getEnv("TRACING_JAEGER_HOST"),
port: getEnvNumber("TRACING_JAEGER_PORT"),
endpoint: getEnv("TRACING_JAEGER_ENDPOINT"),
spanProcessor: {
type: getEnv<SpanProcessor>("TRACING_JAEGER_SPAN_PROCESSOR")
}
},
console: {
enabled: getEnvBoolean("TRACING_CONSOLE_ENABLED")
},
diagnostics: {
enabled: getEnvBoolean("TRACING_DIAGNOSTICS_ENABLED"),
logLevel: getEnvNumber("TRACING_DIAGNOSTICS_LOG_LEVEL")
},
methodInvocations: {
enabled: getEnvBoolean("TRACING_METHOD_INVOCATIONS_ENABLED")
},
http: {
enabled: getEnvBoolean("TRACING_HTTP_ENABLED")
}
};