Skip to content

Commit e26f4f3

Browse files
committed
chore: fixed tests
1 parent d4a66f3 commit e26f4f3

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

  • packages/collector/test/tracing/opentelemetry

packages/collector/test/tracing/opentelemetry/test.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,10 @@ mochaSuiteFn('opentelemetry tests', function () {
915915
dataProperty: 'tags',
916916
extraTests: span => {
917917
expect(span.data.tags.name).to.eql('fs readFileSync');
918-
checkTelemetryResourceAttrs(span);
918+
919+
// This test uses a global OpenTelemetry SDK instance, which still uses sdk version v1.
920+
// Its nice to keep it like that to proof that v1 and v2 work fine with our integration.
921+
checkTelemetryResourceAttrs(span, /1\.\d+\.\d/);
919922
}
920923
});
921924

@@ -928,7 +931,7 @@ mochaSuiteFn('opentelemetry tests', function () {
928931
dataProperty: 'tags',
929932
extraTests: span => {
930933
expect(span.data.tags.name).to.eql('fs statSync');
931-
checkTelemetryResourceAttrs(span);
934+
checkTelemetryResourceAttrs(span, /1\.\d+\.\d/);
932935
}
933936
});
934937
})
@@ -995,8 +998,8 @@ mochaSuiteFn('opentelemetry tests', function () {
995998
expect(response.otelspan.name).to.eql('explicit-otel-operation');
996999
expect(response.otelspan._spanContext).to.have.property('traceId');
9971000
expect(response.otelspan._spanContext).to.have.property('spanId');
998-
expect(response.otelspan.instrumentationLibrary).to.be.an('object');
999-
expect(response.otelspan.instrumentationLibrary.name).to.eql('otel-sdk-app-tracer');
1001+
expect(response.otelspan.instrumentationScope).to.be.an('object');
1002+
expect(response.otelspan.instrumentationScope.name).to.eql('otel-sdk-app-tracer');
10001003
})
10011004
.then(() => delay(DELAY_TIMEOUT_IN_MS))
10021005
.then(() =>
@@ -1021,11 +1024,11 @@ mochaSuiteFn('opentelemetry tests', function () {
10211024
});
10221025
});
10231026

1024-
function checkTelemetryResourceAttrs(span) {
1027+
function checkTelemetryResourceAttrs(span, otelSdkVersion = /2\.\d+\.\d/) {
10251028
expect(span.data.resource['service.name']).to.not.exist;
10261029
expect(span.data.resource['telemetry.sdk.language']).to.eql('nodejs');
10271030
expect(span.data.resource['telemetry.sdk.name']).to.eql('opentelemetry');
1028-
expect(span.data.resource['telemetry.sdk.version']).to.match(/2\.\d+\.\d/);
1031+
expect(span.data.resource['telemetry.sdk.version']).to.match(otelSdkVersion);
10291032
}
10301033

10311034
function verifyHttpExit(spans, parentSpan) {

0 commit comments

Comments
 (0)