Skip to content

Commit 9a6e162

Browse files
author
Andrei Bratu
committed
Bump up OTEL deps
1 parent a57a50d commit 9a6e162

File tree

8 files changed

+24
-355
lines changed

8 files changed

+24
-355
lines changed

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919
"qs": "^6.13.1",
2020
"readable-stream": "^4.5.2",
2121
"form-data-encoder": "^4.0.2",
22-
"@opentelemetry/api": ">=1.9.0",
23-
"@opentelemetry/sdk-node": "^0.55.0",
24-
"@opentelemetry/sdk-trace-node": ">=1.28.0",
22+
"@opentelemetry/api": "^1.9.0",
23+
"@opentelemetry/sdk-trace-node": "^2.0.0",
2524
"@traceloop/instrumentation-anthropic": ">=0.11.1",
2625
"@traceloop/instrumentation-cohere": ">=0.11.1",
2726
"@traceloop/instrumentation-openai": ">=0.11.3",

src/decorators/flow.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as contextApi from "@opentelemetry/api";
2-
import { ReadableSpan, Tracer } from "@opentelemetry/sdk-trace-node";
2+
import { Tracer } from "@opentelemetry/api";
3+
import { ReadableSpan } from "@opentelemetry/sdk-trace-node";
34

45
import { HumanloopClient } from "../Client";
56
import { ChatMessage, FlowLogRequest, FlowLogResponse } from "../api";

src/decorators/tool.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { ReadableSpan, Tracer } from "@opentelemetry/sdk-trace-node";
1+
import { Tracer } from "@opentelemetry/api";
2+
import { ReadableSpan } from "@opentelemetry/sdk-trace-node";
23

34
import { ToolKernelRequest } from "../api/types/ToolKernelRequest";
45
import { getEvaluationContext, getTraceId } from "../context";

src/humanloop.client.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import { Tracer } from "@opentelemetry/api";
12
import {
23
Instrumentation,
34
registerInstrumentations,
45
} from "@opentelemetry/instrumentation";
5-
import { Resource } from "@opentelemetry/resources";
6-
import { NodeTracerProvider, Tracer } from "@opentelemetry/sdk-trace-node";
6+
import { resourceFromAttributes } from "@opentelemetry/resources";
7+
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
78
import { AnthropicInstrumentation } from "@traceloop/instrumentation-anthropic";
89
import { CohereInstrumentation } from "@traceloop/instrumentation-cohere";
910
import { OpenAIInstrumentation } from "@traceloop/instrumentation-openai";
@@ -147,12 +148,9 @@ class HumanloopTracerSingleton {
147148
};
148149
}) {
149150
this.tracerProvider = new NodeTracerProvider({
150-
resource: new Resource({
151-
attributes: {
152-
// @ts-ignore
153-
"service.name": "humanloop-typescript-sdk",
154-
"service.version": SDK_VERSION,
155-
},
151+
resource: resourceFromAttributes({
152+
"service.name": "humanloop-typescript-sdk",
153+
"service.version": SDK_VERSION,
156154
}),
157155
spanProcessors: [
158156
new HumanloopSpanProcessor(
@@ -239,7 +237,8 @@ export class HumanloopClient extends BaseHumanloopClient {
239237
return HumanloopTracerSingleton.getInstance({
240238
hlClientApiKey: this.options().apiKey!.toString(),
241239
hlClientBaseUrl:
242-
this.options().baseUrl!.toString() || HumanloopEnvironment.Default,
240+
this.options().baseUrl?.toString() ||
241+
HumanloopEnvironment.Default.toString(),
243242
instrumentProviders: this.instrumentProviders,
244243
}).tracer;
245244
}
@@ -294,7 +293,8 @@ export class HumanloopClient extends BaseHumanloopClient {
294293
HumanloopTracerSingleton.getInstance({
295294
hlClientApiKey: this.options().apiKey!.toString(),
296295
hlClientBaseUrl:
297-
this.options().baseUrl!.toString() || HumanloopEnvironment.Default,
296+
this.options().baseUrl?.toString() ||
297+
HumanloopEnvironment.Default.toString(),
298298
instrumentProviders: this.instrumentProviders,
299299
});
300300
}

src/otel/exporter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class HumanloopSpanExporter implements SpanExporter {
5656
attributes: span.attributes,
5757
name: span.name,
5858
kind: span.kind,
59-
instrumentationLibrary: span.instrumentationLibrary,
59+
instrumentationScope: span.instrumentationScope,
6060
},
6161
null,
6262
2,

src/otel/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ export function readFromOpenTelemetrySpan(
166166
* @returns True if the span corresponds to an LLM provider call, false otherwise
167167
*/
168168
export function isLLMProviderCall(span: ReadableSpan): boolean {
169-
if (!span.instrumentationLibrary) return false;
169+
if (!span.instrumentationScope) return false;
170170

171-
const spanInstrumentor = span.instrumentationLibrary.name;
171+
const spanInstrumentor = span.instrumentationScope.name;
172172
const instrumentorPrefixes = [
173173
"@traceloop/instrumentation-openai",
174174
"@traceloop/instrumentation-anthropic",

src/otel/processor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export class HumanloopSpanProcessor implements SpanProcessor {
6868
attributes: span.attributes,
6969
name: span.name,
7070
kind: span.kind,
71-
instrumentationLibrary: span.instrumentationLibrary,
71+
instrumentationScope: span.instrumentationScope,
7272
},
7373
null,
7474
2,

0 commit comments

Comments
 (0)