Skip to content

Commit 5ba84ef

Browse files
committed
remove unused properties
1 parent 16f20b8 commit 5ba84ef

File tree

2 files changed

+1
-20
lines changed

2 files changed

+1
-20
lines changed

util/opentelemetry-util-genai/README.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Set the environment variable `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT
1313
This package provides these span attributes.
1414
-> gen_ai.provider.name: Str(openai)
1515
-> gen_ai.operation.name: Str(chat)
16-
-> gen_ai.framework: Str(langchain)
1716
-> gen_ai.system: Str(openai) # deprecated
1817
-> gen_ai.request.model: Str(gpt-3.5-turbo)
1918
-> gen_ai.response.finish_reasons: Slice(["stop"])

util/opentelemetry-util-genai/src/opentelemetry/util/genai/generators.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
from uuid import UUID
3939

4040
from opentelemetry import trace
41-
from opentelemetry.context import Context, get_current
4241
from opentelemetry.instrumentation._semconv import (
4342
_OpenTelemetrySemanticConventionStability,
4443
_OpenTelemetryStabilitySignalType,
@@ -70,10 +69,6 @@
7069
@dataclass
7170
class _SpanState:
7271
span: Span
73-
context: Context
74-
start_time: float
75-
request_model: Optional[str] = None
76-
system: Optional[str] = None
7772
children: List[UUID] = field(default_factory=list)
7873

7974

@@ -82,11 +77,8 @@ def _get_genai_attributes(
8277
response_model: Optional[str],
8378
operation_name: Optional[str],
8479
system: Optional[str],
85-
framework: Optional[str],
8680
) -> Dict[str, AttributeValue]:
8781
attributes: Dict[str, AttributeValue] = {}
88-
if framework is not None:
89-
attributes["gen_ai.framework"] = framework
9082
if system:
9183
attributes[GenAI.GEN_AI_PROVIDER_NAME] = system
9284
if operation_name:
@@ -103,15 +95,12 @@ def _set_initial_span_attributes(
10395
span: Span,
10496
request_model: Optional[str],
10597
system: Optional[str],
106-
framework: Optional[str],
10798
) -> None:
10899
span.set_attribute(
109100
GenAI.GEN_AI_OPERATION_NAME, GenAI.GenAiOperationNameValues.CHAT.value
110101
)
111102
if request_model:
112103
span.set_attribute(GenAI.GEN_AI_REQUEST_MODEL, request_model)
113-
if framework is not None:
114-
span.set_attribute("gen_ai.framework", framework)
115104
if system is not None:
116105
# TODO: clean system name to match GenAiProviderNameValues?
117106
span.set_attribute(GenAI.GEN_AI_PROVIDER_NAME, system)
@@ -258,13 +247,8 @@ def _span_for_invocation(self, invocation: LLMInvocation):
258247
parent_run_id=invocation.parent_run_id,
259248
)
260249
with use_span(span, end_on_exit=False) as span:
261-
request_model = invocation.attributes.get("request_model")
262250
span_state = _SpanState(
263251
span=span,
264-
context=get_current(),
265-
request_model=request_model,
266-
system=system,
267-
start_time=invocation.start_time,
268252
)
269253
self.spans[invocation.run_id] = span_state
270254
yield span
@@ -279,9 +263,8 @@ def _apply_common_span_attributes(
279263
"""
280264
request_model = invocation.attributes.get("request_model")
281265
system = invocation.attributes.get("system")
282-
framework = invocation.attributes.get("framework")
283266

284-
_set_initial_span_attributes(span, request_model, system, framework)
267+
_set_initial_span_attributes(span, request_model, system)
285268

286269
finish_reasons = _collect_finish_reasons(invocation.chat_generations)
287270
if finish_reasons:
@@ -305,7 +288,6 @@ def _apply_common_span_attributes(
305288
response_model,
306289
GenAI.GenAiOperationNameValues.CHAT.value,
307290
system,
308-
framework,
309291
)
310292
return (genai_attributes,)
311293

0 commit comments

Comments
 (0)