From b80091be6a7c99d2d58e8d5a660d161e2dd3cae7 Mon Sep 17 00:00:00 2001 From: Maor Leger Date: Tue, 18 Jan 2022 07:12:01 -0800 Subject: [PATCH] [Instrumentation] - Add CODEOWNERS and filter samples from pipeline (#19855) ## What - Skip samples in CI - Add CODEOWNERS entry and label - Update the artifact name to fix CI - Fix lint errors ## Why We will be adding samples in #19854, but until we are able to we should disable them in CI. --- .github/CODEOWNERS | 5 ++++- sdk/instrumentation/ci.yml | 4 ++-- .../src/instrumentation.browser.ts | 2 +- .../src/instrumentation.ts | 2 +- .../src/instrumenter.ts | 5 ++--- .../src/spanWrapper.ts | 2 +- .../test/public/instrumenter.spec.ts | 16 ++++++++-------- .../test/public/spanWrapper.spec.ts | 2 +- .../test/public/util/testSpan.ts | 14 +++++++------- .../test/public/util/testTracer.ts | 7 ++++--- .../tests.yml | 2 ++ 11 files changed, 33 insertions(+), 28 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 4eeea466074b..04419fc2d730 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -21,7 +21,7 @@ /sdk/core/core-client-rest/ @xirzec @joheredi @jeremymeng @deyaaeldeen # PRLabel: %Azure.Core -/sdk/core/core-tracing/ @xirzec @jeremymeng @maorleger +/sdk/core/core-tracing/ @xirzec @jeremymeng @maorleger @joheredi # Service teams # PRLabel: %App Configuration @@ -69,6 +69,9 @@ # PRLabel: %KeyVault /sdk/keyvault/ @maorleger @sadasant +# PRLabel: %OpenTelemetryInstrumentation +/sdk/instrumentation/ @maorleger @joheredi + # PRLabel: %Service Bus /sdk/servicebus/ @deyaaeldeen @jeremymeng @HarshaNalluru @ramya-rao-a @richardpark-msft diff --git a/sdk/instrumentation/ci.yml b/sdk/instrumentation/ci.yml index 887d18613705..a716950a69ac 100644 --- a/sdk/instrumentation/ci.yml +++ b/sdk/instrumentation/ci.yml @@ -26,5 +26,5 @@ extends: parameters: ServiceDirectory: instrumentation Artifacts: - - name: opentelemetry-instrumentation-azure-sdk - safeName: opentelemetryinstrumentationazuresdk + - name: azure-opentelemetry-instrumentation-azure-sdk + safeName: azureopentelemetryinstrumentationazuresdk diff --git a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/src/instrumentation.browser.ts b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/src/instrumentation.browser.ts index b74fedddb12d..44c823e3f97f 100644 --- a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/src/instrumentation.browser.ts +++ b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/src/instrumentation.browser.ts @@ -6,9 +6,9 @@ import { InstrumentationBase, InstrumentationConfig, } from "@opentelemetry/instrumentation"; +import { OpenTelemetryInstrumenter } from "./instrumenter"; import { SDK_VERSION } from "./constants"; import { useInstrumenter } from "@azure/core-tracing"; -import { OpenTelemetryInstrumenter } from "./instrumenter"; /** * Configuration options that can be passed to {@link createAzureSdkInstrumentation} function. diff --git a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/src/instrumentation.ts b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/src/instrumentation.ts index 086460049529..2103681fcba6 100644 --- a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/src/instrumentation.ts +++ b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/src/instrumentation.ts @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +import type * as coreTracing from "@azure/core-tracing"; import { Instrumentation, InstrumentationBase, @@ -8,7 +9,6 @@ import { InstrumentationModuleDefinition, InstrumentationNodeModuleDefinition, } from "@opentelemetry/instrumentation"; -import type * as coreTracing from "@azure/core-tracing"; import { OpenTelemetryInstrumenter } from "./instrumenter"; import { SDK_VERSION } from "./constants"; diff --git a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/src/instrumenter.ts b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/src/instrumenter.ts index 8cd86717849d..ec16053bb86c 100644 --- a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/src/instrumenter.ts +++ b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/src/instrumenter.ts @@ -7,11 +7,10 @@ import { TracingContext, TracingSpan, } from "@azure/core-tracing"; +import { context, defaultTextMapGetter, defaultTextMapSetter, trace } from "@opentelemetry/api"; -import { trace, context, defaultTextMapGetter, defaultTextMapSetter } from "@opentelemetry/api"; -import { W3CTraceContextPropagator } from "@opentelemetry/core"; import { OpenTelemetrySpanWrapper } from "./spanWrapper"; - +import { W3CTraceContextPropagator } from "@opentelemetry/core"; import { toSpanOptions } from "./transformations"; // While default propagation is user-configurable, Azure services always use the W3C implementation. diff --git a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/src/spanWrapper.ts b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/src/spanWrapper.ts index 3555f83e9356..70dbea455fb9 100644 --- a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/src/spanWrapper.ts +++ b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/src/spanWrapper.ts @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +import { Span, SpanAttributeValue, SpanStatusCode } from "@opentelemetry/api"; import { SpanStatus, TracingSpan } from "@azure/core-tracing"; -import { Span, SpanStatusCode, SpanAttributeValue } from "@opentelemetry/api"; export class OpenTelemetrySpanWrapper implements TracingSpan { private _span: Span; diff --git a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/test/public/instrumenter.spec.ts b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/test/public/instrumenter.spec.ts index 0fc493c5d5df..4c711efb1acd 100644 --- a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/test/public/instrumenter.spec.ts +++ b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/test/public/instrumenter.spec.ts @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { assert } from "chai"; import { OpenTelemetryInstrumenter, propagator } from "../../src/instrumenter"; -import { trace, context, SpanKind } from "@opentelemetry/api"; +import { SpanKind, context, trace } from "@opentelemetry/api"; import { TracingSpan, TracingSpanKind } from "@azure/core-tracing"; -import { TestSpan } from "./util/testSpan"; -import { TestTracer } from "./util/testTracer"; import { resetTracer, setTracer } from "./util/testTracerProvider"; -import sinon from "sinon"; import { Context } from "mocha"; import { OpenTelemetrySpanWrapper } from "../../src/spanWrapper"; +import { TestSpan } from "./util/testSpan"; +import { TestTracer } from "./util/testTracer"; +import { assert } from "chai"; +import sinon from "sinon"; function unwrap(span: TracingSpan): TestSpan { return (span as OpenTelemetrySpanWrapper).unwrap() as TestSpan; @@ -25,15 +25,15 @@ describe("OpenTelemetryInstrumenter", () => { }); it("uses the passed in context if it exists", () => { - let propagationSpy = sinon.spy(propagator); + const propagationSpy = sinon.spy(propagator); const span = new TestTracer().startSpan("test"); - let tracingContext = trace.setSpan(context.active(), span); + const tracingContext = trace.setSpan(context.active(), span); instrumenter.createRequestHeaders(tracingContext); assert.isTrue(propagationSpy.inject.calledWith(tracingContext)); }); it("uses the active context if no context was provided", () => { - let propagationSpy = sinon.spy(propagator); + const propagationSpy = sinon.spy(propagator); instrumenter.createRequestHeaders(); const activeContext = context.active(); assert.isTrue(propagationSpy.inject.calledWith(activeContext)); diff --git a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/test/public/spanWrapper.spec.ts b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/test/public/spanWrapper.spec.ts index f7a362433745..0f3ae47dcba7 100644 --- a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/test/public/spanWrapper.spec.ts +++ b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/test/public/spanWrapper.spec.ts @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { assert } from "chai"; import { OpenTelemetrySpanWrapper } from "../../src/spanWrapper"; import { SpanStatusCode } from "@opentelemetry/api"; import { TestSpan } from "./util/testSpan"; import { TestTracer } from "./util/testTracer"; +import { assert } from "chai"; describe("OpenTelemetrySpanWrapper", () => { let otSpan: TestSpan; diff --git a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/test/public/util/testSpan.ts b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/test/public/util/testSpan.ts index 95f131aec018..c67099593047 100644 --- a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/test/public/util/testSpan.ts +++ b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/test/public/util/testSpan.ts @@ -2,16 +2,16 @@ // Licensed under the MIT license. import { - TimeInput, - Tracer, + Link, + Span, + SpanAttributeValue, + SpanAttributes, + SpanContext, SpanKind, SpanStatus, - SpanContext, - SpanAttributes, SpanStatusCode, - SpanAttributeValue, - Span, - Link, + TimeInput, + Tracer, } from "@opentelemetry/api"; /** diff --git a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/test/public/util/testTracer.ts b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/test/public/util/testTracer.ts index ccdfbca28a00..09af6ccf7092 100644 --- a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/test/public/util/testTracer.ts +++ b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/test/public/util/testTracer.ts @@ -1,18 +1,19 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import { TestSpan } from "./testSpan"; import { + Context, SpanContext, SpanKind, SpanOptions, TraceFlags, - Context, - context, Tracer, + context, trace, } from "@opentelemetry/api"; +import { TestSpan } from "./testSpan"; + /** * Simple representation of a Span that only has name and child relationships. * Children should be arranged in the order they were created. diff --git a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/tests.yml b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/tests.yml index cbf7ddd903d8..bdde61d49358 100644 --- a/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/tests.yml +++ b/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk/tests.yml @@ -5,6 +5,8 @@ stages: parameters: PackageName: "@azure/opentelemetry-instrumentation-azure-sdk" ServiceDirectory: instrumentation + MatrixFilters: + - TestType=^(?!sample).* EnvVars: AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id)