@syntropika/telemetry
v0.1.0
Published
TypeScript/Node.js client for sending product events and OTLP payloads to the Syntropika telemetry service.
Readme
@syntropika/telemetry client
TypeScript/Node.js client for sending product events and OTLP payloads to the Syntropika telemetry service.
Install
pnpm add @syntropika/telemetryCreate a client
import { createTelemetryClient } from '@syntropika/telemetry'
const telemetry = createTelemetryClient({
endpoint: 'https://telemetry.syntropika.com',
apiKey: 'stk_live_xxxxx',
source: 'workers', // optional: 'api' | 'workers' | 'web'
flushInterval: 10000, // optional, defaults to 10000 ms
maxBatchSize: 50, // optional, defaults to 50
})Identify users and track events
telemetry.identify('user_123')
telemetry.track('action.approved', {
action_type: 'like',
queue_id: 'q_abc',
latency_ms: 142,
})
telemetry.track('brief.viewed', {
brief_id: 'b_xyz',
})Flush and shutdown
await telemetry.flush()
await telemetry.shutdown()OTLP helper
import { createOtlpProxy } from '@syntropika/telemetry'
const otlp = createOtlpProxy({
endpoint: 'https://telemetry.syntropika.com',
apiKey: 'stk_live_xxxxx',
})
otlp.tracesUrl
otlp.metricsUrl
otlp.logsUrl
otlp.headers
await otlp.sendTraces(payload)Required API key scopes
events:writefor events.traces:write,metrics:write,logs:writefor OTLP ingestion.
