Summary
Implement an OtlpJsonExporter that sends UserALE logs to any OpenTelemetry Collector via OTLP/HTTP JSON.
Motivation
OpenTelemetry is the de-facto standard for observability. OTLP support lets Flagon users send behavioral data to Grafana, Datadog, Jaeger, and any OTel-compatible backend — without building custom ingestion pipelines.
No competing behavioral analytics library (PostHog, Matomo, Plausible) speaks OTLP. This is a differentiation opportunity.
Design
- Maps Flagon log fields → OTLP
LogRecord attributes using OTel semantic conventions
- Builds OTLP/JSON payloads using plain objects (zero external dependencies)
- Ships to standard OTLP HTTP receiver (port 4318,
/v1/logs)
- ~150 lines of code, ~2-3 KB gzipped added to bundle
Attribute Mapping
| Flagon Field |
OTLP Mapping |
clientTime |
timeUnixNano |
toolName |
resource.service.name |
useraleVersion |
resource.telemetry.sdk.version |
userId |
attributes.enduser.id |
sessionId |
attributes.session.id |
pageUrl |
attributes.url.full |
target |
attributes.flagon.dom.target |
type |
attributes.flagon.event_type |
logType |
attributes.flagon.log_type |
details |
body (JSON string) |
User Experience
// One config change to enable OTLP
userale.start({
exporterType: 'otlp',
otlpEndpoint: 'http://localhost:4318',
});
Depends On
Summary
Implement an
OtlpJsonExporterthat sends UserALE logs to any OpenTelemetry Collector via OTLP/HTTP JSON.Motivation
OpenTelemetry is the de-facto standard for observability. OTLP support lets Flagon users send behavioral data to Grafana, Datadog, Jaeger, and any OTel-compatible backend — without building custom ingestion pipelines.
No competing behavioral analytics library (PostHog, Matomo, Plausible) speaks OTLP. This is a differentiation opportunity.
Design
LogRecordattributes using OTel semantic conventions/v1/logs)Attribute Mapping
clientTimetimeUnixNanotoolNameresource.service.nameuseraleVersionresource.telemetry.sdk.versionuserIdattributes.enduser.idsessionIdattributes.session.idpageUrlattributes.url.fulltargetattributes.flagon.dom.targettypeattributes.flagon.event_typelogTypeattributes.flagon.log_typedetailsbody(JSON string)User Experience
Depends On