diff --git a/src/attributes.ts b/src/attributes.ts index 40160c8..bd06280 100644 --- a/src/attributes.ts +++ b/src/attributes.ts @@ -1,3 +1,11 @@ +import { + SEMATTRS_MESSAGING_CONSUMER_ID, + SEMATTRS_MESSAGING_DESTINATION, + SEMATTRS_MESSAGING_MESSAGE_ID, + SEMATTRS_MESSAGING_OPERATION, + SEMATTRS_MESSAGING_SYSTEM, +} from "@opentelemetry/semantic-conventions"; + const ns = "messaging.bullmq"; const job = `${ns}.job`; const queue = `${ns}.queue`; @@ -26,3 +34,11 @@ export const BullMQAttributes = { WORKER_RATE_LIMIT_DURATION: `${worker}.rateLimiter.duration`, WORKER_RATE_LIMIT_GROUP: `${worker}.rateLimiter.groupKey`, }; + +export const SemanticAttributes = { + MESSAGING_SYSTEM: SEMATTRS_MESSAGING_SYSTEM, + MESSAGING_DESTINATION: SEMATTRS_MESSAGING_DESTINATION, + MESSAGING_OPERATION: SEMATTRS_MESSAGING_OPERATION, + MESSAGING_MESSAGE_ID: SEMATTRS_MESSAGING_MESSAGE_ID, + MESSAGING_CONSUMER_ID: SEMATTRS_MESSAGING_CONSUMER_ID, +}; diff --git a/src/instrumentation.ts b/src/instrumentation.ts index b591168..423fe72 100644 --- a/src/instrumentation.ts +++ b/src/instrumentation.ts @@ -3,7 +3,6 @@ import { InstrumentationConfig, InstrumentationNodeModuleDefinition, } from "@opentelemetry/instrumentation"; -import { SemanticAttributes } from "@opentelemetry/semantic-conventions"; import type { Attributes, Link, Span } from "@opentelemetry/api"; import { context, @@ -27,7 +26,7 @@ import type { import { flatten } from "flat"; import { VERSION } from "./version"; -import { BullMQAttributes } from "./attributes"; +import { SemanticAttributes, BullMQAttributes } from "./attributes"; declare type Fn = (...args: any[]) => any; const BULK_CONTEXT = Symbol("BULLMQ_BULK_CONTEXT");