Use this file to discover Exa products, pricing, evaluations, comparisons, use cases, agent interfaces, and technical documentation before exploring further.
Python metrics libraries record numeric measurements from a running application, such as request counts, latencies, and queue lengths. An instrument such as a counter or histogram records each value with labels before an exporter sends the totals to a monitoring backend. These libraries let developers and on-call engineers see how production services behave over time.
Popularity
opentelemetry-api has the most monthly downloads in this comparison, at 721.7M.
def record_operation_result(
self,
operation: str,
bank_id: str,
outcome: OperationOutcome,
duration: float,
source: str = "api",
budget: str | None = None,
max_tokens: int | None = None,
memories_backend: str | None = None,
):
"""Record a single completed operation (duration + count) with its outcome.
Direct (non-context-manager) recording for code paths that need explicit
outcome control rather than the exception-based ``record_operation`` — e.g.
the async worker, where deferrals/retries are not terminal outcomes and must
not be counted as completions.
"""
attributes = {
"operation": operation,
"source": source,
**self._tenant_attrs(),
**_backend_attrs(memories_backend_for(bank_id) if memories_backend is None else memories_backend),
}
if self._include_bank_id:
attributes["bank_id"] = bank_id
if budget:
attributes["budget"] = budget
if max_tokens:
attributes["max_tokens"] = str(max_tokens)
attributes["success"] = outcome.value
# Record duration self.operation_duration.record(duration, attributes)
# Record operation count self.operation_total.add(1, attributes)
prometheus-client
Records application metrics and exposes an HTTP endpoint for Prometheus to scrape.
Downloads / mo
175.4M
Stars
4.4K
Last release
0.26.0
License
Apache-2.0 AND BSD-2-Clause
Strengths
Serves a scrape endpoint.Expose metrics over HTTP with the built-in server.
Groups observations with labels.Separate related time series by method, endpoint, or other declared dimensions.
Limitations
Summaries omit local quantiles.Choose a histogram when queries need latency percentiles.
Multiprocess mode restricts features.Custom collectors and label removal are unavailable in multiprocess deployments.
def after_request(response):
if hasattr(request, 'prom_do_not_track') or hasattr(request, 'prom_exclude_all'):
return response
if self.excluded_paths:
if any(pattern.match(request.path) for pattern in self.excluded_paths):
return response
if hasattr(request, 'prom_start_time') and self._not_yet_handled('duration_reported'):
total_time = max(default_timer() - request.prom_start_time, 0)
if callable(duration_group):
group = duration_group(request)
else:
group = getattr(request, duration_group)
request_duration_labels = {
'method': request.method,
'status': _to_status_code(response.status_code),
duration_group_name: group
}
request_duration_labels.update(labels.values_for(response))
request_duration_metric.labels(**request_duration_labels).observe(total_time)
if self._not_yet_handled('total_reported'):
request_total_metric.labels(
method=request.method, status=_to_status_code(response.status_code),
**labels.values_for(response)
).inc()
return response
opentelemetry-api suits applications that want vendor-neutral instruments and a choice of backend. prometheus-client suits services that Prometheus scrapes over HTTP. Powertools for AWS Lambda suits Lambda functions that publish to CloudWatch.
opentelemetry-api defines vendor-neutral instruments and leaves collection and export to a configured SDK. prometheus-client records labeled instruments in process and serves them in the Prometheus format over HTTP.
Logfire is the Python SDK and command-line interface for Pydantic Logfire. It provides instruments and readers compatible with OpenTelemetry.
prometheus-client creates labeled counters, histograms, and summaries in the application process. It then serves their values over HTTP for Prometheus to scrape.
Powertools for AWS Lambda is a toolkit for Lambda functions with a metrics facade that writes the CloudWatch Embedded Metric Format by default.
For coding agents
Found your metrics library? Help your agent use it.
Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.