Skip to content

Commit

Permalink
feat(trace): use INSTRUMENTATION_SCOPE constant
Browse files Browse the repository at this point in the history
Signed-off-by: GALLLASMILAN <gallas.milan@gmail.com>
  • Loading branch information
GALLLASMILAN committed Jan 9, 2025
1 parent 299019d commit 482bc24
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/span/utilt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { Long } from '@grpc/proto-loader';

import { MainSpan } from '../types/internal/span.js';
import type { Span__Output } from '../types/open-telemetry/generated.js';
import { constants } from '../utils/constants.js';

import { Span } from './span.document.js';

Expand Down Expand Up @@ -45,6 +46,7 @@ export function getAttributeValue({

export function filterMainSpans(spans: Span[]): MainSpan[] {
return spans.filter(
(span) => span.attributes.traceId && span.name.includes('bee-agent-framework')
(span) =>
span.attributes.traceId && span.name.includes(constants.OPENTELEMETRY.INSTRUMENTATION_SCOPE)
) as MainSpan[];
}
2 changes: 1 addition & 1 deletion src/testing/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const traceExporter = new OTLPTraceExporter({
});

const resource = new resources.Resource({
[ATTR_SERVICE_NAME]: 'bee-agent-framework',
[ATTR_SERVICE_NAME]: constants.OPENTELEMETRY.INSTRUMENTATION_SCOPE,
[ATTR_SERVICE_VERSION]: '0.0.1'
});

Expand Down
2 changes: 1 addition & 1 deletion src/testing/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export async function generateTrace({ prompt }: { prompt: string }) {
}

// mock
const tracer = api.trace.getTracer('bee-agent-framework', Version);
const tracer = api.trace.getTracer(constants.OPENTELEMETRY.INSTRUMENTATION_SCOPE, Version);
traceId = Math.random().toString(16).slice(2, 10);

// 1) main span
Expand Down

0 comments on commit 482bc24

Please sign in to comment.