@opentelemetry/configuration 0.222.0 → 0.300.0-development.1

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.
Files changed (83) hide show
  1. package/dist/ConfigFactory.cjs +12 -0
  2. package/dist/ConfigFactory.cjs.map +1 -0
  3. package/dist/ConfigFactory.d.cts +6 -0
  4. package/dist/ConfigFactory.d.cts.map +1 -0
  5. package/dist/ConfigFactory.d.mts +6 -0
  6. package/dist/ConfigFactory.d.mts.map +1 -0
  7. package/dist/ConfigFactory.mjs +12 -0
  8. package/dist/ConfigFactory.mjs.map +1 -0
  9. package/dist/EnvDefinition.cjs +34 -0
  10. package/dist/EnvDefinition.cjs.map +1 -0
  11. package/dist/EnvDefinition.mjs +33 -0
  12. package/dist/EnvDefinition.mjs.map +1 -0
  13. package/dist/EnvReader.cjs +37 -0
  14. package/dist/EnvReader.cjs.map +1 -0
  15. package/dist/EnvReader.mjs +36 -0
  16. package/dist/EnvReader.mjs.map +1 -0
  17. package/dist/EnvironmentConfigFactory.cjs +354 -0
  18. package/dist/EnvironmentConfigFactory.cjs.map +1 -0
  19. package/dist/EnvironmentConfigFactory.mjs +347 -0
  20. package/dist/EnvironmentConfigFactory.mjs.map +1 -0
  21. package/dist/FileConfigFactory.cjs +141 -0
  22. package/dist/FileConfigFactory.cjs.map +1 -0
  23. package/{build/src/FileConfigFactory.d.ts → dist/FileConfigFactory.d.cts} +8 -12
  24. package/dist/FileConfigFactory.d.cts.map +1 -0
  25. package/dist/FileConfigFactory.d.mts +28 -0
  26. package/dist/FileConfigFactory.d.mts.map +1 -0
  27. package/dist/FileConfigFactory.mjs +134 -0
  28. package/dist/FileConfigFactory.mjs.map +1 -0
  29. package/dist/IConfigFactory.d.cts +13 -0
  30. package/dist/IConfigFactory.d.cts.map +1 -0
  31. package/dist/IConfigFactory.d.mts +13 -0
  32. package/dist/IConfigFactory.d.mts.map +1 -0
  33. package/dist/_virtual/_rolldown/runtime.cjs +25 -0
  34. package/dist/_virtual/_rolldown/runtime.mjs +4 -0
  35. package/dist/generated/types.d.cts +1662 -0
  36. package/dist/generated/types.d.cts.map +1 -0
  37. package/dist/generated/types.d.mts +1662 -0
  38. package/dist/generated/types.d.mts.map +1 -0
  39. package/dist/generated/validator.cjs +14385 -0
  40. package/dist/generated/validator.cjs.map +1 -0
  41. package/dist/generated/validator.mjs +14381 -0
  42. package/dist/generated/validator.mjs.map +1 -0
  43. package/dist/index.cjs +7 -0
  44. package/dist/index.d.cts +5 -0
  45. package/dist/index.d.mts +5 -0
  46. package/dist/index.mjs +3 -0
  47. package/dist/utils.cjs +137 -0
  48. package/dist/utils.cjs.map +1 -0
  49. package/dist/utils.mjs +129 -0
  50. package/dist/utils.mjs.map +1 -0
  51. package/package.json +28 -19
  52. package/build/src/ConfigFactory.d.ts +0 -3
  53. package/build/src/ConfigFactory.js +0 -19
  54. package/build/src/ConfigFactory.js.map +0 -1
  55. package/build/src/EnvDefinition.d.ts +0 -15
  56. package/build/src/EnvDefinition.js +0 -36
  57. package/build/src/EnvDefinition.js.map +0 -1
  58. package/build/src/EnvReader.d.ts +0 -24
  59. package/build/src/EnvReader.js +0 -60
  60. package/build/src/EnvReader.js.map +0 -1
  61. package/build/src/EnvironmentConfigFactory.d.ts +0 -19
  62. package/build/src/EnvironmentConfigFactory.js +0 -540
  63. package/build/src/EnvironmentConfigFactory.js.map +0 -1
  64. package/build/src/FileConfigFactory.js +0 -177
  65. package/build/src/FileConfigFactory.js.map +0 -1
  66. package/build/src/IConfigFactory.d.ts +0 -10
  67. package/build/src/IConfigFactory.js +0 -7
  68. package/build/src/IConfigFactory.js.map +0 -1
  69. package/build/src/generated/types.d.ts +0 -1659
  70. package/build/src/generated/types.js +0 -13
  71. package/build/src/generated/types.js.map +0 -1
  72. package/build/src/generated/validator.d.ts +0 -17
  73. package/build/src/generated/validator.js +0 -8533
  74. package/build/src/generated/validator.js.map +0 -1
  75. package/build/src/index.d.ts +0 -5
  76. package/build/src/index.js +0 -14
  77. package/build/src/index.js.map +0 -1
  78. package/build/src/utils.d.ts +0 -20
  79. package/build/src/utils.js +0 -188
  80. package/build/src/utils.js.map +0 -1
  81. package/build/src/version.d.ts +0 -2
  82. package/build/src/version.js +0 -10
  83. package/build/src/version.js.map +0 -1
@@ -1,5 +0,0 @@
1
- export type { ConfigFactory } from './IConfigFactory';
2
- export type { ConfigurationModel, LogRecordExporter as LogRecordExporterConfigModel, PushMetricExporter as PushMetricExporterConfigModel, OtlpHttpMetricExporter as OtlpHttpMetricExporterConfigModel, OtlpGrpcMetricExporter as OtlpGrpcMetricExporterConfigModel, InstrumentType as InstrumentTypeConfigModel, Aggregation as AggregationConfigModel, PeriodicMetricReader as PeriodicMetricReaderConfigModel, Sampler as SamplerConfigModel, SpanExporter as SpanExporterConfigModel, SpanProcessor as SpanProcessorConfigModel, SpanLimits as SpanLimitsConfigModel, MetricProducer as MetricProducerConfigModel, NameStringValuePair as NameStringValuePairConfigModel, HttpTls as HttpTlsConfigModel, GrpcTls as GrpcTlsConfigModel, IdGenerator as IdGeneratorConfigModel, SeverityNumber as SeverityNumberConfigModel, TextMapPropagator as TextMapPropagatorConfigModel, LoggerProvider as LoggerProviderConfigModel, AttributeLimits as AttributeLimitsConfigModel, LogRecordProcessor as LogRecordProcessorConfigModel, BatchLogRecordProcessor as BatchLogRecordProcessorConfigModel, SimpleLogRecordProcessor as SimpleLogRecordProcessorConfigModel, OtlpHttpExporter as OtlpHttpExporterConfigModel, OtlpGrpcExporter as OtlpGrpcExporterConfigModel, LogRecordLimits as LogRecordLimitsConfigModel, Propagator as PropagatorConfigModel, MeterProvider as MeterProviderConfigModel, MetricReader as MetricReaderConfigModel, ExporterTemporalityPreference as ExporterTemporalityPreferenceConfigModel, ExporterDefaultHistogramAggregation as ExporterDefaultHistogramAggregationConfigModel, ConsoleMetricExporter as ConsoleMetricExporterConfigModel, PullMetricReader as PullMetricReaderConfigModel, PullMetricExporter as PullMetricExporterConfigModel, ExperimentalPrometheusMetricExporter as ExperimentalPrometheusMetricExporterConfigModel, View as ViewConfigModel, ExplicitBucketHistogramAggregation as ExplicitBucketHistogramAggregationConfigModel, Base2ExponentialBucketHistogramAggregation as Base2ExponentialBucketHistogramAggregationConfigModel, TracerProvider as TracerProviderConfigModel, BatchSpanProcessor as BatchSpanProcessorConfigModel, SimpleSpanProcessor as SimpleSpanProcessorConfigModel, TraceIdRatioBasedSampler as TraceIdRatioBasedSamplerConfigModel, ParentBasedSampler as ParentBasedSamplerConfigModel, Resource as ResourceConfigModel, } from './generated/types';
3
- export { createConfigFactory } from './ConfigFactory';
4
- export { mergeHeadersConfig, mergeResourceAttributesConfig, mergePropagatorCompositeConfig, } from './FileConfigFactory';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1,14 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright The OpenTelemetry Authors
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.mergePropagatorCompositeConfig = exports.mergeResourceAttributesConfig = exports.mergeHeadersConfig = exports.createConfigFactory = void 0;
8
- var ConfigFactory_1 = require("./ConfigFactory");
9
- Object.defineProperty(exports, "createConfigFactory", { enumerable: true, get: function () { return ConfigFactory_1.createConfigFactory; } });
10
- var FileConfigFactory_1 = require("./FileConfigFactory");
11
- Object.defineProperty(exports, "mergeHeadersConfig", { enumerable: true, get: function () { return FileConfigFactory_1.mergeHeadersConfig; } });
12
- Object.defineProperty(exports, "mergeResourceAttributesConfig", { enumerable: true, get: function () { return FileConfigFactory_1.mergeResourceAttributesConfig; } });
13
- Object.defineProperty(exports, "mergePropagatorCompositeConfig", { enumerable: true, get: function () { return FileConfigFactory_1.mergePropagatorCompositeConfig; } });
14
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAyDH,iDAAsD;AAA7C,oHAAA,mBAAmB,OAAA;AAC5B,yDAI6B;AAH3B,uHAAA,kBAAkB,OAAA;AAClB,kIAAA,6BAA6B,OAAA;AAC7B,mIAAA,8BAA8B,OAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// Naming convention for types exported from this package: configuration\n// types use the `ConfigModel` suffix (e.g. `SamplerConfigModel`) rather than\n// their schema name (e.g. `Sampler`) so that they don't collide with the SDK\n// runtime types of the same name. Internally the package uses the schema\n// names from `./generated/types`; the renaming happens at export time here.\n// Follow this convention when adding new exports.\n\nexport type { ConfigFactory } from './IConfigFactory';\nexport type {\n ConfigurationModel,\n LogRecordExporter as LogRecordExporterConfigModel,\n PushMetricExporter as PushMetricExporterConfigModel,\n OtlpHttpMetricExporter as OtlpHttpMetricExporterConfigModel,\n OtlpGrpcMetricExporter as OtlpGrpcMetricExporterConfigModel,\n InstrumentType as InstrumentTypeConfigModel,\n Aggregation as AggregationConfigModel,\n PeriodicMetricReader as PeriodicMetricReaderConfigModel,\n Sampler as SamplerConfigModel,\n SpanExporter as SpanExporterConfigModel,\n SpanProcessor as SpanProcessorConfigModel,\n SpanLimits as SpanLimitsConfigModel,\n MetricProducer as MetricProducerConfigModel,\n NameStringValuePair as NameStringValuePairConfigModel,\n HttpTls as HttpTlsConfigModel,\n GrpcTls as GrpcTlsConfigModel,\n IdGenerator as IdGeneratorConfigModel,\n SeverityNumber as SeverityNumberConfigModel,\n TextMapPropagator as TextMapPropagatorConfigModel,\n LoggerProvider as LoggerProviderConfigModel,\n AttributeLimits as AttributeLimitsConfigModel,\n LogRecordProcessor as LogRecordProcessorConfigModel,\n BatchLogRecordProcessor as BatchLogRecordProcessorConfigModel,\n SimpleLogRecordProcessor as SimpleLogRecordProcessorConfigModel,\n OtlpHttpExporter as OtlpHttpExporterConfigModel,\n OtlpGrpcExporter as OtlpGrpcExporterConfigModel,\n LogRecordLimits as LogRecordLimitsConfigModel,\n Propagator as PropagatorConfigModel,\n MeterProvider as MeterProviderConfigModel,\n MetricReader as MetricReaderConfigModel,\n ExporterTemporalityPreference as ExporterTemporalityPreferenceConfigModel,\n ExporterDefaultHistogramAggregation as ExporterDefaultHistogramAggregationConfigModel,\n ConsoleMetricExporter as ConsoleMetricExporterConfigModel,\n PullMetricReader as PullMetricReaderConfigModel,\n PullMetricExporter as PullMetricExporterConfigModel,\n ExperimentalPrometheusMetricExporter as ExperimentalPrometheusMetricExporterConfigModel,\n View as ViewConfigModel,\n ExplicitBucketHistogramAggregation as ExplicitBucketHistogramAggregationConfigModel,\n Base2ExponentialBucketHistogramAggregation as Base2ExponentialBucketHistogramAggregationConfigModel,\n TracerProvider as TracerProviderConfigModel,\n BatchSpanProcessor as BatchSpanProcessorConfigModel,\n SimpleSpanProcessor as SimpleSpanProcessorConfigModel,\n TraceIdRatioBasedSampler as TraceIdRatioBasedSamplerConfigModel,\n ParentBasedSampler as ParentBasedSamplerConfigModel,\n Resource as ResourceConfigModel,\n} from './generated/types';\nexport { createConfigFactory } from './ConfigFactory';\nexport {\n mergeHeadersConfig,\n mergeResourceAttributesConfig,\n mergePropagatorCompositeConfig,\n} from './FileConfigFactory';\n"]}
@@ -1,20 +0,0 @@
1
- import * as yaml from 'yaml';
2
- import type { ConfigurationModel, GrpcTls, HttpTls } from './generated/types';
3
- /**
4
- * Handle (Environment) variable substitution per
5
- * https://opentelemetry.io/docs/specs/otel/configuration/data-model/#environment-variable-substitution
6
- *
7
- * This changes the yaml.Document in-place.
8
- * This must work with a yaml.Document, rather than a raw JS object from
9
- * `yaml.parse()`, to distinguish between `foo: ${BAR}` and `foo: "${BAR}"`.
10
- *
11
- * Exported for testing.
12
- */
13
- export declare function substituteEnvVars(doc: yaml.Document): void;
14
- export declare function getGrpcTlsConfig(certificateFile?: string, clientKeyFile?: string, clientCertificateFile?: string, insecure?: boolean): GrpcTls | undefined;
15
- export declare function initializeDefaultConfiguration(): ConfigurationModel;
16
- export declare function initializeDefaultTracerProviderConfiguration(): NonNullable<ConfigurationModel['tracer_provider']>;
17
- export declare function initializeDefaultMeterProviderConfiguration(): NonNullable<ConfigurationModel['meter_provider']>;
18
- export declare function initializeDefaultLoggerProviderConfiguration(): NonNullable<ConfigurationModel['logger_provider']>;
19
- export declare function getHttpTlsConfig(certificateFile?: string, clientKeyFile?: string, clientCertificateFile?: string): HttpTls | undefined;
20
- //# sourceMappingURL=utils.d.ts.map
@@ -1,188 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright The OpenTelemetry Authors
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.getHttpTlsConfig = exports.initializeDefaultLoggerProviderConfiguration = exports.initializeDefaultMeterProviderConfiguration = exports.initializeDefaultTracerProviderConfiguration = exports.initializeDefaultConfiguration = exports.getGrpcTlsConfig = exports.substituteEnvVars = void 0;
8
- const yaml = require("yaml");
9
- const core_1 = require("@opentelemetry/core");
10
- /**
11
- * Handle (Environment) variable substitution per
12
- * https://opentelemetry.io/docs/specs/otel/configuration/data-model/#environment-variable-substitution
13
- *
14
- * This changes the yaml.Document in-place.
15
- * This must work with a yaml.Document, rather than a raw JS object from
16
- * `yaml.parse()`, to distinguish between `foo: ${BAR}` and `foo: "${BAR}"`.
17
- *
18
- * Exported for testing.
19
- */
20
- function substituteEnvVars(doc) {
21
- // Visit each scalar string value in the document. These are
22
- // the candidates for env var substitution.
23
- yaml.visit(doc, {
24
- Scalar: (key, node, _path) => {
25
- if (key === 'key')
26
- return; // skip mapping keys
27
- if (typeof node.value !== 'string')
28
- return;
29
- let subbed = envVarSubst(node.value);
30
- if (subbed !== node.value && node.type === yaml.Scalar.PLAIN) {
31
- // "PLAIN" here is a simple YAML value (e.g. 42 in `foo: 42`).
32
- // I.e., not quoted (`foo: "42"`) or in a block.
33
- subbed = yamlScalarCoerce(subbed);
34
- }
35
- node.value = subbed;
36
- },
37
- });
38
- }
39
- exports.substituteEnvVars = substituteEnvVars;
40
- // ENV_SUBSTITUTION_RE *mostly* matches the `ENV-SUBSTITUTION` ABNF from the
41
- // spec with the exception of the DEFAULT-VALUE: we are using `[^\n}]*`
42
- // (copying the OTel Java regex) rather than a regex closer to ABNF
43
- // `*(VCHAR-WSP-NO-RBRACE)` (which is slightly ambiguous on what whitespace is
44
- // allowed in WSP).
45
- const ENV_SUBSTITUTION_RE = /^([a-zA-Z_][a-zA-Z0-9_]*)(?::-([^\n}]*))?$/;
46
- /**
47
- * Do environment variable substitution for the given string value.
48
- */
49
- function envVarSubst(s) {
50
- const ESCAPE_RE = /(\$\$)/;
51
- const chunks = s.split(ESCAPE_RE);
52
- for (let i = 0; i < chunks.length; ++i) {
53
- if (i % 2 === 1) {
54
- // Odd chunks are matched escape sequences, i.e. '$$'.
55
- chunks[i] = '$';
56
- continue;
57
- }
58
- // Even chunks are processed for possible substition matches.
59
- const SUBSTITUTION_REF_RE = /\$\{(?:env:)?([^}]+)\}/g;
60
- let chunk = '';
61
- let lastIndex = 0;
62
- let match;
63
- while ((match = SUBSTITUTION_REF_RE.exec(chunks[i])) !== null) {
64
- chunk += chunks[i].slice(lastIndex, match.index);
65
- const envMatch = ENV_SUBSTITUTION_RE.exec(match[1]);
66
- if (!envMatch) {
67
- // E.g.: `key: ${STRING_VALUE:?error}` test case
68
- throw new Error(`parse error: invalid env var substitution: ${match[0]}`);
69
- }
70
- const envName = envMatch[1];
71
- const defaultValue = envMatch[2] ?? '';
72
- chunk += (0, core_1.getStringFromEnv)(envName) || defaultValue;
73
- lastIndex = SUBSTITUTION_REF_RE.lastIndex;
74
- }
75
- chunk += chunks[i].slice(lastIndex);
76
- chunks[i] = chunk;
77
- }
78
- const result = chunks.join('');
79
- return result;
80
- }
81
- /**
82
- * Re-interpret a string value from env var substitution as a possible
83
- * YAML number, boolean, or null value.
84
- *
85
- * If the interpretted value is any other type, we return the original
86
- * string:
87
- * - sequences and mappings may not result from env var substitution, per the spec
88
- * - a re-parsed YAML string normalizes whitespace, which we do not want
89
- */
90
- function yamlScalarCoerce(value) {
91
- let coerced;
92
- try {
93
- coerced = yaml.parse(value, { version: '1.2' });
94
- }
95
- catch {
96
- return value;
97
- }
98
- const type = typeof coerced;
99
- if (coerced === null || type === 'number' || type === 'boolean') {
100
- return coerced;
101
- }
102
- else {
103
- return value;
104
- }
105
- }
106
- function getGrpcTlsConfig(certificateFile, clientKeyFile, clientCertificateFile, insecure) {
107
- if (certificateFile || clientKeyFile || clientCertificateFile) {
108
- const tls = {};
109
- if (certificateFile) {
110
- tls.ca_file = certificateFile;
111
- }
112
- if (clientKeyFile) {
113
- tls.key_file = clientKeyFile;
114
- }
115
- if (clientCertificateFile) {
116
- tls.cert_file = clientCertificateFile;
117
- }
118
- if (insecure !== undefined) {
119
- tls.insecure = insecure;
120
- }
121
- return tls;
122
- }
123
- return undefined;
124
- }
125
- exports.getGrpcTlsConfig = getGrpcTlsConfig;
126
- function initializeDefaultConfiguration() {
127
- return {
128
- disabled: false,
129
- log_level: 'info',
130
- resource: {},
131
- attribute_limits: {
132
- attribute_count_limit: 128,
133
- },
134
- };
135
- }
136
- exports.initializeDefaultConfiguration = initializeDefaultConfiguration;
137
- function initializeDefaultTracerProviderConfiguration() {
138
- return {
139
- processors: [],
140
- limits: {
141
- attribute_count_limit: 128,
142
- event_count_limit: 128,
143
- link_count_limit: 128,
144
- event_attribute_count_limit: 128,
145
- link_attribute_count_limit: 128,
146
- },
147
- sampler: {
148
- parent_based: {
149
- root: { always_on: null },
150
- },
151
- },
152
- };
153
- }
154
- exports.initializeDefaultTracerProviderConfiguration = initializeDefaultTracerProviderConfiguration;
155
- function initializeDefaultMeterProviderConfiguration() {
156
- return {
157
- readers: [],
158
- views: [],
159
- exemplar_filter: 'trace_based',
160
- };
161
- }
162
- exports.initializeDefaultMeterProviderConfiguration = initializeDefaultMeterProviderConfiguration;
163
- function initializeDefaultLoggerProviderConfiguration() {
164
- return {
165
- processors: [],
166
- limits: { attribute_count_limit: 128 },
167
- 'logger_configurator/development': {},
168
- };
169
- }
170
- exports.initializeDefaultLoggerProviderConfiguration = initializeDefaultLoggerProviderConfiguration;
171
- function getHttpTlsConfig(certificateFile, clientKeyFile, clientCertificateFile) {
172
- if (certificateFile || clientKeyFile || clientCertificateFile) {
173
- const tls = {};
174
- if (certificateFile) {
175
- tls.ca_file = certificateFile;
176
- }
177
- if (clientKeyFile) {
178
- tls.key_file = clientKeyFile;
179
- }
180
- if (clientCertificateFile) {
181
- tls.cert_file = clientCertificateFile;
182
- }
183
- return tls;
184
- }
185
- return undefined;
186
- }
187
- exports.getHttpTlsConfig = getHttpTlsConfig;
188
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6BAA6B;AAC7B,8CAAuD;AAGvD;;;;;;;;;GASG;AACH,SAAgB,iBAAiB,CAAC,GAAkB;IAClD,4DAA4D;IAC5D,2CAA2C;IAC3C,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;QACd,MAAM,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;YAC3B,IAAI,GAAG,KAAK,KAAK;gBAAE,OAAO,CAAC,oBAAoB;YAC/C,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;gBAAE,OAAO;YAC3C,IAAI,MAAM,GAAqC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvE,IAAI,MAAM,KAAK,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;gBAC5D,8DAA8D;gBAC9D,gDAAgD;gBAChD,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;aACnC;YACD,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;QACtB,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAhBD,8CAgBC;AAED,4EAA4E;AAC5E,uEAAuE;AACvE,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G,qBAAqB,CAAC;SACvC;QACD,OAAO,GAAG,CAAC;KACZ;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAnBD,4CAmBC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport * as yaml from 'yaml';\nimport { getStringFromEnv } from '@opentelemetry/core';\nimport type { ConfigurationModel, GrpcTls, HttpTls } from './generated/types';\n\n/**\n * Handle (Environment) variable substitution per\n * https://opentelemetry.io/docs/specs/otel/configuration/data-model/#environment-variable-substitution\n *\n * This changes the yaml.Document in-place.\n * This must work with a yaml.Document, rather than a raw JS object from\n * `yaml.parse()`, to distinguish between `foo: ${BAR}` and `foo: \"${BAR}\"`.\n *\n * Exported for testing.\n */\nexport function substituteEnvVars(doc: yaml.Document) {\n // Visit each scalar string value in the document. These are\n // the candidates for env var substitution.\n yaml.visit(doc, {\n Scalar: (key, node, _path) => {\n if (key === 'key') return; // skip mapping keys\n if (typeof node.value !== 'string') return;\n let subbed: string | null | number | boolean = envVarSubst(node.value);\n if (subbed !== node.value && node.type === yaml.Scalar.PLAIN) {\n // \"PLAIN\" here is a simple YAML value (e.g. 42 in `foo: 42`).\n // I.e., not quoted (`foo: \"42\"`) or in a block.\n subbed = yamlScalarCoerce(subbed);\n }\n node.value = subbed;\n },\n });\n}\n\n// ENV_SUBSTITUTION_RE *mostly* matches the `ENV-SUBSTITUTION` ABNF from the\n// spec with the exception of the DEFAULT-VALUE: we are using `[^\\n}]*`\n// (copying the OTel Java regex) rather than a regex closer to ABNF\n// `*(VCHAR-WSP-NO-RBRACE)` (which is slightly ambiguous on what whitespace is\n// allowed in WSP).\nconst ENV_SUBSTITUTION_RE = /^([a-zA-Z_][a-zA-Z0-9_]*)(?::-([^\\n}]*))?$/;\n\n/**\n * Do environment variable substitution for the given string value.\n */\nfunction envVarSubst(s: string): string {\n const ESCAPE_RE = /(\\$\\$)/;\n const chunks = s.split(ESCAPE_RE);\n for (let i = 0; i < chunks.length; ++i) {\n if (i % 2 === 1) {\n // Odd chunks are matched escape sequences, i.e. '$$'.\n chunks[i] = '$';\n continue;\n }\n\n // Even chunks are processed for possible substition matches.\n const SUBSTITUTION_REF_RE = /\\$\\{(?:env:)?([^}]+)\\}/g;\n let chunk = '';\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = SUBSTITUTION_REF_RE.exec(chunks[i])) !== null) {\n chunk += chunks[i].slice(lastIndex, match.index);\n const envMatch = ENV_SUBSTITUTION_RE.exec(match[1]);\n if (!envMatch) {\n // E.g.: `key: ${STRING_VALUE:?error}` test case\n throw new Error(\n `parse error: invalid env var substitution: ${match[0]}`\n );\n }\n const envName = envMatch[1];\n const defaultValue = envMatch[2] ?? '';\n chunk += getStringFromEnv(envName) || defaultValue;\n lastIndex = SUBSTITUTION_REF_RE.lastIndex;\n }\n chunk += chunks[i].slice(lastIndex);\n chunks[i] = chunk;\n }\n\n const result = chunks.join('');\n return result;\n}\n\n/**\n * Re-interpret a string value from env var substitution as a possible\n * YAML number, boolean, or null value.\n *\n * If the interpretted value is any other type, we return the original\n * string:\n * - sequences and mappings may not result from env var substitution, per the spec\n * - a re-parsed YAML string normalizes whitespace, which we do not want\n */\nfunction yamlScalarCoerce(value: string): string | null | number | boolean {\n let coerced;\n try {\n coerced = yaml.parse(value, { version: '1.2' });\n } catch {\n return value;\n }\n const type = typeof coerced;\n if (coerced === null || type === 'number' || type === 'boolean') {\n return coerced;\n } else {\n return value;\n }\n}\n\nexport function getGrpcTlsConfig(\n certificateFile?: string,\n clientKeyFile?: string,\n clientCertificateFile?: string,\n insecure?: boolean\n): GrpcTls | undefined {\n if (certificateFile || clientKeyFile || clientCertificateFile) {\n const tls: GrpcTls = {};\n if (certificateFile) {\n tls.ca_file = certificateFile;\n }\n if (clientKeyFile) {\n tls.key_file = clientKeyFile;\n }\n if (clientCertificateFile) {\n tls.cert_file = clientCertificateFile;\n }\n if (insecure !== undefined) {\n tls.insecure = insecure;\n }\n return tls;\n }\n return undefined;\n}\n\nexport function initializeDefaultConfiguration(): ConfigurationModel {\n return {\n disabled: false,\n log_level: 'info',\n resource: {},\n attribute_limits: {\n attribute_count_limit: 128,\n },\n };\n}\n\nexport function initializeDefaultTracerProviderConfiguration(): NonNullable<\n ConfigurationModel['tracer_provider']\n> {\n return {\n processors: [],\n limits: {\n attribute_count_limit: 128,\n event_count_limit: 128,\n link_count_limit: 128,\n event_attribute_count_limit: 128,\n link_attribute_count_limit: 128,\n },\n sampler: {\n parent_based: {\n root: { always_on: null },\n },\n },\n };\n}\n\nexport function initializeDefaultMeterProviderConfiguration(): NonNullable<\n ConfigurationModel['meter_provider']\n> {\n return {\n readers: [],\n views: [],\n exemplar_filter: 'trace_based',\n };\n}\n\nexport function initializeDefaultLoggerProviderConfiguration(): NonNullable<\n ConfigurationModel['logger_provider']\n> {\n return {\n processors: [],\n limits: { attribute_count_limit: 128 },\n 'logger_configurator/development': {},\n };\n}\n\nexport function getHttpTlsConfig(\n certificateFile?: string,\n clientKeyFile?: string,\n clientCertificateFile?: string\n): HttpTls | undefined {\n if (certificateFile || clientKeyFile || clientCertificateFile) {\n const tls: HttpTls = {};\n if (certificateFile) {\n tls.ca_file = certificateFile;\n }\n if (clientKeyFile) {\n tls.key_file = clientKeyFile;\n }\n if (clientCertificateFile) {\n tls.cert_file = clientCertificateFile;\n }\n return tls;\n }\n return undefined;\n}\n"]}
@@ -1,2 +0,0 @@
1
- export declare const VERSION = "0.222.0";
2
- //# sourceMappingURL=version.d.ts.map
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright The OpenTelemetry Authors
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.VERSION = void 0;
8
- // this is autogenerated file, see scripts/version-update.js
9
- exports.VERSION = '0.222.0';
10
- //# sourceMappingURL=version.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,SAAS,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.222.0';\n"]}