Skip to content

Commit

Permalink
refactor(instr-graphql): use exported strings for attributes (#2156)
Browse files Browse the repository at this point in the history
Refs: #2025
  • Loading branch information
david-luna committed May 14, 2024
1 parent fd51c1c commit b98e431
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions plugins/node/opentelemetry-instrumentation-graphql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ Downstream spans in the context of all resolvers will be child of the first span

Can be found [here](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/examples/graphql)

## Semantic Conventions

This package does not currently generate any attributes from semantic conventions.

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"devDependencies": {
"@opentelemetry/api": "^1.3.0",
"@opentelemetry/sdk-trace-base": "^1.8.0",
"@opentelemetry/semantic-conventions": "^1.3.1",
"@opentelemetry/semantic-conventions": "^1.22.0",
"@types/mocha": "8.2.3",
"@types/node": "18.6.5",
"graphql": "^16.5.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
SimpleSpanProcessor,
} from '@opentelemetry/sdk-trace-base';
import { Span, SpanStatusCode } from '@opentelemetry/api';
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
import { SEMATTRS_EXCEPTION_MESSAGE } from '@opentelemetry/semantic-conventions';
import * as assert from 'assert';
import type * as graphqlTypes from 'graphql';
import { GraphQLInstrumentation } from '../src';
Expand Down Expand Up @@ -1399,7 +1399,7 @@ describe('graphql', () => {
const resolveEvent = resolveSpan.events[0];
assert.deepStrictEqual(resolveEvent.name, 'exception');
assert.deepStrictEqual(
resolveEvent.attributes?.[SemanticAttributes.EXCEPTION_MESSAGE],
resolveEvent.attributes?.[SEMATTRS_EXCEPTION_MESSAGE],
'sync resolver error from tests'
);

Expand Down

0 comments on commit b98e431

Please sign in to comment.