-
Notifications
You must be signed in to change notification settings - Fork 383
feat: add metrics to status protocol #5059
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
25c93cb
f8a5587
0a90183
25e2eba
1d208bc
86b392d
78f2bb3
f018c93
aaa58c1
bd3d899
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,21 +17,22 @@ import ( | |
| ) | ||
|
|
||
| type statusSnapshotResponse struct { | ||
| Overlay string `json:"overlay"` | ||
| Proximity uint `json:"proximity"` | ||
| BeeMode string `json:"beeMode"` | ||
| ReserveSize uint64 `json:"reserveSize"` | ||
| ReserveSizeWithinRadius uint64 `json:"reserveSizeWithinRadius"` | ||
| PullsyncRate float64 `json:"pullsyncRate"` | ||
| StorageRadius uint8 `json:"storageRadius"` | ||
| ConnectedPeers uint64 `json:"connectedPeers"` | ||
| NeighborhoodSize uint64 `json:"neighborhoodSize"` | ||
| RequestFailed bool `json:"requestFailed,omitempty"` | ||
| BatchCommitment uint64 `json:"batchCommitment"` | ||
| IsReachable bool `json:"isReachable"` | ||
| LastSyncedBlock uint64 `json:"lastSyncedBlock"` | ||
| CommittedDepth uint8 `json:"committedDepth"` | ||
| IsWarmingUp bool `json:"isWarmingUp"` | ||
| Overlay string `json:"overlay"` | ||
| Proximity uint `json:"proximity"` | ||
| BeeMode string `json:"beeMode"` | ||
| ReserveSize uint64 `json:"reserveSize"` | ||
| ReserveSizeWithinRadius uint64 `json:"reserveSizeWithinRadius"` | ||
| PullsyncRate float64 `json:"pullsyncRate"` | ||
| StorageRadius uint8 `json:"storageRadius"` | ||
| ConnectedPeers uint64 `json:"connectedPeers"` | ||
| NeighborhoodSize uint64 `json:"neighborhoodSize"` | ||
| RequestFailed bool `json:"requestFailed,omitempty"` | ||
| BatchCommitment uint64 `json:"batchCommitment"` | ||
| IsReachable bool `json:"isReachable"` | ||
| LastSyncedBlock uint64 `json:"lastSyncedBlock"` | ||
| CommittedDepth uint8 `json:"committedDepth"` | ||
| IsWarmingUp bool `json:"isWarmingUp"` | ||
| Metrics map[string]string `json:"metrics,omitempty"` | ||
|
||
| } | ||
|
|
||
| type statusResponse struct { | ||
|
|
@@ -98,6 +99,7 @@ func (s *Service) statusGetHandler(w http.ResponseWriter, _ *http.Request) { | |
| LastSyncedBlock: ss.LastSyncedBlock, | ||
| CommittedDepth: uint8(ss.CommittedDepth), | ||
| IsWarmingUp: s.isWarmingUp, | ||
| Metrics: ss.Metrics, | ||
| }) | ||
| } | ||
|
|
||
|
|
@@ -146,6 +148,7 @@ func (s *Service) statusGetPeersHandler(w http.ResponseWriter, r *http.Request) | |
| snapshot.IsReachable = ss.IsReachable | ||
| snapshot.LastSyncedBlock = ss.LastSyncedBlock | ||
| snapshot.CommittedDepth = uint8(ss.CommittedDepth) | ||
| snapshot.Metrics = ss.Metrics | ||
| } | ||
|
|
||
| mu.Lock() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could add a string argument to the method, which would serve as a label for metrics. This way, we can easily distinguish between 'bzz' and 'bytes' in the endpoint data, because the download speed depends on the logic behind the handlers, and the logic in 'bzz' is more complex than in 'bytes'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice idea, thanks.