pinpoint-apm / pinpoint-apm/pinpoint-cpp-agent
Always auto-generate the agent id and remove the AgentId / instance_suffix configuration
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Summary
The agent id is currently a user-configurable setting (AgentId YAML key, PINPOINT_CPP_AGENT_ID environment variable), with extra machinery to keep pinned ids unique across pre-fork workers (AgentOptions::instance_suffix / pt_agent_options_set_instance_suffix(), pid-suffix fallback). This complicates identity resolution, while the collector only requires the id to be unique per agent instance — a display label is what users actually want to control.
Proposed changes
1. Remove the agent id configuration; always auto-generate
- Drop the
AgentIdYAML key and thePINPOINT_CPP_AGENT_IDenvironment variable. - Always auto-generate the agent id at startup as a 22-char URL-safe Base64 UUIDv7 (uniform across
UidVersionv1/v3/v4), so every process — including sibling pre-fork workers — gets a unique id by construction. - A config reload keeps the running agent id (identity is non-reloadable).
AgentNameremains the human-readable label and falls back to the generated id when omitted.
2. Remove the instance_suffix feature
With the id always auto-generated per process, the per-worker suffix machinery has no remaining purpose:
- Remove
AgentOptions::instance_suffixand the C APIpt_agent_options_set_instance_suffix(). - Use a configured
AgentNameverbatim — it need not be unique across workers. - Remove the
%suffix%placeholder inLog.FilePath(%pid%remains for per-worker log files).
3. Fix a spurious reload warning for UidVersion: v4
resolve_v4() regenerates a fresh UUIDv7 on every make_config() call, so every v4 config-file reload carried a new agent_id_, tripping isReloadable() inside retainNonReloadableFrom() and logging a spurious "non-reloadable config fields changed at runtime" warning even when the file did not change. Re-resolution on reload should keep the running agent id (and its UUID) intact.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing config resolution through resolve_v4(), make_config(), and retainNonReloadableFrom(), then inspect AgentOptions and the pt_agent_options_set_instance_suffix() API. Check the AgentId, PINPOINT_CPP_AGENT_ID, AgentName, and Log.FilePath handling described in the issue. Done means per-process generated ids remain stable across reloads, instance_suffix and %suffix% are removed, and the obsolete reload warning no longer appears.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api, backend, observability-sre
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100