[Design Proposal] OTel exporter (tracing) token management #1312
AnoshanJ
started this conversation in
Design Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Problem
When an agent is deployed, or an external agent is connected, the platform issues a tracing API key: an RS256 JWT signed by agent-manager-service, sent by the instrumentation SDK on every trace export in the
x-amp-api-keyheader. Today:generateAgentAPIKeyinservices/agent_manager.go).Ref: #1063.
Existing Solutions
services/agent_apikey_service.go), with changes pushed to gateways over websocket plus a bulk-sync fallback (services/apikey_broadcaster.go). Tracing keys have none of this because they are stateless JWTs that the gateway validates against JWKS only.Proposed Solution
Overview
No single option solves this, so the options are ranked.
Option 1: short default expiry plus manual regenerate with custom expiry
Phase 1): Make the deployed-agent token expiry configurable instead of the hardcoded 1 year duration, and add a regenerate flow:
POST /orgs/{org}/projects/{proj}/agents/{agent}/tracing-token/regenerateIt mints a new token with optional expiry parameter, upserts the KV secret (the secret reference is stable, so traits don't change), and restarts the workload by stampingrestartedAton the ReleaseBinding. That is a pod rollout, not a full redeploy;clients/openchoreosvc/client/deployments.goalready does this internally.Challenges: without auto-rotation, a short default risks trace outages when tokens expire unnoticed. Phase 1 therefore keeps a conservative default (90 days, open to feedback) and documents the manual refresh responsibility. Old tokens stay valid until their expiry.
Optional Phase 2: auto-rotation job
A background scheduler in agent-manager-service, following the existing monitor scheduler pattern. It finds tokens expiring within a threshold (around 7 days), regenerates them, upserts the secret, and restarts the workload. With this in place a 30-day default becomes safe.
Option 2: persist jti and expiry, revoke with gateway support
Add a
jticlaim to issued tokens, persist issued-token records (jti, agent, environment, expiry), and expose revoke APIs and UI. Revoked jtis would reach gateways over a sync channel with the gateway. Denylist entries expire with the token, so state stays bounded.Blocker: the gateway's
jwt-authpolicy validates statelessly and has no denylist support, so this needs an enhancement on the API Platform gateway side. Thejticlaim itself can ship in phase 1, so tokens issued from now on become revocable once the gateway supports it.Additionally: document signing-key rotation (already possible)
The JWKS already supports multiple keys with an active-key selector (
JWT_SIGNING_ACTIVE_KEY_ID). Rotating the RSA key and dropping the oldkidkills every outstanding tracing token within the gateway's JWKS cache TTL (about 5 minutes). This needs only be documented.Option 5: Thunder AgentID tokens (not pursued)
Per-agent Thunder client_credentials identities already exist and could in theory be exchanged for short-lived tracing tokens with custom claims. But AgentID exists for agent access control, not trace publishing. Reusing it couples two unrelated credential lifecycles and requires token-refresh logic in both instrumentation SDKs. Listed only for completeness.
Out of Scope
MCP, CLI, and Skill Components
amctlalready outputs a token on external-agent create. A rotate command is a possible follow-up once the REST endpoint exists.Open Questions
Milestones
jticlaim, docs including the signing-key-rotation runbookDependencies: Phase 3 requires denylist support in the API Platform gateway's
jwt-authpolicy.All reactions