otel-java Skill
Java 中的 OpenTelemetry——Javaagent 零代码插桩、Spring Boot Starter、手动 autoconfigure SDK、声明式 YAML 配置、BOM 依赖管理、敏感数据采集与脱敏(url.query、headers、请求参数、SQL 清洗)。适用于在 Java 服务中添加、评审或配置 OpenTelemetry。触发词:'setup otel in java'、'java telemetry'、'javaagent'、'Spring Boot otel'、'GlobalOpenTelemetry'、'AutoConfiguredOpenTelemetrySdk'、'TracerProvider java'、'url.query redaction'、'capture request headers',或任何 Java 相关的 OTel 问题。
安装方式:把技能目录放入 ~/.claude/skills/(Claude Code)或在 claude.ai 设置中启用;也可复制右侧安装命令一键添加。
技能指令原文(SKILL.md)
OpenTelemetry in Java
Entry point for OpenTelemetry mechanics in Java services. Load a reference below based on
the task; each reference is self-contained.
References
| File | Use when |
|---|---|
| references/declarative-setup.md | Configuring the SDK via declarative YAML: Javaagent activation, Spring Boot Starter, autoconfigure SDK, BOM, agent-only properties, manual instrumentation entry points. |
| references/sensitive-data-capture.md | What HTTP instrumentation captures by default (query strings ON, headers/params OFF), query-parameter redaction (sensitive-query-parameters), header/servlet-parameter capture knobs, SQL sanitization. |
Sources of Truth
For YAML schema details, fetch the upstream sources listed in the otel-declarative-config skill.
For Java-specific facts:
| Fact | Fetch |
|---|---|
| Latest BOM (opentelemetry-bom) | gh api repos/open-telemetry/opentelemetry-java/releases/latest -q '.tag_name' |
| Latest Javaagent | gh api repos/open-telemetry/opentelemetry-java-instrumentation/releases/latest -q '.tag_name' |
| SDK declarative-config accepted and preferred file_format for a selected BOM tag | WebFetch https://raw.githubusercontent.com/open-telemetry/opentelemetry-java//sdk-extensions/declarative-config/src/main/java/io/opentelemetry/sdk/autoconfigure/declarativeconfig/OpenTelemetryConfigurationFactory.java |
| Javaagent declarative-config docs (current activation flag, supported file_format) | WebFetch https://opentelemetry.io/docs/zero-code/java/agent/declarative-configuration/ |
| Javaagent declarative-config smoke fixture (parser truth for selected agent tag) | WebFetch https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-instrumentation//smoke-tests/src/test/resources/declarative-config.yaml |
| Javaagent CHANGELOG (when each schema rc landed) | WebFetch https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-instrumentation//CHANGELOG.md |
| Generated Java instrumentation config reference (names, types, defaults, deprecations) | WebFetch https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-instrumentation//docs/declarative-configuration-example.yaml |
| Spring Boot Starter declarative-config fixture (selected starter tag) | WebFetch https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-instrumentation//smoke-tests-otel-starter/spring-boot-2/src/testDeclarativeConfig/resources/application.yaml |
| Spring Boot starter docs | WebFetch https://opentelemetry.io/docs/zero-code/java/spring-boot-starter/ |
| Per-instrumentation telemetry & config (resolved spans/attributes, metrics, config options, target versions) | WebFetch https://explorer.opentelemetry.io/data/javaagent/instrumentations//-.json — get and the latest from the index (see below) |
What telemetry does an instrumentation emit?
For "what does the agent produce for library X" — which spans, attributes, metrics, or config
knobs — use the OpenTelemetry Ecosystem Explorer, which fully
maps the Java agent and exposes an agent-friendly surface (Markdown indexes and resolved JSON, no
scraping). Do not answer from model memory.
Navigation:
WebFetch https://explorer.opentelemetry.io/agent/javaagent/index.md— table mapping display
name → id → the instrumentation's JSON data URL (the URL embeds the content ).
WebFetchthat JSON URL — one self-contained record (a few KB): resolvedconfigurations,
telemetry (spans with span_kind + typed attributes, and metrics),
javaagent_target_versions, semantic_conventions, and scope.
Version-specific or "what changed between releases":
https://explorer.opentelemetry.io/agent/javaagent/versions.md lists versions and marks the latest;
https://explorer.opentelemetry.io/data/javaagent/versions/-index.json gives the
id→hash map for a version — a differing hash for the same id across two versions means that
instrumentation changed. Schema:
https://explorer.opentelemetry.io/schemas/javaagent-instrumentation.schema.json; use
/llms.txt for the agent-oriented index and /llms-full.txt for the full documentation.
Prefer this Explorer data over the raw ecosystem-registry YAML on GitHub: the Explorer applies
upstream metadata corrections that the raw registry does not.
Cross-References
- Schema-level facts:
otel-declarative-configskill (language-agnostic YAML schema sources). - SDK version selection across languages:
otel-sdk-versionsskill. - Semantic conventions lookup:
otel-semantic-conventionsskill.