Skip to content

Commit f964b7e

Browse files
committed
chore: handle lingma-agents suggestions
1 parent c5624e5 commit f964b7e

File tree

2 files changed

+5
-4
lines changed
  • instrumentation-genai/opentelemetry-instrumentation-langchain

2 files changed

+5
-4
lines changed

instrumentation-genai/opentelemetry-instrumentation-langchain/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ If everything is working correctly, you should see logs similar to th
9696

9797
## Forwarding OTLP Data to the Backend
9898
```shell
99-
export OTEL_SERVICE_NAME= <service_name>
99+
export OTEL_SERVICE_NAME=<service_name>
100100
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
101-
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT= <trace_endpoint>
102-
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT= <metrics_endpoint>
101+
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=<trace_endpoint>
102+
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=<metrics_endpoint>
103103

104104
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true
105105

instrumentation-genai/opentelemetry-instrumentation-langchain/src/opentelemetry/instrumentation/langchain/internal/_tracer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,8 @@ def _parse_message_data(message_data: Optional[Mapping[str, Any]]) -> Iterator[T
472472
elif message_class_name.startswith("ToolMessage"):
473473
role = "tool"
474474
elif message_class_name.startswith("ChatMessage"):
475-
role = message_data["kwargs"]["role"]
475+
kwargs = message_data.get("kwargs", {})
476+
role = kwargs.get("role", "unknown")
476477
else:
477478
raise ValueError(f"Cannot parse message of type: {message_class_name}")
478479
yield MESSAGE_ROLE, role

0 commit comments

Comments
 (0)