Skip to content

Commit 6cabe21

Browse files
authored
Merge branch 'main' into handle_unpickled_exception
2 parents be36de0 + cf28145 commit 6cabe21

File tree

180 files changed

+4998
-3481
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+4998
-3481
lines changed

.cz.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tag_format = "v$version"
44
version_scheme = "pep440"
55
major_version_zero = true
66
update_changelog_on_bump = true
7-
version = "0.47.3"
7+
version = "0.47.5"
88
version_files = [
99
"packages/opentelemetry-instrumentation-mcp/pyproject.toml:^version",
1010
"packages/opentelemetry-instrumentation-mcp/opentelemetry/instrumentation/mcp/version.py",

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## v0.47.5 (2025-10-24)
2+
3+
### Fix
4+
5+
- **google-genai**: make streaming responses work (again) (#3421)
6+
- **langchain**: changed dictionary access from spans[run_id] to spans.get(run_id) (#3403)
7+
8+
## v0.47.4 (2025-10-22)
9+
10+
### Fix
11+
12+
- **fastmcp**: Remote MCP instrumentation (#3419)
13+
114
## v0.47.3 (2025-09-21)
215

316
### Fix

packages/opentelemetry-instrumentation-alephalpha/opentelemetry/instrumentation/alephalpha/__init__.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
_SUPPRESS_INSTRUMENTATION_KEY,
2424
unwrap,
2525
)
26+
from opentelemetry.semconv._incubating.attributes import (
27+
gen_ai_attributes as GenAIAttributes,
28+
)
2629
from opentelemetry.semconv_ai import (
2730
SUPPRESS_LANGUAGE_MODEL_INSTRUMENTATION_KEY,
2831
LLMRequestTypeValues,
@@ -69,7 +72,7 @@ def _handle_message_event(
6972
event: PromptEvent, span: Span, event_logger: Optional[EventLogger], kwargs
7073
):
7174
if span.is_recording():
72-
_set_span_attribute(span, SpanAttributes.LLM_REQUEST_MODEL, kwargs.get("model"))
75+
_set_span_attribute(span, GenAIAttributes.GEN_AI_REQUEST_MODEL, kwargs.get("model"))
7376

7477
if should_emit_events():
7578
return emit_event(event, event_logger)
@@ -86,9 +89,9 @@ def _handle_completion_event(event: CompletionEvent, span, event_logger, respons
8689
span, SpanAttributes.LLM_USAGE_TOTAL_TOKENS, input_tokens + output_tokens
8790
)
8891
_set_span_attribute(
89-
span, SpanAttributes.LLM_USAGE_COMPLETION_TOKENS, output_tokens
92+
span, GenAIAttributes.GEN_AI_USAGE_OUTPUT_TOKENS, output_tokens
9093
)
91-
_set_span_attribute(span, SpanAttributes.LLM_USAGE_PROMPT_TOKENS, input_tokens)
94+
_set_span_attribute(span, GenAIAttributes.GEN_AI_USAGE_INPUT_TOKENS, input_tokens)
9295

9396
if should_emit_events():
9497
emit_event(event, event_logger)
@@ -157,7 +160,7 @@ def _wrap(
157160
name,
158161
kind=SpanKind.CLIENT,
159162
attributes={
160-
SpanAttributes.LLM_SYSTEM: "AlephAlpha",
163+
GenAIAttributes.GEN_AI_SYSTEM: "AlephAlpha",
161164
SpanAttributes.LLM_REQUEST_TYPE: llm_request_type.value,
162165
},
163166
)

packages/opentelemetry-instrumentation-alephalpha/opentelemetry/instrumentation/alephalpha/span_utils.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
CompletionEvent,
33
PromptEvent,
44
)
5-
from opentelemetry.semconv_ai import SpanAttributes
5+
from opentelemetry.semconv._incubating.attributes import (
6+
gen_ai_attributes as GenAIAttributes,
7+
)
68
from opentelemetry.trace.span import Span
79

810

@@ -16,10 +18,10 @@ def set_prompt_attributes(event: PromptEvent, span: Span):
1618
return
1719

1820
if should_send_prompts():
19-
_set_span_attribute(span, f"{SpanAttributes.LLM_PROMPTS}.0.role", "user")
21+
_set_span_attribute(span, f"{GenAIAttributes.GEN_AI_PROMPT}.0.role", "user")
2022
_set_span_attribute(
2123
span,
22-
f"{SpanAttributes.LLM_PROMPTS}.0.content",
24+
f"{GenAIAttributes.GEN_AI_PROMPT}.0.content",
2325
event.content[0].get("data"),
2426
)
2527

@@ -36,9 +38,9 @@ def set_completion_attributes(event: CompletionEvent, span: Span):
3638
if should_send_prompts():
3739
_set_span_attribute(
3840
span,
39-
f"{SpanAttributes.LLM_COMPLETIONS}.0.content",
41+
f"{GenAIAttributes.GEN_AI_COMPLETION}.0.content",
4042
event.message["content"],
4143
)
4244
_set_span_attribute(
43-
span, f"{SpanAttributes.LLM_COMPLETIONS}.0.role", "assistant"
45+
span, f"{GenAIAttributes.GEN_AI_COMPLETION}.0.role", "assistant"
4446
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.47.3"
1+
__version__ = "0.47.5"

packages/opentelemetry-instrumentation-alephalpha/poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/opentelemetry-instrumentation-alephalpha/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ show_missing = true
88

99
[tool.poetry]
1010
name = "opentelemetry-instrumentation-alephalpha"
11-
version = "0.47.3"
11+
version = "0.47.5"
1212
description = "OpenTelemetry Aleph Alpha instrumentation"
1313
authors = [
1414
"Gal Kleinman <[email protected]>",

packages/opentelemetry-instrumentation-alephalpha/tests/test_completion.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ def test_alephalpha_completion(
3535
together_span.attributes.get("gen_ai.completion.0.content")
3636
== response.completions[0].completion
3737
)
38-
assert together_span.attributes.get("gen_ai.usage.prompt_tokens") == 9
38+
assert together_span.attributes.get("gen_ai.usage.input_tokens") == 9
3939
assert together_span.attributes.get(
4040
"llm.usage.total_tokens"
4141
) == together_span.attributes.get(
42-
"gen_ai.usage.completion_tokens"
43-
) + together_span.attributes.get("gen_ai.usage.prompt_tokens")
42+
"gen_ai.usage.output_tokens"
43+
) + together_span.attributes.get("gen_ai.usage.input_tokens")
4444

4545
logs = log_exporter.get_finished_logs()
4646
assert (
@@ -66,12 +66,12 @@ def test_alephalpha_completion_with_events_with_content(
6666
assert together_span.attributes.get("gen_ai.system") == "AlephAlpha"
6767
assert together_span.attributes.get("llm.request.type") == "completion"
6868
assert together_span.attributes.get("gen_ai.request.model") == "luminous-base"
69-
assert together_span.attributes.get("gen_ai.usage.prompt_tokens") == 9
69+
assert together_span.attributes.get("gen_ai.usage.input_tokens") == 9
7070
assert together_span.attributes.get(
7171
"llm.usage.total_tokens"
7272
) == together_span.attributes.get(
73-
"gen_ai.usage.completion_tokens"
74-
) + together_span.attributes.get("gen_ai.usage.prompt_tokens")
73+
"gen_ai.usage.output_tokens"
74+
) + together_span.attributes.get("gen_ai.usage.input_tokens")
7575

7676
logs = log_exporter.get_finished_logs()
7777
assert len(logs) == 2
@@ -116,12 +116,12 @@ def test_alephalpha_completion_with_events_with_no_content(
116116
assert together_span.attributes.get("gen_ai.system") == "AlephAlpha"
117117
assert together_span.attributes.get("llm.request.type") == "completion"
118118
assert together_span.attributes.get("gen_ai.request.model") == "luminous-base"
119-
assert together_span.attributes.get("gen_ai.usage.prompt_tokens") == 9
119+
assert together_span.attributes.get("gen_ai.usage.input_tokens") == 9
120120
assert together_span.attributes.get(
121121
"llm.usage.total_tokens"
122122
) == together_span.attributes.get(
123-
"gen_ai.usage.completion_tokens"
124-
) + together_span.attributes.get("gen_ai.usage.prompt_tokens")
123+
"gen_ai.usage.output_tokens"
124+
) + together_span.attributes.get("gen_ai.usage.input_tokens")
125125

126126
logs = log_exporter.get_finished_logs()
127127
assert len(logs) == 2

packages/opentelemetry-instrumentation-anthropic/opentelemetry/instrumentation/anthropic/__init__.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
3737
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY, unwrap
3838
from opentelemetry.metrics import Counter, Histogram, Meter, get_meter
39+
from opentelemetry.semconv._incubating.attributes import (
40+
gen_ai_attributes as GenAIAttributes,
41+
)
3942
from opentelemetry.semconv_ai import (
4043
SUPPRESS_LANGUAGE_MODEL_INSTRUMENTATION_KEY,
4144
LLMRequestTypeValues,
@@ -223,7 +226,7 @@ async def _aset_token_usage(
223226
input_tokens,
224227
attributes={
225228
**metric_attributes,
226-
SpanAttributes.LLM_TOKEN_TYPE: "input",
229+
GenAIAttributes.GEN_AI_TOKEN_TYPE: "input",
227230
},
228231
)
229232

@@ -250,7 +253,7 @@ async def _aset_token_usage(
250253
completion_tokens,
251254
attributes={
252255
**metric_attributes,
253-
SpanAttributes.LLM_TOKEN_TYPE: "output",
256+
GenAIAttributes.GEN_AI_TOKEN_TYPE: "output",
254257
},
255258
)
256259

@@ -273,18 +276,18 @@ async def _aset_token_usage(
273276
},
274277
)
275278

276-
set_span_attribute(span, SpanAttributes.LLM_USAGE_PROMPT_TOKENS, input_tokens)
279+
set_span_attribute(span, GenAIAttributes.GEN_AI_USAGE_INPUT_TOKENS, input_tokens)
277280
set_span_attribute(
278-
span, SpanAttributes.LLM_USAGE_COMPLETION_TOKENS, completion_tokens
281+
span, GenAIAttributes.GEN_AI_USAGE_OUTPUT_TOKENS, completion_tokens
279282
)
280283
set_span_attribute(span, SpanAttributes.LLM_USAGE_TOTAL_TOKENS, total_tokens)
281284

282285
set_span_attribute(
283-
span, SpanAttributes.LLM_USAGE_CACHE_READ_INPUT_TOKENS, cache_read_tokens
286+
span, GenAIAttributes.GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS, cache_read_tokens
284287
)
285288
set_span_attribute(
286289
span,
287-
SpanAttributes.LLM_USAGE_CACHE_CREATION_INPUT_TOKENS,
290+
GenAIAttributes.GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS,
288291
cache_creation_tokens,
289292
)
290293

@@ -337,7 +340,7 @@ def _set_token_usage(
337340
input_tokens,
338341
attributes={
339342
**metric_attributes,
340-
SpanAttributes.LLM_TOKEN_TYPE: "input",
343+
GenAIAttributes.GEN_AI_TOKEN_TYPE: "input",
341344
},
342345
)
343346

@@ -364,7 +367,7 @@ def _set_token_usage(
364367
completion_tokens,
365368
attributes={
366369
**metric_attributes,
367-
SpanAttributes.LLM_TOKEN_TYPE: "output",
370+
GenAIAttributes.GEN_AI_TOKEN_TYPE: "output",
368371
},
369372
)
370373

@@ -387,18 +390,18 @@ def _set_token_usage(
387390
},
388391
)
389392

390-
set_span_attribute(span, SpanAttributes.LLM_USAGE_PROMPT_TOKENS, input_tokens)
393+
set_span_attribute(span, GenAIAttributes.GEN_AI_USAGE_INPUT_TOKENS, input_tokens)
391394
set_span_attribute(
392-
span, SpanAttributes.LLM_USAGE_COMPLETION_TOKENS, completion_tokens
395+
span, GenAIAttributes.GEN_AI_USAGE_OUTPUT_TOKENS, completion_tokens
393396
)
394397
set_span_attribute(span, SpanAttributes.LLM_USAGE_TOTAL_TOKENS, total_tokens)
395398

396399
set_span_attribute(
397-
span, SpanAttributes.LLM_USAGE_CACHE_READ_INPUT_TOKENS, cache_read_tokens
400+
span, GenAIAttributes.GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS, cache_read_tokens
398401
)
399402
set_span_attribute(
400403
span,
401-
SpanAttributes.LLM_USAGE_CACHE_CREATION_INPUT_TOKENS,
404+
GenAIAttributes.GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS,
402405
cache_creation_tokens,
403406
)
404407

@@ -532,7 +535,7 @@ def _wrap(
532535
name,
533536
kind=SpanKind.CLIENT,
534537
attributes={
535-
SpanAttributes.LLM_SYSTEM: "Anthropic",
538+
GenAIAttributes.GEN_AI_SYSTEM: "Anthropic",
536539
SpanAttributes.LLM_REQUEST_TYPE: LLMRequestTypeValues.COMPLETION.value,
537540
},
538541
)
@@ -656,7 +659,7 @@ async def _awrap(
656659
name,
657660
kind=SpanKind.CLIENT,
658661
attributes={
659-
SpanAttributes.LLM_SYSTEM: "Anthropic",
662+
GenAIAttributes.GEN_AI_SYSTEM: "Anthropic",
660663
SpanAttributes.LLM_REQUEST_TYPE: LLMRequestTypeValues.COMPLETION.value,
661664
},
662665
)

0 commit comments

Comments
 (0)