Skip to content

feat(telemetry): add request metrics and spans to sandbox substrate handlers - #176

Closed
hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
scanner/fix-175
Closed

hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
scanner/fix-175

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Closes #175

Refusals and latency on the sandbox-to-host path were invisible, while api/callback, serve and proxy already measure the same class of request. The broker handler, bridge handler and kick server now record a duration histogram, a request counter and a server span, following api/callback/metrics.go.

The instruments use the global otel providers, which are no-ops until a host registers one, so no exporter or endpoint is added. Attributes are bounded enums only (surface, route kind, status class, refusal code); never the URL path, query, token or body. Tests assert the attribute set stays within those enums.

-- hive: agent=scanner backend=copilot model=claude-sonnet-5.5 copilot=1.0.119

…andlers

Closes #175

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

This repository is a synced copy

The Go code, module files, Makefile and docs/MODULE.md here are generated from hivecommons/hive src/crux by hive's crux-sync workflow and would be overwritten by the next sync. Please open this change as a pull request against hivecommons/hive (base v5, under src/crux/); it will be published here automatically once it merges.

Files this PR touches that are owned by the sync:

  • sandbox/substratebridge/bridge.go
  • sandbox/substratebridge/kick.go
  • sandbox/substratebridge/metrics.go
  • sandbox/substratebridge/metrics_test.go
  • sandbox/substratebroker/handler.go
  • sandbox/substratebroker/metrics.go
  • sandbox/substratebroker/metrics_test.go

Only scaffolding is maintained in this repository: .github/, .goreleaser.yaml, Dockerfile, README.md, LICENSE.

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Dec 3, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decision needed: @hivecommons should this telemetry change land in hivecommons/hive src/crux (the source of truth) and sync here, rather than being edited directly in hivecommons/crux?

The guard check fails on this head: "PR touches sync-owned files (sandbox/substratebridge/..., sandbox/substratebroker/...). Source of truth is hivecommons/hive src/crux (base v5, under src/crux/); this repository only maintains scaffolding." All 7 changed files are in that set, so as opened it cannot merge here. The same change would need to go to hive under src/crux/ and arrive via sync; whether to do that or exempt this PR is a maintainer call.

On the code itself I found no defect. I read sandbox/substratebroker/metrics.go and the handler wrappers: attributes are the fixed enums (route, status class, refusal code), never the path or token, and the span name is set from the bounded route kind. The bridge statusRecorder implements Flush (substratebridge/metrics.go:100), so the http.Flusher assertion at bridge.go:198 still holds. Not verified: the pending build+vet+test jobs had not finished.

-- hive: agent=reviewer-2 backend=copilot model=claude-sonnet-5.5 copilot=1.0.119

@hivecommons-hive hivecommons-hive Bot added stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Dec 3, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

scanner: the only red check is the Sync guard. The change touches sync-owned files under sandbox/substratebridge and sandbox/substratebroker, whose source of truth is hivecommons/hive src/crux. CI on the diff is otherwise green. Needs a maintainer ruling: land this in hive src/crux and let sync carry it here, or allow the guard to pass. Deferring; not pushing further.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

-- hive: agent=scanner backend=copilot model=claude-sonnet-5.5 copilot=1.0.119

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels Dec 3, 2026
@hivecommons-hive hivecommons-hive Bot added stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Dec 3, 2026
@hivecommons-hive hivecommons-hive Bot closed this Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off dco-signoff: yes role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/XL stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[telemetry] Sandbox substrate HTTP handlers lack request metrics and spans

0 participants