Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.ai-coustics.com/llms.txt

Use this file to discover all available pages before exploring further.

This is an experimental feature. The API and available metrics may change in future SDK versions. Please reach out to ai-coustics support if you want to use or provide feedback on this functionality.

Overview

The ai-coustics SDK can export operational metrics via OpenTelemetry (OTel), giving you full visibility into audio processing performance, usage, and quality in your own infrastructure.
These metrics are exported to your own observability backend. They are entirely separate from the product telemetry the SDK sends to ai-coustics.

What is OpenTelemetry?

OpenTelemetry is a vendor-neutral, open-source observability framework. It provides a standardized way to collect and export telemetry data (metrics, traces, and logs) from your applications. All major observability platforms support OTel natively, including Grafana, Datadog, New Relic, Honeycomb, and many others. The ai-coustics SDK currently exposes metrics only. Traces and logs are not emitted.

Configuration

To activate the OTel metrics pipeline, set the AIC_SDK_OTEL_ENABLE environment variable to 1. The SDK uses the standard OpenTelemetry environment variables for endpoint configuration. No code changes are required in your SDK integration. Set the variables in your runtime environment and restart your service.
# Activate the OTel metrics pipeline
export AIC_SDK_OTEL_ENABLE=1

# Point to your OTLP-compatible endpoint (default: http://localhost:4318)
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318"
The SDK exports metrics using the OTLP/HTTP protocol with Protobuf encoding. It registers all instruments under:
  • Service name: aic-sdk
  • Meter name: aic_usage
OTel metrics export is currently enabled on non-WASM targets.
The api.key attribute attached to every metric observation is a SHA-256 hash of your API key, not the raw key itself. It is safe to store in your telemetry backend.

Environment Variables

VariableDescription
AIC_SDK_OTEL_ENABLESet to 1 to activate the OTel metrics pipeline. Any other value disables it.
OTEL_EXPORTER_OTLP_ENDPOINTOTLP endpoint URL. Defaults to http://localhost:4318.
OTEL_EXPORTER_OTLP_HEADERSComma-separated key=value pairs for authentication headers.
OTEL_METRIC_EXPORT_INTERVALExport interval in milliseconds. Defaults to 60000 (60s).
OTEL_METRIC_EXPORT_TIMEOUTExport timeout in milliseconds. Defaults to 30000 (30s).
For a full list of supported environment variables, see the OpenTelemetry SDK Environment Variables specification.

Session Attributes

Every metric observation includes the following attributes, allowing you to filter and group by session, API key, SDK version, or model.
AttributeDescription
api.keySHA-256 hash of the API key used for this session.
session.idUnique identifier for the processing session.
sdk.versionVersion of the ai-coustics SDK.
model.idIdentifier of the enhancement model in use.

Metrics Reference

Usage

Cumulative counters tracking how much audio has been processed.
MetricTypeUnitDescription
usage.processedCounter (u64)msCumulative duration of audio processed this session.
usage.disallowedCounter (u64)msCumulative duration of audio that was bypassed this session due to unauthorized usage (e.g. invalid license).

Audio Configuration

Gauges reflecting the audio stream configuration for the session. These values are set once during initialization.
MetricTypeUnitDescription
audio.sample_rateGauge (u64)HzSample rate of the audio stream.
audio.channelsGauge (u64)Number of audio channels.
audio.frame_sizeGauge (u64)samplesNumber of samples per processing frame (per channel).

Processor State

Gauges reflecting the current state of the audio processor.
MetricTypeUnitDescription
processor.output_delayGauge (u64)samplesAlgorithmic delay introduced by the enhancement model. Convert to ms: delay_ms=value×1000sample_rate\text{delay\_ms} = \frac{\text{value} \times 1000}{\text{sample\_rate}}. Lower is better.
processor.enhancement_levelGauge (f64)Current enhancement strength (0.0 to 1.0). Higher = more aggressive enhancement.
processor.bypassGauge (u64)Whether the processor is in bypass mode. 1 = bypass active, 0 = processing active.
processor.vad_createdGauge (u64)Whether a voice activity detection (VAD) context has been created. 1 = created, 0 = not created.

Experimental Metrics

Experimental metrics are prefixed with experimental. and may change or be removed in future SDK versions. Do not build critical alerting on these without pinning your SDK version.

Performance

MetricTypeUnitDescription
experimental.processor.realtime_violationsCounter (u64)Cumulative number of process() calls that exceeded the audio buffer duration, indicating real-time budget overruns. Lower is better; sustained values indicate CPU pressure or thread contention.
experimental.processor.process_duration_avgGauge (f64)nsAverage wall-clock time spent inside process() per call over the last export interval. Lower is better.
experimental.processor.process_duration_maxGauge (u64)nsPeak wall-clock time spent inside process() in any single call during the last export interval. Lower is better.

Voice Activity Detection

MetricTypeUnitDescription
experimental.vad.speech_duration_msCounter (u64)msCumulative duration of audio frames classified as containing speech by the voice activity detector.

Audio Quality

MetricTypeUnitDescription
experimental.audio.input_clipping_samplesCounter (u64)samplesCumulative number of input samples whose absolute value reached or exceeded 1.0 (full-scale clipping). Lower is better; sustained values indicate bad hardware or encoding upstream.
experimental.audio.output_clipping_samplesCounter (u64)samplesCumulative number of output samples whose absolute value reached or exceeded 1.0 after enhancement. Lower is better.
experimental.audio.snrGauge (f64)dBSignal-to-noise ratio of the enhanced audio over the last export interval. Computed as 10log10(signal_powernoise_power)10 \log_{10} \left( \frac{\text{signal\_power}}{\text{noise\_power}} \right). Higher is better. Not reported during bypass.

Deployment Examples

Point the SDK at a Grafana Alloy instance or an OpenTelemetry Collector that forwards to Grafana Mimir.
export AIC_SDK_OTEL_ENABLE=1
export OTEL_EXPORTER_OTLP_ENDPOINT="http://alloy.internal:4318"

Runtime Behavior

  • The OTel pipeline is process-wide: concurrent SDK sessions share one exporter pipeline.
  • Metric observations remain session-specific via attributes such as session.id, api.key, sdk.version, and model.id.
  • If your collector is unreachable, export attempts for that interval fail and are dropped by the OTel exporter. Audio processing continues.

Troubleshooting

  1. Verify that AIC_SDK_OTEL_ENABLE=1 is set in the environment where the SDK runs.
  2. Confirm OTEL_EXPORTER_OTLP_ENDPOINT points to a reachable OTLP endpoint.
  3. Check firewall rules and network connectivity between your application and the collector.
Metrics are exported according to OTEL_METRIC_EXPORT_INTERVAL (default: 60s).
The export timeout is controlled by OTEL_METRIC_EXPORT_TIMEOUT (default: 30s).