Logs, metrics and errors
Metrics
Metrics shows two things: your checks' response times and uptime, there before you send anything, and your services' own metrics sent over OpenTelemetry.
Metrics is a beta feature preview. An owner or admin turns it on under Settings › Feature previews.
Send metrics from a service
Create an ingest key (pwi_…) under Settings › Telemetry, set the standard OpenTelemetry variables, and restart the service:
export OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.pingwright.app
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_HEADERS=authorization=Bearer%20<your-ingest-key>
export OTEL_SERVICE_NAME=checkout-api
export OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=production
export OTEL_METRICS_EXPORTER=otlp
# Every 15 s; the default is 60 s.
export OTEL_METRIC_EXPORT_INTERVAL=15000
# Traces are not stored yet: don’t send them.
export OTEL_TRACES_EXPORTER=noneMetrics go over OTLP/HTTP to https://ingest.pingwright.app/v1/metrics, as protobuf or JSON.
Go
The Go client sends Go runtime metrics (memory, GC, goroutines) every 30 seconds once pingwright.Init has run, HTTP server metrics through pingwright.Middleware, and your own through a standard OpenTelemetry meter:
go get github.com/Pingwright-Labs/pingwright-goorders, _ := pingwright.Meter("checkout").Int64Counter("orders.placed")
orders.Add(ctx, 1, metric.WithAttributes(attribute.String("plan", "pro")))Already collecting metrics with Prometheus, Grafana Alloy, Telegraf, Vector or CloudWatch? Point that tool at Pingwright instead: see Send metrics without code.
Send metrics from Kubernetes
The same Collector setup as for logs, with the kubelet metrics preset: CPU, memory and network per pod and container, plus OTLP from your apps.
kubectl create namespace observability
kubectl -n observability create secret generic pingwright-ingest --from-literal=key=<your-ingest-key>
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm upgrade --install otel-collector open-telemetry/opentelemetry-collector \
-n observability -f values.yamlmode: daemonset
image:
repository: otel/opentelemetry-collector-k8s
presets:
kubeletMetrics:
enabled: true # kubeletstats: pod and container CPU, memory, network
kubernetesAttributes:
enabled: true # k8sattributes: namespace, pod, deployment
extraEnvs:
- name: PINGWRIGHT_INGEST_KEY
valueFrom:
secretKeyRef: { name: pingwright-ingest, key: key }
config:
receivers:
otlp: # apps in the cluster send their metrics here
protocols:
grpc: { endpoint: ${env:MY_POD_IP}:4317 }
http: { endpoint: ${env:MY_POD_IP}:4318 }
processors:
memory_limiter: { check_interval: 1s, limit_percentage: 80, spike_limit_percentage: 25 }
resourcedetection: { detectors: [env, eks], timeout: 2s, override: false }
batch: { send_batch_max_size: 8192 } # keeps each request well under the per-request limit
exporters:
otlphttp/pingwright:
endpoint: https://ingest.pingwright.app
headers:
authorization: "Bearer ${env:PINGWRIGHT_INGEST_KEY}"
service:
pipelines:
metrics:
receivers: [otlp] # the kubeletMetrics preset adds kubeletstats
processors: [memory_limiter, resourcedetection, batch]
exporters: [otlphttp/pingwright]For cluster-wide status (nodes, pods and deployments by phase, restarts, desired against available replicas), install the same chart once more as a single-replica deployment, so nothing is counted twice:
mode: deployment
replicaCount: 1
image:
repository: otel/opentelemetry-collector-k8s
presets:
clusterMetrics:
enabled: true # k8s_cluster receiver
# extraEnvs and config as in values.yamlhelm upgrade --install otel-cluster open-telemetry/opentelemetry-collector \
-n observability -f cluster.yamlQuery them
Metrics opens on an overview per service. From there, build a chart one of two ways:
- Query builder: pick a metric, an aggregation and the labels to group by. Good for most questions.
- MetricsQL: write the query yourself. MetricsQL is PromQL with extras.
Put up to six queries on one chart. Names are stored the Prometheus way: dots become underscores, counters end in _total, and service.name is the service_name label. For example:
sum by (service_name) (rate(http_server_request_duration_seconds_count[5m]))
histogram_quantile(0.95, sum by (vmrange, le, service_name) (rate(http_server_request_duration_seconds_bucket[5m])))
sum(rate(orders_placed_total[5m]))When you write a percentile yourself, group by vmrange as well as le: OpenTelemetry exponential histograms are stored with vmrange buckets, and a query that groups only by le comes back empty for them. The query builder does this for you.
Metrics your services send as OpenTelemetry deltas (StatsD, and some SDKs by default) are stored as sent and carry the label otel_temporality="delta". rate() and increase() return nothing on them; use rate_over_sum() and sum_over_time() instead, for example sum(rate_over_sum(orders_placed_total[5m])). The query builder picks the right one.
The query builder sizes its rate window from your data: at least four times the interval between samples, so a service that sends every 60 seconds (the OpenTelemetry SDK and StatsD default) still gets a rate on a short range. In MetricsQL you write yourself, $__rate_interval is max(4 × step, 60s); for a sender that reports every 60 seconds, write the window out, such as [5m].
Your checks' metrics
Every check's response time (p50, p95, p99), runs, failures and error rate, by location, are in Metrics without sending anything. Percentiles are approximate.
Retention and limits
Metrics are kept for 30 days. Per organization: 5 000 records a second (bursts to 25 000) and 50 000 active series. See Limits.
Your agent can run the same queries with query_metrics and query_check_metrics over MCP.