Catalog
pydantic/logfire-infrastructure

pydantic

logfire-infrastructure

Monitor hosts, Docker containers, Kubernetes clusters, database/queue/cache servers, and cloud-provider metrics with Pydantic Logfire — no application code required. Use this skill whenever the user asks to "monitor my host/server/VM", "monitor my Docker containers", "monitor my Kubernetes cluster", "send infrastructure metrics to Logfire", "watch my database/Postgres/Redis/MongoDB/Kafka", "collect cloud metrics" (AWS/GCP), or mentions the OpenTelemetry Collector in the context of Logfire. This is infrastructure only — for instrumenting APPLICATION CODE (traces, logs, AI/agent spans) use the logfire-instrumentation skill instead.

NewUpdated Nov 25, 2026

Monitor Infrastructure with Logfire

Do not use this skill for application-level traces, logs, or AI/agent spans — that's logfire-instrumentation. The two compose: a full setup often runs both.

How This Works

The OpenTelemetry Collector ships host, container, cluster, and infrastructure-service metrics to Logfire with no application code changes — Logfire is a fully compliant OTel backend and ingests standard OTLP traces, logs, and metrics from it (one narrow exception noted in the collector reference), so the Collector is the entire mechanism. This is optional and is an advanced tool: if the user only wants their app's own traces, logfire-instrumentation's language SDKs are enough on their own.

Step 1: Authenticate and Select the Exact Project

Read the repository's agent instructions first. Read-only inspection of infrastructure configuration does not require login. Before changing or starting an exporter, confirm the target and project through the shared authentication reference below, and obtain approval for deployment changes.

If the parent wizard already prepared the project, use its confirmed target and project without rerunning account commands. Otherwise, use Authenticate and Select the Exact Project for the Rust CLI's target-aware identity check, OAuth session, and explicit project selection, including its safe handoff for the write credential created by init use.

Step 2: Identify What to Monitor

Detect the infrastructure actually in play, don't assume:

  • Host/VM: monitoring the machine itself (CPU, memory, disk, network, load).
  • Docker: read docker-compose.yml / Dockerfiles for running containers.
  • Kubernetes: look for manifests, a kubeconfig, or kubectl context.
  • Database/queue/cache servers: read docker-compose.yml / pyproject.toml / package.json for Postgres, MySQL, Redis, MongoDB, Kafka, RabbitMQ, Nginx, Apache, Elasticsearch, or Memcached.
  • Cloud provider: GCP or AWS metrics (Cloud Monitoring, CloudWatch, ECS), when the user names the provider or the app clearly runs there.

More than one can apply at once — a single Collector can run multiple receivers in parallel pipelines.

Step 3: Configure the Collector

Follow the collector reference for the receiver(s) identified in Step 2 — it covers the shared exporter setup, then a dedicated section per source: host metrics, Docker, Kubernetes, database/queue/cache servers, and cloud-provider metrics, each with the exact receiver name, a working config, and the caveats that actually bite (Docker socket permissions, API version pinning, host.docker.internal vs localhost, IAM permissions, ADOT vs. Contrib collector images).

Set the same service & resource metadata conventions the collector reference describes — host.name, service.name, service.instance.id — so data groups correctly across the Hosts, Kubernetes, and Metrics pages.

Before starting or restarting the Collector, validate the config file — a receiver typo or bad indentation should surface as a validation error, not a Collector that starts, logs nothing useful, and silently drops the pipeline:

Set COLLECTOR_CONFIG to the existing config path, or the file you created in Step 3. Reuse that exact path for validation, the smoke test, and persistent deployment.

otelcol-contrib validate --config="$COLLECTOR_CONFIG"
# or, for the core (non-Contrib) distribution: otelcol validate --config="$COLLECTOR_CONFIG"

If neither binary is on PATH, inspect the running Collector container (for example with kubectl exec) or use the deployment-specific validation command from the image entrypoint, systemd unit, or Helm chart. docker compose config or kubectl get pod <name> -o yaml can show the command when it is explicitly configured.

Step 4: Verify

Wiring a receiver isn't done when the Collector starts cleanly — confirm the data reached the right page for the right host, container, or cluster. Never report a metric as "arrived" without checking it in this same session — by an exact query when MCP or API access is available, or by finding the same exact identifier in the relevant Logfire page.

  1. Record the restart time, then restart the Collector after any config change (having validated it, above).
  2. Query for the exact resource you configured, not just any data on the page. If a Logfire MCP server or API is connected in this session, query for the specific host.name / container / cluster you set in Step 3 and require a datapoint newer than the recorded restart time — a query that returns zero fresh rows for that exact identifier means it didn't land, even if the page shows older data from something else. Otherwise, open the specific product page — Hosts, Docker, or Kubernetes — or the Metrics explorer for database/queue/cache/cloud sources, select a recent time range, and inspect a latest timestamp/sample after the restart time for that same exact identifier.
  3. If nothing appears, check in order: the exporter endpoint/region and write token, that the receiver is in an active pipeline (not defined but never referenced under service.pipelines), and that resource attributes (host.name, service.name) are set — the reference's own Verify section has the full troubleshooting path.
  4. Fix and re-check until the specific source is visible, not just "some" data.

Close with a final report built from what you just confirmed — the exact org/project/region, active receiver(s), and host/container/cluster identifier, not a template. Include a direct link to the relevant view (/hosts, /docker, /kubernetes, or /metrics, based on the source) so the user can see their own source arrive. Append the selected view's path to the validated project URL from project current for standalone setup. After a parent-prepared wizard handoff, use project open --no-open with the same target/org and --no-input --output json, then append the same path; do not rerun project current. If the link cannot be resolved, report that separately from telemetry verification rather than returning a placeholder.

References

Files2
2 files · 15.7 KB

Select a file to preview

Overall Score

83/100

Grade

B

Good

Grades are signals, not a certification. Always review a skill yourself before use.

Safety

82

Quality

86

Clarity

85

Completeness

78

Summary

This skill guides agents to set up OpenTelemetry Collector for infrastructure monitoring (hosts, Docker, Kubernetes, databases, cloud) and ship metrics to Logfire. It provides structured receiver configurations, authentication flows, validation commands, and verification procedures with no application code changes required. The skill is infrastructure-focused and explicitly disclaims application-level instrumentation.

Static Analysis Findings

1 finding

Patterns detected by deterministic static analysis before AI scoring. Hover over any finding code for detailed information and remediation guidance.

Command Injection
SEC-011Dynamic Shell Eval

Shell eval/exec of dynamic content

SKILL.mdexec`

Detected Capabilities

read configuration files (docker-compose.yml, Dockerfile, kubeconfig)read project manifest files (pyproject.toml, package.json)execute CLI commands (otelcol-contrib validate, docker compose, kubectl)environment variable substitution and secret management guidanceHTTP exporter configuration for external endpoint

Trigger Keywords

Phrases that agents use to match this skill to user intent.

monitor host metricsdocker container monitoringkubernetes cluster metricsdatabase performance trackingopentelemetry collector setuplogfire infrastructurecloud metrics collectionotel receiver config

Risk Signals

INFO

Shell exec/eval of dynamic content (reference to 'exec' in Step 1 auth flow)

SKILL.md | Step 1 | reference to auth.md handoff
WARNING

Credential handling via environment variable (LOGFIRE_TOKEN, OTEL_RESOURCE_ATTRIBUTES)

references/collector/host-and-infra-metrics.md | 'Send Collector data to Logfire' section
WARNING

Docker socket access as root (user: '0:0')

references/collector/host-and-infra-metrics.md | Docker containers section
INFO

File permission guidance (mode 0600 on POSIX for secret files)

references/collector/host-and-infra-metrics.md | 'Send Collector data to Logfire' section
INFO

Outbound network request (OTLP exporter to Logfire endpoint)

references/collector/host-and-infra-metrics.md | exporters configuration

Referenced Domains

External domains referenced in skill content, detected by static analysis.

pydantic.dev

Use Cases

  • Monitor host CPU, memory, disk, and network metrics
  • Collect Docker container performance data
  • Watch Kubernetes cluster state and per-node metrics
  • Track database/Redis/Kafka server metrics
  • Gather AWS CloudWatch or GCP Cloud Monitoring metrics
  • Verify telemetry pipeline connectivity to Logfire
  • Validate OpenTelemetry Collector configuration before deployment

Quality Notes

  • Strength: Clear scope boundary between infrastructure monitoring (this skill) and application instrumentation (logfire-instrumentation). Explicitly redirects users to the correct skill.
  • Strength: Detailed caveats and common pitfalls documented (e.g., API version pinning for Docker, 'host.docker.internal' vs 'localhost', Summary type rejection, port deduplication).
  • Strength: Step-by-step verification procedure with concrete checks (query for exact resource identifiers, timestamp bounds, troubleshooting order).
  • Strength: Security guidance included for credential handling (env vars only, no hardcoding, gitignored 0600 files, secret managers for persistent deployments).
  • Strength: Receiver configurations provide working YAML with meaningful defaults rather than stubs.
  • Opportunity: Validation command examples assume otelcol-contrib or otelcol on PATH; fallback guidance is provided but could be more prescriptive for air-gapped environments.
  • Opportunity: Kubernetes section defers entirely to external Helm guide (opentelemetry-kube-stack) with strong caveat to 'stop rather than claiming incomplete setup succeeded' — this is correct but means agent will frequently require user intervention.
Model: claude-haiku-4-5-20251001Analyzed: Nov 25, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Version History

  1. v1.1

    Content updated

    ✦ AIRequires reading repository agent instructions first and permits read-only config inspection before authentication. Changes CLI target confirmation, Collector validation, and verification query…

    2026-11-25

    LATEST
  2. v1.0

    2026-10-13

    View This VersionInitial version

Use pydantic/logfire-infrastructure in your dev environment

Command Palette

Search for a command to run...