Files
crewAI/lib/crewai/tests/telemetry
Joao Moura fbf05039b0 fix: emit coding_agent as a span attribute, not a Resource attribute
The previous commit set coding_agent on the OTel Resource. Verified
against the telemetry ClickHouse instance that this would have silently
produced nothing: across 2,000,000 sampled spans the `process` column
contains exactly one key, `serviceName`, and no row has more than one.
The ingestion pipeline discards every other resource attribute.

Replace it with CommonAttributesSpanProcessor, whose on_start hook
applies the attribute to every span the provider emits. Span attributes
are preserved through ingestion and land in the `tags` array alongside
crew_key and crewai_version, which is where existing extraction reads
from.

- Add CommonAttributesSpanProcessor, a SpanProcessor that applies a fixed
  attribute set at span start. Attribute application is wrapped so a
  failure can never propagate into user execution.
- Remove the now-redundant explicit coding_agent attributes from the Crew
  Created and Flow Creation spans; the processor covers all spans.
- Replace the resource-attribute test with an end-to-end one that exports
  four differently-named spans through a real TracerProvider and asserts
  coding_agent survives on each, and that it is NOT on the resource.
- Add a test asserting the processor swallows attribute-application
  errors.

Verified at runtime that the real Telemetry provider installs the
processor and that an emitted span carries {'coding_agent':
'claude_code', 'crew_key': 'abc'} with resource {'service.name':
'crewAI-telemetry'}.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UNumDnNbiyw3pv1WakAe6t
2026-08-02 09:24:58 -07:00
..
2025-10-20 14:10:19 -07:00