Skip to content

Add Prometheus metrics endpoint for market gateway#6

Open
jfust3 wants to merge 3 commits into
GautamKumarOffical:mainfrom
jfust3:hustlebot/prometheus-metrics-issue-5
Open

Add Prometheus metrics endpoint for market gateway#6
jfust3 wants to merge 3 commits into
GautamKumarOffical:mainfrom
jfust3:hustlebot/prometheus-metrics-issue-5

Conversation

@jfust3

@jfust3 jfust3 commented Jun 19, 2026

Copy link
Copy Markdown

Summary

Adds a Prometheus-compatible /metrics endpoint for the Go market gateway so operators can scrape build info, uptime, order/trade counters, active WebSocket connections, order book depth, and matching latency without shell access.

Closes #5.

Changes

  • Adds a lightweight market/metrics exporter using Prometheus text format.
  • Tracks order counts by type/side and matching latency in the matching engine.
  • Exposes active WebSocket connection counts from the hub.
  • Starts /metrics on METRICS_PORT or --metrics-port (default 9090), with --metrics=false to disable it.
  • Documents the endpoint and response shape in docs/API_REFERENCE.md.
  • Adds focused exporter coverage for the required metric names and labels.

Testing

  • go test . ./matching ./metrics ./orderbook ./types ./ws — passed
  • git diff --check — passed
  • go test ./... — attempted, but unrelated existing packages fail before/without this change (analytics, compliance, ai, and gateway currently have unused imports, undefined symbols, and duplicate helper declarations).
  • python3 build.py — generated and committed diagnostic/build-c7ff674b.logd plus diagnostic/build-c7ff674b.json; exits non-zero because unrelated repo modules are missing local toolchains or fail outside this change (cargo, cmake, Java runtime, luac, ghc, and existing frailbox C build error).

Checklist

  • Relevant modules affected by these changes build locally
  • Tests pass locally
  • Diagnostic build log is committed in this PR
  • Documentation has been updated, if applicable
  • Configuration or schema changes are documented, if applicable
  • No generated build artifacts are committed, except the required diagnostic build log
  • Changes are scoped to the PR purpose and avoid unrelated cleanup
  • Security, privacy, and error-handling implications have been considered

  • I would like to request that my diagnostic build log is removed before merging

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for the PR. I don't see the encrypted build diagnostic log artifact (*.logd / builds.compact) committed on this branch yet. Please rerun the build diagnostic/encryption step with the fixed encryptly tooling and commit the generated encrypted log artifact to this PR (typically under diagnostic/).

Blocking review until the encrypted diagnostic log artifact is present.

@jfust3

jfust3 commented Jun 19, 2026

Copy link
Copy Markdown
Author

Thanks for the review — fixed. I repaired the local build diagnostic generation issue, reran python3 build.py, and committed the generated encrypted diagnostic artifacts:

  • diagnostic/build-c7ff674b.logd
  • diagnostic/build-c7ff674b.json

Also re-ran go test . ./matching ./metrics ./orderbook ./types ./ws and git diff --check; both pass. The full build command still exits non-zero only because unrelated repo modules are missing local toolchains / have pre-existing failures outside this change, and those failures are captured in the diagnostic metadata.

GautamKumarOffical pushed a commit that referenced this pull request Jun 20, 2026
* Improve build command diagnostics

* Add build diagnostics for e73376d
Nexussyn added a commit to Nexussyn/TentOfTrials that referenced this pull request Jun 22, 2026
…Preserve overlong watchdog log lines for
Nexussyn added a commit to Nexussyn/TentOfTrials that referenced this pull request Jun 22, 2026
…Preserve overlong watchdog log lines for
Nexussyn added a commit to Nexussyn/TentOfTrials that referenced this pull request Jun 22, 2026
…Preserve overlong watchdog log lines for
Nexussyn added a commit to Nexussyn/TentOfTrials that referenced this pull request Jun 22, 2026
…Preserve overlong watchdog log lines for
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.

[$35 BOUNTY] [Go] Prometheus metrics export for market gateway

1 participant