Token导航 LogoToken导航TokenDH.com
AI 工具敏感数据github未标认证来源可访问clear审计异常

claude-code-telemetry-enableClaude 代码 telemetry enable

Agent Skill

claude-code-telemetry-enable 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

376

周安装

16

GitHub Stars

9

下载量

132
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:claude-code-telemetry-enable(Claude 代码 telemetry enable)
来源仓库:https://github.com/adaptationio/skrillz
仓库路径:skills/claude-code-telemetry-enable
安装命令:
npx skills add https://github.com/adaptationio/skrillz --skill claude-code-telemetry-enable
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/adaptationio/skrillz --skill claude-code-telemetry-enable

简介

claude-code-telemetry-enable 启用 OpenTelemetry 遥测,向观测平台发送指标、日志与追踪数据。

  • 适用于已部署 LGTM 或 Railway 等监控系统的团队,实现 Claude Code 运行洞察。
  • 整理内容包括令牌用量、会话计数、工具性能、API 请求及错误详情。
  • 配置前请确认观测后端地址与认证信息,防止敏感数据泄露到不可信端点。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Claude Code Telemetry Enable

Enable OpenTelemetry telemetry in Claude Code to send metrics, logs, and traces to your observability stack (local LGTM or Railway).

When to Use

  • After deploying observability stack (observability-stack-setup)
  • Need to enable Claude Code monitoring
  • Want to configure telemetry for local or cloud backends
  • Need to verify telemetry connectivity

What This Skill Does

Creates Claude Code environment configuration files that enable:

  • Metrics: Token usage, costs, session counts, tool performance
  • Logs: User prompts (full content), tool results, API requests/errors
  • Traces: Session flows, tool execution spans, API call traces

Privacy Note: Configured for FULL LOGGING (no redactions) per your requirements.

Quick Start

For Local Stack

# After running observability-stack-setup
# Invoke this skill with:
enable-local

# Claude Code will now send telemetry to localhost:4317

For Railway Stack

# After deploying to Railway
# Invoke this skill with:
enable-railway --endpoint https://your-alloy.railway.app:443

# Claude Code will send telemetry to Railway

Operations

enable-local

Configure Claude Code for local LGTM stack.

Creates: ~/.config/claude-code/.env.telemetry

Configuration:

CLAUDE_CODE_ENABLE_TELEMETRY=1
OTEL_METRICS_EXPORTER=otlp
OTEL_LOGS_EXPORTER=otlp
OTEL_EXPORTER_OTLP_PROTOCOL=grpc
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317

# Fast export (for development)
OTEL_METRIC_EXPORT_INTERVAL=10000  # 10 seconds
OTEL_LOGS_EXPORT_INTERVAL=5000     # 5 seconds

# FULL LOGGING (no privacy restrictions)
OTEL_LOG_USER_PROMPTS=1
OTEL_METRICS_INCLUDE_SESSION_ID=true
OTEL_METRICS_INCLUDE_VERSION=true
OTEL_METRICS_INCLUDE_ACCOUNT_UUID=true

enable-railway

Configure Claude Code for Railway-hosted LGTM stack.

Parameters:

  • --endpoint: Railway Alloy OTLP endpoint URL
  • --token: (Optional) Railway authentication token

Example:

enable-railway \
  --endpoint https://your-alloy-abc123.railway.app:443 \
  --token your-railway-token

Creates: ~/.config/claude-code/.env.telemetry with Railway endpoint

enable-custom

Configure for custom OTLP endpoint (Grafana Cloud, DataDog, etc.).

Parameters:

  • --endpoint: OTLP endpoint URL
  • --protocol: grpc or http (default: grpc)
  • --headers: Authentication headers (e.g., "Authorization=Bearer token")

Example:

enable-custom \
  --endpoint https://otlp.grafana.net:443 \
  --protocol grpc \
  --headers "Authorization=Basic base64encodedcreds"

verify

Test telemetry configuration and connectivity.

Checks:

  1. Configuration file exists
  2. Required environment variables set
  3. OTLP endpoint reachable
  4. Test telemetry successfully sent
  5. Data visible in backend (Grafana/Loki/Prometheus/Tempo)

Output:

Telemetry Configuration Check:
✅ Config file: ~/.config/claude-code/.env.telemetry
✅ CLAUDE_CODE_ENABLE_TELEMETRY=1
✅ OTLP endpoint: localhost:4317
✅ Endpoint reachable
✅ Test span sent successfully
✅ Data visible in Grafana

Status: HEALTHY - Telemetry fully operational

disable

Turn off telemetry completely.

Actions:

  1. Renames .env.telemetry to .env.telemetry.disabled
  2. OR sets CLAUDE_CODE_ENABLE_TELEMETRY=0

Re-enable: Rename file back or use enable-local / enable-railway again

status

Show current telemetry configuration.

Output:

Telemetry Status:
  State: ENABLED
  Endpoint: http://localhost:4317
  Protocol: gRPC
  Privacy: FULL LOGGING (all data captured)
  Export Intervals: Metrics 10s, Logs 5s

  Captured Data:
    - User prompts (full content)
    - Tool executions (all tools)
    - API requests (tokens, cost, latency)
    - Session metadata (IDs, version, account)

Configuration Details

Environment Variables

Essential:

  • CLAUDE_CODE_ENABLE_TELEMETRY: 1 to enable, 0 to disable
  • OTEL_EXPORTER_OTLP_ENDPOINT: OTLP endpoint URL
  • OTEL_EXPORTER_OTLP_PROTOCOL: grpc or http

Exporters:

  • OTEL_METRICS_EXPORTER: otlp (send metrics via OTLP)
  • OTEL_LOGS_EXPORTER: otlp (send logs via OTLP)

Export Intervals:

  • OTEL_METRIC_EXPORT_INTERVAL: Milliseconds between metric exports (default: 60000)
  • OTEL_LOGS_EXPORT_INTERVAL: Milliseconds between log exports (default: 5000)

Privacy Controls (configured for FULL logging):

  • OTEL_LOG_USER_PROMPTS: 1 = log full prompt content, 0 = log length only
  • OTEL_METRICS_INCLUDE_SESSION_ID: true = include session IDs in metrics
  • OTEL_METRICS_INCLUDE_VERSION: true = include Claude Code version
  • OTEL_METRICS_INCLUDE_ACCOUNT_UUID: true = include account identifier

Authentication (for cloud backends):

  • OTEL_EXPORTER_OTLP_HEADERS: Headers for authentication (e.g., "Authorization=Bearer token")

What Gets Captured

Metrics (counters, gauges, histograms):

  • claude_code.session.count - Session frequency
  • claude_code.token.usage - Token consumption (input + output)
  • claude_code.cost.usage - API costs in USD
  • claude_code.code_edit_tool.decision - Accept/reject patterns
  • claude_code.active_time.total - Engagement duration (seconds)
  • claude_code.pull_request.count - PR creation count
  • claude_code.commit.count - Git commit count

Log Events (structured JSON):

  1. claude_code.user_prompt - User prompt submissions (full content)
  2. claude_code.tool_result - Tool execution outcomes (tool name, status, duration)
  3. claude_code.api_request - Claude API calls (model, tokens, cost, latency)
  4. claude_code.api_error - Failed API requests (status codes, retry attempts)
  5. claude_code.tool_decision - Permission decisions (approved/rejected)

Traces (distributed tracing):

  • Session traces: Complete conversation workflows
  • Tool call spans: Read, Write, Edit, Bash, Glob, Grep, Task, etc.
  • Agent task spans: Parallel agent execution
  • API request spans: Claude API latency breakdown

Retention

All data stored for 365 days (configured in observability stack).

File Locations

Configuration File:

  • Linux/WSL: ~/.config/claude-code/.env.telemetry
  • macOS: ~/.config/claude-code/.env.telemetry
  • Windows: %USERPROFILE%\.config\claude-code\.env.telemetry

Managed Settings (organization-enforced, optional):

  • Linux: /etc/claude-code/managed-settings.json
  • macOS: /Library/Application Support/ClaudeCode/managed-settings.json
  • Windows: C:\ProgramData\ClaudeCode\managed-settings.json

Troubleshooting

Telemetry Not Appearing in Grafana

Check 1: Is telemetry enabled?

cat ~/.config/claude-code/.env.telemetry
# Should show CLAUDE_CODE_ENABLE_TELEMETRY=1

Check 2: Is OTLP endpoint reachable?

curl -v http://localhost:4317
# Should connect (may get empty response, that's ok)

Check 3: Is observability stack running?

docker compose -f .observability/docker-compose.yml ps
# All 5 services should be "running"

Check 4: Use Claude Code and check immediately

# After using Claude Code, query Loki:
curl -s 'http://localhost:3100/loki/api/v1/query?query={job="claude_code"}' | jq .
# Should show recent logs

Port Already in Use (4317)

If another service is using port 4317:

Option 1: Stop the conflicting service

sudo lsof -i :4317
sudo kill <PID>

Option 2: Change Alloy port in observability stack Edit .observability/docker-compose.yml:

ports:
  - "4318:4317"  # Expose on 4318 instead

Then update telemetry config:

OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318

Permission Denied

If configuration file creation fails:

# Create directory manually
mkdir -p ~/.config/claude-code
chmod 755 ~/.config/claude-code

# Try again

Next Steps

After enabling telemetry:

  1. Use Claude Code: Run tools (Read, Write, Bash, etc.)
  2. Generate telemetry: Each operation sends data
  3. View in Grafana: Open http://localhost:3000
  4. Check dashboards: Navigate to "Claude Code Overview"
  5. Verify metrics: See token usage, costs, tool calls

References

  • references/env-telemetry-local.txt - Local configuration template
  • references/env-telemetry-railway.txt - Railway configuration template
  • references/env-telemetry-custom.txt - Custom endpoint template
  • references/telemetry-variables.md - All environment variables explained
  • references/privacy-settings.md - Privacy configuration options

Scripts

  • scripts/enable-local.sh - Enable for local stack
  • scripts/enable-railway.sh - Enable for Railway
  • scripts/verify-telemetry.sh - Test configuration and connectivity
  • scripts/disable-telemetry.sh - Turn off telemetry

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

github-copilot

26.39%
按下载量换算35

Claude Code

25.72%
按下载量换算34

mcpjam

20.22%
按下载量换算27

moltbot

12.97%
按下载量换算17

windsurf

8.35%
按下载量换算11

zencoder

3.98%
按下载量换算5

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

未通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills