Skip to content
pingwright
Docs menu Send metrics without code

Logs, metrics and errors

Send metrics without code

You probably already collect metrics somewhere: Prometheus scraping your services, Telegraf on your servers, CloudWatch for everything in AWS. Point that tool at Pingwright and the metrics show up in Metrics, ready for dashboards and alert rules. Nothing to add to your code.

Metrics is a beta feature preview. An owner or admin turns it on under Settings › Feature previews.

SourceHow it sendsRoute
Prometheus, Alloy, vmagentremote_write/api/v1/write
TelegrafInfluxDB line protocol/api/v2/write
VectorDatadog metrics format/api/v2/series
AWS CloudWatchMetric stream to Firehose/drains/firehose
KubernetesOTel Collector, from Helm/v1/metrics

Every route is on https://ingest.pingwright.app and takes the same ingest key (pwi_…, with Metrics allowed). Create one under Settings › Telemetry. Name the environment with a deployment_environment_name label, so dashboards and alert rules can tell production from staging.

The console's Connect a service fills in your key and environment for each source below. It then waits for the first datapoint to arrive.

A few limits apply to every route: a request may be up to 5 MiB, 16 MiB once decompressed; a series may have at most 40 labels, and a metric name, label name or value over 4 KiB makes it invalid. Datapoints older than 48 hours or more than 10 minutes in the future are refused, so historical imports aren't supported.

Prometheus, Alloy and vmagent

Add a remote_write block, and everything Prometheus scrapes is also sent to Pingwright, labels and all:

YAML
# prometheus.yml
global:
  external_labels:
    deployment_environment_name: production

remote_write:
  - url: https://ingest.pingwright.app/api/v1/write
    authorization:
      type: Bearer
      credentials_file: /etc/prometheus/pingwright-key

Grafana Alloy:

// Alloy reads the key from its environment: export PINGWRIGHT_KEY=<your-ingest-key>,
// or for the alloy systemd service, PINGWRIGHT_KEY=<your-ingest-key> in /etc/default/alloy
prometheus.remote_write "pingwright" {
  endpoint {
    url          = "https://ingest.pingwright.app/api/v1/write"
    bearer_token = sys.env("PINGWRIGHT_KEY")
  }
  external_labels = {
    deployment_environment_name = "production",
  }
}

vmagent:

Shell
vmagent -promscrape.config=prometheus.yml \
  -remoteWrite.url=https://ingest.pingwright.app/api/v1/write \
  -remoteWrite.bearerToken="$PINGWRIGHT_KEY" \
  -remoteWrite.label=deployment_environment_name=production

Each label set is a series, and series count against the organization's limit. Drop labels you don't need, such as request ids or full URLs, with write_relabel_configs before they leave Prometheus.

Telegraf

Telegraf's InfluxDB v2 output speaks line protocol, which Pingwright takes as is:

# telegraf.conf
[global_tags]
  deployment_environment_name = "production"

[[outputs.influxdb_v2]]
  urls = ["https://ingest.pingwright.app"]
  token = "${PINGWRIGHT_KEY}"
  organization = "pingwright"   # required by Telegraf, ignored by Pingwright
  bucket = "telegraf"           # likewise
  content_encoding = "gzip"

[[inputs.cpu]]
[[inputs.mem]]
[[inputs.disk]]

Each measurement and field becomes a metric (cpu_usage_idle, mem_used_percent) and the tags become labels. Anything else that writes InfluxDB line protocol works too: POST /api/v2/write with Authorization: Token <your-ingest-key>.

Vector

Pingwright accepts Datadog's metrics format at /api/v2/series, with the ingest key in the DD-API-KEY header. Vector's Datadog metrics sink sends host metrics, and DogStatsD from your apps through its statsd source:

# vector.toml
[sources.host]
type = "host_metrics"

[sources.statsd]
type = "statsd"
address = "0.0.0.0:8125"
mode = "udp"

[sinks.pingwright_metrics]
type = "datadog_metrics"
inputs = ["host", "statsd"]
endpoint = "https://ingest.pingwright.app"
default_api_key = "${PINGWRIGHT_KEY}"

Gauges and counters are stored. Distributions (Datadog sketches, at /api/beta/sketches) are accepted but dropped for now, and show up as the key's last error under Settings › Telemetry. Vector's health check (/api/v1/validate) passes.

AWS CloudWatch

A CloudWatch metric stream sends every metric in the account (Lambda, RDS, ELB, SQS and the rest) through Amazon Data Firehose to Pingwright, in the OpenTelemetry format. The console builds a CloudFormation template for it: the metric stream, a Firehose stream, the two IAM roles and an S3 bucket for batches Pingwright couldn't take. Deploy it with:

Shell
aws cloudformation deploy \
  --stack-name pingwright-metrics \
  --template-file pingwright-metrics.yaml \
  --capabilities CAPABILITY_IAM \
  --parameter-overrides PingwrightKey=<your-ingest-key>

The parts that matter:

YAML
MetricStream:
  Type: AWS::CloudWatch::MetricStream
  Properties:
    OutputFormat: opentelemetry1.0
    # IncludeFilters: [{ Namespace: AWS/Lambda }]   # every namespace if left out
Stream:
  Type: AWS::KinesisFirehose::DeliveryStream
  Properties:
    HttpEndpointDestinationConfiguration:
      EndpointConfiguration:
        Url: "https://ingest.pingwright.app/drains/firehose?env=production"   # only env: metrics carry their own ServiceName
        AccessKey: !Ref PingwrightKey
      RequestConfiguration: { ContentEncoding: GZIP }
      BufferingHints: { IntervalInSeconds: 60, SizeInMBs: 3 }  # 3 MiB or less, with GZIP on

Metrics arrive a few minutes behind CloudWatch. AWS bills each metric update in the stream, plus Firehose and S3 as usual. The same Firehose route takes CloudWatch logs.

Kubernetes

The OpenTelemetry Collector's Helm chart collects CPU, memory and network for every pod and container on each node, and a second, single-replica release adds node, pod and deployment status for the whole cluster. See Metrics › Send metrics from Kubernetes; the console's Connect a service › Kubernetes fills in both values files. Already running Prometheus in the cluster? Its remote_write above is enough.

Not yet

  • Scraping your endpoints. Pingwright reading a /metrics URL itself, from its probe locations, is coming. Until then, use Prometheus, Alloy or vmagent.
  • StatsD over UDP. Send it through Vector's statsd source, as above.
  • Graphite. Not planned; Telegraf can read it and send it on.

Connect a source in the console