@kopai/collector
v0.3.0
Published
OTLP collector as a Fastify plugin. Receives OpenTelemetry traces, metrics, and logs.
Readme
@kopai/collector
OTLP collector as a Fastify plugin. Receives OpenTelemetry traces, metrics, and logs.
Supported Protocols
| OTEL_EXPORTER_OTLP_PROTOCOL | Description |
| ----------------------------- | -------------------- |
| http/protobuf | OTLP/HTTP + protobuf |
| http/json | OTLP/HTTP + JSON |
See OTLP Exporter Configuration for details.
Usage
import Fastify from "fastify";
import { collectorPlugin } from "@kopai/collector";
const app = Fastify();
await app.register(collectorPlugin, {
onTraces: async (data) => {
// handle traces
},
onMetrics: async (data) => {
// handle metrics
},
onLogs: async (data) => {
// handle logs
},
});
await app.listen({ port: 4318 });Endpoints:
POST /v1/tracesPOST /v1/metricsPOST /v1/logs
