@damngamerz/pi-otel

Privacy-conscious OpenTelemetry traces, metrics, and optional LLM evaluation for Pi

Packages

Package details

extension

Install @damngamerz/pi-otel from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@damngamerz/pi-otel
Package
@damngamerz/pi-otel
Version
0.1.2
Published
Jul 22, 2026
Downloads
298/mo · 298/wk
Author
damngamerz
License
MIT
Types
extension
Size
171.3 KB
Dependencies
7 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./dist/index.js"
  ],
  "image": "https://pi.dev/packages/@damngamerz/pi-otel"
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@damngamerz/pi-otel

Privacy-conscious OpenTelemetry traces, metrics, and optional response evaluation for the Pi coding agent.

  • GenAI semantic traces for agent, LLM, and tool activity
  • token, cost, latency, error, and tool metrics
  • optional manual, sampled, or always-on LLM evaluation
  • correlated gen_ai.evaluation.result events
  • pinned local Grafana LGTM example
  • remote evaluation off by default

Privacy first

Baseline telemetry never contains prompts, responses, thinking, provider payloads, tool arguments/results, shell commands, paths, cwd, usernames, hostnames, or email addresses.

Remote evaluation changes that boundary by sending the latest user request and assistant text to the configured judge model. It is disabled by default, content-limited, deduplicated, and blocked when likely credentials or private keys are detected. See the privacy model.

Quick preview

pi-otel Grafana dashboard

The example telemetry Grafana stack ships with a pre-built dashboard showing real-time telemetry.

Install

pi install npm:@damngamerz/pi-otel

For a pinned install:

pi install npm:@damngamerz/pi-otel@0.1.1

Local Grafana quick start

cd examples/grafana-lgtm
docker compose up -d

Open http://127.0.0.1:33000/d/damngamerz-pi-otel/atdamngamerz-pi-otel.

The extension exports OTLP/HTTP to http://127.0.0.1:4318 by default.

Configure

Add piOtel to ~/.pi/agent/settings.json or a trusted project's .pi/settings.json:

{
  "piOtel": {
    "enabled": true,
    "endpoint": "http://127.0.0.1:4318",
    "evaluation": {
      "mode": "off",
      "provider": "openai-codex",
      "model": "gpt-5.4-mini"
    }
  }
}

Evaluation modes:

  • off — no remote evaluation; default
  • manual — evaluate through /otel-eval-last
  • sample — deterministically evaluate a configured fraction
  • always — evaluate every settled response

See configuration for every setting and environment override.

Commands

/otel-status
/otel-flush
/otel-eval-last

Telemetry

Primary metrics include:

  • gen_ai.client.operation.duration
  • gen_ai.client.token.usage
  • gen_ai.client.tool_calls_per_operation
  • gen_ai.client.tool.calls
  • gen_ai.evaluation.score
  • pi.agent.prompts
  • pi.agent.turns
  • pi.agent.tool.duration
  • pi.agent.tool.errors
  • pi.agent.session.duration
  • pi.agent.cost
  • pi.agent.time_to_first_token

See metrics for the full reference.

Security

Pi packages execute with the user's full permissions. Review extension source before installation and pin versions in sensitive environments.

This package:

  • has no install or postinstall scripts
  • does not start Docker or modify system services
  • rejects remote OTLP endpoints unless explicitly enabled and protected by HTTPS
  • rejects endpoint URLs containing credentials
  • keeps baseline telemetry content-free

Report vulnerabilities privately according to SECURITY.md.

Development

npm install --ignore-scripts
npm run check
npm pack --dry-run

Acknowledgements

This project gratefully credits Oleksii Nikiforov (NikiforovAll) and the original NikiforovAll/pi-otel project. Its work directly inspired this package, and the Grafana dashboard is adapted from that project under Apache-2.0.

See ACKNOWLEDGEMENTS.md, NOTICE, and LICENSES/Apache-2.0.txt.

License

Original package code is MIT licensed. The adapted Grafana dashboard remains subject to its Apache-2.0 attribution and notice.