Skip to content

Observability

Observability helps you determine where a call is failing or spending time. Use logs for individual events, metrics for counts and trends, and traces to follow work across service boundaries. For example, a slow catalog lookup may come from connection establishment, handler work, or a downstream store; a trace helps distinguish those stages.

Aster’s shared Rust telemetry pipeline exports built-in RPC measurements and application telemetry. Language bindings connect it to their logging systems. You need a working service before using the snippets below, and a collector if you want remote export. Collector authentication and delivery must be verified in your own deployment.

Language Logging integration
Rust tracing; the application installs its subscriber
Python Standard logging
TypeScript Language logger over the native bridge
Go log/slog
Java SLF4J
.NET Microsoft.Extensions.Logging

For Rust, enable the otel Cargo feature for the shared telemetry integration or health for the health/Prometheus listener, which also enables otel. Plain Rust logging does not require an exporter. For example, an application with a tracing-subscriber environment filter can use RUST_LOG=warn,aster=debug. The binding pipeline’s Rust filter is configured through ASTER_LOG.

The first Python AsterServer or AsterClient start initializes the log bridge. Network export requires exporter configuration. To configure the pipeline explicitly, call observability.init() before starting the first server or client:

from aster import observability
observability.init(
service_name="orders",
otlp_endpoint="https://otel.example.com:4318",
metrics=True,
traces=True,
)

Replace the example collector address with yours. Configuration precedence is explicit initialization arguments, then OTEL_* and ASTER_* environment variables, then the [observability] TOML table, then defaults. A later initialization with different settings raises an error because the pipeline is shared within the process.

Setting Purpose
OTEL_SERVICE_NAME Service resource name
OTEL_EXPORTER_OTLP_ENDPOINT Collector URL
OTEL_METRICS_EXPORTER otlp, prometheus, or none
OTEL_TRACES_EXPORTER otlp or none
OTEL_LOGS_EXPORTER otlp or none; logs export is off by default
OTEL_SDK_DISABLED Disable telemetry export
ASTER_LOG Rust log filter, such as warn,aster=info

The supported OTLP protocol is http/protobuf. Configure authentication headers through your secret management system. In Python, initialize after forking into workers; forking after initialization is unsupported.

The Python log bridge forwards Rust events to Python’s logging system. Configure your handlers and formatters there. Distributed trace context travels in Aster call metadata using traceparent, tracestate, and baggage; outbound calls from a handler can continue the incoming trace.

Use OpenTelemetry resource attributes and exporter settings to connect the shared pipeline to your collector. Application metrics and spans use the same pipeline as the built-in telemetry.

Built-in metrics are recorded in Rust at the RPC and admission paths. They do not require a metrics interceptor.

Instrument Kind
aster.rpc.server.requests_started Counter
aster.rpc.server.requests_completed Counter
aster.rpc.server.duration Histogram in seconds
aster.rpc.server.in_flight Up-down counter
aster.rpc.client.requests_completed Counter
aster.rpc.client.duration Histogram in seconds
aster.admission.decisions Counter
aster.transport.bytes Observable counter

Optional application instruments can be created after initialization:

from aster import metrics
placed = metrics.counter("orders.placed", "Orders placed")
latency = metrics.histogram("orders.db.duration", "Database time", unit="s")
placed.add(1, {"region": "eu"})
latency.record(0.012, {"operation": "insert"})

Keep attribute cardinality bounded. The default cap is 2,000 series per instrument. The accepted auto_attrs and custom cardinality_limit options have no effect in this preview.

The health listener uses a separate TCP port from the QUIC endpoint. Enable it for your existing service:

Terminal window
ASTER_HEALTH_PORT=8080 python producer.py

The default host is 127.0.0.1; port 0 disables the listener unless health_enabled is explicitly true. ASTER_HEALTH_HOST=0.0.0.0 permits probes from other hosts. Restrict network access to that port because metrics are unauthenticated.

Route Response
GET /healthz JSON liveness status, HTTP 200 or 503
GET /readyz JSON readiness status and named checks, HTTP 200 or 503
GET /metrics Prometheus text exposition; HTTP 503 when telemetry is disabled

The listener adds a Prometheus reader to the shared pipeline. It serves built-in and application instruments at /metrics; /metrics/prometheus is not a route. Prometheus names replace dots with underscores and append units and counter suffixes where appropriate.

A server is ready after serving starts and its named readiness checks pass. New checks start failing until set true. Once a log bridge has opened, the built-in audit check also fails readiness for 30 seconds after an audit log record is dropped.

Terminal window
curl http://127.0.0.1:8080/healthz
curl http://127.0.0.1:8080/readyz
curl http://127.0.0.1:8080/metrics

AsterServer.drain(grace_period=10.0) asks the RPC server to stop accepting work and gives in-flight requests a bounded period to complete. Call close() afterward or let the async context manager close it. Applications connect their own shutdown mechanism to these methods.

Call observability.flush() to request a telemetry flush and observability.shutdown() when releasing the process’s pipeline references. Exporter timeouts can leave flushing in the background; these calls do not establish durable audit delivery.

Start the working Python producer with the health port above, make one greeting call, and query the three routes. Expect successful liveness/readiness status once serving and all checks pass, plus Prometheus text containing RPC instruments after work is recorded. Match the service name in your collector and confirm the request trace arrives there; a local metrics response does not prove OTLP delivery.

For an application that requires a synchronized catalog, register its readiness check before serving and leave it false until the needed content is available. Expect /readyz to report failure while /healthz can remain successful. Disconnect the collector to check exporter diagnostics independently of application readiness. Collector installation, credentials, and clean-host export qualification remain deployment work.