@osfactory/otel-hook 0.6.0 → 0.8.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 +156 -8
- package/dist/cli.js +219 -60
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +132 -1
- package/dist/config.js +171 -3
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +208 -57
- package/dist/index.js.map +1 -1
- package/dist/integration.d.ts +6 -1
- package/dist/integration.js +54 -55
- package/dist/integration.js.map +1 -1
- package/dist/lifecycle.js +7 -1
- package/dist/lifecycle.js.map +1 -1
- package/dist/{otlp-log-sink-eUEjaLhk.d.ts → otlp-log-sink-zuHojHSP.d.ts} +16 -0
- package/dist/telemetry.d.ts +2 -2
- package/dist/telemetry.js +45 -45
- package/dist/telemetry.js.map +1 -1
- package/package.json +9 -9
package/dist/config.d.ts
CHANGED
|
@@ -195,10 +195,26 @@ type EnvironmentConfigResult = {
|
|
|
195
195
|
* No identity variable appears here by design: session, invocation, and
|
|
196
196
|
* workspace identity are supplied per invocation as identity claims, never
|
|
197
197
|
* through ambient configuration (ADR 0001).
|
|
198
|
+
*
|
|
199
|
+
* The standard OTLP header variables are read too, but listed separately in
|
|
200
|
+
* `OTLP_HEADER_VARIABLES`: only the header *names* they set enter the
|
|
201
|
+
* configuration patch, and their values are resolved by `resolveOtlpHeaders`
|
|
202
|
+
* for the sinks alone.
|
|
203
|
+
*
|
|
204
|
+
* `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` is read too, but listed in
|
|
205
|
+
* `OTLP_ENDPOINT_VARIABLES` with its two siblings: an endpoint is not identity,
|
|
206
|
+
* yet a `TRACE` name in this list would defeat the guard that keeps identity
|
|
207
|
+
* variables out of it.
|
|
198
208
|
*/
|
|
199
209
|
declare const ENVIRONMENT_VARIABLES: Readonly<{
|
|
200
210
|
exporterEnabled: "OTEL_HOOK_ENABLED";
|
|
211
|
+
/** Full traces URL; otel-hook's own variable, above the standard ones. */
|
|
201
212
|
exporterEndpoint: "OTEL_HOOK_EXPORTER_ENDPOINT";
|
|
213
|
+
/**
|
|
214
|
+
* Standard base URL: `/v1/traces` and `/v1/logs` are appended per signal. A
|
|
215
|
+
* value already ending in `/v1/traces` is the legacy full traces URL and is
|
|
216
|
+
* used as-is (see `otlpSignalEndpointFromBase`).
|
|
217
|
+
*/
|
|
202
218
|
otlpEndpoint: "OTEL_EXPORTER_OTLP_ENDPOINT";
|
|
203
219
|
exporterProtocol: "OTEL_HOOK_EXPORTER_PROTOCOL";
|
|
204
220
|
exporterTimeoutMillis: "OTEL_HOOK_EXPORTER_TIMEOUT_MS";
|
|
@@ -230,4 +246,119 @@ declare const ENVIRONMENT_VARIABLES: Readonly<{
|
|
|
230
246
|
*/
|
|
231
247
|
declare const parseEnvironmentConfig: (env: EnvironmentRecord) => EnvironmentConfigResult;
|
|
232
248
|
|
|
233
|
-
|
|
249
|
+
/**
|
|
250
|
+
* The standard OTLP exporter header variables.
|
|
251
|
+
*
|
|
252
|
+
* `OTEL_EXPORTER_OTLP_HEADERS` applies to every signal;
|
|
253
|
+
* `OTEL_EXPORTER_OTLP_TRACES_HEADERS` and `OTEL_EXPORTER_OTLP_LOGS_HEADERS`
|
|
254
|
+
* apply to one signal each. They exist so a credential (`authorization=Basic …`)
|
|
255
|
+
* can reach the exporter without being written on a command line, where `ps` and
|
|
256
|
+
* `/proc/<pid>/cmdline` would show it to every local user.
|
|
257
|
+
*
|
|
258
|
+
* Header *values* never enter configuration. Parsing returns them to the caller,
|
|
259
|
+
* which hands them straight to the sink at construction; configuration carries
|
|
260
|
+
* header *names* only (`exporter.headerNames`), because a resolved-config
|
|
261
|
+
* snapshot is logged and exported. Every diagnostic here names an entry by its
|
|
262
|
+
* position and the variable by its name — never a key, never a value — because a
|
|
263
|
+
* malformed entry may be the secret itself (`Basic abc` with no `=`).
|
|
264
|
+
*/
|
|
265
|
+
/** Upper bound on headers per variable, matching `exporter.headerNames`. */
|
|
266
|
+
declare const MAX_OTLP_HEADERS = 32;
|
|
267
|
+
declare const OTLP_HEADER_VARIABLES: Readonly<{
|
|
268
|
+
generic: "OTEL_EXPORTER_OTLP_HEADERS";
|
|
269
|
+
traces: "OTEL_EXPORTER_OTLP_TRACES_HEADERS";
|
|
270
|
+
logs: "OTEL_EXPORTER_OTLP_LOGS_HEADERS";
|
|
271
|
+
}>;
|
|
272
|
+
type ParsedOtlpHeaders = {
|
|
273
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
274
|
+
/** Position-only explanations; never a key or a value. */
|
|
275
|
+
readonly warnings: readonly string[];
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* Parse one `OTEL_EXPORTER_OTLP_*HEADERS` value.
|
|
279
|
+
*
|
|
280
|
+
* The OpenTelemetry exporter specification defines the format as W3C
|
|
281
|
+
* Baggage-like: comma-separated `key=value` pairs, surrounding whitespace
|
|
282
|
+
* trimmed, keys and values percent-decoded. So `authorization=Basic%20abc` is
|
|
283
|
+
* the header `authorization: Basic abc`, and a `,` inside a value must be
|
|
284
|
+
* written `%2C`. A malformed entry is skipped and reported; the rest of the
|
|
285
|
+
* variable still applies. A repeated key takes its last value.
|
|
286
|
+
*/
|
|
287
|
+
declare const parseOtlpHeadersValue: (raw: string) => ParsedOtlpHeaders;
|
|
288
|
+
/**
|
|
289
|
+
* Overlay header maps, lowest precedence first, per header name.
|
|
290
|
+
*
|
|
291
|
+
* A higher source replaces only the names it sets (case-insensitively), so a
|
|
292
|
+
* signal-specific variable can override `authorization` while a generic tenant
|
|
293
|
+
* header still applies — the same per-key merge the OpenTelemetry SDKs apply.
|
|
294
|
+
*/
|
|
295
|
+
declare const mergeOtlpHeaders: (...sources: readonly Readonly<Record<string, string>>[]) => Readonly<Record<string, string>>;
|
|
296
|
+
type ResolvedOtlpHeaders = {
|
|
297
|
+
/** Headers for the traces exporter. */
|
|
298
|
+
readonly traces: Readonly<Record<string, string>>;
|
|
299
|
+
/** Headers for the logs exporter. */
|
|
300
|
+
readonly logs: Readonly<Record<string, string>>;
|
|
301
|
+
/** Variable-qualified, value-free explanations of skipped entries. */
|
|
302
|
+
readonly warnings: readonly {
|
|
303
|
+
readonly variable: string;
|
|
304
|
+
readonly detail: string;
|
|
305
|
+
}[];
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* Resolve exporter headers per signal.
|
|
309
|
+
*
|
|
310
|
+
* Precedence, per header name, highest first:
|
|
311
|
+
*
|
|
312
|
+
* ```
|
|
313
|
+
* explicit headers (--header) > OTEL_EXPORTER_OTLP_{TRACES,LOGS}_HEADERS > OTEL_EXPORTER_OTLP_HEADERS
|
|
314
|
+
* ```
|
|
315
|
+
*
|
|
316
|
+
* Pure: the environment is passed in, never read from `process.env`.
|
|
317
|
+
*/
|
|
318
|
+
declare const resolveOtlpHeaders: (env: Readonly<Record<string, string | undefined>>, explicit?: Readonly<Record<string, string>>) => ResolvedOtlpHeaders;
|
|
319
|
+
/**
|
|
320
|
+
* Header names, deduplicated case-insensitively (first spelling kept), sorted
|
|
321
|
+
* and bounded — the only part of a header that may enter configuration or a
|
|
322
|
+
* diagnostic.
|
|
323
|
+
*/
|
|
324
|
+
declare const unionOtlpHeaderNames: (...lists: readonly (readonly string[])[]) => readonly string[];
|
|
325
|
+
/** {@link unionOtlpHeaderNames} over the names of header maps. */
|
|
326
|
+
declare const describeOtlpHeaderNames: (...sources: readonly Readonly<Record<string, string>>[]) => readonly string[];
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* OTLP/HTTP endpoint URLs per signal, as the OpenTelemetry exporter
|
|
330
|
+
* specification defines them.
|
|
331
|
+
*
|
|
332
|
+
* - `OTEL_EXPORTER_OTLP_ENDPOINT` is a **base** URL: the signal path
|
|
333
|
+
* (`/v1/traces`, `/v1/logs`) is appended to it.
|
|
334
|
+
* - `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` / `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT`
|
|
335
|
+
* are full URLs, used as they are.
|
|
336
|
+
*
|
|
337
|
+
* One compatibility rule: earlier releases read `OTEL_EXPORTER_OTLP_ENDPOINT`
|
|
338
|
+
* as the full traces URL. A base URL that already ends in `/v1/traces` is
|
|
339
|
+
* therefore taken to be that full URL, not a base to append to, so an existing
|
|
340
|
+
* `…/v1/traces` value keeps posting where it did.
|
|
341
|
+
*/
|
|
342
|
+
/**
|
|
343
|
+
* The standard endpoint variables. `generic` and `logs` also appear in
|
|
344
|
+
* `ENVIRONMENT_VARIABLES`; `traces` does not, because that list is guarded
|
|
345
|
+
* against identity-looking (`TRACE`) names.
|
|
346
|
+
*/
|
|
347
|
+
declare const OTLP_ENDPOINT_VARIABLES: Readonly<{
|
|
348
|
+
generic: "OTEL_EXPORTER_OTLP_ENDPOINT";
|
|
349
|
+
traces: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT";
|
|
350
|
+
logs: "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT";
|
|
351
|
+
}>;
|
|
352
|
+
type OtlpSignal = "traces" | "logs";
|
|
353
|
+
/**
|
|
354
|
+
* The URL a signal posts to, given an `OTEL_EXPORTER_OTLP_ENDPOINT` base.
|
|
355
|
+
*
|
|
356
|
+
* Trailing slashes on the base are dropped before the signal path is appended,
|
|
357
|
+
* so `https://host/otlp` and `https://host/otlp/` both give
|
|
358
|
+
* `https://host/otlp/v1/traces`. A base ending in `/v1/traces` (the legacy
|
|
359
|
+
* full-URL form) is used as-is for traces and has that suffix swapped for
|
|
360
|
+
* `/v1/logs` for logs.
|
|
361
|
+
*/
|
|
362
|
+
declare const otlpSignalEndpointFromBase: (base: string, signal: OtlpSignal) => string;
|
|
363
|
+
|
|
364
|
+
export { CONFIG_SOURCE_PRECEDENCE, type ConfigLayer, type ConfigProvenance, type ConfigResolution, type ConfigSource, EMPTY_RESOURCE_ATTRIBUTES, ENVIRONMENT_VARIABLES, type EnvironmentConfigResult, type EnvironmentRecord, MAX_OTLP_HEADERS, MAX_RESOURCE_ATTRIBUTES, MAX_RESOURCE_ATTRIBUTE_KEY_LENGTH, MAX_RESOURCE_ATTRIBUTE_VALUE_LENGTH, OTLP_ENDPOINT_VARIABLES, OTLP_HEADER_VARIABLES, OtelHookConfig, OtelHookConfigPatch, type OtlpSignal, type ParsedOtlpHeaders, type ParsedResourceAttributes, RESERVED_RESOURCE_ATTRIBUTE_KEYS, RESOURCE_ATTRIBUTE_KEY_PATTERN, RESOURCE_ATTRIBUTE_KEY_REJECTION_DETAIL, type ResolvedOtlpHeaders, type ResourceAttributeKeyRejection, type ResourceAttributeValue, type ResourceAttributes, checkResourceAttributeKey, configSourceSchema, describeOtlpHeaderNames, describeResolvedConfig, describeResourceAttributeNames, isReservedResourceAttributeKey, isSecretResourceAttributeKey, mergeOtlpHeaders, otlpSignalEndpointFromBase, parseEnvironmentConfig, parseOtlpHeadersValue, parseResourceAttributesValue, resolveConfig, resolveOtlpHeaders, resourceAttributeValueSchema, resourceAttributesSchema, sanitizeResourceAttributes, unionOtlpHeaderNames };
|
package/dist/config.js
CHANGED
|
@@ -761,10 +761,160 @@ var describeResolvedConfig = (config) => {
|
|
|
761
761
|
};
|
|
762
762
|
};
|
|
763
763
|
|
|
764
|
+
// src/config/otlp-endpoint.ts
|
|
765
|
+
var OTLP_ENDPOINT_VARIABLES = Object.freeze({
|
|
766
|
+
generic: "OTEL_EXPORTER_OTLP_ENDPOINT",
|
|
767
|
+
traces: "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT",
|
|
768
|
+
logs: "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT"
|
|
769
|
+
});
|
|
770
|
+
var OTLP_TRACES_PATH = "/v1/traces";
|
|
771
|
+
var OTLP_LOGS_PATH = "/v1/logs";
|
|
772
|
+
var withoutTrailingSlashes = (value) => {
|
|
773
|
+
let end = value.length;
|
|
774
|
+
while (end > 0 && value.charCodeAt(end - 1) === 47) {
|
|
775
|
+
end -= 1;
|
|
776
|
+
}
|
|
777
|
+
return value.slice(0, end);
|
|
778
|
+
};
|
|
779
|
+
var otlpSignalEndpointFromBase = (base, signal) => {
|
|
780
|
+
const trimmed = withoutTrailingSlashes(base);
|
|
781
|
+
if (trimmed.endsWith(OTLP_TRACES_PATH)) {
|
|
782
|
+
return signal === "traces" ? trimmed : `${trimmed.slice(0, trimmed.length - OTLP_TRACES_PATH.length)}${OTLP_LOGS_PATH}`;
|
|
783
|
+
}
|
|
784
|
+
return `${trimmed}${signal === "traces" ? OTLP_TRACES_PATH : OTLP_LOGS_PATH}`;
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
// src/config/otlp-headers.ts
|
|
788
|
+
var MAX_OTLP_HEADERS = 32;
|
|
789
|
+
var OTLP_HEADER_VARIABLES = Object.freeze({
|
|
790
|
+
generic: "OTEL_EXPORTER_OTLP_HEADERS",
|
|
791
|
+
traces: "OTEL_EXPORTER_OTLP_TRACES_HEADERS",
|
|
792
|
+
logs: "OTEL_EXPORTER_OTLP_LOGS_HEADERS"
|
|
793
|
+
});
|
|
794
|
+
var HEADER_NAME_PATTERN = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
795
|
+
var isUnsafeHeaderValue = (value) => [...value].some((char) => {
|
|
796
|
+
const code = char.codePointAt(0) ?? 0;
|
|
797
|
+
return code < 32 && code !== 9 || code === 127 || code > 255;
|
|
798
|
+
});
|
|
799
|
+
var decode = (raw) => {
|
|
800
|
+
try {
|
|
801
|
+
return decodeURIComponent(raw);
|
|
802
|
+
} catch {
|
|
803
|
+
return void 0;
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
var parseOtlpHeadersValue = (raw) => {
|
|
807
|
+
const headers = {};
|
|
808
|
+
const warnings = [];
|
|
809
|
+
let overflowed = false;
|
|
810
|
+
for (const [index, rawEntry] of raw.split(",").entries()) {
|
|
811
|
+
const position = String(index + 1);
|
|
812
|
+
const entry = rawEntry.trim();
|
|
813
|
+
if (entry === "") {
|
|
814
|
+
continue;
|
|
815
|
+
}
|
|
816
|
+
const equals = entry.indexOf("=");
|
|
817
|
+
if (equals <= 0) {
|
|
818
|
+
warnings.push(`entry ${position} is not a key=value pair; ignored`);
|
|
819
|
+
continue;
|
|
820
|
+
}
|
|
821
|
+
const key = decode(entry.slice(0, equals).trim());
|
|
822
|
+
const value = decode(entry.slice(equals + 1).trim());
|
|
823
|
+
if (key === void 0 || value === void 0) {
|
|
824
|
+
warnings.push(`entry ${position} has malformed percent-encoding; ignored`);
|
|
825
|
+
continue;
|
|
826
|
+
}
|
|
827
|
+
const name = key.trim();
|
|
828
|
+
const trimmedValue = value.trim();
|
|
829
|
+
if (!HEADER_NAME_PATTERN.test(name)) {
|
|
830
|
+
warnings.push(`entry ${position} does not name a valid HTTP header; ignored`);
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
if (trimmedValue === "") {
|
|
834
|
+
warnings.push(`entry ${position} has an empty value; ignored`);
|
|
835
|
+
continue;
|
|
836
|
+
}
|
|
837
|
+
if (isUnsafeHeaderValue(trimmedValue)) {
|
|
838
|
+
warnings.push(`entry ${position} has a character not allowed in an HTTP header value; ignored`);
|
|
839
|
+
continue;
|
|
840
|
+
}
|
|
841
|
+
const existing = findHeaderName(headers, name);
|
|
842
|
+
if (existing === void 0 && Object.keys(headers).length >= MAX_OTLP_HEADERS) {
|
|
843
|
+
overflowed = true;
|
|
844
|
+
continue;
|
|
845
|
+
}
|
|
846
|
+
if (existing !== void 0) {
|
|
847
|
+
delete headers[existing];
|
|
848
|
+
}
|
|
849
|
+
headers[name] = trimmedValue;
|
|
850
|
+
}
|
|
851
|
+
if (overflowed) {
|
|
852
|
+
warnings.push(`more than ${String(MAX_OTLP_HEADERS)} headers were supplied; the excess was ignored`);
|
|
853
|
+
}
|
|
854
|
+
return { headers, warnings };
|
|
855
|
+
};
|
|
856
|
+
var findHeaderName = (headers, name) => {
|
|
857
|
+
const lower = name.toLowerCase();
|
|
858
|
+
return Object.keys(headers).find((candidate) => candidate.toLowerCase() === lower);
|
|
859
|
+
};
|
|
860
|
+
var mergeOtlpHeaders = (...sources) => {
|
|
861
|
+
const merged = {};
|
|
862
|
+
for (const source of sources) {
|
|
863
|
+
for (const [name, value] of Object.entries(source)) {
|
|
864
|
+
const existing = findHeaderName(merged, name);
|
|
865
|
+
if (existing !== void 0) {
|
|
866
|
+
delete merged[existing];
|
|
867
|
+
}
|
|
868
|
+
merged[name] = value;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
return merged;
|
|
872
|
+
};
|
|
873
|
+
var resolveOtlpHeaders = (env, explicit = {}) => {
|
|
874
|
+
const warnings = [];
|
|
875
|
+
const read = (variable) => {
|
|
876
|
+
const raw = env[variable];
|
|
877
|
+
if (raw === void 0 || raw.trim() === "") {
|
|
878
|
+
return {};
|
|
879
|
+
}
|
|
880
|
+
const parsed = parseOtlpHeadersValue(raw);
|
|
881
|
+
for (const detail of parsed.warnings) {
|
|
882
|
+
warnings.push({ variable, detail });
|
|
883
|
+
}
|
|
884
|
+
return parsed.headers;
|
|
885
|
+
};
|
|
886
|
+
const generic = read(OTLP_HEADER_VARIABLES.generic);
|
|
887
|
+
const traces = read(OTLP_HEADER_VARIABLES.traces);
|
|
888
|
+
const logs = read(OTLP_HEADER_VARIABLES.logs);
|
|
889
|
+
return {
|
|
890
|
+
traces: mergeOtlpHeaders(generic, traces, explicit),
|
|
891
|
+
logs: mergeOtlpHeaders(generic, logs, explicit),
|
|
892
|
+
warnings
|
|
893
|
+
};
|
|
894
|
+
};
|
|
895
|
+
var unionOtlpHeaderNames = (...lists) => {
|
|
896
|
+
const names = [];
|
|
897
|
+
const seen = /* @__PURE__ */ new Set();
|
|
898
|
+
for (const name of lists.flat()) {
|
|
899
|
+
if (!seen.has(name.toLowerCase())) {
|
|
900
|
+
seen.add(name.toLowerCase());
|
|
901
|
+
names.push(name);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
return names.sort().slice(0, MAX_OTLP_HEADERS);
|
|
905
|
+
};
|
|
906
|
+
var describeOtlpHeaderNames = (...sources) => unionOtlpHeaderNames(...sources.map((source) => Object.keys(source)));
|
|
907
|
+
|
|
764
908
|
// src/config/environment.ts
|
|
765
909
|
var ENVIRONMENT_VARIABLES = Object.freeze({
|
|
766
910
|
exporterEnabled: "OTEL_HOOK_ENABLED",
|
|
911
|
+
/** Full traces URL; otel-hook's own variable, above the standard ones. */
|
|
767
912
|
exporterEndpoint: "OTEL_HOOK_EXPORTER_ENDPOINT",
|
|
913
|
+
/**
|
|
914
|
+
* Standard base URL: `/v1/traces` and `/v1/logs` are appended per signal. A
|
|
915
|
+
* value already ending in `/v1/traces` is the legacy full traces URL and is
|
|
916
|
+
* used as-is (see `otlpSignalEndpointFromBase`).
|
|
917
|
+
*/
|
|
768
918
|
otlpEndpoint: "OTEL_EXPORTER_OTLP_ENDPOINT",
|
|
769
919
|
exporterProtocol: "OTEL_HOOK_EXPORTER_PROTOCOL",
|
|
770
920
|
exporterTimeoutMillis: "OTEL_HOOK_EXPORTER_TIMEOUT_MS",
|
|
@@ -838,7 +988,10 @@ var parseEnvironmentConfig = (env) => {
|
|
|
838
988
|
return trimmed === "" ? void 0 : trimmed;
|
|
839
989
|
};
|
|
840
990
|
const exporterEnabled = readBoolean(ENVIRONMENT_VARIABLES.exporterEnabled);
|
|
841
|
-
const
|
|
991
|
+
const hookEndpoint = readString(ENVIRONMENT_VARIABLES.exporterEndpoint);
|
|
992
|
+
const otlpTracesEndpoint = readString(OTLP_ENDPOINT_VARIABLES.traces);
|
|
993
|
+
const otlpBaseEndpoint = readString(ENVIRONMENT_VARIABLES.otlpEndpoint);
|
|
994
|
+
const endpoint = hookEndpoint ?? otlpTracesEndpoint ?? (otlpBaseEndpoint === void 0 ? void 0 : otlpSignalEndpointFromBase(otlpBaseEndpoint, "traces"));
|
|
842
995
|
const timeoutMillis = readInteger(ENVIRONMENT_VARIABLES.exporterTimeoutMillis);
|
|
843
996
|
const resourceRaw = readString(ENVIRONMENT_VARIABLES.resourceAttributes);
|
|
844
997
|
const resource = resourceRaw === void 0 ? void 0 : parseResourceAttributesValue(resourceRaw);
|
|
@@ -924,17 +1077,23 @@ var parseEnvironmentConfig = (env) => {
|
|
|
924
1077
|
const maxEventsPerInvocation = readInteger(ENVIRONMENT_VARIABLES.maxEventsPerInvocation);
|
|
925
1078
|
const logsEnabled = readBoolean(ENVIRONMENT_VARIABLES.logsEnabled);
|
|
926
1079
|
const logsIncludeContent = readBoolean(ENVIRONMENT_VARIABLES.logsIncludeContent);
|
|
927
|
-
const logsEndpoint = readString(ENVIRONMENT_VARIABLES.logsEndpoint) ?? readString(ENVIRONMENT_VARIABLES.otlpLogsEndpoint);
|
|
1080
|
+
const logsEndpoint = readString(ENVIRONMENT_VARIABLES.logsEndpoint) ?? readString(ENVIRONMENT_VARIABLES.otlpLogsEndpoint) ?? (hookEndpoint === void 0 && otlpTracesEndpoint !== void 0 && otlpBaseEndpoint !== void 0 ? otlpSignalEndpointFromBase(otlpBaseEndpoint, "logs") : void 0);
|
|
928
1081
|
const logs = {
|
|
929
1082
|
...logsEnabled === void 0 ? {} : { enabled: logsEnabled },
|
|
930
1083
|
...logsEndpoint === void 0 ? {} : { endpoint: logsEndpoint },
|
|
931
1084
|
...logsIncludeContent === void 0 ? {} : { includeContent: logsIncludeContent }
|
|
932
1085
|
};
|
|
1086
|
+
const otlpHeaders = resolveOtlpHeaders(env);
|
|
1087
|
+
for (const { variable, detail } of otlpHeaders.warnings) {
|
|
1088
|
+
warn(variable, detail);
|
|
1089
|
+
}
|
|
1090
|
+
const headerNames = describeOtlpHeaderNames(otlpHeaders.traces, otlpHeaders.logs);
|
|
933
1091
|
const exporter = {
|
|
934
1092
|
...exporterEnabled === void 0 ? {} : { enabled: exporterEnabled },
|
|
935
1093
|
...endpoint === void 0 ? {} : { endpoint },
|
|
936
1094
|
...protocol === void 0 ? {} : { protocol },
|
|
937
1095
|
...timeoutMillis === void 0 ? {} : { timeoutMillis },
|
|
1096
|
+
...headerNames.length === 0 ? {} : { headerNames: [...headerNames] },
|
|
938
1097
|
...serviceName === void 0 ? {} : { serviceName },
|
|
939
1098
|
...serviceNamespace === void 0 ? {} : { serviceNamespace },
|
|
940
1099
|
...Object.keys(resourceAttributes).length === 0 ? {} : { resourceAttributes },
|
|
@@ -971,15 +1130,19 @@ export {
|
|
|
971
1130
|
DEFAULT_LOGS_POLICY,
|
|
972
1131
|
EMPTY_RESOURCE_ATTRIBUTES,
|
|
973
1132
|
ENVIRONMENT_VARIABLES,
|
|
1133
|
+
MAX_OTLP_HEADERS,
|
|
974
1134
|
MAX_RESOURCE_ATTRIBUTES,
|
|
975
1135
|
MAX_RESOURCE_ATTRIBUTE_KEY_LENGTH,
|
|
976
1136
|
MAX_RESOURCE_ATTRIBUTE_VALUE_LENGTH,
|
|
1137
|
+
OTLP_ENDPOINT_VARIABLES,
|
|
1138
|
+
OTLP_HEADER_VARIABLES,
|
|
977
1139
|
RESERVED_RESOURCE_ATTRIBUTE_KEYS,
|
|
978
1140
|
RESOURCE_ATTRIBUTE_KEY_PATTERN,
|
|
979
1141
|
RESOURCE_ATTRIBUTE_KEY_REJECTION_DETAIL,
|
|
980
1142
|
checkResourceAttributeKey,
|
|
981
1143
|
configSourceSchema,
|
|
982
1144
|
contentModeSchema,
|
|
1145
|
+
describeOtlpHeaderNames,
|
|
983
1146
|
describeResolvedConfig,
|
|
984
1147
|
describeResourceAttributeNames,
|
|
985
1148
|
detectionPolicySchema,
|
|
@@ -988,13 +1151,18 @@ export {
|
|
|
988
1151
|
isReservedResourceAttributeKey,
|
|
989
1152
|
isSecretResourceAttributeKey,
|
|
990
1153
|
logsPolicySchema,
|
|
1154
|
+
mergeOtlpHeaders,
|
|
991
1155
|
otelHookConfigPatchSchema,
|
|
992
1156
|
otelHookConfigSchema,
|
|
1157
|
+
otlpSignalEndpointFromBase,
|
|
993
1158
|
parseEnvironmentConfig,
|
|
1159
|
+
parseOtlpHeadersValue,
|
|
994
1160
|
parseResourceAttributesValue,
|
|
995
1161
|
resolveConfig,
|
|
1162
|
+
resolveOtlpHeaders,
|
|
996
1163
|
resourceAttributeValueSchema,
|
|
997
1164
|
resourceAttributesSchema,
|
|
998
|
-
sanitizeResourceAttributes
|
|
1165
|
+
sanitizeResourceAttributes,
|
|
1166
|
+
unionOtlpHeaderNames
|
|
999
1167
|
};
|
|
1000
1168
|
//# sourceMappingURL=config.js.map
|