Sampling & diagnostics
Control event volume and debug ingest issues.
Sampling
Send only a fraction of events when volume is high.
Node.js
typescript
const client = new AmlexiaClient({
sdkKey: process.env.AMLEXIA_SDK_KEY!,
sampleRate: 0.25, // 25% of track() calls sent
});Python
python
client = AmlexiaClient(sdk_key="...", sample_rate=0.25)Go / Ruby
Set SampleRate / sample_rate on client options (see package docs).
Sampling is applied per track() call before buffering. Use 1 (default) in development; lower in high-QPS production if needed.
WARNING
Error spikes may be under-represented at very low sample rates. Keep critical paths at 1 or use a dedicated low-volume project for alerts.
Diagnostic mode
Logs buffer size, flush success/failure to stderr — no data sent to Amlexia beyond normal events.
Node.js
typescript
const client = new AmlexiaClient({
sdkKey: process.env.AMLEXIA_SDK_KEY!,
diagnostic: true,
});After flush:
typescript
const state = client.getDiagnosticState();
// { enabled, eventsBuffered, lastFlushAt, lastError }Python
python
client = AmlexiaClient(sdk_key="...", diagnostic=True)Health check
Verify SDK key and ingest reachability without sending events.
bash
npx amlexia health
amlexia health # PythonProgrammatic (Node):
typescript
import { checkIngestHealth } from '@amlexiahq/node';
const result = await checkIngestHealth('https://ingest.amlexia.com');CLI in CI
yaml
# GitHub Actions example
- run: npx amlexia health
env:
AMLEXIA_SDK_KEY: ${{ secrets.AMLEXIA_SDK_KEY }}
AMLEXIA_INGEST_URL: https://ingest.amlexia.com