Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit 47036ca

Browse files
author
Ramon Nogueira
authored
Update HTTP metrics and views. (#48)
* Simplify and reduce requirements * Bring into closer alignment with gRPC * Specify units * Add reference to UCUM. * Tweek measure and tag names. * Inline the prefix.
1 parent cffa0dc commit 47036ca

1 file changed

Lines changed: 32 additions & 25 deletions

File tree

http/stats.md

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,60 @@
11
# HTTP Stats
22

3-
All views and measures have the prefix: "opencensus.io/http". Any particular library might provide only a subset of these measures/views/tags.
3+
Any particular library might provide only a subset of these measures/views/tags.
4+
Check the language-specific documentation for the list of supported values.
45

56
All times (latencies) are measured in float64 fractions of microseconds.
67

78
There is no special support for multi-part HTTP requests and responses. These are just treated as one request.
89

10+
## Units
11+
12+
Units are encoded according to the case-sensitive abbreviations from the [Unified Code for Units of Measure](http://unitsofmeasure.org/ucum.html):
13+
14+
* Latencies are measures in float64 milliseconds, denoted "ms"
15+
* Sizes are measured in bytes, denoted "By"
16+
* Dimensionless values have unit "1"
17+
18+
Buckets for distributions in default views are as follows:
19+
20+
* Size in bytes: 0, 1024, 2048, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216, 67108864, 268435456, 1073741824, 4294967296
21+
* Latency in ms: 0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 16, 20, 25, 30, 40, 50, 65, 80, 100, 130, 160, 200, 250, 300, 400, 500, 650, 800, 1000, 2000, 5000, 10000, 20000, 50000, 100000
22+
923
## Client
1024

1125
All views, measures and tags should have the prefix: "opencensus.io/http/client". For example: "opencensus.io/http/client/started".
1226

1327
### Measures
1428

1529
Client stats are recorded for each individual HTTP request, including for each redirect (followed or not).
30+
Views are defined with the same name as the measure and the aggregation specified under Default View Aggregation.
1631

17-
| Measure suffix | Default View Aggregation | Description |
18-
|--------------------|--------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
19-
| started | sum | Number of all client requests started |
20-
| bytes_sent | sum | Total bytes sent in request body (not including headers). This is uncompressed bytes. |
21-
| bytes_recv | sum | Total bytes received in response bodies (not including headers but including error responses with bodies). Should be measured from actual bytes received and read, not the value of the Content-Length header. This is uncompressed bytes. Responses with no body should record 0 for this value. |
22-
| headers_sent | none | Total number of header lines sent in outgoing requests, not including trailing headers |
23-
| headers_recv | none | Total number of header lines received in responses, not including trailing headers |
24-
| latency | distribution | Time between first byte of request headers sent to last byte of response received, or terminal error |
25-
| connections_opened | count | Number of underlying transport (TCP/TLS) connections opened |
26-
| connections_closed | count | Number of underlying transport (TCP/TLS) connections closed |
32+
| Measure suffix | Default View Aggregation | Description |
33+
|------------------------------------------|--------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
34+
| opencensus.io/http/client/request_count | sum | Number of all client requests started |
35+
| opencensus.io/http/client/request_bytes | distribution | Total bytes sent in request body (not including headers). This is uncompressed bytes. |
36+
| opencensus.io/http/client/response_bytes | distribution | Total bytes received in response bodies (not including headers but including error responses with bodies). Should be measured from actual bytes received and read, not the value of the Content-Length header. This is uncompressed bytes. Responses with no body should record 0 for this value. |
37+
| opencensus.io/http/client/latency | distribution | Time between first byte of request headers sent to last byte of response received, or terminal error |
2738

2839
### Tags
2940

3041
All client metrics should be tagged with the following.
3142

32-
| Tag suffix | Description |
33-
|---------------|----------------------------------------------------------------|
34-
| method | HTTP method, capitalized (i.e. GET, POST, PUT, DELETE, etc.) |
35-
| status_code | HTTP status code, or 0 if no response status line was received |
36-
| response_type | Response media type, if applicable |
37-
| request_type | Request media type, if applicable |
38-
| version | HTTP version in request |
39-
| path | URL path (not including query string) |
40-
| host | Value of the request Host header |
43+
| Tag suffix | Description |
44+
|-------------|----------------------------------------------------------------------|
45+
| http.method | HTTP method, capitalized (i.e. GET, POST, PUT, DELETE, etc.) |
46+
| http.status | HTTP status code, or "error" if no response status line was received |
47+
| http.path | URL path (not including query string) |
48+
| http.host | Value of the request Host header |
4149

4250
### Default views
4351

4452
The following default views are also defined:
4553

46-
| View suffix | Measure suffix | Aggregation | Tags |
47-
|----------------------|----------------|--------------|-------------|
48-
| count_by_status_code | latency | count | status-code |
49-
| ended | latency | count | none |
50-
| latency_by_path | latency | distribution | path |
54+
| View suffix | Measure suffix | Aggregation | Tags |
55+
|---------------------------------------------------------|----------------|-------------|-------------|
56+
| opencensus.io/http/client/response_count_by_status_code | latency | count | status_code |
57+
| opencensus.io/http/client/request_count_by_method | latency | count | method |
5158

5259
## Server
5360

0 commit comments

Comments
 (0)