generated from ipfs/ipfs-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
routing/http: feat: add client latency measure
Note that this measure includes some labels that also record: - HTTP status codes - HTTP method and path - Errors returned by the HTTP client - Call counts (included as part of histogram measure)
- Loading branch information
Showing
4 changed files
with
161 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package client | ||
|
||
import ( | ||
"go.opencensus.io/stats" | ||
"go.opencensus.io/stats/view" | ||
"go.opencensus.io/tag" | ||
) | ||
|
||
var ( | ||
distMS = view.Distribution(0, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000) | ||
|
||
measureLatency = stats.Int64("routing_http_client_latency", "the latency of operations by the routing HTTP client", stats.UnitMilliseconds) | ||
|
||
keyOperation = tag.MustNewKey("operation") | ||
keyHost = tag.MustNewKey("host") | ||
keyStatusCode = tag.MustNewKey("code") | ||
keyError = tag.MustNewKey("error") | ||
|
||
ViewLatency = &view.View{ | ||
Measure: measureLatency, | ||
Aggregation: distMS, | ||
TagKeys: []tag.Key{keyOperation, keyHost, keyStatusCode, keyError, tag.MustNewKey("name")}, | ||
} | ||
|
||
OpenCensusViews = []*view.View{ | ||
ViewLatency, | ||
} | ||
) |