Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save keithchambers/bfded4789ae04d47cc0ddb294d6f77ae to your computer and use it in GitHub Desktop.
Save keithchambers/bfded4789ae04d47cc0ddb294d6f77ae to your computer and use it in GitHub Desktop.
OTEL with events
{
"resourceSpans": [
{
"resource": {
"attributes": [
{ "key": "service.name", "value": { "stringValue": "genai-demo-app" } },
{ "key": "deployment.environment", "value": { "stringValue": "prod" } }
]
},
"schema_url": "https://opentelemetry.io/schemas/1.5.0",
"scopeSpans": [
{
"scope": { "name": "genai.chat.client", "version": "1.2.0" },
"spans": [
{
"traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
"spanId": "00f067aa0ba902b7",
"parentSpanId": "",
"name": "gen_ai.chat.completion",
"kind": 3, // CLIENT
"startTimeUnixNano": "1745563200000000000",
"endTimeUnixNano": "1745563202500000000",
"attributes": [
{ "key": "gen_ai.operation.name", "value": { "stringValue": "chat.completion" } },
{ "key": "gen_ai.model.name", "value": { "stringValue": "gpt-4o" } },
{ "key": "gen_ai.input.token_count", "value": { "intValue": "785" } },
{ "key": "gen_ai.output.token_count", "value": { "intValue": "102" } },
{ "key": "gen_ai.temperature", "value": { "doubleValue": 0.7 } },
{ "key": "tag.use_case", "value": { "stringValue": "lost_card" } } ],
"events": [
{
"timeUnixNano": "1745563200100000000",
"name": "prompt.created",
"attributes": [
{ "key": "prompt.size_bytes", "value": { "intValue": "2048" } }
],
"droppedAttributesCount": 0
},
{
"timeUnixNano": "1745563200200000000",
"name": "llm.request.sent",
"attributes": [
{ "key": "request.id", "value": { "stringValue": "req-123" } }
],
"droppedAttributesCount": 0
},
{
"timeUnixNano": "1745563202000000000",
"name": "llm.response.received",
"attributes": [
{ "key": "response.status_code", "value": { "intValue": "200" } },
{ "key": "response.body.size_bytes", "value": { "intValue": "4096" } }
],
"droppedAttributesCount": 0
},
{
"timeUnixNano": "1745563202300000000",
"name": "token.generated",
"attributes": [
{ "key": "token.count", "value": { "intValue": "102" } }
],
"droppedAttributesCount": 0
}
],
"droppedEventsCount": 0,
"links": [],
"droppedLinksCount": 0,
"status": {
"message": "",
"code": 1 // STATUS_CODE_OK
}
}
]
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment