-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.go
132 lines (123 loc) · 5.96 KB
/
constants.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// Copyright (c) 2019 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
package zanzibar
import "net/http"
const (
endpointRequest = "endpoint.request"
endpointSuccess = "endpoint.success"
endpointStatus = "endpoint.status"
endpointSystemErrors = "endpoint.system-errors"
endpointLatency = "endpoint.latency"
// MetricEndpointPanics is endpoint level panic counter
MetricEndpointPanics = "endpoint.panic"
// endpointAppErrors is the metric name for endpoint level application error for HTTP
endpointAppErrors = "endpoint.app-errors"
// MetricEndpointAppErrors is the metric name for endpoint level application error for TChannel
MetricEndpointAppErrors = "endpoint.app-errors"
clientRequest = "client.request"
clientSuccess = "client.success"
clientStatus = "client.status"
clientErrors = "client.errors"
clientAppErrors = "client.app-errors"
clientSystemErrors = "client.system-errors"
clientLatency = "client.latency"
)
var knownMetrics = []string{
"inbound.calls.recvd",
"inbound.calls.latency",
"inbound.calls.success",
"inbound.calls.app-errors",
"inbound.calls.system-errors",
"inbound.calls.errors",
"inbound.calls.status",
// TChannel docs say it emits 'outbound.calls.sent':
// http://tchannel.readthedocs.io/en/latest/metrics/#call-metrics
// but uber/tchannel-go emits 'outbound.calls.send':
// https://github.com/uber/tchannel-go/blob/3abb4c025c1663b383452339a22d918cf9d0be0b/outbound.go#L196
"outbound.calls.send",
"outbound.calls.sent",
"outbound.calls.latency",
"outbound.calls.success",
"outbound.calls.app-errors",
"outbound.calls.system-errors",
"outbound.calls.errors",
"outbound.calls.status",
}
var knownStatusCodes = map[int]bool{
http.StatusContinue: true, // 100
http.StatusSwitchingProtocols: true, // 101
http.StatusProcessing: true, // 102
http.StatusOK: true, // 200
http.StatusCreated: true, // 201
http.StatusAccepted: true, // 202
http.StatusNonAuthoritativeInfo: true, // 203
http.StatusNoContent: true, // 204
http.StatusResetContent: true, // 205
http.StatusPartialContent: true, // 206
http.StatusMultiStatus: true, // 207
http.StatusAlreadyReported: true, // 208
http.StatusIMUsed: true, // 226
http.StatusMultipleChoices: true, // 300
http.StatusMovedPermanently: true, // 301
http.StatusFound: true, // 302
http.StatusSeeOther: true, // 303
http.StatusNotModified: true, // 304
http.StatusUseProxy: true, // 305
http.StatusTemporaryRedirect: true, // 307
http.StatusPermanentRedirect: true, // 308
http.StatusBadRequest: true, // 400
http.StatusUnauthorized: true, // 401
http.StatusPaymentRequired: true, // 402
http.StatusForbidden: true, // 403
http.StatusNotFound: true, // 404
http.StatusMethodNotAllowed: true, // 405
http.StatusNotAcceptable: true, // 406
http.StatusProxyAuthRequired: true, // 407
http.StatusRequestTimeout: true, // 408
http.StatusConflict: true, // 409
http.StatusGone: true, // 410
http.StatusLengthRequired: true, // 411
http.StatusPreconditionFailed: true, // 412
http.StatusRequestEntityTooLarge: true, // 413
http.StatusRequestURITooLong: true, // 414
http.StatusUnsupportedMediaType: true, // 415
http.StatusRequestedRangeNotSatisfiable: true, // 416
http.StatusExpectationFailed: true, // 417
http.StatusTeapot: true, // 418
http.StatusUnprocessableEntity: true, // 422
http.StatusLocked: true, // 423
http.StatusFailedDependency: true, // 424
http.StatusUpgradeRequired: true, // 426
http.StatusPreconditionRequired: true, // 428
http.StatusTooManyRequests: true, // 429
http.StatusRequestHeaderFieldsTooLarge: true, // 431
http.StatusUnavailableForLegalReasons: true, // 451
http.StatusInternalServerError: true, // 500
http.StatusNotImplemented: true, // 501
http.StatusBadGateway: true, // 502
http.StatusServiceUnavailable: true, // 503
http.StatusGatewayTimeout: true, // 504
http.StatusHTTPVersionNotSupported: true, // 505
http.StatusVariantAlsoNegotiates: true, // 506
http.StatusInsufficientStorage: true, // 507
http.StatusLoopDetected: true, // 508
http.StatusNotExtended: true, // 510
http.StatusNetworkAuthenticationRequired: true, // 511
}