[draft] feat(monitoring): add byte metrics with aggregate Prometheus gauges#285
Open
gimballock wants to merge 1 commit intostratum-mining:mainfrom
Open
[draft] feat(monitoring): add byte metrics with aggregate Prometheus gauges#285gimballock wants to merge 1 commit intostratum-mining:mainfrom
gimballock wants to merge 1 commit intostratum-mining:mainfrom
Conversation
4db15b0 to
017e05a
Compare
Add bytes_received/bytes_sent tracking across all three components
(pool, jd-client, translator) for SV2 channels and SV1 clients.
SV2 byte tracking:
- Per-channel (bytes_received, bytes_sent) counters in pool, jd-client,
and translator, keyed by channel_id in bytes_by_channel maps
- Shared mining_message_channel_id() helper in protocol_message_type.rs
to extract channel_id from parsed Mining messages
- Raw frame payload guard (len >= 4) for channel_id extraction from
unparsed upstream frames in jd-client and translator
- Cleanup in all CloseChannel handlers and ChannelManagerData::reset()
- JDC record_upstream_sent_bytes() eliminates double-lock on sends
SV1 byte tracking (translator only):
- Arc<AtomicU64> counters in ConnectionSV1, shared with DownstreamData
- Reader counts line.len()+1 (newline stripped by LinesCodec)
- Writer counts serialized JSON bytes before write_all
Prometheus metrics (fixed cardinality):
- sv2_server_bytes_{received,sent}_total — aggregate scalar Gauges
- sv2_client_bytes_{received,sent}_total — aggregate scalar Gauges
- sv1_client_bytes_{received,sent}_total — per-client GaugeVec
(1:1 with TCP connections, appropriate granularity)
Per-channel byte detail remains available via the JSON REST API
(/api/v1/server/channels, /api/v1/clients/{id}/channels,
/api/v1/sv1/clients) for drill-down without inflating Prometheus
time series cardinality.
Aggregate byte totals added to ServerSummary and Sv2ClientsSummary
so /api/v1/global includes byte totals alongside hashrate and
channel counts.
017e05a to
e152487
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add bytes_received/bytes_sent tracking across all three components
(pool, jd-client, translator) for SV2 channels and SV1 clients.
SV2 byte tracking:
and translator, keyed by channel_id in bytes_by_channel maps
to extract channel_id from parsed Mining messages
unparsed upstream frames in jd-client and translator
SV1 byte tracking (translator only):
Prometheus metrics (fixed cardinality):
(1:1 with TCP connections, appropriate granularity)
Per-channel byte detail remains available via the JSON REST API
(/api/v1/server/channels, /api/v1/clients/{id}/channels,
/api/v1/sv1/clients) for drill-down without inflating Prometheus
time series cardinality.
Aggregate byte totals added to ServerSummary and Sv2ClientsSummary
so /api/v1/global includes byte totals alongside hashrate and
channel counts.