Skip to content

feat(policies): name the OTLP policy scope attribute pktvisor.policy.name - #814

Draft
leoparente wants to merge 2 commits into
developfrom
feat/otel-policy-scope-key
Draft

leoparente wants to merge 2 commits into
developfrom
feat/otel-policy-scope-key

Conversation

@leoparente

@leoparente leoparente commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

pktvisor tags each policy's OTLP instrumentation scope with the policy name, which the orb-agent OTLP bridge reads to attribute the series. The attribute key moves from policy_name to pktvisor.policy.name, following the OpenTelemetry naming conventions: dot-delimited namespaces, and the application's own namespace for custom attributes. pktvisor is used outside orb-agent, so it takes its own namespace rather than orb's.

Merge after the orb-agent bridge change, netboxlabs/orb-agent#814, which reads pktvisor.policy.name and falls back to policy_name. The orb-agent image takes pktvisor's develop-alpine at build time, so a pktvisor with the new key under a bridge that only knows policy_name would leave pktvisor's series unattributed.

Change

  • PolicyManager::opentelemetry_metrics sets the scope attribute key to pktvisor.policy.name.
  • The scope name (pktvisor/<policy>), the value, the datapoint labels and the Prometheus output are unchanged.

Test

"OpenTelemetry push tags each policy's scope with pktvisor.policy.name" (src/tests/test_policies.cpp) loads two policies, closes a window on each, and checks that each scope:

  • is named pktvisor/<policy>;
  • carries exactly pktvisor.policy.name = <policy>;
  • carries no policy_name.

On the previous key, the key assertion fails for both policies.

Verification

ctest on macOS: 24/25. unit-tests-input-netprobe fails the same way on develop on this machine and passes in CI.

🤖 Generated with Claude Code

Each policy's OTLP instrumentation scope now carries its name under orb.policy.name, following OpenTelemetry attribute naming, instead of policy_name. The scope name (pktvisor/<policy>), the attribute value, the datapoint labels and the Prometheus output are unchanged.

The orb-agent OTLP bridge reads orb.policy.name and falls back to policy_name, so agents keep attributing series from older pktvisor builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leoparente

Copy link
Copy Markdown
Contributor Author

@codex review

@leoparente

Copy link
Copy Markdown
Contributor Author

/ai-review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T12:28:42.547218Z 358294c Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@nbl-ai-review

nbl-ai-review Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

AI Code Review — risk tier: Lite · dimensions run: correctness, security

Advisory only. A human owns the merge decision.

Summary — Straightforward rename of the OTLP policy scope attribute key from policy_name to orb.policy.name, matched by an updated test. No correctness or security issues found; this is a net-positive change.

🤖 AI Code Review · run · prompts: code-review/v1 · models: claude-sonnet-5/medium · context: description · 3 comment(s) · 0 prior AI review(s) · usage: $0.49 · 692k in (91% cached) · 1.7k out

@nbl-ai-review

nbl-ai-review Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

AI Code Review — risk tier: Lite · dimensions run: correctness, security

Advisory only. A human owns the merge decision.

Summary — Clean, net-positive change: renames the OTLP metric attribute key from policy_name to pktvisor.policy.name with a matching test update. No logic changes, no security-sensitive surface touched, and no other code references the old key.

No findings.

🤖 AI Code Review · run · prompts: code-review/v1 · models: claude-sonnet-5/medium · context: description · 6 comment(s) · 2 prior AI review(s) · usage: $0.6 · 1025k in (94% cached) · 3.2k out

Previous review · 2026-11-16 · 7299703

AI Code Review — risk tier: Lite · dimensions run: correctness, security

Advisory only. A human owns the merge decision.

Summary — Net-positive, trivial rename of the OTLP policy scope attribute key from policy_name to orb.policy.name, with matching test coverage updated to verify the new key and the absence of the old one. No correctness or security issues found.

🤖 AI Code Review · run · prompts: code-review/v1 · models: claude-sonnet-5/medium · context: description · 3 comment(s) · 0 prior AI review(s) · usage: $0.32 · 632k in (97% cached) · 1.6k out

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 7299703de6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

LCOV of commit 358294c during Debug Builds #290

Summary coverage rate:
  source files: 149
  lines.......: 88.0% (20204 of 22968 lines)
  functions...: 81.0% (2110 of 2605 functions)
  branches....: no data found
Message summary:
  no messages were reported

Files changed coverage rate: n/a

Full coverage report

pktvisor is used outside orb-agent, so the scope attribute takes the
project's own namespace, pktvisor.policy.name, rather than orb's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leoparente leoparente changed the title feat(policies): name the OTLP policy scope attribute orb.policy.name feat(policies): name the OTLP policy scope attribute pktvisor.policy.name Nov 16, 2026
@leoparente

Copy link
Copy Markdown
Contributor Author

/ai-review

@nbl-ai-review

nbl-ai-review Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

🔁 AI Code Review updated for 358294cf — see the review · 0 resolved · 0 open (run)

@leoparente

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 358294cf71

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant