From 06bc629c9731a91e5b29c1dc7412ac7b827ee793 Mon Sep 17 00:00:00 2001 From: syncush Date: Sat, 17 Jul 2021 13:14:02 +0300 Subject: [PATCH] refactor: renamed ResourceAttributes to SemanticResourceAttributes --- examples/memcached/tracer.js | 4 ++-- metapackages/auto-instrumentations-node/README.md | 4 ++-- .../src/instrumentation/index.ts | 4 ++-- .../src/instrumentation.ts | 6 +++--- .../test/integrations/lambda-handler.test.ts | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/memcached/tracer.js b/examples/memcached/tracer.js index b86bceb967..0c32a4cc1e 100644 --- a/examples/memcached/tracer.js +++ b/examples/memcached/tracer.js @@ -9,14 +9,14 @@ const { registerInstrumentations } = require('@opentelemetry/instrumentation'); const { NodeTracerProvider } = require('@opentelemetry/node'); const { SimpleSpanProcessor, ConsoleSpanExporter } = require('@opentelemetry/tracing'); const { Resource } = require('@opentelemetry/resources'); -const { ResourceAttributes } = require('@opentelemetry/semantic-conventions'); +const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions'); const { MemcachedInstrumentation } = require('@opentelemetry/instrumentation-memcached'); module.exports = (serviceName) => { const provider = new NodeTracerProvider({ resource: new Resource({ - [ResourceAttributes.SERVICE_NAME]: serviceName, + [SemanticResourceAttributes.SERVICE_NAME]: serviceName, }), }); registerInstrumentations({ diff --git a/metapackages/auto-instrumentations-node/README.md b/metapackages/auto-instrumentations-node/README.md index 6acdf9b527..9ab3fe3a1e 100644 --- a/metapackages/auto-instrumentations-node/README.md +++ b/metapackages/auto-instrumentations-node/README.md @@ -23,14 +23,14 @@ const { NodeTracerProvider } = require('@opentelemetry/node'); const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node'); const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector'); const { Resource } = require('@opentelemetry/resources'); -const { ResourceAttributes } = require('@opentelemetry/semantic-conventions'); +const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions'); const { SimpleSpanProcessor } = require('@opentelemetry/tracing'); const { registerInstrumentations } = require('@opentelemetry/instrumentation'); const exporter = new CollectorTraceExporter(); const provider = new NodeTracerProvider({ resource: new Resource({ - [ResourceAttributes.SERVICE_NAME]: 'basic-service', + [SemanticResourceAttributes.SERVICE_NAME]: 'basic-service', }), }); provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); diff --git a/packages/opentelemetry-browser-extension-autoinjection/src/instrumentation/index.ts b/packages/opentelemetry-browser-extension-autoinjection/src/instrumentation/index.ts index ef0cebd8f6..c82a58d6c0 100644 --- a/packages/opentelemetry-browser-extension-autoinjection/src/instrumentation/index.ts +++ b/packages/opentelemetry-browser-extension-autoinjection/src/instrumentation/index.ts @@ -23,7 +23,7 @@ import { } from '../types'; import { WebInstrumentation } from './WebInstrumentation'; import { Resource } from '@opentelemetry/resources'; -import { ResourceAttributes } from '@opentelemetry/semantic-conventions'; +import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'; const configTag = document.getElementById(DomElements['CONFIG_TAG']); const { exporters }: Settings = configTag @@ -48,7 +48,7 @@ new WebInstrumentation( }, new WebTracerProvider({ resource: new Resource({ - [ResourceAttributes.SERVICE_NAME]: window.location.hostname, + [SemanticResourceAttributes.SERVICE_NAME]: window.location.hostname, }), }) ).register(); diff --git a/plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts b/plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts index 1bed063047..c4e41490d1 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts @@ -42,7 +42,7 @@ import { } from '@opentelemetry/propagator-aws-xray'; import { SemanticAttributes, - ResourceAttributes, + SemanticResourceAttributes, } from '@opentelemetry/semantic-conventions'; import { BasicTracerProvider } from '@opentelemetry/tracing'; @@ -168,8 +168,8 @@ export class AwsLambdaInstrumentation extends InstrumentationBase { kind: SpanKind.SERVER, attributes: { [SemanticAttributes.FAAS_EXECUTION]: context.awsRequestId, - [ResourceAttributes.FAAS_ID]: context.invokedFunctionArn, - [ResourceAttributes.CLOUD_ACCOUNT_ID]: + [SemanticResourceAttributes.FAAS_ID]: context.invokedFunctionArn, + [SemanticResourceAttributes.CLOUD_ACCOUNT_ID]: AwsLambdaInstrumentation._extractAccountId( context.invokedFunctionArn ), diff --git a/plugins/node/opentelemetry-instrumentation-aws-lambda/test/integrations/lambda-handler.test.ts b/plugins/node/opentelemetry-instrumentation-aws-lambda/test/integrations/lambda-handler.test.ts index a92e53b3c3..a41be9b50f 100644 --- a/plugins/node/opentelemetry-instrumentation-aws-lambda/test/integrations/lambda-handler.test.ts +++ b/plugins/node/opentelemetry-instrumentation-aws-lambda/test/integrations/lambda-handler.test.ts @@ -34,7 +34,7 @@ import { Context } from 'aws-lambda'; import * as assert from 'assert'; import { SemanticAttributes, - ResourceAttributes, + SemanticResourceAttributes, } from '@opentelemetry/semantic-conventions'; import { Context as OtelContext, @@ -632,7 +632,7 @@ describe('lambda handler', () => { initializeHandler('lambda-test/async.handler', { requestHook: (span, { context }) => { span.setAttribute( - ResourceAttributes.FAAS_NAME, + SemanticResourceAttributes.FAAS_NAME, context.functionName ); }, @@ -643,7 +643,7 @@ describe('lambda handler', () => { const [span] = spans; assert.strictEqual(spans.length, 1); assert.strictEqual( - span.attributes[ResourceAttributes.FAAS_NAME], + span.attributes[SemanticResourceAttributes.FAAS_NAME], ctx.functionName ); assertSpanSuccess(span);