autotel 7.4.0 → 7.6.0
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/README.md +29 -12
- package/dist/{attributes-Dt4YUYbP.js → attributes-DQQl-D6Q.js} +3 -1
- package/dist/{attributes-Cxys8tgr.cjs → attributes-DnfoMlA9.cjs} +3 -1
- package/dist/attributes.cjs +1 -1
- package/dist/attributes.d.cts +1 -1
- package/dist/attributes.d.ts +1 -1
- package/dist/attributes.js +1 -1
- package/dist/auto.cjs +1 -1
- package/dist/auto.js +1 -1
- package/dist/{canonical-log-line-processor-DolzdawH.cjs → canonical-log-line-processor-B-tzezhk.cjs} +24 -10
- package/dist/{canonical-log-line-processor-l0Aqe6yp.d.cts → canonical-log-line-processor-C0Z_N4oL.d.cts} +17 -3
- package/dist/{canonical-log-line-processor-hFUmS__K.js → canonical-log-line-processor-CBv-OCp4.js} +24 -10
- package/dist/{canonical-log-line-processor-cPB4Axk-.d.ts → canonical-log-line-processor-Yq4cXcD5.d.ts} +17 -3
- package/dist/correlation-id.cjs +1 -1
- package/dist/correlation-id.js +1 -1
- package/dist/db.cjs +7 -7
- package/dist/db.js +7 -7
- package/dist/decorators.cjs +1 -1
- package/dist/decorators.js +1 -1
- package/dist/event.cjs +1 -1
- package/dist/event.js +1 -1
- package/dist/{functional-C4js2vTM.js → functional-BXgTFVTA.js} +1 -1
- package/dist/{functional-DHlD7V0x.cjs → functional-zasLBPyX.cjs} +1 -1
- package/dist/functional.cjs +1 -1
- package/dist/functional.js +1 -1
- package/dist/http.cjs +12 -9
- package/dist/http.js +12 -9
- package/dist/{index-CwrNAsgk.d.ts → index-CsoeCsGL.d.ts} +2 -2
- package/dist/{index-DQHf4cNl.d.cts → index-Y7If_wH4.d.cts} +2 -2
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/{init-8GSy2bza.d.cts → init-BU7qa-Ii.d.cts} +67 -6
- package/dist/{init-CsKK9vZO.js → init-Bst_BhiS.js} +35 -13
- package/dist/{init-UnKrXhpq.d.ts → init-DDCgmfa4.d.ts} +67 -6
- package/dist/{init-DmM7dprX.cjs → init-OSYC19sK.cjs} +35 -13
- package/dist/instrumentation.cjs +3 -1
- package/dist/instrumentation.js +3 -1
- package/dist/messaging.cjs +2 -4
- package/dist/messaging.js +2 -4
- package/dist/processors.cjs +1 -1
- package/dist/processors.d.cts +1 -1
- package/dist/processors.d.ts +1 -1
- package/dist/processors.js +1 -1
- package/dist/{registry-DVSmWg6Y.js → registry-Cy4JjIB-.js} +2 -2
- package/dist/{registry-DYgvb62e.cjs → registry-DIoklBz5.cjs} +2 -2
- package/dist/sampling.cjs +1 -1
- package/dist/sampling.js +1 -1
- package/dist/semantic-conventions.cjs +1 -1
- package/dist/semantic-conventions.js +1 -1
- package/dist/semantic-helpers.cjs +4 -5
- package/dist/semantic-helpers.js +4 -5
- package/dist/tail-sampling-processor.cjs +1 -1
- package/dist/tail-sampling-processor.js +1 -1
- package/dist/webhook.cjs +1 -1
- package/dist/webhook.js +1 -1
- package/dist/workflow-distributed.cjs +1 -1
- package/dist/workflow-distributed.js +1 -1
- package/dist/workflow.cjs +1 -1
- package/dist/workflow.js +1 -1
- package/dist/yaml-config.cjs +1 -1
- package/dist/yaml-config.d.cts +1 -1
- package/dist/yaml-config.d.ts +1 -1
- package/dist/yaml-config.js +1 -1
- package/package.json +34 -34
package/dist/http.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as readProperty, h as isFunction, i as asNumber, l as asString } from "./values-BenyvWKz.js";
|
|
2
2
|
import { getConfig } from "./config.js";
|
|
3
|
-
import { G as getActiveContextWithBaggage } from "./init-
|
|
3
|
+
import { G as getActiveContextWithBaggage } from "./init-Bst_BhiS.js";
|
|
4
4
|
import { SpanStatusCode, context, propagation } from "@opentelemetry/api";
|
|
5
5
|
|
|
6
6
|
//#region src/http.ts
|
|
@@ -88,17 +88,18 @@ function HttpInstrumented(options = {}) {
|
|
|
88
88
|
const startTime = performance.now();
|
|
89
89
|
try {
|
|
90
90
|
span.setAttributes({
|
|
91
|
-
"http.method": method,
|
|
92
|
-
"
|
|
91
|
+
"http.request.method": method,
|
|
92
|
+
"url.full": url || "unknown",
|
|
93
93
|
"service.name": serviceName,
|
|
94
94
|
"operation.name": `${serviceName}.${methodName}`
|
|
95
95
|
});
|
|
96
96
|
if (url) {
|
|
97
97
|
const urlObj = parseUrl(url);
|
|
98
98
|
span.setAttributes({
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
99
|
+
"url.scheme": urlObj.protocol,
|
|
100
|
+
"server.address": urlObj.host,
|
|
101
|
+
"url.path": urlObj.path,
|
|
102
|
+
...urlObj.query ? { "url.query": urlObj.query } : {}
|
|
102
103
|
});
|
|
103
104
|
}
|
|
104
105
|
if (options.attributesFromArgs) span.setAttributes(options.attributesFromArgs(args));
|
|
@@ -106,7 +107,7 @@ function HttpInstrumented(options = {}) {
|
|
|
106
107
|
const duration = performance.now() - startTime;
|
|
107
108
|
const statusCode = extractStatusCode(result);
|
|
108
109
|
if (statusCode) {
|
|
109
|
-
span.setAttribute("http.status_code", statusCode);
|
|
110
|
+
span.setAttribute("http.response.status_code", statusCode);
|
|
110
111
|
if (statusCode >= 400) span.setStatus({
|
|
111
112
|
code: SpanStatusCode.ERROR,
|
|
112
113
|
message: `HTTP ${statusCode}`
|
|
@@ -201,13 +202,15 @@ function parseUrl(url) {
|
|
|
201
202
|
return {
|
|
202
203
|
protocol: urlObj.protocol.replace(":", ""),
|
|
203
204
|
host: urlObj.host,
|
|
204
|
-
path: urlObj.pathname
|
|
205
|
+
path: urlObj.pathname,
|
|
206
|
+
query: urlObj.search.replace(/^\?/, "")
|
|
205
207
|
};
|
|
206
208
|
} catch {
|
|
207
209
|
return {
|
|
208
210
|
protocol: "http",
|
|
209
211
|
host: "unknown",
|
|
210
|
-
path: url
|
|
212
|
+
path: url,
|
|
213
|
+
query: ""
|
|
211
214
|
};
|
|
212
215
|
}
|
|
213
216
|
}
|
|
@@ -496,7 +496,7 @@ declare const attrs: {
|
|
|
496
496
|
"messaging.destination.name": string;
|
|
497
497
|
};
|
|
498
498
|
readonly operation: (value: "publish" | "receive" | "process") => {
|
|
499
|
-
"messaging.operation": "publish" | "receive" | "process";
|
|
499
|
+
"messaging.operation.type": "publish" | "receive" | "process";
|
|
500
500
|
};
|
|
501
501
|
readonly messageId: (value: string) => {
|
|
502
502
|
"messaging.message.id": string;
|
|
@@ -508,7 +508,7 @@ declare const attrs: {
|
|
|
508
508
|
};
|
|
509
509
|
readonly rpc: {
|
|
510
510
|
readonly system: (value: string) => {
|
|
511
|
-
"rpc.system": string;
|
|
511
|
+
"rpc.system.name": string;
|
|
512
512
|
};
|
|
513
513
|
readonly service: (value: string) => {
|
|
514
514
|
"rpc.service": string;
|
|
@@ -496,7 +496,7 @@ declare const attrs: {
|
|
|
496
496
|
"messaging.destination.name": string;
|
|
497
497
|
};
|
|
498
498
|
readonly operation: (value: "publish" | "receive" | "process") => {
|
|
499
|
-
"messaging.operation": "publish" | "receive" | "process";
|
|
499
|
+
"messaging.operation.type": "publish" | "receive" | "process";
|
|
500
500
|
};
|
|
501
501
|
readonly messageId: (value: string) => {
|
|
502
502
|
"messaging.message.id": string;
|
|
@@ -508,7 +508,7 @@ declare const attrs: {
|
|
|
508
508
|
};
|
|
509
509
|
readonly rpc: {
|
|
510
510
|
readonly system: (value: string) => {
|
|
511
|
-
"rpc.system": string;
|
|
511
|
+
"rpc.system.name": string;
|
|
512
512
|
};
|
|
513
513
|
readonly service: (value: string) => {
|
|
514
514
|
"rpc.service": string;
|
package/dist/index.cjs
CHANGED
|
@@ -3,13 +3,13 @@ const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
|
|
|
3
3
|
const require_values = require('./values-DApyq53y.cjs');
|
|
4
4
|
const require_tracer_provider = require('./tracer-provider.cjs');
|
|
5
5
|
const require_structured_error = require('./structured-error--_wXpd_C.cjs');
|
|
6
|
-
const require_init = require('./init-
|
|
6
|
+
const require_init = require('./init-OSYC19sK.cjs');
|
|
7
7
|
const require_filtering_span_processor = require('./filtering-span-processor.cjs');
|
|
8
8
|
const require_span_name_normalizer = require('./span-name-normalizer.cjs');
|
|
9
9
|
const require_attribute_redacting_processor = require('./attribute-redacting-processor.cjs');
|
|
10
|
-
const require_canonical_log_line_processor = require('./canonical-log-line-processor-
|
|
10
|
+
const require_canonical_log_line_processor = require('./canonical-log-line-processor-B-tzezhk.cjs');
|
|
11
11
|
const require_metric = require('./metric.cjs');
|
|
12
|
-
const require_functional = require('./functional-
|
|
12
|
+
const require_functional = require('./functional-zasLBPyX.cjs');
|
|
13
13
|
const require_trace_helpers = require('./trace-helpers.cjs');
|
|
14
14
|
const require_stable_hash = require('./stable-hash-C0pOegH_.cjs');
|
|
15
15
|
const require_correlated_events = require('./correlated-events-CcuknWnU.cjs');
|
|
@@ -17,9 +17,9 @@ const require_parse_error = require('./parse-error.cjs');
|
|
|
17
17
|
const require_drain_pipeline = require('./drain-pipeline.cjs');
|
|
18
18
|
const require_metric_helpers = require('./metric-helpers.cjs');
|
|
19
19
|
const require_semantic_helpers = require('./semantic-helpers.cjs');
|
|
20
|
-
const require_registry = require('./registry-
|
|
20
|
+
const require_registry = require('./registry-DIoklBz5.cjs');
|
|
21
21
|
const require_semantic_conventions = require('./semantic-conventions.cjs');
|
|
22
|
-
const require_attributes = require('./attributes-
|
|
22
|
+
const require_attributes = require('./attributes-DnfoMlA9.cjs');
|
|
23
23
|
const require_messaging = require('./messaging.cjs');
|
|
24
24
|
const require_business_baggage = require('./business-baggage.cjs');
|
|
25
25
|
const require_workflow = require('./workflow.cjs');
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as AttributeRedactorPreset, c as REDACTOR_PATTERNS, d as builtinPatterns, f as createAttributeRedactor, i as AttributeRedactorFn, l as REDACTOR_PRESETS, m as normalizeAttributeRedactorConfig, n as AttributeRedactingProcessorOptions, o as BuiltinPatternName, p as createRedactedSpan, r as AttributeRedactorConfig, s as MaskFn, t as AttributeRedactingProcessor, u as ValuePatternConfig } from "./attribute-redacting-processor-CvBE0z1p.cjs";
|
|
2
|
-
import { A as ExceptionAttrs, B as PeerAttrs, C as CloudAttrs, D as DeploymentAttrs, E as DBAttrs, F as HTTPServerAttrs, G as SessionAttrs, H as RPCAttrs, I as K8sAttrs, J as URLAttrs, K as TLSAttrs, L as MessagingAttrs, M as FeatureFlagAttrs, N as GraphQLAttrs, O as DeviceAttrs, P as HTTPClientAttrs, R as NetworkAttrs, S as ClientAttrs, T as ContainerAttrs, U as ServerAddressAttrs, V as ProcessAttrs, W as ServiceAttrs, Y as UserAttrs, _ as autoRedactPII, a as httpClient, b as validateAttribute, c as mergeServiceResource, d as setError, f as setException, g as AttributePolicy, h as AttributeGuardrails, i as dbClient, j as FaaSAttrs, k as ErrorAttrs, l as request, m as setUser, n as safeSetAttributes, o as httpServer, p as setSession, q as ThreadAttrs, s as identify, t as mergeAttrs, u as setDevice, w as CodeAttrs, x as attrs, z as OTelAttrs } from "./index-
|
|
2
|
+
import { A as ExceptionAttrs, B as PeerAttrs, C as CloudAttrs, D as DeploymentAttrs, E as DBAttrs, F as HTTPServerAttrs, G as SessionAttrs, H as RPCAttrs, I as K8sAttrs, J as URLAttrs, K as TLSAttrs, L as MessagingAttrs, M as FeatureFlagAttrs, N as GraphQLAttrs, O as DeviceAttrs, P as HTTPClientAttrs, R as NetworkAttrs, S as ClientAttrs, T as ContainerAttrs, U as ServerAddressAttrs, V as ProcessAttrs, W as ServiceAttrs, Y as UserAttrs, _ as autoRedactPII, a as httpClient, b as validateAttribute, c as mergeServiceResource, d as setError, f as setException, g as AttributePolicy, h as AttributeGuardrails, i as dbClient, j as FaaSAttrs, k as ErrorAttrs, l as request, m as setUser, n as safeSetAttributes, o as httpServer, p as setSession, q as ThreadAttrs, s as identify, t as mergeAttrs, u as setDevice, w as CodeAttrs, x as attrs, z as OTelAttrs } from "./index-Y7If_wH4.cjs";
|
|
3
3
|
import { t as UnknownRecord } from "./values-CeMH-mYG.cjs";
|
|
4
4
|
import { n as TraceContext$1, r as defineBaggageSchema, t as AttributeValue$2 } from "./trace-context-C1Cn1q0y.cjs";
|
|
5
5
|
import { BaggageError, BaggageFieldDefinition, BaggageFieldType, BusinessBaggage, BusinessBaggageValues, SafeBaggageOptions, SafeBaggageSchema, createSafeBaggageSchema } from "./business-baggage.cjs";
|
|
@@ -10,9 +10,9 @@ import { DrainPipelineOptions, PipelineDrainFn, createDrainPipeline } from "./dr
|
|
|
10
10
|
import { a as EventSchemaMetadata, c as FunnelStatus, l as OutcomeStatus, n as EventAttributeValue, o as EventSubscriber, r as EventAttributes, s as EventTrackingOptions, t as AutotelEventContext } from "./event-subscriber-DMACQA-1.cjs";
|
|
11
11
|
import { Event, EventsOptions, getEvents, resetEvents } from "./event.cjs";
|
|
12
12
|
import { n as FilteringSpanProcessorOptions, r as SpanFilterPredicate, t as FilteringSpanProcessor } from "./filtering-span-processor-BpDagWNa.cjs";
|
|
13
|
-
import { a as AutotelConfig, c as StringRedactor, i as lockLogger, l as createStringRedactor, n as isInitialized, r as isLoggerLocked, s as ProcessHandlersConfig, t as init } from "./init-
|
|
13
|
+
import { a as AutotelConfig, c as StringRedactor, i as lockLogger, l as createStringRedactor, n as isInitialized, r as isLoggerLocked, s as ProcessHandlersConfig, t as init } from "./init-BU7qa-Ii.cjs";
|
|
14
14
|
import { a as SpanNameNormalizerPreset, i as SpanNameNormalizerFn, n as NORMALIZER_PRESETS, o as SpanNameNormalizingProcessor, r as SpanNameNormalizerConfig, s as SpanNameNormalizingProcessorOptions, t as NORMALIZER_PATTERNS } from "./span-name-normalizer-CN1-8C76.cjs";
|
|
15
|
-
import "./canonical-log-line-processor-
|
|
15
|
+
import "./canonical-log-line-processor-C0Z_N4oL.cjs";
|
|
16
16
|
import { i as defineEvent, n as DefinedEvent, r as SchemaLike, t as DefineEventOptions } from "./define-event-BNeuKUPv.cjs";
|
|
17
17
|
import { ParsedError, parseError } from "./parse-error.cjs";
|
|
18
18
|
import { Metric, MetricsOptions, getMetrics, resetMetrics } from "./metric.cjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as AttributeRedactorPreset, c as REDACTOR_PATTERNS, d as builtinPatterns, f as createAttributeRedactor, i as AttributeRedactorFn, l as REDACTOR_PRESETS, m as normalizeAttributeRedactorConfig, n as AttributeRedactingProcessorOptions, o as BuiltinPatternName, p as createRedactedSpan, r as AttributeRedactorConfig, s as MaskFn, t as AttributeRedactingProcessor, u as ValuePatternConfig } from "./attribute-redacting-processor-CvBE0z1p.js";
|
|
2
|
-
import { A as ExceptionAttrs, B as PeerAttrs, C as CloudAttrs, D as DeploymentAttrs, E as DBAttrs, F as HTTPServerAttrs, G as SessionAttrs, H as RPCAttrs, I as K8sAttrs, J as URLAttrs, K as TLSAttrs, L as MessagingAttrs, M as FeatureFlagAttrs, N as GraphQLAttrs, O as DeviceAttrs, P as HTTPClientAttrs, R as NetworkAttrs, S as ClientAttrs, T as ContainerAttrs, U as ServerAddressAttrs, V as ProcessAttrs, W as ServiceAttrs, Y as UserAttrs, _ as autoRedactPII, a as httpClient, b as validateAttribute, c as mergeServiceResource, d as setError, f as setException, g as AttributePolicy, h as AttributeGuardrails, i as dbClient, j as FaaSAttrs, k as ErrorAttrs, l as request, m as setUser, n as safeSetAttributes, o as httpServer, p as setSession, q as ThreadAttrs, s as identify, t as mergeAttrs, u as setDevice, w as CodeAttrs, x as attrs, z as OTelAttrs } from "./index-
|
|
2
|
+
import { A as ExceptionAttrs, B as PeerAttrs, C as CloudAttrs, D as DeploymentAttrs, E as DBAttrs, F as HTTPServerAttrs, G as SessionAttrs, H as RPCAttrs, I as K8sAttrs, J as URLAttrs, K as TLSAttrs, L as MessagingAttrs, M as FeatureFlagAttrs, N as GraphQLAttrs, O as DeviceAttrs, P as HTTPClientAttrs, R as NetworkAttrs, S as ClientAttrs, T as ContainerAttrs, U as ServerAddressAttrs, V as ProcessAttrs, W as ServiceAttrs, Y as UserAttrs, _ as autoRedactPII, a as httpClient, b as validateAttribute, c as mergeServiceResource, d as setError, f as setException, g as AttributePolicy, h as AttributeGuardrails, i as dbClient, j as FaaSAttrs, k as ErrorAttrs, l as request, m as setUser, n as safeSetAttributes, o as httpServer, p as setSession, q as ThreadAttrs, s as identify, t as mergeAttrs, u as setDevice, w as CodeAttrs, x as attrs, z as OTelAttrs } from "./index-CsoeCsGL.js";
|
|
3
3
|
import { t as UnknownRecord } from "./values-CeMH-mYG.js";
|
|
4
4
|
import { n as TraceContext$1, r as defineBaggageSchema, t as AttributeValue$2 } from "./trace-context-f89xPJbK.js";
|
|
5
5
|
import { BaggageError, BaggageFieldDefinition, BaggageFieldType, BusinessBaggage, BusinessBaggageValues, SafeBaggageOptions, SafeBaggageSchema, createSafeBaggageSchema } from "./business-baggage.js";
|
|
@@ -10,9 +10,9 @@ import { DrainPipelineOptions, PipelineDrainFn, createDrainPipeline } from "./dr
|
|
|
10
10
|
import { a as EventSchemaMetadata, c as FunnelStatus, l as OutcomeStatus, n as EventAttributeValue, o as EventSubscriber, r as EventAttributes, s as EventTrackingOptions, t as AutotelEventContext } from "./event-subscriber-DMACQA-1.js";
|
|
11
11
|
import { Event, EventsOptions, getEvents, resetEvents } from "./event.js";
|
|
12
12
|
import { n as FilteringSpanProcessorOptions, r as SpanFilterPredicate, t as FilteringSpanProcessor } from "./filtering-span-processor-BpDagWNa.js";
|
|
13
|
-
import { a as AutotelConfig, c as StringRedactor, i as lockLogger, l as createStringRedactor, n as isInitialized, r as isLoggerLocked, s as ProcessHandlersConfig, t as init } from "./init-
|
|
13
|
+
import { a as AutotelConfig, c as StringRedactor, i as lockLogger, l as createStringRedactor, n as isInitialized, r as isLoggerLocked, s as ProcessHandlersConfig, t as init } from "./init-DDCgmfa4.js";
|
|
14
14
|
import { a as SpanNameNormalizerPreset, i as SpanNameNormalizerFn, n as NORMALIZER_PRESETS, o as SpanNameNormalizingProcessor, r as SpanNameNormalizerConfig, s as SpanNameNormalizingProcessorOptions, t as NORMALIZER_PATTERNS } from "./span-name-normalizer-CN1-8C76.js";
|
|
15
|
-
import "./canonical-log-line-processor-
|
|
15
|
+
import "./canonical-log-line-processor-Yq4cXcD5.js";
|
|
16
16
|
import { i as defineEvent, n as DefinedEvent, r as SchemaLike, t as DefineEventOptions } from "./define-event-Bd8f8mST.js";
|
|
17
17
|
import { ParsedError, parseError } from "./parse-error.js";
|
|
18
18
|
import { Metric, MetricsOptions, getMetrics, resetMetrics } from "./metric.js";
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { g as nonEmptyString, i as asNumber, l as asString, r as asFunction, s as asRecord, x as toError } from "./values-BenyvWKz.js";
|
|
2
2
|
import { getAutotelTracer, getAutotelTracerProvider, setAutotelTracerProvider } from "./tracer-provider.js";
|
|
3
3
|
import { a as flattenToAttributes, i as structuredErrorToJSON, n as getStructuredErrorAttributes, o as toAttributeValue, r as recordStructuredError, t as createStructuredError } from "./structured-error-YIuka-FE.js";
|
|
4
|
-
import { B as markForceKept, D as AlwaysSampler, E as AdaptiveSampler, F as createLinkFromHeaders, H as samplingPresets, J as getEventQueue, L as extractLinksFromBatch, M as NeverSampler, N as RandomSampler, P as UserIdSampler, Q as getCorrelationId, S as AUTOTEL_DEBUG_BAGGAGE_KEY, T as AUTOTEL_SAMPLING_TAIL_KEEP, U as createTraceContext, V as resolveSamplingPreset, W as defineBaggageSchema, X as CORRELATION_ID_BAGGAGE_KEY, Y as track, Z as generateCorrelationId, a as init, b as BaggageSpanProcessor, c as lockLogger, d as Event, et as getOrCreateCorrelationId, f as getEvents, h as runInOperationContext, l as flush, m as getOperationContext, nt as setCorrelationId, o as isInitialized, p as resetEvents, rt as setCorrelationIdInBaggage, s as isLoggerLocked, tt as runWithCorrelationId, u as shutdown, w as AUTOTEL_SAMPLING_TAIL_EVALUATED, y as createStringRedactor } from "./init-
|
|
4
|
+
import { B as markForceKept, D as AlwaysSampler, E as AdaptiveSampler, F as createLinkFromHeaders, H as samplingPresets, J as getEventQueue, L as extractLinksFromBatch, M as NeverSampler, N as RandomSampler, P as UserIdSampler, Q as getCorrelationId, S as AUTOTEL_DEBUG_BAGGAGE_KEY, T as AUTOTEL_SAMPLING_TAIL_KEEP, U as createTraceContext, V as resolveSamplingPreset, W as defineBaggageSchema, X as CORRELATION_ID_BAGGAGE_KEY, Y as track, Z as generateCorrelationId, a as init, b as BaggageSpanProcessor, c as lockLogger, d as Event, et as getOrCreateCorrelationId, f as getEvents, h as runInOperationContext, l as flush, m as getOperationContext, nt as setCorrelationId, o as isInitialized, p as resetEvents, rt as setCorrelationIdInBaggage, s as isLoggerLocked, tt as runWithCorrelationId, u as shutdown, w as AUTOTEL_SAMPLING_TAIL_EVALUATED, y as createStringRedactor } from "./init-Bst_BhiS.js";
|
|
5
5
|
import { FilteringSpanProcessor } from "./filtering-span-processor.js";
|
|
6
6
|
import { NORMALIZER_PATTERNS, NORMALIZER_PRESETS, SpanNameNormalizingProcessor } from "./span-name-normalizer.js";
|
|
7
7
|
import { AttributeRedactingProcessor, REDACTOR_PATTERNS, REDACTOR_PRESETS, builtinPatterns, createAttributeRedactor, createRedactedSpan, normalizeAttributeRedactorConfig } from "./attribute-redacting-processor.js";
|
|
8
|
-
import { n as formatDuration } from "./canonical-log-line-processor-
|
|
8
|
+
import { n as formatDuration } from "./canonical-log-line-processor-CBv-OCp4.js";
|
|
9
9
|
import { Metric, getMetrics, resetMetrics } from "./metric.js";
|
|
10
|
-
import { a as trace$2, c as withTracing, i as span, n as getActiveTraceContext, o as withBaggage, r as instrument, s as withNewContext, t as ctx } from "./functional-
|
|
10
|
+
import { a as trace$2, c as withTracing, i as span, n as getActiveTraceContext, o as withBaggage, r as instrument, s as withNewContext, t as ctx } from "./functional-BXgTFVTA.js";
|
|
11
11
|
import { createDeterministicTraceId, enrichWithTraceContext, finalizeSpan, flattenMetadata, getActiveContext, getActiveSpan, getTraceContext, getTracer, isTracing, resolveTraceUrl, runWithSpan } from "./trace-helpers.js";
|
|
12
12
|
import { t as hashJson } from "./stable-hash-BkoAYVks.js";
|
|
13
13
|
import { t as emitCorrelatedEvent } from "./correlated-events-DwMMbItg.js";
|
|
@@ -15,9 +15,9 @@ import { parseError } from "./parse-error.js";
|
|
|
15
15
|
import { createDrainPipeline } from "./drain-pipeline.js";
|
|
16
16
|
import { createCounter, createHistogram, createObservableGauge, createUpDownCounter, getMeter } from "./metric-helpers.js";
|
|
17
17
|
import { traceDB, traceHTTP, traceMessaging } from "./semantic-helpers.js";
|
|
18
|
-
import { C as URLAttributes, d as HTTPAttributes, y as ServiceAttributes } from "./registry-
|
|
18
|
+
import { C as URLAttributes, d as HTTPAttributes, y as ServiceAttributes } from "./registry-Cy4JjIB-.js";
|
|
19
19
|
import { httpRequestHeaderAttribute, httpResponseHeaderAttribute } from "./semantic-conventions.js";
|
|
20
|
-
import { a as identify, c as setDevice, d as setSession, f as setUser, h as autoRedactPII, i as httpServer, l as setError, m as safeSetAttributes, n as dbClient, o as mergeServiceResource, p as mergeAttrs, r as httpClient, s as request, u as setException, v as validateAttribute, y as attrs } from "./attributes-
|
|
20
|
+
import { a as identify, c as setDevice, d as setSession, f as setUser, h as autoRedactPII, i as httpServer, l as setError, m as safeSetAttributes, n as dbClient, o as mergeServiceResource, p as mergeAttrs, r as httpClient, s as request, u as setException, v as validateAttribute, y as attrs } from "./attributes-DQQl-D6Q.js";
|
|
21
21
|
import { traceConsumer, traceProducer } from "./messaging.js";
|
|
22
22
|
import { BusinessBaggage, createSafeBaggageSchema } from "./business-baggage.js";
|
|
23
23
|
import { getCurrentWorkflowContext, isInWorkflow, traceStep, traceWorkflow } from "./workflow.js";
|
|
@@ -5,7 +5,7 @@ import { o as EventSubscriber } from "./event-subscriber-DMACQA-1.cjs";
|
|
|
5
5
|
import { r as SpanFilterPredicate } from "./filtering-span-processor-BpDagWNa.cjs";
|
|
6
6
|
import { r as Policy } from "./policy-CbpP4tFH.cjs";
|
|
7
7
|
import { r as SpanNameNormalizerConfig } from "./span-name-normalizer-CN1-8C76.cjs";
|
|
8
|
-
import { t as CanonicalLogLineOptions } from "./canonical-log-line-processor-
|
|
8
|
+
import { t as CanonicalLogLineOptions } from "./canonical-log-line-processor-C0Z_N4oL.cjs";
|
|
9
9
|
import { ReadableSpan, SpanExporter, SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
10
10
|
import { Attributes } from "@opentelemetry/api";
|
|
11
11
|
import { Resource } from "@opentelemetry/resources";
|
|
@@ -261,8 +261,31 @@ interface ProcessHandlersConfig {
|
|
|
261
261
|
*/
|
|
262
262
|
interface CanonicalLogLinesConfig {
|
|
263
263
|
enabled: boolean;
|
|
264
|
-
/**
|
|
265
|
-
|
|
264
|
+
/**
|
|
265
|
+
* Logger(s) to emit canonical log lines through. Pass an array to fan out to
|
|
266
|
+
* several. When omitted, lines go to the OTel Logs API instead.
|
|
267
|
+
*
|
|
268
|
+
* Note this falls back to the top-level `logger` on AutotelConfig, so
|
|
269
|
+
* setting that alone also diverts canonical log lines away from OTLP.
|
|
270
|
+
*/
|
|
271
|
+
logger?: Logger | Logger[];
|
|
272
|
+
/**
|
|
273
|
+
* Also emit through the OTel Logs API alongside any `logger`, so the same
|
|
274
|
+
* lines reach an OTLP logs backend (Loki, and the like).
|
|
275
|
+
*
|
|
276
|
+
* Defaults to true only when no `logger` is given. Set `otel: true` with a
|
|
277
|
+
* logger to get both: the platform's own log view keeps the lines, and OTLP
|
|
278
|
+
* carries them to your backend.
|
|
279
|
+
*
|
|
280
|
+
* @example Console and Loki at once
|
|
281
|
+
* ```typescript
|
|
282
|
+
* init({
|
|
283
|
+
* endpoint: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
|
|
284
|
+
* canonicalLogLines: { enabled: true, logger: pino(), otel: true },
|
|
285
|
+
* });
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
otel?: boolean;
|
|
266
289
|
/** Only emit canonical log lines for root spans (default: false). */
|
|
267
290
|
rootSpansOnly?: boolean;
|
|
268
291
|
/** Minimum log level for canonical log lines (default: 'info'). */
|
|
@@ -468,7 +491,18 @@ interface AutotelConfig {
|
|
|
468
491
|
* Single-destination shorthand. For multi-backend OTLP fan-out, use
|
|
469
492
|
* `destinations` instead.
|
|
470
493
|
* Only used if you don't provide custom exporters/processors
|
|
471
|
-
*
|
|
494
|
+
*
|
|
495
|
+
* Falls back to the OTel spec's `OTEL_EXPORTER_OTLP_ENDPOINT`, which is the
|
|
496
|
+
* variable every vendor's docs hand you (see `env-config.ts`;
|
|
497
|
+
* `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_PROTOCOL` are read
|
|
498
|
+
* the same way).
|
|
499
|
+
*
|
|
500
|
+
* With no endpoint from either source there is NO default and no fallback
|
|
501
|
+
* to localhost: the span processor list stays empty and nothing is
|
|
502
|
+
* exported, so telemetry is off rather than aimed at a collector that is
|
|
503
|
+
* not there. Point it at a local collector explicitly when you want one.
|
|
504
|
+
*
|
|
505
|
+
* @default process.env.OTEL_EXPORTER_OTLP_ENDPOINT, else no exporter
|
|
472
506
|
*/
|
|
473
507
|
endpoint?: string;
|
|
474
508
|
/**
|
|
@@ -661,13 +695,26 @@ interface AutotelConfig {
|
|
|
661
695
|
headers?: Record<string, string> | string;
|
|
662
696
|
/**
|
|
663
697
|
* OTLP protocol to use for traces, metrics, and logs
|
|
664
|
-
* - 'http': HTTP
|
|
698
|
+
* - 'http': OTLP over HTTP with a **JSON** body (default, port 4318)
|
|
699
|
+
* - 'http/protobuf': OTLP over HTTP with a protobuf body (port 4318)
|
|
665
700
|
* - 'grpc': gRPC (uses port 4317)
|
|
666
701
|
*
|
|
702
|
+
* The default is JSON, not protobuf — `createTraceExporter` falls through to
|
|
703
|
+
* `OTLPTraceExporterHTTP`, which sends `content-type: application/json`.
|
|
704
|
+
* Grafana Cloud, Honeycomb and the other hosted OTLP gateways all accept
|
|
705
|
+
* JSON, so the default needs no extra install and is what the vendor presets
|
|
706
|
+
* in `autotel-backends` rely on.
|
|
707
|
+
*
|
|
667
708
|
* Can be overridden with OTEL_EXPORTER_OTLP_PROTOCOL env var.
|
|
668
709
|
*
|
|
669
|
-
* Note:
|
|
710
|
+
* Note: only the JSON exporters ship with autotel. 'http/protobuf' and
|
|
711
|
+
* 'grpc' need optional peer dependencies, and a bundler (Vercel, Nitro,
|
|
712
|
+
* esbuild) will not trace a lazy `require`, so they must be direct
|
|
713
|
+
* dependencies of the *application* to survive bundling:
|
|
670
714
|
* ```bash
|
|
715
|
+
* # http/protobuf
|
|
716
|
+
* pnpm add @opentelemetry/exporter-trace-otlp-proto @opentelemetry/exporter-metrics-otlp-proto
|
|
717
|
+
* # grpc
|
|
671
718
|
* pnpm add @opentelemetry/exporter-trace-otlp-grpc @opentelemetry/exporter-metrics-otlp-grpc
|
|
672
719
|
* ```
|
|
673
720
|
*
|
|
@@ -793,6 +840,20 @@ interface AutotelConfig {
|
|
|
793
840
|
* }
|
|
794
841
|
* init({ service: 'my-app', logger })
|
|
795
842
|
* ```
|
|
843
|
+
*
|
|
844
|
+
* @remarks
|
|
845
|
+
* This is also the fallback logger for canonical log lines, so setting it
|
|
846
|
+
* sends them here INSTEAD of the OTel Logs API — and therefore stops them
|
|
847
|
+
* reaching an OTLP logs backend such as Loki. On a platform whose log view
|
|
848
|
+
* reads stdout you usually want both, which is what
|
|
849
|
+
* `canonicalLogLines.otel` is for:
|
|
850
|
+
*
|
|
851
|
+
* ```typescript
|
|
852
|
+
* init({
|
|
853
|
+
* service: 'my-app',
|
|
854
|
+
* canonicalLogLines: { enabled: true, logger, otel: true },
|
|
855
|
+
* })
|
|
856
|
+
* ```
|
|
796
857
|
*/
|
|
797
858
|
logger?: Logger;
|
|
798
859
|
/**
|
|
@@ -8,7 +8,7 @@ import { PolicyLogRecordProcessor, policySpanFilter, setPolicies, watchPolicyFil
|
|
|
8
8
|
import { SpanNameNormalizingProcessor } from "./span-name-normalizer.js";
|
|
9
9
|
import { AttributeRedactingProcessor, REDACTOR_PRESETS, normalizeAttributeRedactorConfig } from "./attribute-redacting-processor.js";
|
|
10
10
|
import { t as PrettyConsoleExporter } from "./pretty-console-exporter-DqKl_q9z.js";
|
|
11
|
-
import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-
|
|
11
|
+
import { t as CanonicalLogLineProcessor } from "./canonical-log-line-processor-CBv-OCp4.js";
|
|
12
12
|
import { resetMetrics } from "./metric.js";
|
|
13
13
|
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
14
14
|
import { AlwaysOffSampler, AlwaysOnSampler, BatchSpanProcessor, ConsoleSpanExporter, ParentBasedSampler, SamplingDecision, SimpleSpanProcessor, TraceIdRatioBasedSampler } from "@opentelemetry/sdk-trace-base";
|
|
@@ -2833,7 +2833,10 @@ var Event = class {
|
|
|
2833
2833
|
const config = getConfig();
|
|
2834
2834
|
if (config) {
|
|
2835
2835
|
if (config.version) enriched["service.version"] = config.version;
|
|
2836
|
-
if (config.environment)
|
|
2836
|
+
if (config.environment) {
|
|
2837
|
+
enriched["deployment.environment"] = config.environment;
|
|
2838
|
+
enriched["deployment.environment.name"] = config.environment;
|
|
2839
|
+
}
|
|
2837
2840
|
}
|
|
2838
2841
|
const spanContext = trace.getActiveSpan()?.spanContext();
|
|
2839
2842
|
if (spanContext) {
|
|
@@ -3492,7 +3495,7 @@ function loadGRPCTraceExporter() {
|
|
|
3492
3495
|
OTLPTraceExporterGRPC = requireModule("@opentelemetry/exporter-trace-otlp-grpc").OTLPTraceExporter;
|
|
3493
3496
|
return OTLPTraceExporterGRPC;
|
|
3494
3497
|
} catch {
|
|
3495
|
-
throw new Error("gRPC trace exporter not found. Install @opentelemetry/exporter-trace-otlp-grpc");
|
|
3498
|
+
throw new Error("gRPC trace exporter not found. Install @opentelemetry/exporter-trace-otlp-grpc. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel.");
|
|
3496
3499
|
}
|
|
3497
3500
|
}
|
|
3498
3501
|
/**
|
|
@@ -3504,7 +3507,7 @@ function loadGRPCMetricExporter() {
|
|
|
3504
3507
|
OTLPMetricExporterGRPC = requireModule("@opentelemetry/exporter-metrics-otlp-grpc").OTLPMetricExporter;
|
|
3505
3508
|
return OTLPMetricExporterGRPC;
|
|
3506
3509
|
} catch {
|
|
3507
|
-
throw new Error("gRPC metric exporter not found. Install @opentelemetry/exporter-metrics-otlp-grpc");
|
|
3510
|
+
throw new Error("gRPC metric exporter not found. Install @opentelemetry/exporter-metrics-otlp-grpc. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel.");
|
|
3508
3511
|
}
|
|
3509
3512
|
}
|
|
3510
3513
|
/**
|
|
@@ -3516,7 +3519,7 @@ function loadProtoTraceExporter() {
|
|
|
3516
3519
|
OTLPTraceExporterPROTO = requireModule("@opentelemetry/exporter-trace-otlp-proto").OTLPTraceExporter;
|
|
3517
3520
|
return OTLPTraceExporterPROTO;
|
|
3518
3521
|
} catch {
|
|
3519
|
-
throw new Error("Protobuf trace exporter not found. Install @opentelemetry/exporter-trace-otlp-proto");
|
|
3522
|
+
throw new Error("Protobuf trace exporter not found. Install @opentelemetry/exporter-trace-otlp-proto. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel. Or drop `protocol` to use the default JSON exporter, which ships with autotel and is accepted by Grafana Cloud, Honeycomb and the other hosted OTLP gateways.");
|
|
3520
3523
|
}
|
|
3521
3524
|
}
|
|
3522
3525
|
/**
|
|
@@ -3536,7 +3539,7 @@ function createMetricExporter(protocol, config) {
|
|
|
3536
3539
|
if (!OTLPMetricExporterPROTO) try {
|
|
3537
3540
|
OTLPMetricExporterPROTO = requireModule("@opentelemetry/exporter-metrics-otlp-proto").OTLPMetricExporter;
|
|
3538
3541
|
} catch {
|
|
3539
|
-
throw new Error("Protobuf metric exporter not found. Install @opentelemetry/exporter-metrics-otlp-proto");
|
|
3542
|
+
throw new Error("Protobuf metric exporter not found. Install @opentelemetry/exporter-metrics-otlp-proto. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel. Or drop `protocol` to use the default JSON exporter, which ships with autotel and is accepted by Grafana Cloud, Honeycomb and the other hosted OTLP gateways.");
|
|
3540
3543
|
}
|
|
3541
3544
|
return new OTLPMetricExporterPROTO(config);
|
|
3542
3545
|
}
|
|
@@ -3551,7 +3554,7 @@ function loadGRPCLogExporter() {
|
|
|
3551
3554
|
OTLPLogExporterGRPC = requireModule("@opentelemetry/exporter-logs-otlp-grpc").OTLPLogExporter;
|
|
3552
3555
|
return OTLPLogExporterGRPC;
|
|
3553
3556
|
} catch {
|
|
3554
|
-
throw new Error("gRPC log exporter not found. Install @opentelemetry/exporter-logs-otlp-grpc");
|
|
3557
|
+
throw new Error("gRPC log exporter not found. Install @opentelemetry/exporter-logs-otlp-grpc. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel.");
|
|
3555
3558
|
}
|
|
3556
3559
|
}
|
|
3557
3560
|
/**
|
|
@@ -3563,7 +3566,7 @@ function createLogExporter(protocol, config) {
|
|
|
3563
3566
|
if (!OTLPLogExporterPROTO) try {
|
|
3564
3567
|
OTLPLogExporterPROTO = requireModule("@opentelemetry/exporter-logs-otlp-proto").OTLPLogExporter;
|
|
3565
3568
|
} catch {
|
|
3566
|
-
throw new Error("Protobuf log exporter not found. Install @opentelemetry/exporter-logs-otlp-proto");
|
|
3569
|
+
throw new Error("Protobuf log exporter not found. Install @opentelemetry/exporter-logs-otlp-proto. It is an optional peer dependency, and bundlers (Vercel, Nitro, esbuild) do not follow the lazy require that loads it, so add it as a direct dependency of your application, not just of autotel. Or drop `protocol` to use the default JSON exporter, which ships with autotel and is accepted by Grafana Cloud, Honeycomb and the other hosted OTLP gateways.");
|
|
3567
3570
|
}
|
|
3568
3571
|
return new OTLPLogExporterPROTO(config);
|
|
3569
3572
|
}
|
|
@@ -3861,6 +3864,20 @@ function getAutoInstrumentations(integrations, manualInstrumentationNames = /* @
|
|
|
3861
3864
|
* Replaces initInstrumentation() and separate events config.
|
|
3862
3865
|
*/
|
|
3863
3866
|
/**
|
|
3867
|
+
* Records nothing and exports nothing, so a `TracerProvider` is still
|
|
3868
|
+
* registered when there is no destination. See where it is used below.
|
|
3869
|
+
*/
|
|
3870
|
+
var NoopSpanProcessor = class {
|
|
3871
|
+
onStart() {}
|
|
3872
|
+
onEnd() {}
|
|
3873
|
+
forceFlush() {
|
|
3874
|
+
return Promise.resolve();
|
|
3875
|
+
}
|
|
3876
|
+
shutdown() {
|
|
3877
|
+
return Promise.resolve();
|
|
3878
|
+
}
|
|
3879
|
+
};
|
|
3880
|
+
/**
|
|
3864
3881
|
* Adapts an Autotel Sampler to the OTel SDK Sampler interface.
|
|
3865
3882
|
*/
|
|
3866
3883
|
function toOtelSampler(sampler) {
|
|
@@ -4007,7 +4024,10 @@ function init(cfg) {
|
|
|
4007
4024
|
const version = mergedConfig.version || detectVersion();
|
|
4008
4025
|
const environment = mergedConfig.environment || process.env.NODE_ENV || "development";
|
|
4009
4026
|
const metricsEnabled = resolveMetricsFlag(mergedConfig.metrics);
|
|
4010
|
-
const
|
|
4027
|
+
const canonicalLogger = mergedConfig.canonicalLogLines?.logger ?? mergedConfig.logger;
|
|
4028
|
+
const hasCanonicalLogger = Array.isArray(canonicalLogger) ? canonicalLogger.length > 0 : canonicalLogger !== void 0;
|
|
4029
|
+
const canonicalUsesOtel = mergedConfig.canonicalLogLines?.enabled === true && (mergedConfig.canonicalLogLines.otel ?? !hasCanonicalLogger);
|
|
4030
|
+
const logsEnabled = resolveLogsFlag(mergedConfig.logs ?? (canonicalUsesOtel ? true : "auto"));
|
|
4011
4031
|
if (devtoolsConfig.enabled && devtoolsConfig.embedded) {
|
|
4012
4032
|
const devtoolsModule = _optionalRequire("autotel-devtools");
|
|
4013
4033
|
if (devtoolsModule?.createDevtools) {
|
|
@@ -4035,12 +4055,12 @@ function init(cfg) {
|
|
|
4035
4055
|
if (mergedConfig.resource) resource = resource.merge(mergedConfig.resource);
|
|
4036
4056
|
if (mergedConfig.resourceAttributes) resource = resource.merge(resourceFromAttributes(mergedConfig.resourceAttributes));
|
|
4037
4057
|
const otlpDestinations = resolveOtlpDestinations(mergedConfig, endpoint);
|
|
4038
|
-
const configuredSpanProcessors = mergedConfig.spanProcessors
|
|
4058
|
+
const configuredSpanProcessors = mergedConfig.spanProcessors !== void 0 ? mergedConfig.spanProcessors : mergedConfig.spanProcessor ? [mergedConfig.spanProcessor] : void 0;
|
|
4039
4059
|
const configuredSpanExporters = mergedConfig.spanExporters && mergedConfig.spanExporters.length > 0 ? mergedConfig.spanExporters : mergedConfig.spanExporter ? [mergedConfig.spanExporter] : void 0;
|
|
4040
4060
|
const configuredMetricReaders = mergedConfig.metricReaders && mergedConfig.metricReaders.length > 0 ? mergedConfig.metricReaders : mergedConfig.metricReader ? [mergedConfig.metricReader] : void 0;
|
|
4041
4061
|
const configuredLogRecordProcessors = mergedConfig.logRecordProcessors && mergedConfig.logRecordProcessors.length > 0 ? mergedConfig.logRecordProcessors : mergedConfig.logRecordProcessor ? [mergedConfig.logRecordProcessor] : void 0;
|
|
4042
4062
|
let spanProcessors = [];
|
|
4043
|
-
if (configuredSpanProcessors
|
|
4063
|
+
if (configuredSpanProcessors !== void 0) spanProcessors.push(...configuredSpanProcessors);
|
|
4044
4064
|
else if (configuredSpanExporters && configuredSpanExporters.length > 0) for (const exporter of configuredSpanExporters) spanProcessors.push(new TailSamplingSpanProcessor(new BatchSpanProcessor(exporter)));
|
|
4045
4065
|
else for (const destination of otlpDestinations) {
|
|
4046
4066
|
if (!destinationSupportsSignal(destination, "traces")) continue;
|
|
@@ -4059,7 +4079,8 @@ function init(cfg) {
|
|
|
4059
4079
|
else if (debugMode === true) spanProcessors.push(new SimpleSpanProcessor(new ConsoleSpanExporter()));
|
|
4060
4080
|
if (mergedConfig.canonicalLogLines?.enabled) {
|
|
4061
4081
|
const canonicalOptions = {
|
|
4062
|
-
logger:
|
|
4082
|
+
logger: canonicalLogger,
|
|
4083
|
+
otel: mergedConfig.canonicalLogLines.otel,
|
|
4063
4084
|
rootSpansOnly: mergedConfig.canonicalLogLines.rootSpansOnly,
|
|
4064
4085
|
minLevel: mergedConfig.canonicalLogLines.minLevel,
|
|
4065
4086
|
messageFormat: mergedConfig.canonicalLogLines.messageFormat,
|
|
@@ -4148,9 +4169,10 @@ function init(cfg) {
|
|
|
4148
4169
|
sampler,
|
|
4149
4170
|
instrumentations: finalInstrumentations
|
|
4150
4171
|
};
|
|
4151
|
-
|
|
4172
|
+
sdkOptions.spanProcessors = spanProcessors.length > 0 ? spanProcessors : [new NoopSpanProcessor()];
|
|
4152
4173
|
if (metricReaders.length > 0) sdkOptions.metricReaders = metricReaders;
|
|
4153
4174
|
if (logRecordProcessors && logRecordProcessors.length > 0) sdkOptions.logRecordProcessors = logRecordProcessors;
|
|
4175
|
+
else if (!process.env.OTEL_LOGS_EXPORTER) sdkOptions.logRecordProcessors = [];
|
|
4154
4176
|
sdk = mergedConfig.sdkFactory ? mergedConfig.sdkFactory(sdkOptions) : new NodeSDK(sdkOptions);
|
|
4155
4177
|
if (!sdk) throw new Error("[autotel] sdkFactory must return a NodeSDK instance");
|
|
4156
4178
|
sdk.start();
|
|
@@ -5,7 +5,7 @@ import { o as EventSubscriber } from "./event-subscriber-DMACQA-1.js";
|
|
|
5
5
|
import { r as SpanFilterPredicate } from "./filtering-span-processor-BpDagWNa.js";
|
|
6
6
|
import { r as Policy } from "./policy-CbpP4tFH.js";
|
|
7
7
|
import { r as SpanNameNormalizerConfig } from "./span-name-normalizer-CN1-8C76.js";
|
|
8
|
-
import { t as CanonicalLogLineOptions } from "./canonical-log-line-processor-
|
|
8
|
+
import { t as CanonicalLogLineOptions } from "./canonical-log-line-processor-Yq4cXcD5.js";
|
|
9
9
|
import { NodeSDK, NodeSDKConfiguration } from "@opentelemetry/sdk-node";
|
|
10
10
|
import { ReadableSpan, SpanExporter, SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
11
11
|
import { Resource } from "@opentelemetry/resources";
|
|
@@ -261,8 +261,31 @@ interface ProcessHandlersConfig {
|
|
|
261
261
|
*/
|
|
262
262
|
interface CanonicalLogLinesConfig {
|
|
263
263
|
enabled: boolean;
|
|
264
|
-
/**
|
|
265
|
-
|
|
264
|
+
/**
|
|
265
|
+
* Logger(s) to emit canonical log lines through. Pass an array to fan out to
|
|
266
|
+
* several. When omitted, lines go to the OTel Logs API instead.
|
|
267
|
+
*
|
|
268
|
+
* Note this falls back to the top-level `logger` on AutotelConfig, so
|
|
269
|
+
* setting that alone also diverts canonical log lines away from OTLP.
|
|
270
|
+
*/
|
|
271
|
+
logger?: Logger | Logger[];
|
|
272
|
+
/**
|
|
273
|
+
* Also emit through the OTel Logs API alongside any `logger`, so the same
|
|
274
|
+
* lines reach an OTLP logs backend (Loki, and the like).
|
|
275
|
+
*
|
|
276
|
+
* Defaults to true only when no `logger` is given. Set `otel: true` with a
|
|
277
|
+
* logger to get both: the platform's own log view keeps the lines, and OTLP
|
|
278
|
+
* carries them to your backend.
|
|
279
|
+
*
|
|
280
|
+
* @example Console and Loki at once
|
|
281
|
+
* ```typescript
|
|
282
|
+
* init({
|
|
283
|
+
* endpoint: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
|
|
284
|
+
* canonicalLogLines: { enabled: true, logger: pino(), otel: true },
|
|
285
|
+
* });
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
otel?: boolean;
|
|
266
289
|
/** Only emit canonical log lines for root spans (default: false). */
|
|
267
290
|
rootSpansOnly?: boolean;
|
|
268
291
|
/** Minimum log level for canonical log lines (default: 'info'). */
|
|
@@ -468,7 +491,18 @@ interface AutotelConfig {
|
|
|
468
491
|
* Single-destination shorthand. For multi-backend OTLP fan-out, use
|
|
469
492
|
* `destinations` instead.
|
|
470
493
|
* Only used if you don't provide custom exporters/processors
|
|
471
|
-
*
|
|
494
|
+
*
|
|
495
|
+
* Falls back to the OTel spec's `OTEL_EXPORTER_OTLP_ENDPOINT`, which is the
|
|
496
|
+
* variable every vendor's docs hand you (see `env-config.ts`;
|
|
497
|
+
* `OTEL_EXPORTER_OTLP_HEADERS` and `OTEL_EXPORTER_OTLP_PROTOCOL` are read
|
|
498
|
+
* the same way).
|
|
499
|
+
*
|
|
500
|
+
* With no endpoint from either source there is NO default and no fallback
|
|
501
|
+
* to localhost: the span processor list stays empty and nothing is
|
|
502
|
+
* exported, so telemetry is off rather than aimed at a collector that is
|
|
503
|
+
* not there. Point it at a local collector explicitly when you want one.
|
|
504
|
+
*
|
|
505
|
+
* @default process.env.OTEL_EXPORTER_OTLP_ENDPOINT, else no exporter
|
|
472
506
|
*/
|
|
473
507
|
endpoint?: string;
|
|
474
508
|
/**
|
|
@@ -661,13 +695,26 @@ interface AutotelConfig {
|
|
|
661
695
|
headers?: Record<string, string> | string;
|
|
662
696
|
/**
|
|
663
697
|
* OTLP protocol to use for traces, metrics, and logs
|
|
664
|
-
* - 'http': HTTP
|
|
698
|
+
* - 'http': OTLP over HTTP with a **JSON** body (default, port 4318)
|
|
699
|
+
* - 'http/protobuf': OTLP over HTTP with a protobuf body (port 4318)
|
|
665
700
|
* - 'grpc': gRPC (uses port 4317)
|
|
666
701
|
*
|
|
702
|
+
* The default is JSON, not protobuf — `createTraceExporter` falls through to
|
|
703
|
+
* `OTLPTraceExporterHTTP`, which sends `content-type: application/json`.
|
|
704
|
+
* Grafana Cloud, Honeycomb and the other hosted OTLP gateways all accept
|
|
705
|
+
* JSON, so the default needs no extra install and is what the vendor presets
|
|
706
|
+
* in `autotel-backends` rely on.
|
|
707
|
+
*
|
|
667
708
|
* Can be overridden with OTEL_EXPORTER_OTLP_PROTOCOL env var.
|
|
668
709
|
*
|
|
669
|
-
* Note:
|
|
710
|
+
* Note: only the JSON exporters ship with autotel. 'http/protobuf' and
|
|
711
|
+
* 'grpc' need optional peer dependencies, and a bundler (Vercel, Nitro,
|
|
712
|
+
* esbuild) will not trace a lazy `require`, so they must be direct
|
|
713
|
+
* dependencies of the *application* to survive bundling:
|
|
670
714
|
* ```bash
|
|
715
|
+
* # http/protobuf
|
|
716
|
+
* pnpm add @opentelemetry/exporter-trace-otlp-proto @opentelemetry/exporter-metrics-otlp-proto
|
|
717
|
+
* # grpc
|
|
671
718
|
* pnpm add @opentelemetry/exporter-trace-otlp-grpc @opentelemetry/exporter-metrics-otlp-grpc
|
|
672
719
|
* ```
|
|
673
720
|
*
|
|
@@ -793,6 +840,20 @@ interface AutotelConfig {
|
|
|
793
840
|
* }
|
|
794
841
|
* init({ service: 'my-app', logger })
|
|
795
842
|
* ```
|
|
843
|
+
*
|
|
844
|
+
* @remarks
|
|
845
|
+
* This is also the fallback logger for canonical log lines, so setting it
|
|
846
|
+
* sends them here INSTEAD of the OTel Logs API — and therefore stops them
|
|
847
|
+
* reaching an OTLP logs backend such as Loki. On a platform whose log view
|
|
848
|
+
* reads stdout you usually want both, which is what
|
|
849
|
+
* `canonicalLogLines.otel` is for:
|
|
850
|
+
*
|
|
851
|
+
* ```typescript
|
|
852
|
+
* init({
|
|
853
|
+
* service: 'my-app',
|
|
854
|
+
* canonicalLogLines: { enabled: true, logger, otel: true },
|
|
855
|
+
* })
|
|
856
|
+
* ```
|
|
796
857
|
*/
|
|
797
858
|
logger?: Logger;
|
|
798
859
|
/**
|