Skip to content

Commit

Permalink
refactor: renamed ResourceAttributes to SemanticResourceAttributes
Browse files Browse the repository at this point in the history
  • Loading branch information
syncush committed Jul 24, 2021
1 parent e27bda4 commit 90585fc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions examples/memcached/tracer.js
Expand Up @@ -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({
Expand Down
4 changes: 2 additions & 2 deletions metapackages/auto-instrumentations-node/README.md
Expand Up @@ -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));
Expand Down
Expand Up @@ -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
Expand All @@ -48,7 +48,7 @@ new WebInstrumentation(
},
new WebTracerProvider({
resource: new Resource({
[ResourceAttributes.SERVICE_NAME]: window.location.hostname,
[SemanticResourceAttributes.SERVICE_NAME]: window.location.hostname,
}),
})
).register();
Expand Up @@ -42,7 +42,7 @@ import {
} from '@opentelemetry/propagator-aws-xray';
import {
SemanticAttributes,
ResourceAttributes,
SemanticResourceAttributes,
} from '@opentelemetry/semantic-conventions';
import { BasicTracerProvider } from '@opentelemetry/tracing';

Expand Down Expand Up @@ -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
),
Expand Down
Expand Up @@ -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,
Expand Down Expand Up @@ -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
);
},
Expand All @@ -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);
Expand Down

0 comments on commit 90585fc

Please sign in to comment.