Skip to content

Commit e176ad2

Browse files
committed
Fix the instructions for exporting metrics to axiom
1 parent e1f1c18 commit e176ad2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

docs/config/config-file.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,17 +160,21 @@ You can also configure custom telemetry exporters to send your traces, logs, and
160160
"dependencies": {
161161
"@opentelemetry/exporter-logs-otlp-http": "0.52.1",
162162
"@opentelemetry/exporter-trace-otlp-http": "0.52.1",
163-
"@opentelemetry/exporter-metrics-otlp-http": "0.52.1"
163+
"@opentelemetry/exporter-metrics-otlp-proto": "0.52.1"
164164
}
165165
```
166166

167+
<Note>
168+
Axiom's `/v1/metrics` endpoint only supports protobuf (`application/x-protobuf`), not JSON. Use `@opentelemetry/exporter-metrics-otlp-proto` instead of `@opentelemetry/exporter-metrics-otlp-http` for metrics. Traces and logs work fine with the `-http` (JSON) exporters.
169+
</Note>
170+
167171
Then, configure the exporters in your `trigger.config.ts` file:
168172

169173
```ts trigger.config.ts
170174
import { defineConfig } from "@trigger.dev/sdk";
171175
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
172176
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
173-
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
177+
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-proto";
174178

175179
// Initialize OTLP trace exporter with the endpoint URL and headers;
176180
export default defineConfig({
@@ -203,15 +207,15 @@ export default defineConfig({
203207
url: "https://api.axiom.co/v1/metrics",
204208
headers: {
205209
Authorization: `Bearer ${process.env.AXIOM_API_TOKEN}`,
206-
"X-Axiom-Dataset": process.env.AXIOM_DATASET,
210+
"x-axiom-metrics-dataset": process.env.AXIOM_METRICS_DATASET,
207211
},
208212
}),
209213
],
210214
},
211215
});
212216
```
213217

214-
Make sure to set the `AXIOM_API_TOKEN` and `AXIOM_DATASET` environment variables in your project.
218+
Make sure to set the `AXIOM_API_TOKEN`, `AXIOM_DATASET`, and `AXIOM_METRICS_DATASET` environment variables in your project. Axiom requires a separate, dedicated dataset for metrics — you cannot reuse the same dataset for traces/logs and metrics.
215219

216220
It's important to note that you cannot configure exporters using `OTEL_*` environment variables, as they would conflict with our internal telemetry. Instead you should configure the exporters via passing in arguments to the `OTLPTraceExporter`, `OTLPLogExporter`, and `OTLPMetricExporter` constructors. For example, here is how you can configure exporting to Honeycomb:
217221

0 commit comments

Comments
 (0)