Add AI credit cap observability attributes to OTLP conclusion spans#38550
Conversation
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request extends the OTLP conclusion span telemetry emitted by actions/setup to include AI credit cap context (configured cap and cap/rate-limit failure signals), enabling downstream observability to distinguish runs by budget configuration alongside existing gh-aw.aic cost data.
Changes:
- Emit
gh-aw.max_ai_credits,gh-aw.max_ai_credits_exceeded, andgh-aw.ai_credits_rate_limit_erroras conclusion-span attributes viaresolveAICreditsFailureState(). - Add Vitest assertions ensuring the new fields are emitted on conclusion spans (and not on dedicated agent spans), including omission behavior for invalid cap values.
- Update the OpenTelemetry reference docs and the observability spec to include the new attributes.
Show a summary per file
| File | Description |
|---|---|
actions/setup/js/send_otlp_span.cjs |
Adds conclusion-span attribute emission for max AI credits and cap/rate-limit failure state. |
actions/setup/js/send_otlp_span.test.cjs |
Adds tests validating emission/omission and conclusion-only placement of the new attributes. |
docs/src/content/docs/reference/open-telemetry.mdx |
Documents the new OTel attributes in the reference table. |
specs/otel-observability-spec.md |
Updates the conclusion-span conditional attributes table to include the new fields. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 2
|
@copilot Address all remaining review comments. |
…t to use fs mocks Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Done in commits Console logging noise ( Flaky test ( |
|
@copilot Fix tests |
… tests Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Fixed in the latest commit. The root cause was a cross-test contamination in shard 1/4:
Two fixes:
|
This change extends OTLP conclusion-span telemetry to include AI credit cap context, so runs can be distinguished by budget configuration and cap-related failure signals alongside existing
gh-aw.aiccost data. It surfaces cap value and cap/rate-limit state already resolved inai_credits_context.cjswithout adding provenance or unrelated billing metadata.Conclusion-span AI credit cap attributes
send_otlp_span.cjsnow imports and usesresolveAICreditsFailureState().gh-aw.max_ai_creditsas a numeric attribute only when a valid value is available.gh-aw.max_ai_credits_exceededandgh-aw.ai_credits_rate_limit_erroras boolean attributes on conclusion spans.Scope and behavior constraints preserved
gh-aw.aicbehavior is unchanged.gh-aw.ai_credits.source) were added.Test coverage updates
send_otlp_span.test.cjsfor:gh-aw.max_ai_creditsgh-aw.max_ai_credits_exceededgh-aw.ai_credits_rate_limit_errorgh-aw.max_ai_creditsObservability docs/spec alignment
docs/src/content/docs/reference/open-telemetry.mdxattribute table.specs/otel-observability-spec.mdconclusion-span conditional attributes.