๐Ÿš€ Everything is free โ€” help us improve! Submit feedback and shape the platform.
๐ŸงชTDD Challengeยทadvancedยทโฑ๏ธ 30โ€“40mยทโญ 200 XP

M-076Build an OpenTelemetry LLM Exporter

Description

Nebula Corp wants vendor-neutral observability. Build a lightweight OpenTelemetry-compatible span exporter for LLM calls. The exporter should capture LLM-specific semantic conventions (gen_ai.* attributes), batch spans for efficient export, and format them as OTLP-compatible JSON. This lets them send traces to any backend โ€” Langfuse, Jaeger, Grafana Tempo โ€” without changing application code.

Test Cases (3)

Creates valid span
Should create span with trace ID
Input:createLLMSpan('test', {'gen_ai.system': 'openai'})
Expected:CONTAINS:traceId
Ends span with OK
Should end span with OK status
Input:endSpan(createLLMSpan('test'), {})
Expected:CONTAINS:OK
Ends span with error
Should set ERROR status when error present
Input:endSpan(createLLMSpan('err'), {error: 'timeout'})
Expected:CONTAINS:ERROR

Related Lessons

Click Run / Check to validate your solution