Update test framework: fix run_tests.py to support all test files, add auto-import-check for test files

This commit is contained in:
qiaoxinjiu
2026-05-09 15:11:30 +08:00
parent eb053a347f
commit eaba8328da
21739 changed files with 2236758 additions and 719 deletions

View File

@@ -0,0 +1,21 @@
import { BasicTracerProvider, SDKRegistrationConfig } from '@opentelemetry/sdk-trace-base';
import { NodeTracerConfig } from './config';
/**
* Register this TracerProvider for use with the OpenTelemetry API.
* Undefined values may be replaced with defaults, and
* null values will be skipped.
*
* @param config Configuration object for SDK registration
*/
export declare class NodeTracerProvider extends BasicTracerProvider {
constructor(config?: NodeTracerConfig);
/**
* Register this TracerProvider for use with the OpenTelemetry API.
* Undefined values may be replaced with defaults, and
* null values will be skipped.
*
* @param config Configuration object for SDK registration
*/
register(config?: SDKRegistrationConfig): void;
}
//# sourceMappingURL=NodeTracerProvider.d.ts.map

View File

@@ -0,0 +1,80 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NodeTracerProvider = void 0;
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const context_async_hooks_1 = require("@opentelemetry/context-async-hooks");
const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
const api_1 = require("@opentelemetry/api");
const core_1 = require("@opentelemetry/core");
function setupContextManager(contextManager) {
// null means 'do not register'
if (contextManager === null) {
return;
}
// undefined means 'register default'
if (contextManager === undefined) {
const defaultContextManager = new context_async_hooks_1.AsyncLocalStorageContextManager();
defaultContextManager.enable();
api_1.context.setGlobalContextManager(defaultContextManager);
return;
}
contextManager.enable();
api_1.context.setGlobalContextManager(contextManager);
}
function setupPropagator(propagator) {
// null means 'do not register'
if (propagator === null) {
return;
}
// undefined means 'register default'
if (propagator === undefined) {
api_1.propagation.setGlobalPropagator(new core_1.CompositePropagator({
propagators: [
new core_1.W3CTraceContextPropagator(),
new core_1.W3CBaggagePropagator(),
],
}));
return;
}
api_1.propagation.setGlobalPropagator(propagator);
}
/**
* Register this TracerProvider for use with the OpenTelemetry API.
* Undefined values may be replaced with defaults, and
* null values will be skipped.
*
* @param config Configuration object for SDK registration
*/
class NodeTracerProvider extends sdk_trace_base_1.BasicTracerProvider {
constructor(config = {}) {
super(config);
}
/**
* Register this TracerProvider for use with the OpenTelemetry API.
* Undefined values may be replaced with defaults, and
* null values will be skipped.
*
* @param config Configuration object for SDK registration
*/
register(config = {}) {
api_1.trace.setGlobalTracerProvider(this);
setupContextManager(config.contextManager);
setupPropagator(config.propagator);
}
}
exports.NodeTracerProvider = NodeTracerProvider;
//# sourceMappingURL=NodeTracerProvider.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NodeTracerProvider.js","sourceRoot":"","sources":["../../src/NodeTracerProvider.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,4EAAqF;AACrF,kEAGuC;AAEvC,4CAM4B;AAC5B,8CAI6B;AAE7B,SAAS,mBAAmB,CAC1B,cAAiD;IAEjD,+BAA+B;IAC/B,IAAI,cAAc,KAAK,IAAI,EAAE;QAC3B,OAAO;KACR;IAED,qCAAqC;IACrC,IAAI,cAAc,KAAK,SAAS,EAAE;QAChC,MAAM,qBAAqB,GAAG,IAAI,qDAA+B,EAAE,CAAC;QACpE,qBAAqB,CAAC,MAAM,EAAE,CAAC;QAC/B,aAAO,CAAC,uBAAuB,CAAC,qBAAqB,CAAC,CAAC;QACvD,OAAO;KACR;IAED,cAAc,CAAC,MAAM,EAAE,CAAC;IACxB,aAAO,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,eAAe,CAAC,UAAgD;IACvE,+BAA+B;IAC/B,IAAI,UAAU,KAAK,IAAI,EAAE;QACvB,OAAO;KACR;IAED,qCAAqC;IACrC,IAAI,UAAU,KAAK,SAAS,EAAE;QAC5B,iBAAW,CAAC,mBAAmB,CAC7B,IAAI,0BAAmB,CAAC;YACtB,WAAW,EAAE;gBACX,IAAI,gCAAyB,EAAE;gBAC/B,IAAI,2BAAoB,EAAE;aAC3B;SACF,CAAC,CACH,CAAC;QACF,OAAO;KACR;IAED,iBAAW,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;GAMG;AACH,MAAa,kBAAmB,SAAQ,oCAAmB;IACzD,YAAY,SAA2B,EAAE;QACvC,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,SAAgC,EAAE;QACzC,WAAK,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;QACpC,mBAAmB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QAC3C,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;CACF;AAjBD,gDAiBC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-hooks';\nimport {\n BasicTracerProvider,\n SDKRegistrationConfig,\n} from '@opentelemetry/sdk-trace-base';\nimport { NodeTracerConfig } from './config';\nimport {\n context,\n ContextManager,\n propagation,\n TextMapPropagator,\n trace,\n} from '@opentelemetry/api';\nimport {\n CompositePropagator,\n W3CBaggagePropagator,\n W3CTraceContextPropagator,\n} from '@opentelemetry/core';\n\nfunction setupContextManager(\n contextManager: ContextManager | null | undefined\n) {\n // null means 'do not register'\n if (contextManager === null) {\n return;\n }\n\n // undefined means 'register default'\n if (contextManager === undefined) {\n const defaultContextManager = new AsyncLocalStorageContextManager();\n defaultContextManager.enable();\n context.setGlobalContextManager(defaultContextManager);\n return;\n }\n\n contextManager.enable();\n context.setGlobalContextManager(contextManager);\n}\n\nfunction setupPropagator(propagator: TextMapPropagator | null | undefined) {\n // null means 'do not register'\n if (propagator === null) {\n return;\n }\n\n // undefined means 'register default'\n if (propagator === undefined) {\n propagation.setGlobalPropagator(\n new CompositePropagator({\n propagators: [\n new W3CTraceContextPropagator(),\n new W3CBaggagePropagator(),\n ],\n })\n );\n return;\n }\n\n propagation.setGlobalPropagator(propagator);\n}\n\n/**\n * Register this TracerProvider for use with the OpenTelemetry API.\n * Undefined values may be replaced with defaults, and\n * null values will be skipped.\n *\n * @param config Configuration object for SDK registration\n */\nexport class NodeTracerProvider extends BasicTracerProvider {\n constructor(config: NodeTracerConfig = {}) {\n super(config);\n }\n\n /**\n * Register this TracerProvider for use with the OpenTelemetry API.\n * Undefined values may be replaced with defaults, and\n * null values will be skipped.\n *\n * @param config Configuration object for SDK registration\n */\n register(config: SDKRegistrationConfig = {}): void {\n trace.setGlobalTracerProvider(this);\n setupContextManager(config.contextManager);\n setupPropagator(config.propagator);\n }\n}\n"]}

View File

@@ -0,0 +1,6 @@
import { TracerConfig } from '@opentelemetry/sdk-trace-base';
/**
* NodeTracerConfig provides an interface for configuring a Node Tracer.
*/
export type NodeTracerConfig = TracerConfig;
//# sourceMappingURL=config.d.ts.map

View File

@@ -0,0 +1,18 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=config.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TracerConfig } from '@opentelemetry/sdk-trace-base';\n\n/**\n * NodeTracerConfig provides an interface for configuring a Node Tracer.\n */\nexport type NodeTracerConfig = TracerConfig;\n"]}

View File

@@ -0,0 +1,4 @@
export { NodeTracerConfig } from './config';
export { NodeTracerProvider } from './NodeTracerProvider';
export { AlwaysOffSampler, AlwaysOnSampler, BasicTracerProvider, BatchSpanProcessor, BatchSpanProcessorBrowserConfig, BufferConfig, ConsoleSpanExporter, GeneralLimits, IdGenerator, InMemorySpanExporter, NoopSpanProcessor, ParentBasedSampler, RandomIdGenerator, ReadableSpan, Sampler, SamplingDecision, SamplingResult, SDKRegistrationConfig, SimpleSpanProcessor, Span, SpanExporter, SpanLimits, SpanProcessor, TimedEvent, TraceIdRatioBasedSampler, TracerConfig, } from '@opentelemetry/sdk-trace-base';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,34 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.TraceIdRatioBasedSampler = exports.SimpleSpanProcessor = exports.SamplingDecision = exports.RandomIdGenerator = exports.ParentBasedSampler = exports.NoopSpanProcessor = exports.InMemorySpanExporter = exports.ConsoleSpanExporter = exports.BatchSpanProcessor = exports.BasicTracerProvider = exports.AlwaysOnSampler = exports.AlwaysOffSampler = exports.NodeTracerProvider = void 0;
var NodeTracerProvider_1 = require("./NodeTracerProvider");
Object.defineProperty(exports, "NodeTracerProvider", { enumerable: true, get: function () { return NodeTracerProvider_1.NodeTracerProvider; } });
var sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
Object.defineProperty(exports, "AlwaysOffSampler", { enumerable: true, get: function () { return sdk_trace_base_1.AlwaysOffSampler; } });
Object.defineProperty(exports, "AlwaysOnSampler", { enumerable: true, get: function () { return sdk_trace_base_1.AlwaysOnSampler; } });
Object.defineProperty(exports, "BasicTracerProvider", { enumerable: true, get: function () { return sdk_trace_base_1.BasicTracerProvider; } });
Object.defineProperty(exports, "BatchSpanProcessor", { enumerable: true, get: function () { return sdk_trace_base_1.BatchSpanProcessor; } });
Object.defineProperty(exports, "ConsoleSpanExporter", { enumerable: true, get: function () { return sdk_trace_base_1.ConsoleSpanExporter; } });
Object.defineProperty(exports, "InMemorySpanExporter", { enumerable: true, get: function () { return sdk_trace_base_1.InMemorySpanExporter; } });
Object.defineProperty(exports, "NoopSpanProcessor", { enumerable: true, get: function () { return sdk_trace_base_1.NoopSpanProcessor; } });
Object.defineProperty(exports, "ParentBasedSampler", { enumerable: true, get: function () { return sdk_trace_base_1.ParentBasedSampler; } });
Object.defineProperty(exports, "RandomIdGenerator", { enumerable: true, get: function () { return sdk_trace_base_1.RandomIdGenerator; } });
Object.defineProperty(exports, "SamplingDecision", { enumerable: true, get: function () { return sdk_trace_base_1.SamplingDecision; } });
Object.defineProperty(exports, "SimpleSpanProcessor", { enumerable: true, get: function () { return sdk_trace_base_1.SimpleSpanProcessor; } });
Object.defineProperty(exports, "TraceIdRatioBasedSampler", { enumerable: true, get: function () { return sdk_trace_base_1.TraceIdRatioBasedSampler; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAGH,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,gEA2BuC;AA1BrC,kHAAA,gBAAgB,OAAA;AAChB,iHAAA,eAAe,OAAA;AACf,qHAAA,mBAAmB,OAAA;AACnB,oHAAA,kBAAkB,OAAA;AAGlB,qHAAA,mBAAmB,OAAA;AAGnB,sHAAA,oBAAoB,OAAA;AACpB,mHAAA,iBAAiB,OAAA;AACjB,oHAAA,kBAAkB,OAAA;AAClB,mHAAA,iBAAiB,OAAA;AAGjB,kHAAA,gBAAgB,OAAA;AAGhB,qHAAA,mBAAmB,OAAA;AAMnB,0HAAA,wBAAwB,OAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { NodeTracerConfig } from './config';\nexport { NodeTracerProvider } from './NodeTracerProvider';\nexport {\n AlwaysOffSampler,\n AlwaysOnSampler,\n BasicTracerProvider,\n BatchSpanProcessor,\n BatchSpanProcessorBrowserConfig,\n BufferConfig,\n ConsoleSpanExporter,\n GeneralLimits,\n IdGenerator,\n InMemorySpanExporter,\n NoopSpanProcessor,\n ParentBasedSampler,\n RandomIdGenerator,\n ReadableSpan,\n Sampler,\n SamplingDecision,\n SamplingResult,\n SDKRegistrationConfig,\n SimpleSpanProcessor,\n Span,\n SpanExporter,\n SpanLimits,\n SpanProcessor,\n TimedEvent,\n TraceIdRatioBasedSampler,\n TracerConfig,\n} from '@opentelemetry/sdk-trace-base';\n"]}

View File

@@ -0,0 +1,2 @@
export declare const VERSION = "2.0.0";
//# sourceMappingURL=version.d.ts.map

View File

@@ -0,0 +1,21 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.VERSION = void 0;
// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '2.0.0';
//# sourceMappingURL=version.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '2.0.0';\n"]}