Repository navigation
Description
Summary
Add automatic OTLP metrics emission capability to gh-aw so operators can observe
per-job performance (duration, token usage, tool call rates) without
writing custom instrumentation. Extends the existing OTLP traces pipeline
to emit metrics via /v1/metrics on the same endpoint.
Scope: This issue covers the metric emission plumbing only — the OTLP
transport, thelogMetric()public API, and a minimal set of built-in
per-job metrics to validate the pipeline. A follow-up issue will propose
the full canonical list of built-in metrics and default dashboard structure.
Use Case
An agentic factory with 10+ concurrent executor runs needs aggregate visibility:
- How long are runs taking? (
gh_aw.run.durationhistogram) - Which runs fail? (
gh_aw.run.errorscounter) - Token spend per workflow? (
gh_aw.tokens.input/outputcounters)
Without metrics, operators must parse JSONL logs or trace data for aggregation.
Expected Behavior
When GH_AW_OTEL_METRICS=true is set in a workflow:
-
At job conclusion, gh-aw automatically emits the following built-in metrics
via OTLP/HTTP to the same endpoint(s) configured for traces:Metric Type Unit Description gh_aw.run.durationHistogram sWall-clock job duration gh_aw.run.errorsCounter {run}Emitted on failure/timed_outonlygh_aw.tokens.inputCounter {token}LLM input tokens gh_aw.tokens.outputCounter {token}LLM output tokens gh_aw.tool_callsCounter {call}Tool executions, by gh-aw.tool.statusgh_aw.safe_outputsCounter {item}Safe-output items, by gh-aw.safe_output.typeSee the full spec additions (§11.5 + §12.6, v0.7.0):
https://github.com/eedorenko/gh-aw/pull/1/changes#diff-44f20ea27777b62159e5b64cb7d66081d566f6f3c41d6840553c6d39772a975f -
Metrics are mirrored to
/tmp/gh-aw/otel-metrics.jsonlbefore remote export -
A
logMetric(name, value, options)public API is available for custom metrics -
No metrics are emitted when the flag is absent (fully opt-in)
Implementation (complete — available in fork)
A working implementation exists in eedorenko/gh-aw PR #1. See that PR for
the full diff. Summary of changes:
New file: actions/setup/js/otlp_metrics.cjs
buildOTLPMetric(opts)— OTLP/JSON builder for counter, gauge, histogrambuildBuiltinRunMetrics(conclusionData)— emits the 6 built-in metricssendOTLPMetrics(payload, endpointOverride)— mirrors first, then fan-outlogMetric(name, value, opts)— non-fatal public API
Modified: actions/setup/js/otlp.cjs, index.cjs, index.test.cjs
- Exports
logMetricalongside existinglogSpan
Go: pkg/constants/job_constants.go
- Adds
OtelMetricsJsonlFilenameconstant
Go: pkg/workflow/compiler_yaml_post_agent.go
- Adds metrics JSONL to artifact recovery paths when OTLP is configured
Tests: 8 golden file updates + new unit tests (otlp_metrics.test.cjs)
Docs: docs/src/content/docs/reference/open-telemetry.mdx
- Documents
logMetric()API and built-in metrics flag
Spec: specs/otel-observability-spec.md
- Adds §11.5 (built-in job metrics) and §12.6 (
logMetricAPI), bumps to v0.7.0
Step-by-Step Agentic Plan
- Review fork PR
eedorenko/gh-aw#1diff - Run existing test suite:
npm testinactions/setup/ - Add any missing test cases for
otlp_metrics.cjsedge cases - Verify golden files reflect the new artifact path
- Update spec per §11.5 and §12.6 as described above
- Merge PR, link to this issue
References
- Fork PR with full implementation: [Executor #73] Add OpenTelemetry metrics support eedorenko/gh-aw#1
- Spec diff (§11.5 + §12.6, v0.7.0): https://github.com/eedorenko/gh-aw/pull/1/changes#diff-44f20ea27777b62159e5b64cb7d66081d566f6f3c41d6840553c6d39772a975f
- Existing spec:
specs/otel-observability-spec.md§11, §14 - CONTRIBUTING.md: agentic plan format followed above
Activity