技能库
智客分类:运维与云
opentelemetry
Opentelemetry
装有OpenTeleometry和船标/日志/追踪到Grafana Cloud或自我托管的Mimir / Loki / Tempo / Pyroscope的任何应用程序。 包括Go、Java(Grafana JVM代理)、Python(`开远测量-仪器 ' )、Node.js、.NET(`Grafana.OpenTeleometter')的SDK自动仪器, Beyla eBPF为零码;Grafana Cloud OTLP网关+ Basic-auth(InstanceID + API key, Base64);env-var config(`OTEL_EXPORter_OTLP_*`',`OTEL_RESOURCE_ATTRIBUTES');合金/OTel-Collector管道;Kubernetes操作员注入-注释;和头+尾取样。 使用仪器时,将OTLP指向Grafana Cloud,从Jaeger / Datadog / New Relic中切换,选择头-对尾-采样,或调试"spans不在Explore中显示"——即使用户说出"自动仪器我的Java应用","发送给Grafana的痕迹","我设置的内脏","OTLP端点",或"操作员注射"而不命名OpenTeleometer.
SKILL.md / Agent 安装方式 SKILL.md 原文
6915 安装量
官方网址:skills.sh
技能介绍
先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。
做什么
装有OpenTeleometry和船标/日志/追踪到Grafana Cloud或自我托管的Mimir / Loki / Tempo / Pyroscope的任何应用程序。 包括Go、Java(Grafana JVM代理)、Python(`开远测量-仪器 ' )、Node.js、.NET(`Grafana.OpenTeleometter')的SDK自动仪器, Beyla eBPF 零码; Grafana Cloud OTLP网关 + Basic-auth (IntanceID + API key, Base64); env-var config (`OTEL_EXporter_OTLP_*`',`OTEL_RESOURCE_ATTRIBUTEs'); 合金/OTel- Collector 管道; Kubernetes 操作员注入-注释; 头+尾取样
何时用
使用仪器服务,将OTLP指向Grafana Cloud,从Jaeger / Datadog / New Relic中切换,选择了头-对尾-抽样,或调试"spans不在Explore中显示"——即使用户表示"自动装置我的Java应用","发送给Grafana的痕迹","什么inv vars"
代理如何加载
按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:OpenTelemetry with Grafana、Backends、Prerequisites、Common Workflows、1. Authenticate to the Grafana Cloud OTLP endpoint、1. Build the auth header。 其中含规范建议的小节:分步指令。
文件分析
文件分析:除 SKILL.md 外,正文引用了 references/collector-config.md、references/instrumentation.md,属于带资源的技能包,这些文件按需再读。
官方 description(原文)
Instrument any app with OpenTelemetry and ship metrics / logs / traces to Grafana Cloud or self-hosted Mimir / Loki / Tempo / Pyroscope. Covers SDK auto-instrumentation for Go, Java (Grafana JVM agent), Python (`opentelemetry-instrument`), Node.js, .NET (`Grafana.OpenTelemetry`), Beyla eBPF for zero-code; Grafana Cloud OTLP gateway + Basic-auth (instanceID + API key, base64); env-var config (`OTEL_EXPORTER_OTLP_*`, `OTEL_RESOURCE_ATTRIBUTES`); Alloy / OTel-Collector pipelines; Kubernetes Operator inject-annotations; and head + tail sampling. Use when instrumenting a service, pointing OTLP at Grafana Cloud, switching from Jaeger / Datadog / New Relic, choosing head- vs tail-sampling, or debugging "spans aren't showing in Explore" — even when the user says "auto-instrument my Java app", "send traces to Grafana", "what env vars do I set", "OTLP endpoint", or "Operator inject" without naming OpenTelemetry.
OpenTelemetry with Grafana Backends Prerequisites Common Workflows 1. Authenticate to the Grafana Cloud OTLP endpoint 1. Build the auth header 2. Smoke-test creds with a curl POST against the OTLP traces endpoint (empty body) Expect 400 (malformed payload) — NOT 401 (auth) or 404 (wrong endpoint). 2. Auto-instrument a Java app + verify 1. Download the Grafana JVM agent (single jar) 2. Run with the agent + env from step 1 3. Generate traffic, then verify in Grafana → Explore → Tempo:
· 许可:Apache-2.0
来源分类:skills.sh agent-skill
来源与网址
nameopentelemetry
descriptionInstrument any app with OpenTelemetry and ship metrics / logs / traces to Grafana Cloud or self-hosted Mimir / Loki / Tempo / Pyroscope. Covers SDK auto-instrumentation for Go, Java (Grafana JVM agent), Python (`opentelemetry-instrument`), Node.js, .NET (`Grafana.OpenTelemetry`), Beyla eBPF for zero-code; Grafana Cloud OTLP gateway + Basic-auth (instanceID + API key, base64); env-var config (`OTEL_EXPORTER_OTLP_*`, `OTEL_RESOURCE_ATTRIBUTES`); Alloy / OTel-Collector pipelines; Kubernetes Operator inject-annotations; and head + tail sampling. Use when instrumenting a service, pointing OTLP at Grafana Cloud, switching from Jaeger / Datadog / New Relic, choosing head- vs tail-sampling, or debugging "spans aren't showing in Explore" — even when the user says "auto-instrument my Java app", "send traces to Grafana", "what env vars do I set", "OTLP endpoint", or "Operator inject" without naming OpenTelemetry.
许可 Apache-2.0
发现技能 客户端向 Agent 提供名称与描述目录。
匹配与调用 用户指定或任务匹配后,载入 SKILL.md 指令。
按需加载 按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 2 references/collector-config.mdreferences/instrumentation.md以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。
具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗
先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。
该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。
交给 Agent 安装
复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。
把 Agent Skill「opentelemetry」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-f7c6c11344849ed4-Opentelemetry.html
请存为 .cursor/skills/opentelemetry/SKILL.md 或 .claude/skills/opentelemetry/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/grafana/skills 取完整目录,不要只建一个 SKILL.md。
复制安装提示词 GitHub 完整包 ↗
终端安装 · Skills CLI
需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。
npx skills add 'https://github.com/grafana/skills' --list
复制查看命令
目标客户端
安装时交互选择 Codex Claude Code Cursor
安装范围
当前项目 我的所有项目
npx skills add 'https://github.com/grafana/skills' --skill 'opentelemetry' 复制安装命令
CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。
SKILL.md 原文 可复制,不会改动源文件
复制 SKILL.md
恢复原文
阅读排版
---
name: opentelemetry
license: Apache-2.0
description: Instrument any app with OpenTelemetry and ship metrics / logs / traces to Grafana Cloud or self-hosted Mimir / Loki / Tempo / Pyroscope. Covers SDK auto-instrumentation for Go, Java (Grafana JVM agent), Python (`opentelemetry-instrument`), Node.js, .NET (`Grafana.OpenTelemetry`), Beyla eBPF for zero-code; Grafana Cloud OTLP gateway + Basic-auth (instanceID + API key, base64); env-var config (`OTEL_EXPORTER_OTLP_*`, `OTEL_RESOURCE_ATTRIBUTES`); Alloy / OTel-Collector pipelines; Kubernetes Operator inject-annotations; and head + tail sampling. Use when instrumenting a service, pointing OTLP at Grafana Cloud, switching from Jaeger / Datadog / New Relic, choosing head- vs tail-sampling, or debugging "spans aren't showing in Explore" — even when the user says "auto-instrument my Java app", "send traces to Grafana", "what env vars do I set", "OTLP endpoint", or "Operator inject" without naming OpenTelemetry.
---
# OpenTelemetry with Grafana
> **Docs**: https://grafana.com/docs/opentelemetry/
Vendor-neutral instrumentation pipeline. Apps speak OTLP → Alloy (or direct) → Grafana Cloud (Mimir / Loki / Tempo / Pyroscope).
## Backends
| Signal | Backend |
|--------|---------|
| Metrics | Grafana Mimir |
| Logs | Grafana Loki |
| Traces | Grafana Tempo |
| Profiles | Grafana Pyroscope |
## Prerequisites
- Grafana Cloud stack OR self-hosted Mimir / Loki / Tempo
- Cloud OTLP endpoint: `https://otlp-gateway-.grafana.net/otlp`
- Basic-auth credentials: numeric instance ID + API token with `MetricsPublisher` + `LogsPublisher` + `TracesPublisher`
- An app to instrument
## Common Workflows
### 1. Authenticate to the Grafana Cloud OTLP endpoint
```bash
# 1. Build the auth header
INSTANCE_ID=123456
API_KEY="glc_eyJ..."
export OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp-gateway-prod-us-east-0.grafana.net/otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic $(echo -n "${INSTANCE_ID}:${API_KEY}" | base64)"
export OTEL_RESOURCE_ATTRIBUTES="service.name=myapp,service.namespace=myteam,deployment.environment=prod"
# 2. Smoke-test creds with a curl POST against the OTLP traces endpoint (empty body)
curl -s -o /dev/null -w "%{http_code}\n" \
-X POST -H "Content-Type: application/x-protobuf" \
-H "Authorization: Basic $(echo -n "${INSTANCE_ID}:${API_KEY}" | base64)" \
"$OTEL_EXPORTER_OTLP_ENDPOINT/v1/traces" --data-binary '\n'
# Expect 400 (malformed payload) — NOT 401 (auth) or 404 (wrong endpoint).
```
### 2. Auto-instrument a Java app + verify
```bash
# 1. Download the Grafana JVM agent (single jar)
curl -sLO https://github.com/grafana/grafana-opentelemetry-java/releases/latest/download/grafana-opentelemetry-java.jar
# 2. Run with the agent + env from step 1
java -javaagent:./grafana-opentelemetry-java.jar -jar myapp.jar
# 3. Generate traffic, then verify in Grafana → Explore → Tempo:
# TraceQL: { resource.service.name = "myapp" }
# Expect spans within ~30s. Also verify metrics:
# PromQL: count by (service_name)({service_name="myapp"})
```
### 3. Auto-instrument a Python app
```bash
pip install "opentelemetry-distro[otlp]"
opentelemetry-bootstrap -a install
# Same env vars as step 1, then:
opentelemetry-instrument python app.py
# Verify the same way — Explore → Traces filter service.name=myapp.
```
### 4. Add Alloy as a buffering / sampling collector
```bash
# Application points at local Alloy (gRPC fastest)
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
# Alloy environment for forwarding to Cloud
export GRAFANA_CLOUD_OTLP_ENDPOINT=https://otlp-gateway-prod-us-east-0.grafana.net/otlp
export GRAFANA_CLOUD_INSTANCE_ID=$INSTANCE_ID
export GRAFANA_CLOUD_API_KEY=$API_KEY
alloy run /etc/alloy/config.alloy
# Verify Alloy received and forwarded
curl -s http://localhost:12345/metrics | grep otelcol_exporter_sent_spans
```
Full Alloy config + tail-sampling block + OTel Collector YAML + K8s Operator install: [`references/collector-config.md`](references/collector-config.md).
SDK-by-language details (Go full code, Node manual setup, .NET ASP.NET Core, all the env-var quirks): [`references/instrumentation.md`](references/instrumentation.md).
### 5. Kubernetes — auto-inject via the Operator
```yaml
apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata: { name: my-instrumentation }
spec:
exporter: { endpoint: http://otelcol:4317 }
propagators: [tracecontext, baggage]
java:
image: us-docker.pkg.dev/grafanalabs-global/docker-grafana-opentelemetry-java-prod/grafana-opentelemetry-java:2.3.0-beta.1
nodejs: {}
python: {}
```
Then annotate pods:
```yaml
metadata:
annotations:
instrumentation.opentelemetry.io/inject-java: "true"
# or: inject-nodejs, inject-python, inject-dotnet
```
```bash
# Verify the operator injected the agent
kubectl describe pod | grep -A2 'opentelemetry-auto-instrumentation'
# Then run the same Grafana Explore checks.
```
## Sampling — when to pick which
```bash
# Head sampling (cheap, decided at start; may lose rare errors)
export OTEL_TRACES_SAMPLER=parentbased_traceidratio
export OTEL_TRACES_SAMPLER_ARG=0.1 # 10%
```
Tail sampling (decides after seeing the whole trace — keep errors + sample the rest) requires an Alloy / OTel-Collector `tail_sampling` processor; full block in [`references/collector-config.md`](references/collector-config.md).
## Key environment variables
| Variable | Example |
|----------|---------|
| `OTEL_EXPORTER_OTLP_ENDPOINT` | `https://otlp-gateway-prod-us-east-0.grafana.net/otlp` |
| `OTEL_EXPORTER_OTLP_PROTOCOL` | `grpc` or `http/protobuf` |
| `OTEL_EXPORTER_OTLP_HEADERS` | `Authorization=Basic ` |
| `OTEL_RESOURCE_ATTRIBUTES` | `service.name=app,service.namespace=team,deployment.environment=prod` |
| `OTEL_SERVICE_NAME` | shorthand for `service.name` |
| `OTEL_TRACES_SAMPLER` / `_ARG` | `parentbased_traceidratio` / `0.1` |
## Troubleshooting
- 401 from OTLP gateway → instance ID is not numeric, or API key missing publisher roles
- 404 → endpoint URL wrong (must end with `/otlp`)
- Spans missing → check `OTEL_EXPORTER_OTLP_PROTOCOL` matches transport (Cloud OTLP gateway = `http/protobuf`, Alloy local = `grpc`)
- Node.js auto-instrumentation broken after bundling → bundlers like `@vercel/ncc` defeat the require hooks
- Python under Gunicorn / uWSGI shows no spans → reinit OTel providers in a post-fork hook
## Resources
- [Grafana OTel docs](https://grafana.com/docs/opentelemetry/)
- [Grafana Cloud OTLP](https://grafana.com/docs/grafana-cloud/send-data/otlp/)
- [Grafana JVM agent](https://github.com/grafana/grafana-opentelemetry-java)
- [Grafana .NET SDK](https://github.com/grafana/grafana-opentelemetry-dotnet)
- [OTel Operator](https://opentelemetry.io/docs/kubernetes/operator/)
相关技能
运维与云
用于容器管理,图像操作,调试的基本道克命令和工作流程.
运维与云
从开放的代理技能生态系统中发现并安装技能. 使用时:(1)用户问"我如何做X",X可能拥有现有技能,(2)用户说"为X找到技能"或"是否为X有技能",(3)用户问"你能否做X",X是专门能力,(4)用户想扩展代理能力,(5)用户想搜索工具,模板,或工作流程,(6)用户提到他们希望…
运维与云
构建,部署,评价,优化,微调,管理微软创始代理,模型,资源最终结束. 用法:铸造、azd ai代理、azd 提供/部署、托管代理脚手架/开发/运行/部署/拖放、即时代理创建、创建代理、更新代理、添加代理工具、援引代理、代理.yaml、评估代理、批量活化、连续活化、持续监测、代理C…
运维与云
执行已有.azure/部署计划.md和基础设施文件的ALREADY-PREPARED应用程序的Azure部署。 当用户向 CREATE 请求新应用程序时, 请不要使用此技能 。 这种技能运行了 azd上行, azd 部署, trarraform 应用, 和 az 部署命令带有内置…