Skip to content

Enable metrics

The Developer SDK documentation below describes a metrics story for operators. For the Java developer preview client (com.aerospike:aerospike-client-sdk in aerospike-client-java-fluent), there is no MetricsConfig / built-in Micrometer bridge on ClusterDefinition as in older drafts—instrument your application with Micrometer or OpenTelemetry and use client logs under com.aerospike.client.sdk (see Configure logging).

Available metrics

Standard metrics

MetricTypeDescription
aerospike.operations.totalCounterTotal operations executed
aerospike.operations.errorsCounterFailed operations
aerospike.latency.readHistogramRead operation latency
aerospike.latency.writeHistogramWrite operation latency
aerospike.connections.activeGaugeCurrent open connections
aerospike.connections.poolGaugeConnections in pool

Extended metrics

MetricTypeDescription
aerospike.batch.sizeHistogramBatch operation sizes
aerospike.retriesCounterOperation retry count
aerospike.timeoutsCounterTimeout events
aerospike.cluster.nodesGaugeNodes in cluster

Enable metrics programmatically

import com.aerospike.client.sdk.Cluster;
import com.aerospike.client.sdk.ClusterDefinition;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Timer;
import io.micrometer.prometheus.PrometheusConfig;
import io.micrometer.prometheus.PrometheusMeterRegistry;
// Application-owned registry (not provided by the Aerospike JAR)
MeterRegistry registry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
try (Cluster cluster = new ClusterDefinition("localhost", 3000).connect()) {
Timer.Sample sample = Timer.start(registry);
try {
// session.query(...).execute(); etc.
} finally {
sample.stop(registry.timer("aerospike.sdk.requests"));
}
}

Access metrics snapshots

Get current metric values programmatically:

// The preview Java client does not expose cluster.getMetrics() / MetricsSnapshot.
// Export Micrometer/Prometheus from your app or scrape logs for connection events.

Metrics log files

Enable periodic metrics logging to files:

// No built-in periodic metrics log in the preview client; use your logging framework
// and rotate files under /var/log/... as needed (see Configure logging).

Client identification labels

Add labels to identify metrics by application or environment:

// Apply labels in your metrics backend (Prometheus relabel, Datadog tags, etc.), not on ClusterDefinition.

Integration with monitoring systems

Prometheus + Grafana

  1. Export metrics via HTTP endpoint
  2. Configure Prometheus to scrape your application
  3. Import the Aerospike client dashboard in Grafana

Datadog

import io.micrometer.datadog.DatadogConfig;
import io.micrometer.datadog.DatadogMeterRegistry;
import java.time.Clock;
DatadogMeterRegistry registry = new DatadogMeterRegistry(
DatadogConfig.DEFAULT, Clock.SYSTEM);
// Register timers/counters around your own Aerospike calls; the SDK does not wire this for you.

Performance impact

Metrics collection has minimal overhead:

  • Counter/gauge operations: ~100ns
  • Histogram recording: ~500ns
  • Total impact: <1% CPU overhead

For latency-critical applications, you can disable histograms:

// Configure Micrometer histogram buckets on your own meters; unrelated to the Aerospike JAR.

Next steps

Configure Logging

Set up client-side logging for debugging.

Logging →

Tune Performance

Optimize client configuration with Behaviors.

Behaviors →

Feedback

Was this page helpful?

What type of feedback are you giving?

What would you like us to know?

+Capture screenshot

Can we reach out to you?