chore: update `module` config in tsconfig.base.json (#5347)
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
This commit is contained in:
parent
c00f36ee43
commit
34475825e8
|
@ -66,6 +66,7 @@ For semantic convention package changes, see the [semconv CHANGELOG](packages/se
|
|||
* refactor(sdk-trace-base): remove `BasicTracerProvider._registeredSpanProcessors` private property. [#5134](https://github.com/open-telemetry/opentelemetry-js/pull/5134) @david-luna
|
||||
* refactor(sdk-trace-base): rename `BasicTracerProvider.activeSpanProcessor` private property. [#5211](https://github.com/open-telemetry/opentelemetry-js/pull/5211) @david-luna
|
||||
* chore(selenium-tests): remove internal selenium-tests/ package, it wasn't being used @trentm
|
||||
* chore: update typescript `module` compiler option to `node16`. [#5347](https://github.com/open-telemetry/opentelemetry-js/pull/5347) @david-luna
|
||||
|
||||
## 1.30.0
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ describe('NoopContextManager', () => {
|
|||
it('should work', () => {
|
||||
assert.doesNotThrow(() => {
|
||||
contextManager = new NoopContextManager();
|
||||
assert(
|
||||
assert.ok(
|
||||
contextManager.enable() === contextManager,
|
||||
'should return this'
|
||||
);
|
||||
|
@ -36,7 +36,7 @@ describe('NoopContextManager', () => {
|
|||
describe('.disable()', () => {
|
||||
it('should work', () => {
|
||||
assert.doesNotThrow(() => {
|
||||
assert(
|
||||
assert.ok(
|
||||
contextManager.disable() === contextManager,
|
||||
'should return this'
|
||||
);
|
||||
|
|
|
@ -37,7 +37,7 @@ const options = {
|
|||
describe('NoopMeter', () => {
|
||||
it('constructor should not crash', () => {
|
||||
const meter = new NoopMeterProvider().getMeter('test-noop');
|
||||
assert(meter instanceof NoopMeter);
|
||||
assert.ok(meter instanceof NoopMeter);
|
||||
});
|
||||
|
||||
it('counter should not crash', () => {
|
||||
|
|
|
@ -59,9 +59,9 @@ describe('NoopTracer', () => {
|
|||
{},
|
||||
trace.setSpanContext(context.active(), parent)
|
||||
);
|
||||
assert(span.spanContext().traceId === parent.traceId);
|
||||
assert(span.spanContext().spanId === parent.spanId);
|
||||
assert(span.spanContext().traceFlags === parent.traceFlags);
|
||||
assert.ok(span.spanContext().traceId === parent.traceId);
|
||||
assert.ok(span.spanContext().spanId === parent.spanId);
|
||||
assert.ok(span.spanContext().traceFlags === parent.traceFlags);
|
||||
});
|
||||
|
||||
it('should propagate valid spanContext on the span (from current context)', () => {
|
||||
|
@ -76,9 +76,9 @@ describe('NoopTracer', () => {
|
|||
const activeStub = sinon.stub(context, 'active');
|
||||
activeStub.returns(ctx);
|
||||
const span = tracer.startSpan('test-1');
|
||||
assert(span.spanContext().traceId === parent.traceId);
|
||||
assert(span.spanContext().spanId === parent.spanId);
|
||||
assert(span.spanContext().traceFlags === parent.traceFlags);
|
||||
assert.ok(span.spanContext().traceId === parent.traceId);
|
||||
assert.ok(span.spanContext().spanId === parent.spanId);
|
||||
assert.ok(span.spanContext().traceFlags === parent.traceFlags);
|
||||
});
|
||||
|
||||
it('should accept 2 to 4 args and start an active span', () => {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import * as webpack from 'webpack';
|
||||
import { webpack, Stats } from 'webpack';
|
||||
import * as path from 'path';
|
||||
import { Union } from 'unionfs';
|
||||
import { fs as mfs } from 'memfs';
|
||||
|
@ -97,7 +97,7 @@ describe('tree-shaking', function () {
|
|||
join: path.join,
|
||||
} as any;
|
||||
|
||||
const stats = await new Promise<webpack.Stats>((resolve, reject) => {
|
||||
const stats = await new Promise<Stats>((resolve, reject) => {
|
||||
compiler.run((err, stats) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
|
|
|
@ -21,7 +21,7 @@ import { NoopEventLoggerProvider } from '../../src/NoopEventLoggerProvider';
|
|||
describe('NoopEventLogger', () => {
|
||||
it('constructor should not crash', () => {
|
||||
const logger = new NoopEventLoggerProvider().getEventLogger('test-noop');
|
||||
assert(logger instanceof NoopEventLogger);
|
||||
assert.ok(logger instanceof NoopEventLogger);
|
||||
});
|
||||
|
||||
it('calling emit should not crash', () => {
|
||||
|
|
|
@ -22,7 +22,7 @@ import { NoopLoggerProvider } from '../../src/NoopLoggerProvider';
|
|||
describe('NoopLogger', () => {
|
||||
it('constructor should not crash', () => {
|
||||
const logger = new NoopLoggerProvider().getLogger('test-noop');
|
||||
assert(logger instanceof NoopLogger);
|
||||
assert.ok(logger instanceof NoopLogger);
|
||||
});
|
||||
|
||||
it('calling emit should not crash', () => {
|
||||
|
|
|
@ -74,7 +74,7 @@ describe('PrometheusSerializer', () => {
|
|||
describe('constructor', () => {
|
||||
it('should construct a serializer', () => {
|
||||
const serializer = new PrometheusSerializer();
|
||||
assert(serializer instanceof PrometheusSerializer);
|
||||
assert.ok(serializer instanceof PrometheusSerializer);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1369,10 +1369,10 @@ describe('HttpInstrumentation', () => {
|
|||
const result = await httpRequest.get(
|
||||
`${protocol}://${hostname}:${serverPort}${testPath}`
|
||||
);
|
||||
assert(
|
||||
assert.ok(
|
||||
result.reqHeaders[DummyPropagation.TRACE_CONTEXT_KEY] !== undefined
|
||||
);
|
||||
assert(
|
||||
assert.ok(
|
||||
result.reqHeaders[DummyPropagation.SPAN_CONTEXT_KEY] !== undefined
|
||||
);
|
||||
const spans = memoryExporter.getFinishedSpans();
|
||||
|
@ -1393,10 +1393,10 @@ describe('HttpInstrumentation', () => {
|
|||
const result = await httpRequest.get(
|
||||
`${protocol}://${hostname}:${serverPort}${testPath}`
|
||||
);
|
||||
assert(
|
||||
assert.ok(
|
||||
result.reqHeaders[DummyPropagation.TRACE_CONTEXT_KEY] !== undefined
|
||||
);
|
||||
assert(
|
||||
assert.ok(
|
||||
result.reqHeaders[DummyPropagation.SPAN_CONTEXT_KEY] !== undefined
|
||||
);
|
||||
const spans = memoryExporter.getFinishedSpans();
|
||||
|
@ -1424,11 +1424,11 @@ describe('HttpInstrumentation', () => {
|
|||
.get(`${protocol}://${hostname}:${serverPort}${testPath}`)
|
||||
.then(result => {
|
||||
span.end();
|
||||
assert(
|
||||
assert.ok(
|
||||
result.reqHeaders[DummyPropagation.TRACE_CONTEXT_KEY] !==
|
||||
undefined
|
||||
);
|
||||
assert(
|
||||
assert.ok(
|
||||
result.reqHeaders[DummyPropagation.SPAN_CONTEXT_KEY] !==
|
||||
undefined
|
||||
);
|
||||
|
@ -1463,9 +1463,9 @@ describe('HttpInstrumentation', () => {
|
|||
it('should set rpc metadata for incoming http request', async () => {
|
||||
server = http.createServer((request, response) => {
|
||||
const rpcMetadata = getRPCMetadata(context.active());
|
||||
assert(typeof rpcMetadata !== 'undefined');
|
||||
assert(rpcMetadata.type === RPCType.HTTP);
|
||||
assert(rpcMetadata.span.setAttribute('key', 'value'));
|
||||
assert.ok(typeof rpcMetadata !== 'undefined');
|
||||
assert.ok(rpcMetadata.type === RPCType.HTTP);
|
||||
assert.ok(rpcMetadata.span.setAttribute('key', 'value'));
|
||||
response.end('Test Server Response');
|
||||
});
|
||||
await new Promise<void>(resolve => server.listen(serverPort, resolve));
|
||||
|
|
|
@ -265,7 +265,7 @@ describe('Node SDK', () => {
|
|||
|
||||
const spanProcessor = nodeTracerProvider['_activeSpanProcessor'] as any;
|
||||
|
||||
assert(
|
||||
assert.ok(
|
||||
spanProcessor.constructor.name === 'MultiSpanProcessor',
|
||||
'is MultiSpanProcessor'
|
||||
);
|
||||
|
@ -274,13 +274,13 @@ describe('Node SDK', () => {
|
|||
'_spanProcessors'
|
||||
] as SpanProcessor[];
|
||||
|
||||
assert(
|
||||
assert.ok(
|
||||
listOfProcessors.length === 3,
|
||||
'it has the right amount of processors'
|
||||
);
|
||||
assert(listOfProcessors[0] instanceof NoopSpanProcessor);
|
||||
assert(listOfProcessors[1] instanceof SimpleSpanProcessor);
|
||||
assert(listOfProcessors[2] instanceof BatchSpanProcessor);
|
||||
assert.ok(listOfProcessors[0] instanceof NoopSpanProcessor);
|
||||
assert.ok(listOfProcessors[1] instanceof SimpleSpanProcessor);
|
||||
assert.ok(listOfProcessors[2] instanceof BatchSpanProcessor);
|
||||
await sdk.shutdown();
|
||||
});
|
||||
|
||||
|
@ -380,20 +380,20 @@ describe('Node SDK', () => {
|
|||
|
||||
const loggerProvider = logs.getLoggerProvider();
|
||||
const sharedState = (loggerProvider as any)['_sharedState'];
|
||||
assert(sharedState.registeredLogRecordProcessors.length === 2);
|
||||
assert(
|
||||
assert.ok(sharedState.registeredLogRecordProcessors.length === 2);
|
||||
assert.ok(
|
||||
sharedState.registeredLogRecordProcessors[0]._exporter instanceof
|
||||
InMemoryLogRecordExporter
|
||||
);
|
||||
assert(
|
||||
assert.ok(
|
||||
sharedState.registeredLogRecordProcessors[0] instanceof
|
||||
SimpleLogRecordProcessor
|
||||
);
|
||||
assert(
|
||||
assert.ok(
|
||||
sharedState.registeredLogRecordProcessors[1]._exporter instanceof
|
||||
InMemoryLogRecordExporter
|
||||
);
|
||||
assert(
|
||||
assert.ok(
|
||||
sharedState.registeredLogRecordProcessors[1] instanceof
|
||||
BatchLogRecordProcessor
|
||||
);
|
||||
|
@ -1004,7 +1004,7 @@ describe('Node SDK', () => {
|
|||
sdk.start();
|
||||
const loggerProvider = logs.getLoggerProvider();
|
||||
const sharedState = (loggerProvider as any)['_sharedState'];
|
||||
assert(
|
||||
assert.ok(
|
||||
sharedState.registeredLogRecordProcessors[0]._exporter instanceof
|
||||
OTLPProtoLogExporter
|
||||
);
|
||||
|
@ -1019,21 +1019,21 @@ describe('Node SDK', () => {
|
|||
|
||||
const loggerProvider = logs.getLoggerProvider();
|
||||
const sharedState = (loggerProvider as any)['_sharedState'];
|
||||
assert(sharedState.registeredLogRecordProcessors.length === 2);
|
||||
assert(
|
||||
assert.ok(sharedState.registeredLogRecordProcessors.length === 2);
|
||||
assert.ok(
|
||||
sharedState.registeredLogRecordProcessors[0]._exporter instanceof
|
||||
ConsoleLogRecordExporter
|
||||
);
|
||||
assert(
|
||||
assert.ok(
|
||||
sharedState.registeredLogRecordProcessors[0] instanceof
|
||||
SimpleLogRecordProcessor
|
||||
);
|
||||
// defaults to http/protobuf
|
||||
assert(
|
||||
assert.ok(
|
||||
sharedState.registeredLogRecordProcessors[1]._exporter instanceof
|
||||
OTLPProtoLogExporter
|
||||
);
|
||||
assert(
|
||||
assert.ok(
|
||||
sharedState.registeredLogRecordProcessors[1] instanceof
|
||||
BatchLogRecordProcessor
|
||||
);
|
||||
|
@ -1049,8 +1049,8 @@ describe('Node SDK', () => {
|
|||
|
||||
const loggerProvider = logs.getLoggerProvider();
|
||||
const sharedState = (loggerProvider as any)['_sharedState'];
|
||||
assert(sharedState.registeredLogRecordProcessors.length === 1);
|
||||
assert(
|
||||
assert.ok(sharedState.registeredLogRecordProcessors.length === 1);
|
||||
assert.ok(
|
||||
sharedState.registeredLogRecordProcessors[0]._exporter instanceof
|
||||
OTLPGrpcLogExporter
|
||||
);
|
||||
|
@ -1066,8 +1066,8 @@ describe('Node SDK', () => {
|
|||
|
||||
const loggerProvider = logs.getLoggerProvider();
|
||||
const sharedState = (loggerProvider as any)['_sharedState'];
|
||||
assert(sharedState.registeredLogRecordProcessors.length === 1);
|
||||
assert(
|
||||
assert.ok(sharedState.registeredLogRecordProcessors.length === 1);
|
||||
assert.ok(
|
||||
sharedState.registeredLogRecordProcessors[0]._exporter instanceof
|
||||
OTLPHttpLogExporter
|
||||
);
|
||||
|
@ -1083,8 +1083,8 @@ describe('Node SDK', () => {
|
|||
|
||||
const loggerProvider = logs.getLoggerProvider();
|
||||
const sharedState = (loggerProvider as any)['_sharedState'];
|
||||
assert(sharedState.registeredLogRecordProcessors.length === 1);
|
||||
assert(
|
||||
assert.ok(sharedState.registeredLogRecordProcessors.length === 1);
|
||||
assert.ok(
|
||||
sharedState.registeredLogRecordProcessors[0]._exporter instanceof
|
||||
OTLPGrpcLogExporter
|
||||
);
|
||||
|
@ -1100,8 +1100,8 @@ describe('Node SDK', () => {
|
|||
|
||||
const loggerProvider = logs.getLoggerProvider();
|
||||
const sharedState = (loggerProvider as any)['_sharedState'];
|
||||
assert(sharedState.registeredLogRecordProcessors.length === 1);
|
||||
assert(
|
||||
assert.ok(sharedState.registeredLogRecordProcessors.length === 1);
|
||||
assert.ok(
|
||||
sharedState.registeredLogRecordProcessors[0]._exporter instanceof
|
||||
OTLPProtoLogExporter
|
||||
);
|
||||
|
@ -1148,7 +1148,7 @@ describe('Node SDK', () => {
|
|||
sdk.start();
|
||||
const meterProvider = metrics.getMeterProvider();
|
||||
const sharedState = (meterProvider as any)['_sharedState'];
|
||||
assert(
|
||||
assert.ok(
|
||||
sharedState.metricCollectors[0]._metricReader._exporter instanceof
|
||||
ConsoleMetricExporter
|
||||
);
|
||||
|
@ -1170,7 +1170,7 @@ describe('Node SDK', () => {
|
|||
sdk.start();
|
||||
const meterProvider = metrics.getMeterProvider();
|
||||
const sharedState = (meterProvider as any)['_sharedState'];
|
||||
assert(
|
||||
assert.ok(
|
||||
sharedState.metricCollectors[0]._metricReader._exporter instanceof
|
||||
OTLPGrpcMetricExporter
|
||||
);
|
||||
|
@ -1192,7 +1192,7 @@ describe('Node SDK', () => {
|
|||
sdk.start();
|
||||
const meterProvider = metrics.getMeterProvider();
|
||||
const sharedState = (meterProvider as any)['_sharedState'];
|
||||
assert(
|
||||
assert.ok(
|
||||
sharedState.metricCollectors[0]._metricReader._exporter instanceof
|
||||
OTLPProtoMetricExporter
|
||||
);
|
||||
|
@ -1214,7 +1214,7 @@ describe('Node SDK', () => {
|
|||
sdk.start();
|
||||
const meterProvider = metrics.getMeterProvider();
|
||||
const sharedState = (meterProvider as any)['_sharedState'];
|
||||
assert(
|
||||
assert.ok(
|
||||
sharedState.metricCollectors[0]._metricReader._exporter instanceof
|
||||
OTLPHttpMetricExporter
|
||||
);
|
||||
|
@ -1236,7 +1236,7 @@ describe('Node SDK', () => {
|
|||
sdk.start();
|
||||
const meterProvider = metrics.getMeterProvider();
|
||||
const sharedState = (meterProvider as any)['_sharedState'];
|
||||
assert(
|
||||
assert.ok(
|
||||
sharedState.metricCollectors[0]._metricReader._exporter instanceof
|
||||
OTLPGrpcMetricExporter
|
||||
);
|
||||
|
@ -1258,7 +1258,7 @@ describe('Node SDK', () => {
|
|||
sdk.start();
|
||||
const meterProvider = metrics.getMeterProvider();
|
||||
const sharedState = (meterProvider as any)['_sharedState'];
|
||||
assert(
|
||||
assert.ok(
|
||||
sharedState.metricCollectors[0]._metricReader._exporter instanceof
|
||||
OTLPProtoMetricExporter
|
||||
);
|
||||
|
@ -1280,7 +1280,7 @@ describe('Node SDK', () => {
|
|||
sdk.start();
|
||||
const meterProvider = metrics.getMeterProvider();
|
||||
const sharedState = (meterProvider as any)['_sharedState'];
|
||||
assert(
|
||||
assert.ok(
|
||||
sharedState.metricCollectors[0]._metricReader._exporter instanceof
|
||||
OTLPProtoMetricExporter
|
||||
);
|
||||
|
@ -1305,7 +1305,7 @@ describe('Node SDK', () => {
|
|||
sdk.start();
|
||||
const meterProvider = metrics.getMeterProvider();
|
||||
const sharedState = (meterProvider as any)['_sharedState'];
|
||||
assert(
|
||||
assert.ok(
|
||||
sharedState.metricCollectors[0]._metricReader._exporter instanceof
|
||||
OTLPProtoMetricExporter
|
||||
);
|
||||
|
@ -1329,7 +1329,7 @@ describe('Node SDK', () => {
|
|||
sdk.start();
|
||||
const meterProvider = metrics.getMeterProvider();
|
||||
const sharedState = (meterProvider as any)['_sharedState'];
|
||||
assert(
|
||||
assert.ok(
|
||||
sharedState.metricCollectors[0]._metricReader instanceof
|
||||
PrometheusMetricExporter
|
||||
);
|
||||
|
@ -1344,11 +1344,11 @@ describe('setup exporter from env', () => {
|
|||
const getSdkSpanProcessors = (sdk: NodeSDK) => {
|
||||
const tracerProvider = sdk['_tracerProvider'];
|
||||
|
||||
assert(tracerProvider instanceof NodeTracerProvider);
|
||||
assert.ok(tracerProvider instanceof NodeTracerProvider);
|
||||
|
||||
const activeSpanProcessor = tracerProvider['_activeSpanProcessor'];
|
||||
|
||||
assert(activeSpanProcessor.constructor.name === 'MultiSpanProcessor');
|
||||
assert.ok(activeSpanProcessor.constructor.name === 'MultiSpanProcessor');
|
||||
|
||||
return (activeSpanProcessor as any)['_spanProcessors'] as SpanProcessor[];
|
||||
};
|
||||
|
@ -1365,9 +1365,11 @@ describe('setup exporter from env', () => {
|
|||
sdk.start();
|
||||
const listOfProcessors = getSdkSpanProcessors(sdk);
|
||||
|
||||
assert(listOfProcessors.length === 1);
|
||||
assert(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert(listOfProcessors[0]['_exporter'] instanceof OTLPProtoTraceExporter);
|
||||
assert.ok(listOfProcessors.length === 1);
|
||||
assert.ok(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert.ok(
|
||||
listOfProcessors[0]['_exporter'] instanceof OTLPProtoTraceExporter
|
||||
);
|
||||
await sdk.shutdown();
|
||||
});
|
||||
|
||||
|
@ -1379,9 +1381,9 @@ describe('setup exporter from env', () => {
|
|||
sdk.start();
|
||||
const listOfProcessors = getSdkSpanProcessors(sdk);
|
||||
|
||||
assert(listOfProcessors.length === 1);
|
||||
assert(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert(listOfProcessors[0]['_exporter'] instanceof ConsoleSpanExporter);
|
||||
assert.ok(listOfProcessors.length === 1);
|
||||
assert.ok(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert.ok(listOfProcessors[0]['_exporter'] instanceof ConsoleSpanExporter);
|
||||
await sdk.shutdown();
|
||||
});
|
||||
|
||||
|
@ -1394,9 +1396,9 @@ describe('setup exporter from env', () => {
|
|||
sdk.start();
|
||||
const listOfProcessors = getSdkSpanProcessors(sdk);
|
||||
|
||||
assert(listOfProcessors.length === 1);
|
||||
assert(listOfProcessors[0] instanceof SimpleSpanProcessor);
|
||||
assert(listOfProcessors[0]['_exporter'] instanceof ConsoleSpanExporter);
|
||||
assert.ok(listOfProcessors.length === 1);
|
||||
assert.ok(listOfProcessors[0] instanceof SimpleSpanProcessor);
|
||||
assert.ok(listOfProcessors[0]['_exporter'] instanceof ConsoleSpanExporter);
|
||||
await sdk.shutdown();
|
||||
});
|
||||
|
||||
|
@ -1409,9 +1411,9 @@ describe('setup exporter from env', () => {
|
|||
sdk.start();
|
||||
const listOfProcessors = getSdkSpanProcessors(sdk);
|
||||
|
||||
assert(listOfProcessors.length === 1);
|
||||
assert(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert(listOfProcessors[0]['_exporter'] instanceof OTLPTraceExporter);
|
||||
assert.ok(listOfProcessors.length === 1);
|
||||
assert.ok(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert.ok(listOfProcessors[0]['_exporter'] instanceof OTLPTraceExporter);
|
||||
delete env.OTEL_TRACES_EXPORTER;
|
||||
await sdk.shutdown();
|
||||
});
|
||||
|
@ -1428,8 +1430,8 @@ describe('setup exporter from env', () => {
|
|||
sdk['_tracerProvider']!['_config']?.sampler instanceof AlwaysOffSampler
|
||||
);
|
||||
assert.strictEqual(listOfProcessors.length, 1);
|
||||
assert(listOfProcessors[0] instanceof SimpleSpanProcessor);
|
||||
assert(listOfProcessors[0]['_exporter'] instanceof ConsoleSpanExporter);
|
||||
assert.ok(listOfProcessors[0] instanceof SimpleSpanProcessor);
|
||||
assert.ok(listOfProcessors[0]['_exporter'] instanceof ConsoleSpanExporter);
|
||||
delete env.OTEL_TRACES_EXPORTER;
|
||||
await sdk.shutdown();
|
||||
});
|
||||
|
@ -1441,9 +1443,11 @@ describe('setup exporter from env', () => {
|
|||
sdk.start();
|
||||
const listOfProcessors = getSdkSpanProcessors(sdk);
|
||||
|
||||
assert(listOfProcessors.length === 1);
|
||||
assert(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert(listOfProcessors[0]['_exporter'] instanceof OTLPGrpcTraceExporter);
|
||||
assert.ok(listOfProcessors.length === 1);
|
||||
assert.ok(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert.ok(
|
||||
listOfProcessors[0]['_exporter'] instanceof OTLPGrpcTraceExporter
|
||||
);
|
||||
delete env.OTEL_TRACES_EXPORTER;
|
||||
delete env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL;
|
||||
await sdk.shutdown();
|
||||
|
@ -1457,9 +1461,11 @@ describe('setup exporter from env', () => {
|
|||
sdk.start();
|
||||
const listOfProcessors = getSdkSpanProcessors(sdk);
|
||||
|
||||
assert(listOfProcessors.length === 1);
|
||||
assert(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert(listOfProcessors[0]['_exporter'] instanceof OTLPGrpcTraceExporter);
|
||||
assert.ok(listOfProcessors.length === 1);
|
||||
assert.ok(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert.ok(
|
||||
listOfProcessors[0]['_exporter'] instanceof OTLPGrpcTraceExporter
|
||||
);
|
||||
delete env.OTEL_TRACES_EXPORTER;
|
||||
delete env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL;
|
||||
await sdk.shutdown();
|
||||
|
@ -1477,8 +1483,8 @@ describe('setup exporter from env', () => {
|
|||
);
|
||||
|
||||
const listOfProcessors = getSdkSpanProcessors(sdk);
|
||||
|
||||
assert.strictEqual(listOfProcessors.length, 0);
|
||||
|
||||
delete env.OTEL_TRACES_EXPORTER;
|
||||
await sdk.shutdown();
|
||||
});
|
||||
|
@ -1490,9 +1496,11 @@ describe('setup exporter from env', () => {
|
|||
|
||||
const listOfProcessors = getSdkSpanProcessors(sdk);
|
||||
|
||||
assert(listOfProcessors.length === 1);
|
||||
assert(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert(listOfProcessors[0]['_exporter'] instanceof OTLPProtoTraceExporter);
|
||||
assert.ok(listOfProcessors.length === 1);
|
||||
assert.ok(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert.ok(
|
||||
listOfProcessors[0]['_exporter'] instanceof OTLPProtoTraceExporter
|
||||
);
|
||||
env.OTEL_TRACES_EXPORTER = '';
|
||||
await sdk.shutdown();
|
||||
});
|
||||
|
@ -1510,9 +1518,11 @@ describe('setup exporter from env', () => {
|
|||
|
||||
const listOfProcessors = getSdkSpanProcessors(sdk);
|
||||
|
||||
assert(listOfProcessors.length === 1);
|
||||
assert(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert(listOfProcessors[0]['_exporter'] instanceof OTLPProtoTraceExporter);
|
||||
assert.ok(listOfProcessors.length === 1);
|
||||
assert.ok(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert.ok(
|
||||
listOfProcessors[0]['_exporter'] instanceof OTLPProtoTraceExporter
|
||||
);
|
||||
|
||||
delete env.OTEL_TRACES_EXPORTER;
|
||||
await sdk.shutdown();
|
||||
|
@ -1545,9 +1555,9 @@ describe('setup exporter from env', () => {
|
|||
|
||||
const listOfProcessors = getSdkSpanProcessors(sdk);
|
||||
|
||||
assert(listOfProcessors.length === 1);
|
||||
assert(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert(listOfProcessors[0]['_exporter'] instanceof ZipkinExporter);
|
||||
assert.ok(listOfProcessors.length === 1);
|
||||
assert.ok(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert.ok(listOfProcessors[0]['_exporter'] instanceof ZipkinExporter);
|
||||
|
||||
delete env.OTEL_TRACES_EXPORTER;
|
||||
delete env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL;
|
||||
|
@ -1562,11 +1572,13 @@ describe('setup exporter from env', () => {
|
|||
|
||||
const listOfProcessors = getSdkSpanProcessors(sdk);
|
||||
|
||||
assert(listOfProcessors.length === 2);
|
||||
assert(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert(listOfProcessors[0]['_exporter'] instanceof ZipkinExporter);
|
||||
assert(listOfProcessors[1] instanceof BatchSpanProcessor);
|
||||
assert(listOfProcessors[1]['_exporter'] instanceof OTLPGrpcTraceExporter);
|
||||
assert.ok(listOfProcessors.length === 2);
|
||||
assert.ok(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert.ok(listOfProcessors[0]['_exporter'] instanceof ZipkinExporter);
|
||||
assert.ok(listOfProcessors[1] instanceof BatchSpanProcessor);
|
||||
assert.ok(
|
||||
listOfProcessors[1]['_exporter'] instanceof OTLPGrpcTraceExporter
|
||||
);
|
||||
|
||||
delete env.OTEL_TRACES_EXPORTER;
|
||||
delete env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL;
|
||||
|
@ -1581,9 +1593,9 @@ describe('setup exporter from env', () => {
|
|||
|
||||
const listOfProcessors = getSdkSpanProcessors(sdk);
|
||||
|
||||
assert(listOfProcessors.length === 1);
|
||||
assert(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert(listOfProcessors[0]['_exporter'] instanceof JaegerExporter);
|
||||
assert.ok(listOfProcessors.length === 1);
|
||||
assert.ok(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert.ok(listOfProcessors[0]['_exporter'] instanceof JaegerExporter);
|
||||
|
||||
delete env.OTEL_TRACES_EXPORTER;
|
||||
delete env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL;
|
||||
|
@ -1598,11 +1610,13 @@ describe('setup exporter from env', () => {
|
|||
|
||||
const listOfProcessors = getSdkSpanProcessors(sdk);
|
||||
|
||||
assert(listOfProcessors.length === 2);
|
||||
assert(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert(listOfProcessors[0]['_exporter'] instanceof OTLPGrpcTraceExporter);
|
||||
assert(listOfProcessors[1] instanceof BatchSpanProcessor);
|
||||
assert(listOfProcessors[1]['_exporter'] instanceof JaegerExporter);
|
||||
assert.ok(listOfProcessors.length === 2);
|
||||
assert.ok(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert.ok(
|
||||
listOfProcessors[0]['_exporter'] instanceof OTLPGrpcTraceExporter
|
||||
);
|
||||
assert.ok(listOfProcessors[1] instanceof BatchSpanProcessor);
|
||||
assert.ok(listOfProcessors[1]['_exporter'] instanceof JaegerExporter);
|
||||
|
||||
delete env.OTEL_TRACES_EXPORTER;
|
||||
delete env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL;
|
||||
|
@ -1617,13 +1631,15 @@ describe('setup exporter from env', () => {
|
|||
|
||||
const listOfProcessors = getSdkSpanProcessors(sdk);
|
||||
|
||||
assert(listOfProcessors.length === 3);
|
||||
assert(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert(listOfProcessors[0]['_exporter'] instanceof ZipkinExporter);
|
||||
assert(listOfProcessors[1] instanceof BatchSpanProcessor);
|
||||
assert(listOfProcessors[1]['_exporter'] instanceof OTLPGrpcTraceExporter);
|
||||
assert(listOfProcessors[2] instanceof BatchSpanProcessor);
|
||||
assert(listOfProcessors[2]['_exporter'] instanceof JaegerExporter);
|
||||
assert.ok(listOfProcessors.length === 3);
|
||||
assert.ok(listOfProcessors[0] instanceof BatchSpanProcessor);
|
||||
assert.ok(listOfProcessors[0]['_exporter'] instanceof ZipkinExporter);
|
||||
assert.ok(listOfProcessors[1] instanceof BatchSpanProcessor);
|
||||
assert.ok(
|
||||
listOfProcessors[1]['_exporter'] instanceof OTLPGrpcTraceExporter
|
||||
);
|
||||
assert.ok(listOfProcessors[2] instanceof BatchSpanProcessor);
|
||||
assert.ok(listOfProcessors[2]['_exporter'] instanceof JaegerExporter);
|
||||
|
||||
delete env.OTEL_TRACES_EXPORTER;
|
||||
delete env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL;
|
||||
|
@ -1637,11 +1653,13 @@ describe('setup exporter from env', () => {
|
|||
|
||||
const listOfProcessors = getSdkSpanProcessors(sdk);
|
||||
|
||||
assert(listOfProcessors.length === 2);
|
||||
assert(listOfProcessors[0] instanceof SimpleSpanProcessor);
|
||||
assert(listOfProcessors[0]['_exporter'] instanceof ConsoleSpanExporter);
|
||||
assert(listOfProcessors[1] instanceof BatchSpanProcessor);
|
||||
assert(listOfProcessors[1]['_exporter'] instanceof OTLPProtoTraceExporter);
|
||||
assert.ok(listOfProcessors.length === 2);
|
||||
assert.ok(listOfProcessors[0] instanceof SimpleSpanProcessor);
|
||||
assert.ok(listOfProcessors[0]['_exporter'] instanceof ConsoleSpanExporter);
|
||||
assert.ok(listOfProcessors[1] instanceof BatchSpanProcessor);
|
||||
assert.ok(
|
||||
listOfProcessors[1]['_exporter'] instanceof OTLPProtoTraceExporter
|
||||
);
|
||||
delete env.OTEL_TRACES_EXPORTER;
|
||||
await sdk.shutdown();
|
||||
});
|
||||
|
@ -1653,9 +1671,9 @@ describe('setup exporter from env', () => {
|
|||
|
||||
const listOfProcessors = getSdkSpanProcessors(sdk);
|
||||
|
||||
assert(listOfProcessors.length === 1);
|
||||
assert(listOfProcessors[0] instanceof SimpleSpanProcessor);
|
||||
assert(listOfProcessors[0]['_exporter'] instanceof ConsoleSpanExporter);
|
||||
assert.ok(listOfProcessors.length === 1);
|
||||
assert.ok(listOfProcessors[0] instanceof SimpleSpanProcessor);
|
||||
assert.ok(listOfProcessors[0]['_exporter'] instanceof ConsoleSpanExporter);
|
||||
delete env.OTEL_TRACES_EXPORTER;
|
||||
await sdk.shutdown();
|
||||
});
|
||||
|
@ -1668,9 +1686,9 @@ describe('setup exporter from env', () => {
|
|||
|
||||
const listOfProcessors = getSdkSpanProcessors(sdk);
|
||||
|
||||
assert(listOfProcessors.length === 1);
|
||||
assert(listOfProcessors[0] instanceof SimpleSpanProcessor);
|
||||
assert(listOfProcessors[0]['_exporter'] instanceof ConsoleSpanExporter);
|
||||
assert.ok(listOfProcessors.length === 1);
|
||||
assert.ok(listOfProcessors[0] instanceof SimpleSpanProcessor);
|
||||
assert.ok(listOfProcessors[0]['_exporter'] instanceof ConsoleSpanExporter);
|
||||
delete env.OTEL_TRACES_EXPORTER;
|
||||
delete env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL;
|
||||
await sdk.shutdown();
|
||||
|
|
|
@ -108,5 +108,5 @@ export async function assertRejects(
|
|||
}, expected);
|
||||
}
|
||||
}
|
||||
assert(rejected, 'Promise not rejected');
|
||||
assert.ok(rejected, 'Promise not rejected');
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ describe('EventLogger', () => {
|
|||
timestamp: now,
|
||||
});
|
||||
|
||||
assert(
|
||||
assert.ok(
|
||||
spy.calledWith(
|
||||
sinon.match({
|
||||
attributes: {
|
||||
|
@ -77,7 +77,7 @@ describe('EventLogger', () => {
|
|||
name: 'event name',
|
||||
});
|
||||
|
||||
assert(
|
||||
assert.ok(
|
||||
spy.calledWith(
|
||||
sinon.match({
|
||||
severityNumber: SeverityNumber.INFO,
|
||||
|
@ -86,7 +86,7 @@ describe('EventLogger', () => {
|
|||
'severityNumber should be set to INFO'
|
||||
);
|
||||
|
||||
assert(
|
||||
assert.ok(
|
||||
spy.calledWith(
|
||||
sinon.match((value: any) => {
|
||||
return value.timestamp !== undefined;
|
||||
|
|
|
@ -274,7 +274,7 @@ describe('LoggerProvider', () => {
|
|||
.forceFlush()
|
||||
.then(() => {
|
||||
sinon.restore();
|
||||
assert(forceFlushStub.calledTwice);
|
||||
assert.ok(forceFlushStub.calledTwice);
|
||||
done();
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
|
@ -40,5 +40,5 @@ export async function assertRejects(
|
|||
throw err;
|
||||
}, expected);
|
||||
}
|
||||
assert(rejected, 'Promise not rejected');
|
||||
assert.ok(rejected, 'Promise not rejected');
|
||||
}
|
||||
|
|
|
@ -33,20 +33,20 @@ describe('ShimTracer', () => {
|
|||
|
||||
it('should initially be inactive', () => {
|
||||
const shimTracer = new ShimTracer(sinon.createStubInstance(Tracer));
|
||||
assert(!shimTracer.active);
|
||||
assert.ok(!shimTracer.active);
|
||||
});
|
||||
describe('start', () => {
|
||||
it('should set the tracer as active', () => {
|
||||
const shimTracer = new ShimTracer(sinon.createStubInstance(Tracer));
|
||||
shimTracer.start({});
|
||||
assert(shimTracer.active);
|
||||
assert.ok(shimTracer.active);
|
||||
});
|
||||
});
|
||||
describe('stop', () => {
|
||||
it('should set the tracer as inactive', () => {
|
||||
const shimTracer = new ShimTracer(sinon.createStubInstance(Tracer));
|
||||
shimTracer.start({});
|
||||
assert(shimTracer.active);
|
||||
assert.ok(shimTracer.active);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ describe('shim', () => {
|
|||
installShim();
|
||||
const { CoreTracer } = require('@opencensus/core');
|
||||
assert.notStrictEqual(CoreTracer, OrigCoreTracer);
|
||||
assert(new CoreTracer() instanceof ShimTracer);
|
||||
assert.ok(new CoreTracer() instanceof ShimTracer);
|
||||
});
|
||||
|
||||
it('should use the provided Tracer', async () => {
|
||||
|
|
|
@ -49,7 +49,7 @@ for (const contextManagerClass of [
|
|||
it('should work', () => {
|
||||
assert.doesNotThrow(() => {
|
||||
contextManager = new contextManagerClass();
|
||||
assert(
|
||||
assert.ok(
|
||||
contextManager.enable() === contextManager,
|
||||
'should return this'
|
||||
);
|
||||
|
@ -60,7 +60,7 @@ for (const contextManagerClass of [
|
|||
describe('.disable()', () => {
|
||||
it('should work', () => {
|
||||
assert.doesNotThrow(() => {
|
||||
assert(
|
||||
assert.ok(
|
||||
contextManager.disable() === contextManager,
|
||||
'should return this'
|
||||
);
|
||||
|
|
|
@ -42,12 +42,15 @@ describe('ZoneContextManager', () => {
|
|||
it('should work', () => {
|
||||
const ctx = ROOT_CONTEXT.setValue(key1, 1);
|
||||
assert.doesNotThrow(() => {
|
||||
assert(
|
||||
assert.ok(
|
||||
contextManager.enable() === contextManager,
|
||||
'should return this'
|
||||
);
|
||||
contextManager.with(ctx, () => {
|
||||
assert(contextManager.active() === ctx, 'should have root context');
|
||||
assert.ok(
|
||||
contextManager.active() === ctx,
|
||||
'should have root context'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -57,12 +60,12 @@ describe('ZoneContextManager', () => {
|
|||
it('should work', () => {
|
||||
const ctx = ROOT_CONTEXT.setValue(key1, 1);
|
||||
assert.doesNotThrow(() => {
|
||||
assert(
|
||||
assert.ok(
|
||||
contextManager.disable() === contextManager,
|
||||
'should return this'
|
||||
);
|
||||
contextManager.with(ctx, () => {
|
||||
assert(
|
||||
assert.ok(
|
||||
contextManager.active() === ROOT_CONTEXT,
|
||||
'should have root context'
|
||||
);
|
||||
|
|
|
@ -40,5 +40,5 @@ export async function assertRejects(
|
|||
throw err;
|
||||
}, expected);
|
||||
}
|
||||
assert(rejected, 'Promise not rejected');
|
||||
assert.ok(rejected, 'Promise not rejected');
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ describe('callback', () => {
|
|||
assert.deepStrictEqual(stub.firstCall.args, [1]);
|
||||
assert.deepStrictEqual(stub.firstCall.thisValue, that);
|
||||
|
||||
assert(future.isCalled);
|
||||
assert.ok(future.isCalled);
|
||||
});
|
||||
|
||||
it('should handle thrown errors', async () => {
|
||||
|
|
|
@ -115,7 +115,7 @@ describe('Zipkin Exporter - web', () => {
|
|||
|
||||
setTimeout(() => {
|
||||
const request = server.requests[0];
|
||||
assert(request.url, endpointUrl);
|
||||
assert.ok(request.url, endpointUrl);
|
||||
const body = request.requestBody;
|
||||
const json = JSON.parse(body) as any;
|
||||
ensureSpanIsCorrect(json[0]);
|
||||
|
|
|
@ -251,11 +251,11 @@ describe('JaegerPropagator', () => {
|
|||
);
|
||||
|
||||
const firstEntry = extractedBaggage?.getEntry('test');
|
||||
assert(typeof firstEntry !== 'undefined');
|
||||
assert(firstEntry.value === 'value');
|
||||
assert.ok(typeof firstEntry !== 'undefined');
|
||||
assert.ok(firstEntry.value === 'value');
|
||||
const secondEntry = extractedBaggage?.getEntry('myuser');
|
||||
assert(typeof secondEntry !== 'undefined');
|
||||
assert(secondEntry.value === '%id%');
|
||||
assert.ok(typeof secondEntry !== 'undefined');
|
||||
assert.ok(secondEntry.value === '%id%');
|
||||
});
|
||||
|
||||
it('should extract baggage with custom prefix from carrier', () => {
|
||||
|
@ -270,11 +270,11 @@ describe('JaegerPropagator', () => {
|
|||
);
|
||||
|
||||
const firstEntry = extractedBaggage?.getEntry('test');
|
||||
assert(typeof firstEntry !== 'undefined');
|
||||
assert(firstEntry.value === 'value');
|
||||
assert.ok(typeof firstEntry !== 'undefined');
|
||||
assert.ok(firstEntry.value === 'value');
|
||||
const secondEntry = extractedBaggage?.getEntry('myuser');
|
||||
assert(typeof secondEntry !== 'undefined');
|
||||
assert(secondEntry.value === '%id%');
|
||||
assert.ok(typeof secondEntry !== 'undefined');
|
||||
assert.ok(secondEntry.value === '%id%');
|
||||
});
|
||||
|
||||
it('should extract baggage from carrier and not override current one', () => {
|
||||
|
@ -292,14 +292,14 @@ describe('JaegerPropagator', () => {
|
|||
);
|
||||
|
||||
const firstEntry = extractedBaggage?.getEntry('test');
|
||||
assert(typeof firstEntry !== 'undefined');
|
||||
assert(firstEntry.value === 'value');
|
||||
assert.ok(typeof firstEntry !== 'undefined');
|
||||
assert.ok(firstEntry.value === 'value');
|
||||
const secondEntry = extractedBaggage?.getEntry('myuser');
|
||||
assert(typeof secondEntry !== 'undefined');
|
||||
assert(secondEntry.value === '%id%');
|
||||
assert.ok(typeof secondEntry !== 'undefined');
|
||||
assert.ok(secondEntry.value === '%id%');
|
||||
const alreadyExistingEntry = extractedBaggage?.getEntry('one');
|
||||
assert(typeof alreadyExistingEntry !== 'undefined');
|
||||
assert(alreadyExistingEntry.value === 'two');
|
||||
assert.ok(typeof alreadyExistingEntry !== 'undefined');
|
||||
assert.ok(alreadyExistingEntry.value === 'two');
|
||||
});
|
||||
|
||||
it('should handle invalid baggage from carrier (undefined)', () => {
|
||||
|
@ -309,7 +309,7 @@ describe('JaegerPropagator', () => {
|
|||
);
|
||||
|
||||
const firstEntry = extractedBaggage?.getEntry('test');
|
||||
assert(typeof firstEntry === 'undefined');
|
||||
assert.ok(typeof firstEntry === 'undefined');
|
||||
});
|
||||
|
||||
it('should handle invalid baggage from carrier (array)', () => {
|
||||
|
@ -319,8 +319,8 @@ describe('JaegerPropagator', () => {
|
|||
);
|
||||
|
||||
const firstEntry = extractedBaggage?.getEntry('test');
|
||||
assert(typeof firstEntry !== 'undefined');
|
||||
assert(firstEntry.value === 'one');
|
||||
assert.ok(typeof firstEntry !== 'undefined');
|
||||
assert.ok(firstEntry.value === 'one');
|
||||
});
|
||||
|
||||
it('should 0-pad span and trace id from header', () => {
|
||||
|
|
|
@ -410,7 +410,7 @@ describe('BasicTracerProvider', () => {
|
|||
}
|
||||
|
||||
const provider = new CustomTracerProvider({});
|
||||
assert(
|
||||
assert.ok(
|
||||
provider['_getPropagator']('tracecontext') instanceof
|
||||
W3CTraceContextPropagator
|
||||
);
|
||||
|
@ -718,7 +718,7 @@ describe('BasicTracerProvider', () => {
|
|||
.forceFlush()
|
||||
.then(() => {
|
||||
sinon.restore();
|
||||
assert(forceFlushStub.calledTwice);
|
||||
assert.ok(forceFlushStub.calledTwice);
|
||||
done();
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
|
@ -385,7 +385,7 @@ describe('Tracer', () => {
|
|||
assert.strictEqual(
|
||||
tracer.startActiveSpan('my-span', span => {
|
||||
try {
|
||||
assert(spy.calledWith('my-span'));
|
||||
assert.ok(spy.calledWith('my-span'));
|
||||
assert.strictEqual(trace.getSpan(context.active()), span);
|
||||
return 1;
|
||||
} finally {
|
||||
|
@ -412,7 +412,9 @@ describe('Tracer', () => {
|
|||
{ attributes: { foo: 'bar' } },
|
||||
span => {
|
||||
try {
|
||||
assert(spy.calledWith('my-span', { attributes: { foo: 'bar' } }));
|
||||
assert.ok(
|
||||
spy.calledWith('my-span', { attributes: { foo: 'bar' } })
|
||||
);
|
||||
assert.strictEqual(trace.getSpan(context.active()), span);
|
||||
return 1;
|
||||
} finally {
|
||||
|
@ -445,7 +447,7 @@ describe('Tracer', () => {
|
|||
ctx,
|
||||
span => {
|
||||
try {
|
||||
assert(
|
||||
assert.ok(
|
||||
spy.calledWith('my-span', { attributes: { foo: 'bar' } }, ctx)
|
||||
);
|
||||
assert.strictEqual(trace.getSpan(context.active()), span);
|
||||
|
|
|
@ -34,11 +34,11 @@ describe('StackContextManager', () => {
|
|||
describe('.enable()', () => {
|
||||
it('should work', () => {
|
||||
assert.doesNotThrow(() => {
|
||||
assert(
|
||||
assert.ok(
|
||||
contextManager.enable() === contextManager,
|
||||
'should return this'
|
||||
);
|
||||
assert(
|
||||
assert.ok(
|
||||
contextManager.active() === ROOT_CONTEXT,
|
||||
'should have root context'
|
||||
);
|
||||
|
@ -49,11 +49,11 @@ describe('StackContextManager', () => {
|
|||
describe('.disable()', () => {
|
||||
it('should work', () => {
|
||||
assert.doesNotThrow(() => {
|
||||
assert(
|
||||
assert.ok(
|
||||
contextManager.disable() === contextManager,
|
||||
'should return this'
|
||||
);
|
||||
assert(
|
||||
assert.ok(
|
||||
contextManager.active() === ROOT_CONTEXT,
|
||||
'should have no context'
|
||||
);
|
||||
|
|
|
@ -49,7 +49,7 @@ describe('Meter', () => {
|
|||
);
|
||||
const meter = new Meter(meterSharedState);
|
||||
const counter = meter.createCounter(name);
|
||||
assert(counter instanceof CounterInstrument);
|
||||
assert.ok(counter instanceof CounterInstrument);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -61,7 +61,7 @@ describe('Meter', () => {
|
|||
);
|
||||
const meter = new Meter(meterSharedState);
|
||||
const upDownCounter = meter.createUpDownCounter(name);
|
||||
assert(upDownCounter instanceof UpDownCounterInstrument);
|
||||
assert.ok(upDownCounter instanceof UpDownCounterInstrument);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -73,7 +73,7 @@ describe('Meter', () => {
|
|||
);
|
||||
const meter = new Meter(meterSharedState);
|
||||
const histogram = meter.createHistogram(name);
|
||||
assert(histogram instanceof HistogramInstrument);
|
||||
assert.ok(histogram instanceof HistogramInstrument);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -85,7 +85,7 @@ describe('Meter', () => {
|
|||
);
|
||||
const meter = new Meter(meterSharedState);
|
||||
const observableGauge = meter.createObservableGauge(name);
|
||||
assert(observableGauge instanceof ObservableGaugeInstrument);
|
||||
assert.ok(observableGauge instanceof ObservableGaugeInstrument);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -97,7 +97,7 @@ describe('Meter', () => {
|
|||
);
|
||||
const meter = new Meter(meterSharedState);
|
||||
const Gauge = meter.createGauge(name);
|
||||
assert(Gauge instanceof GaugeInstrument);
|
||||
assert.ok(Gauge instanceof GaugeInstrument);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -109,7 +109,7 @@ describe('Meter', () => {
|
|||
);
|
||||
const meter = new Meter(meterSharedState);
|
||||
const observableCounter = meter.createObservableCounter(name);
|
||||
assert(observableCounter instanceof ObservableCounterInstrument);
|
||||
assert.ok(observableCounter instanceof ObservableCounterInstrument);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -121,7 +121,7 @@ describe('Meter', () => {
|
|||
);
|
||||
const meter = new Meter(meterSharedState);
|
||||
const observableUpDownCounter = meter.createObservableUpDownCounter(name);
|
||||
assert(
|
||||
assert.ok(
|
||||
observableUpDownCounter instanceof ObservableUpDownCounterInstrument
|
||||
);
|
||||
});
|
||||
|
|
|
@ -43,12 +43,12 @@ describe('MeterProvider', () => {
|
|||
describe('constructor', () => {
|
||||
it('should construct without exceptions', () => {
|
||||
const meterProvider = new MeterProvider();
|
||||
assert(meterProvider instanceof MeterProvider);
|
||||
assert.ok(meterProvider instanceof MeterProvider);
|
||||
});
|
||||
|
||||
it('construct with resource', () => {
|
||||
const meterProvider = new MeterProvider({ resource: defaultResource });
|
||||
assert(meterProvider instanceof MeterProvider);
|
||||
assert.ok(meterProvider instanceof MeterProvider);
|
||||
});
|
||||
|
||||
it('should use default resource when no resource is passed', async function () {
|
||||
|
@ -108,7 +108,7 @@ describe('MeterProvider', () => {
|
|||
it('should get a meter', () => {
|
||||
const meterProvider = new MeterProvider();
|
||||
const meter = meterProvider.getMeter('meter1', '1.0.0');
|
||||
assert(meter instanceof Meter);
|
||||
assert.ok(meter instanceof Meter);
|
||||
});
|
||||
|
||||
it('should get an identical meter on duplicated calls', () => {
|
||||
|
|
|
@ -52,7 +52,7 @@ describe('ObservableResultImpl', () => {
|
|||
observableResult.observe(2, {});
|
||||
|
||||
assert.strictEqual(observableResult._buffer.size, 1);
|
||||
assert(observableResult._buffer.has({}));
|
||||
assert.ok(observableResult._buffer.has({}));
|
||||
assert.strictEqual(observableResult._buffer.get({}), 2);
|
||||
});
|
||||
|
||||
|
@ -113,8 +113,8 @@ describe('BatchObservableResultImpl', () => {
|
|||
observableResult.observe(observable2, 4, {});
|
||||
|
||||
assert.strictEqual(observableResult._buffer.size, 2);
|
||||
assert(observableResult._buffer.has(observable1));
|
||||
assert(observableResult._buffer.has(observable2));
|
||||
assert.ok(observableResult._buffer.has(observable1));
|
||||
assert.ok(observableResult._buffer.has(observable2));
|
||||
|
||||
const observable1Buffer = observableResult._buffer.get(observable1);
|
||||
const observable2Buffer = observableResult._buffer.get(observable2);
|
||||
|
|
|
@ -33,7 +33,7 @@ describe('HistogramAggregator', () => {
|
|||
it('no exceptions on createAccumulation', () => {
|
||||
const aggregator = new HistogramAggregator([1, 10, 100], true);
|
||||
const accumulation = aggregator.createAccumulation([0, 0]);
|
||||
assert(accumulation instanceof HistogramAccumulation);
|
||||
assert.ok(accumulation instanceof HistogramAccumulation);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ describe('LastValueAggregator', () => {
|
|||
it('no exceptions on createAccumulation', () => {
|
||||
const aggregator = new LastValueAggregator();
|
||||
const accumulation = aggregator.createAccumulation([0, 0]);
|
||||
assert(accumulation instanceof LastValueAccumulation);
|
||||
assert.ok(accumulation instanceof LastValueAccumulation);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ describe('SumAggregator', () => {
|
|||
it('no exceptions on createAccumulation', () => {
|
||||
const aggregator = new SumAggregator(true);
|
||||
const accumulation = aggregator.createAccumulation([0, 0]);
|
||||
assert(accumulation instanceof SumAccumulation);
|
||||
assert.ok(accumulation instanceof SumAccumulation);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ describe('MetricReader', () => {
|
|||
const collectSpy = sinon.spy(producer, 'collect');
|
||||
|
||||
await reader.collect({ timeoutMillis: 20 });
|
||||
assert(collectSpy.calledOnce);
|
||||
assert.ok(collectSpy.calledOnce);
|
||||
const args = collectSpy.args[0];
|
||||
assert.deepStrictEqual(args, [{ timeoutMillis: 20 }]);
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ describe('MetricCollector', () => {
|
|||
sinon.clock.tick(200);
|
||||
const { resourceMetrics, errors } = await future;
|
||||
assert.strictEqual(errors.length, 1);
|
||||
assert(errors[0] instanceof TimeoutError);
|
||||
assert.ok(errors[0] instanceof TimeoutError);
|
||||
const { scopeMetrics } = resourceMetrics;
|
||||
const { metrics } = scopeMetrics[0];
|
||||
|
||||
|
@ -310,7 +310,7 @@ describe('MetricCollector', () => {
|
|||
sinon.clock.tick(200);
|
||||
const { resourceMetrics, errors } = await future;
|
||||
assert.strictEqual(errors.length, 1);
|
||||
assert(errors[0] instanceof TimeoutError);
|
||||
assert.ok(errors[0] instanceof TimeoutError);
|
||||
const { scopeMetrics } = resourceMetrics;
|
||||
const { metrics } = scopeMetrics[0];
|
||||
|
||||
|
|
|
@ -44,5 +44,5 @@ export async function assertRejects(
|
|||
throw err;
|
||||
}, expected);
|
||||
}
|
||||
assert(rejected, 'Promise not rejected');
|
||||
assert.ok(rejected, 'Promise not rejected');
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ export function assertScopeMetrics(
|
|||
): asserts actual is ScopeMetrics {
|
||||
const it = actual as ScopeMetrics;
|
||||
assertPartialDeepStrictEqual(it.scope, instrumentationScope);
|
||||
assert(Array.isArray(it.metrics));
|
||||
assert.ok(Array.isArray(it.metrics));
|
||||
}
|
||||
|
||||
export function assertMetricData(
|
||||
|
@ -112,12 +112,12 @@ export function assertMetricData(
|
|||
if (isNotNullish(dataPointType)) {
|
||||
assert.strictEqual(it.dataPointType, dataPointType);
|
||||
} else {
|
||||
assert(isNotNullish(DataPointType[it.dataPointType]));
|
||||
assert.ok(isNotNullish(DataPointType[it.dataPointType]));
|
||||
}
|
||||
if (aggregationTemporality != null) {
|
||||
assert.strictEqual(aggregationTemporality, it.aggregationTemporality);
|
||||
}
|
||||
assert(Array.isArray(it.dataPoints));
|
||||
assert.ok(Array.isArray(it.dataPoints));
|
||||
}
|
||||
|
||||
export function assertDataPoint(
|
||||
|
@ -137,13 +137,13 @@ export function assertDataPoint(
|
|||
'startTime should be equal'
|
||||
);
|
||||
} else {
|
||||
assert(Array.isArray(it.startTime));
|
||||
assert.ok(Array.isArray(it.startTime));
|
||||
assert.strictEqual(it.startTime.length, 2, 'startTime should be equal');
|
||||
}
|
||||
if (endTime) {
|
||||
assert.deepStrictEqual(it.endTime, endTime, 'endTime should be equal');
|
||||
} else {
|
||||
assert(Array.isArray(it.endTime));
|
||||
assert.ok(Array.isArray(it.endTime));
|
||||
assert.strictEqual(it.endTime.length, 2, 'endTime should be equal');
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ export function assertMeasurementEqual(
|
|||
): asserts actual is Measurement {
|
||||
// NOTE: Node.js v8 assert.strictEquals treat two NaN as different values.
|
||||
if (Number.isNaN(expected.value)) {
|
||||
assert(Number.isNaN((actual as Measurement).value));
|
||||
assert.ok(Number.isNaN((actual as Measurement).value));
|
||||
} else {
|
||||
assert.strictEqual((actual as Measurement).value, expected.value);
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ describe('DefaultAggregation', () => {
|
|||
|
||||
const aggregation = new DefaultAggregation();
|
||||
for (const [instrumentDescriptor, type] of expectations) {
|
||||
assert(
|
||||
assert.ok(
|
||||
aggregation.createAggregator(instrumentDescriptor) instanceof type,
|
||||
`${InstrumentType[instrumentDescriptor.type]}`
|
||||
);
|
||||
|
@ -103,7 +103,7 @@ describe('HistogramAggregator', () => {
|
|||
const aggregator = new HistogramAggregation().createAggregator(
|
||||
defaultInstrumentDescriptor
|
||||
);
|
||||
assert(aggregator instanceof HistogramAggregator);
|
||||
assert.ok(aggregator instanceof HistogramAggregator);
|
||||
assert.deepStrictEqual(
|
||||
aggregator['_boundaries'],
|
||||
[
|
||||
|
@ -124,7 +124,7 @@ describe('ExplicitBucketHistogramAggregation', () => {
|
|||
];
|
||||
for (const boundaries of cases) {
|
||||
const aggregation = new ExplicitBucketHistogramAggregation(boundaries);
|
||||
assert(aggregation instanceof ExplicitBucketHistogramAggregation);
|
||||
assert.ok(aggregation instanceof ExplicitBucketHistogramAggregation);
|
||||
assert.deepStrictEqual(aggregation['_boundaries'], [1, 10, 100]);
|
||||
}
|
||||
});
|
||||
|
@ -151,7 +151,7 @@ describe('ExplicitBucketHistogramAggregation', () => {
|
|||
it('constructor should not modify inputs', () => {
|
||||
const boundaries = [100, 10, 1];
|
||||
const aggregation = new ExplicitBucketHistogramAggregation(boundaries);
|
||||
assert(aggregation instanceof ExplicitBucketHistogramAggregation);
|
||||
assert.ok(aggregation instanceof ExplicitBucketHistogramAggregation);
|
||||
assert.deepStrictEqual(aggregation['_boundaries'], [1, 10, 100]);
|
||||
assert.deepStrictEqual(boundaries, [100, 10, 1]);
|
||||
});
|
||||
|
@ -161,7 +161,7 @@ describe('ExplicitBucketHistogramAggregation', () => {
|
|||
const aggregator1 = new ExplicitBucketHistogramAggregation([
|
||||
100, 10, 1,
|
||||
]).createAggregator(defaultInstrumentDescriptor);
|
||||
assert(aggregator1 instanceof HistogramAggregator);
|
||||
assert.ok(aggregator1 instanceof HistogramAggregator);
|
||||
assert.deepStrictEqual(aggregator1['_boundaries'], [1, 10, 100]);
|
||||
|
||||
const aggregator2 = new ExplicitBucketHistogramAggregation([
|
||||
|
@ -173,7 +173,7 @@ describe('ExplicitBucketHistogramAggregation', () => {
|
|||
Infinity,
|
||||
Infinity,
|
||||
]).createAggregator(defaultInstrumentDescriptor);
|
||||
assert(aggregator2 instanceof HistogramAggregator);
|
||||
assert.ok(aggregator2 instanceof HistogramAggregator);
|
||||
assert.deepStrictEqual(aggregator2['_boundaries'], [10, 100, 1000]);
|
||||
});
|
||||
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
"forceConsistentCasingInFileNames": true,
|
||||
"incremental": true,
|
||||
"inlineSources": true,
|
||||
"module": "commonjs",
|
||||
"module": "node16",
|
||||
"moduleResolution": "node16",
|
||||
"esModuleInterop": false,
|
||||
"newLine": "LF",
|
||||
"noEmitOnError": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
|
|
Loading…
Reference in New Issue