Skip to content

Optimize Daily OTel Instrumentation Advisor with inline sub-agents#36028

Merged
pelikhan merged 4 commits into
mainfrom
copilot/subagent-optimizeroptimize-daily-otel-advisor
May 31, 2026
Merged

Optimize Daily OTel Instrumentation Advisor with inline sub-agents#36028
pelikhan merged 4 commits into
mainfrom
copilot/subagent-optimizeroptimize-daily-otel-advisor

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 31, 2026

The Daily OTel Instrumentation Advisor was spending a large share of Claude context on two extractive phases: reading the OTel instrumentation sources and sampling live telemetry from Sentry/Grafana. This change moves those phases behind inline small sub-agents while keeping the cross-source evaluation and issue-authoring steps in the main workflow.

  • Prompt flow

    • Replaced the verbose Step 1 source-inspection block with an otel-code-inspector invocation
    • Replaced the verbose Step 2 telemetry-query block with an otel-telemetry-sampler invocation
    • Clarified that the main workflow should retain each agent’s returned output in memory for Step 3 synthesis
  • Inline sub-agents

    • Added otel-code-inspector to extract:
      • span attributes
      • resource attributes
      • error/status fields
      • trace-context propagation
    • Added otel-telemetry-sampler to collect:
      • per-backend attribute presence tables for Sentry and Grafana
      • sampled trace_id and span name
      • no-data diagnostics (ingestion delay vs auth/config vs query limits)
  • Compiled workflow

    • Regenerated the compiled lock workflow so the prompt body and compiled artifact stay aligned

Example of the new delegation pattern:

### Step 1: Read and Understand the Current Instrumentation

Invoke the `otel-code-inspector` agent (no arguments). It reads the core OTel `.cjs`
files and returns a structured inventory of span attributes, resource attributes,
error fields, and trace-context propagation. Save the returned inventory to memory
and use it as the static-code basis for Step 3.

## agent: `otel-code-inspector`
---
description: Read the core OTel instrumentation files and report which attributes and trace fields the code currently sets
model: small
---

Copilot AI and others added 3 commits May 31, 2026 00:44
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Optimize Daily OTel Instrumentation Advisor workflow Optimize Daily OTel Instrumentation Advisor with inline sub-agents May 31, 2026
Copilot AI requested a review from pelikhan May 31, 2026 00:52
@pelikhan pelikhan marked this pull request as ready for review May 31, 2026 01:13
Copilot AI review requested due to automatic review settings May 31, 2026 01:13
@pelikhan pelikhan merged commit 06c4357 into main May 31, 2026
1 check failed
@pelikhan pelikhan deleted the copilot/subagent-optimizeroptimize-daily-otel-advisor branch May 31, 2026 01:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the “Daily OTel Instrumentation Advisor” workflow prompt to delegate two high-context extractive phases (static instrumentation inspection and live telemetry sampling) to inline small sub-agents, keeping the main workflow focused on synthesis and issue authoring.

Changes:

  • Replaced verbose Step 1 static-code inspection instructions with an otel-code-inspector sub-agent invocation.
  • Replaced verbose Step 2 live telemetry querying instructions with an otel-telemetry-sampler sub-agent invocation.
  • Regenerated the compiled lock workflow for the OTel advisor (and also includes a regeneration of daily-news.lock.yml).
Show a summary per file
File Description
.github/workflows/daily-otel-instrumentation-advisor.md Delegates code inspection and telemetry sampling to inline small sub-agents and adds the agent definitions.
.github/workflows/daily-otel-instrumentation-advisor.lock.yml Updates compiled lock metadata to reflect the new prompt body.
.github/workflows/daily-news.lock.yml Regenerated lock metadata/heredoc IDs without an accompanying .md change in this PR.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 4

Comment on lines +74 to +79
Invoke the `otel-telemetry-sampler` agent (no arguments). It queries Sentry and
Grafana for recent gh-aw spans and returns a per-backend attribute-presence table
plus a sampled trace_id. After the agent returns its two backend tables, cross-check
them yourself and note any discrepancies (attribute present in one backend but absent
in the other, or signs of ingestion delay vs. auth/config issues). Record the result
to memory for Step 3.
1. **Sentry**: call `find_organizations`, then `find_projects`, then `search_events` with `dataset: spans` (fall back to `dataset: transactions` if empty). Take one `trace_id` and call `get_trace_details`.
2. **Grafana**: use `list_datasources`, `tempo_traceql-search`, then `tempo_get-trace` on one trace ID.

For each backend, return a markdown table with one row per attribute — `service.version`, `github.repository`, `github.event_name`, `github.run_id`, `deployment.environment` — and a Present/Absent column. Include the sampled `trace_id` and span `name`. If a backend returned no data, state whether it looks like ingestion delay, auth/config, or query limits. Report findings only.
- `actions/setup/js/generate_observability_summary.cjs`
- `actions/setup/js/aw_context.cjs`

Also inspect broader usage with targeted `grep -n` commands under `actions/setup/js/` for OTLP/otel references.
@@ -1,4 +1,4 @@
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"847860af3924384aa2f4bd0188a573e31264f6225f10ed1ff1dd8cb0ca014fe5","body_hash":"55ac3a789fdbd8eca450f17c99cb9b78e5eafede9392b9e5444dce5e97f9cbee","strict":true,"agent_id":"copilot"}
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"8d41a250f29248203bc447b1d39fe538173aa7b849fdbc6d8c2dadeb04b5d229","body_hash":"55ac3a789fdbd8eca450f17c99cb9b78e5eafede9392b9e5444dce5e97f9cbee","strict":true,"agent_id":"copilot"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[subagent-optimizer] Optimize Daily OTel Instrumentation Advisor — 2026-05-30

3 participants