-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.go
40 lines (36 loc) · 1.78 KB
/
global.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
//nolint:gochecknoglobals // global registrations.
package metrics
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
const (
FunctionNameLabel = "functionName"
InvocationRoleArnLabel = "invocationRole"
ErrorLabel = "error"
)
var (
AwsLambdaInvocationLabels = []string{FunctionNameLabel, InvocationRoleArnLabel}
HTTPRequestLabels = []string{"method", "code", FunctionNameLabel, InvocationRoleArnLabel}
HTTPRequestsTotal = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "http_requests_total", Help: "total count of http requests",
}, HTTPRequestLabels)
HTTPRequestsDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
Name: "http_request_duration_seconds", Help: "duration of http requests in seconds",
}, HTTPRequestLabels)
HTTPRequestsSize = promauto.NewHistogramVec(prometheus.HistogramOpts{
Name: "http_request_size_bytes", Help: "total size of http requests",
}, HTTPRequestLabels)
HTTPResponsesSize = promauto.NewHistogramVec(prometheus.HistogramOpts{
Name: "http_response_size_bytes", Help: "total size of http responses",
}, HTTPRequestLabels)
AwsLambdaInvocationTotal = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "aws_lambda_invocation_total", Help: "total count of AWS lambda invocations by ARN",
}, AwsLambdaInvocationLabels)
AwsLambdaInvocationErrors = promauto.NewCounterVec(prometheus.CounterOpts{
Name: "aws_lambda_invocation_errors_total", Help: "AWS lambda invocation errors by ARN",
}, append(AwsLambdaInvocationLabels, ErrorLabel))
AwsLambdaInvocationDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
Name: "aws_lambda_invocation_duration_seconds", Help: "duration of AWS lambda invocations by ARN",
}, AwsLambdaInvocationLabels)
)