From 4fb9c5aba9cbddb939cd348df956a11059bdaf38 Mon Sep 17 00:00:00 2001 From: Marc Pichler Date: Tue, 11 Feb 2025 14:53:04 +0100 Subject: [PATCH] refactor(web-common): add incubating semconv to package (#5446) --- .../src/SessionLogRecordProcessor.ts | 2 +- .../web-common/src/SessionSpanProcessor.ts | 2 +- .../packages/web-common/src/semconv.ts | 22 +++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 experimental/packages/web-common/src/semconv.ts diff --git a/experimental/packages/web-common/src/SessionLogRecordProcessor.ts b/experimental/packages/web-common/src/SessionLogRecordProcessor.ts index 6f152bd043a..908eea2fecb 100644 --- a/experimental/packages/web-common/src/SessionLogRecordProcessor.ts +++ b/experimental/packages/web-common/src/SessionLogRecordProcessor.ts @@ -16,7 +16,7 @@ import { Context } from '@opentelemetry/api'; import { LogRecord, LogRecordProcessor } from '@opentelemetry/sdk-logs'; -import { ATTR_SESSION_ID } from '@opentelemetry/semantic-conventions/incubating'; +import { ATTR_SESSION_ID } from './semconv'; import { SessionProvider } from './types/SessionProvider'; /** diff --git a/experimental/packages/web-common/src/SessionSpanProcessor.ts b/experimental/packages/web-common/src/SessionSpanProcessor.ts index ee3f7370fb6..a59197e9a05 100644 --- a/experimental/packages/web-common/src/SessionSpanProcessor.ts +++ b/experimental/packages/web-common/src/SessionSpanProcessor.ts @@ -20,7 +20,7 @@ import { Span, ReadableSpan, } from '@opentelemetry/sdk-trace-base'; -import { ATTR_SESSION_ID } from '@opentelemetry/semantic-conventions/incubating'; +import { ATTR_SESSION_ID } from './semconv'; import { SessionProvider } from './types/SessionProvider'; /** diff --git a/experimental/packages/web-common/src/semconv.ts b/experimental/packages/web-common/src/semconv.ts new file mode 100644 index 00000000000..5ef92574369 --- /dev/null +++ b/experimental/packages/web-common/src/semconv.ts @@ -0,0 +1,22 @@ +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A unique id to identify a session. + * + * @example "00112233-4455-6677-8899-aabbccddeeff" + */ +export const ATTR_SESSION_ID = 'session.id' as const;