pinpoint-apm / pinpoint-apm/pinpoint-cpp-agent

Always auto-generate the agent id and remove the AgentId / instance_suffix configuration

Open
#100 0 comments 0 reactions 0 assignees View on GitHub

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 AgentId YAML key and the PINPOINT_CPP_AGENT_ID environment variable.
  • Always auto-generate the agent id at startup as a 22-char URL-safe Base64 UUIDv7 (uniform across UidVersion v1/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).
  • AgentName remains 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_suffix and the C API pt_agent_options_set_instance_suffix().
  • Use a configured AgentName verbatim — it need not be unique across workers.
  • Remove the %suffix% placeholder in Log.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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.