Overview
The Qhaway OTEL exporter converts agent traces into OpenTelemetry format and exports via OTLP/HTTP JSON. Works with any OTEL-compatible backend.
Usage
import {
QhawayOtelExporter,
QhawayOtelStorage,
CompositeStorage,
ConsoleStorage,
} from '@carloscortezcloud/qhaway/otel';
import { QhawayTrace } from '@carloscortezcloud/qhaway/trace';
// Configure exporter for Honeycomb
const otel = new QhawayOtelExporter({
endpoint: 'https://api.honeycomb.io/v1/traces',
headers: {
'X-Honeycomb-Team': process.env.HONEYCOMB_API_KEY!,
},
serviceName: 'my-agent',
});
// Combine with local storage
const storage = new CompositeStorage([
new ConsoleStorage(),
new QhawayOtelStorage(otel),
]);
const trace = new QhawayTrace(storage, { agent_id: 'finops-agent' });
Supported Backends
| Backend | Endpoint | Auth |
|---|---|---|
| Honeycomb | https://api.honeycomb.io/v1/traces |
X-Honeycomb-Team header |
| Grafana Tempo | http://tempo:4318/v1/traces |
HTTP Basic or none |
| Datadog | https://api.datadoghq.com/api/v0.2/traces |
DD-API-KEY header |
| SigNoz | http://signoz-otel-collector:4318/v1/traces |
None (internal) |
Semantic Conventions
Qhaway uses custom GenAI semantic convention keys:
| Attribute | Description |
|---|---|
gen_ai.request.model |
Model ID (e.g., “gpt-4o”) |
gen_ai.request.provider |
Provider (e.g., “openai”) |
gen_ai.usage.input_tokens |
Input token count |
gen_ai.usage.output_tokens |
Output token count |
gen_ai.response.cost_usd |
Cost in USD |
qhaway.agent_id |
Agent identifier |
qhaway.user_id |
User identifier |
qhaway.session_id |
Session identifier |
With Tinkuy Agent
const agent = new Agent({
router,
tools: [myTool],
systemPrompt: '...',
onIteration: async (msg) => {
await otel.export([{
id: crypto.randomUUID(),
timestamp: new Date().toISOString(),
model: 'gpt-4o',
provider: 'openai',
latency_ms: 0,
tokens_in: 0,
tokens_out: 0,
cost_usd: 0,
success: true,
agent_id: 'my-agent',
metadata: { message: msg.slice(0, 200) },
}]);
},
});