Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions ecinterface/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,9 @@ import (
"github.com/reddit/baseplate.go/log"
)

const (
promNamespace = "ecinterface"
)

var (
getBeforeSet = promauto.With(prometheusbpint.GlobalRegistry).NewCounter(prometheus.CounterOpts{
Namespace: promNamespace,
Name: "get_before_set_total",
Name: "ecinterface_get_before_set_total",
Help: "Total number of ecinterface.Get calls before Set is called",
})
)
Expand Down
18 changes: 8 additions & 10 deletions grpcbp/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ var (
successLabel,
}

serverLatencyDistribution = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheus.HistogramOpts{
Name: "grpc_server_latency_seconds",
Help: "RPC latencies",
Buckets: prometheusbp.DefaultLatencyBuckets,
}, serverLatencyLabels)
serverLatencyDistribution = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheusbp.HistogramOpts{
Name: "grpc_server_latency_seconds",
Help: "RPC latencies",
}.ToPrometheus(), serverLatencyLabels)

serverTotalRequestLabels = []string{
serviceLabel,
Expand Down Expand Up @@ -73,11 +72,10 @@ var (
clientNameLabel,
}

clientLatencyDistribution = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheus.HistogramOpts{
Name: "grpc_client_latency_seconds",
Help: "RPC latencies",
Buckets: prometheusbp.DefaultLatencyBuckets,
}, clientLatencyLabels)
clientLatencyDistribution = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheusbp.HistogramOpts{
Name: "grpc_client_latency_seconds",
Help: "RPC latencies",
}.ToPrometheus(), clientLatencyLabels)

clientTotalRequestLabels = []string{
serviceLabel,
Expand Down
31 changes: 16 additions & 15 deletions headerbp/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/prometheus/client_golang/prometheus/promauto"

"github.com/reddit/baseplate.go/internal/prometheusbpint"
"github.com/reddit/baseplate.go/prometheusbp"
)

const (
Expand Down Expand Up @@ -37,22 +38,22 @@ var (
headerNameLabel,
})

clientHeadersSentTotal = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheus.HistogramOpts{
Name: "baseplate_client_sent_headers_total",
Help: "Total number of internal headers that were automatically sent by a client",
Buckets: []float64{1, 4, 8, 16, 32, 64, 128},
}, []string{
clientHeadersSentTotal = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheusbp.HistogramOpts{
Name: "baseplate_client_sent_headers_total",
Help: "Total number of internal headers that were automatically sent by a client",
LegacyBuckets: []float64{1, 4, 8, 16, 32, 64, 128},
}.ToPrometheus(), []string{
rpcTypeLabel,
serviceLabel,
clientNameLabel,
clientMethodLabel,
})

clientHeadersSentSize = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheus.HistogramOpts{
Name: "baseplate_client_headers_sent_size_bytes",
Help: "Estimated size (in bytes) of internal headers that were automatically sent by a client",
Buckets: []float64{1, 64, 128, 256, 512, 1024, 2048, 4096},
}, []string{
clientHeadersSentSize = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheusbp.HistogramOpts{
Name: "baseplate_client_headers_sent_size_bytes",
Help: "Estimated size (in bytes) of internal headers that were automatically sent by a client",
LegacyBuckets: []float64{1, 64, 128, 256, 512, 1024, 2048, 4096},
}.ToPrometheus(), []string{
rpcTypeLabel,
serviceLabel,
clientNameLabel,
Expand All @@ -69,11 +70,11 @@ var (
headerNameLabel,
})

serverHeadersReceivedSize = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheus.HistogramOpts{
Name: "baseplate_server_headers_received_size_bytes",
Help: "Estimated size (in bytes) of internal headers that were automatically extracted by a server",
Buckets: []float64{1, 64, 128, 256, 512, 1024, 2048, 4096},
}, []string{
serverHeadersReceivedSize = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheusbp.HistogramOpts{
Name: "baseplate_server_headers_received_size_bytes",
Help: "Estimated size (in bytes) of internal headers that were automatically extracted by a server",
LegacyBuckets: []float64{1, 64, 128, 256, 512, 1024, 2048, 4096},
}.ToPrometheus(), []string{
rpcTypeLabel,
serviceLabel,
serverMethodLabel,
Expand Down
64 changes: 30 additions & 34 deletions httpbp/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,32 @@ var (
endpointLabel,
}

serverLatency = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheus.HistogramOpts{
Name: "http_server_latency_seconds",
Help: "HTTP server request latencies",
Buckets: prometheusbp.DefaultLatencyBuckets,
}, serverLabels)

serverRequestSize = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheus.HistogramOpts{
Name: "http_server_request_size_bytes",
Help: "Request size",
Buckets: payloadSizeBuckets,
}, serverLabels)

serverResponseSize = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheus.HistogramOpts{
Name: "http_server_response_size_bytes",
Help: "Response size",
Buckets: payloadSizeBuckets,
}, serverLabels)

serverTimeToWriteHeader = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheus.HistogramOpts{
Name: "http_server_time_to_write_header_seconds",
Help: "Request size",
Buckets: prometheusbp.DefaultLatencyBuckets,
}, serverLabels)

serverTimeToFirstByte = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheus.HistogramOpts{
Name: "http_server_time_to_first_byte_seconds",
Help: "Time elapsed before first byte was sent",
Buckets: prometheusbp.DefaultLatencyBuckets,
}, serverLabels)
serverLatency = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheusbp.HistogramOpts{
Name: "http_server_latency_seconds",
Help: "HTTP server request latencies",
}.ToPrometheus(), serverLabels)

serverRequestSize = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheusbp.HistogramOpts{
Name: "http_server_request_size_bytes",
Help: "Request size",
LegacyBuckets: payloadSizeBuckets,
}.ToPrometheus(), serverLabels)

serverResponseSize = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheusbp.HistogramOpts{
Name: "http_server_response_size_bytes",
Help: "Response size",
LegacyBuckets: payloadSizeBuckets,
}.ToPrometheus(), serverLabels)

serverTimeToWriteHeader = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheusbp.HistogramOpts{
Name: "http_server_time_to_write_header_seconds",
Help: "Request size",
}.ToPrometheus(), serverLabels)

serverTimeToFirstByte = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheusbp.HistogramOpts{
Name: "http_server_time_to_first_byte_seconds",
Help: "Time elapsed before first byte was sent",
}.ToPrometheus(), serverLabels)

serverTotalRequestLabels = []string{
methodLabel,
Expand Down Expand Up @@ -100,11 +97,10 @@ var (
clientNameLabel,
}

clientLatencyDistribution = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheus.HistogramOpts{
Name: "http_client_latency_seconds",
Help: "HTTP client request latencies",
Buckets: prometheusbp.DefaultLatencyBuckets,
}, clientLatencyLabels)
clientLatencyDistribution = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheusbp.HistogramOpts{
Name: "http_client_latency_seconds",
Help: "HTTP client request latencies",
}.ToPrometheus(), clientLatencyLabels)

clientTotalRequestLabels = []string{
methodLabel,
Expand Down
12 changes: 4 additions & 8 deletions internal/limitopen/limitopen.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import (
)

const (
promNamespace = "limitopen"

pathLabel = "path"
)

Expand All @@ -26,15 +24,13 @@ var (
}

sizeGauge = promauto.With(prometheusbpint.GlobalRegistry).NewGaugeVec(prometheus.GaugeOpts{
Namespace: promNamespace,
Name: "file_size_bytes",
Help: "The size of the file opened by limitopen.Open",
Name: "limitopen_file_size_bytes",
Help: "The size of the file opened by limitopen.Open",
}, sizeLabels)

softLimitCounter = promauto.With(prometheusbpint.GlobalRegistry).NewCounterVec(prometheus.CounterOpts{
Namespace: promNamespace,
Name: "softlimit_violation_total",
Help: "The total number of violations of softlimit",
Name: "limitopen_softlimit_violation_total",
Help: "The total number of violations of softlimit",
}, sizeLabels)
)

Expand Down
52 changes: 17 additions & 35 deletions kafkabp/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,17 @@ import (
)

const (
promNamespace = "kafkabp"

subsystemConsumer = "consumer"
subsystemGroupConsumer = "group_consumer"

successLabel = "kafka_success"
topicLabel = "kafka_topic"
topicLabel = "kafka_topic"
)

var (
rebalanceTotalCounter = promauto.With(prometheusbpint.GlobalRegistry).NewCounter(prometheus.CounterOpts{
Namespace: promNamespace,
Subsystem: subsystemConsumer,
Name: "rebalances_total",
Help: "The number of times consumer rebalance happened",
Name: "kafkabp_consumer_rebalances_total",
Help: "The number of times consumer rebalance happened",
})
rebalanceFailureCounter = promauto.With(prometheusbpint.GlobalRegistry).NewCounter(prometheus.CounterOpts{
Namespace: promNamespace,
Subsystem: subsystemConsumer,
Name: "rebalance_failures_total",
Help: "The number of times consumer rebalance failed",
Name: "kafkabp_consumer_rebalance_failures_total",
Help: "The number of times consumer rebalance failed",
})
)

Expand All @@ -38,34 +28,26 @@ var (
topicLabel,
}

consumerTimer = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheus.HistogramOpts{
Namespace: promNamespace,
Subsystem: subsystemConsumer,
Name: "duration_seconds",
Help: "The time took for a non-group consumer to consume a single kafka message",
Buckets: prometheusbp.DefaultLatencyBuckets,
}, timerLabels)
consumerTimer = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheusbp.HistogramOpts{
Name: "kafkabp_consumer_duration_seconds",
Help: "The time took for a non-group consumer to consume a single kafka message",
}.ToPrometheus(), timerLabels)

groupConsumerTimer = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheus.HistogramOpts{
Namespace: promNamespace,
Subsystem: subsystemGroupConsumer,
Name: "duration_seconds",
Help: "The time took for a group consumer to consume a single kafka message",
Buckets: prometheusbp.DefaultLatencyBuckets,
}, timerLabels)
groupConsumerTimer = promauto.With(prometheusbpint.GlobalRegistry).NewHistogramVec(prometheusbp.HistogramOpts{
Name: "kafkabp_group_consumer_duration_seconds",
Help: "The time took for a group consumer to consume a single kafka message",
}.ToPrometheus(), timerLabels)
)

var (
awsRackFailure = promauto.With(prometheusbpint.GlobalRegistry).NewCounter(prometheus.CounterOpts{
Namespace: promNamespace,
Name: "aws_rack_id_failures_total",
Help: "Total failures of getting rack id from AWS endpoint",
Name: "kafkabp_aws_rack_id_failures_total",
Help: "Total failures of getting rack id from AWS endpoint",
})

httpRackFailure = promauto.With(prometheusbpint.GlobalRegistry).NewCounter(prometheus.CounterOpts{
Namespace: promNamespace,
Name: "http_rack_id_failures_total",
Help: "Total failures of getting rack id from http endpoint",
Name: "kafkabp_http_rack_id_failures_total",
Help: "Total failures of getting rack id from http endpoint",
})
)

Expand Down
12 changes: 6 additions & 6 deletions log/core_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import (

"go.uber.org/zap/zapcore"

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/reddit/baseplate.go/internal/prometheusbpint"
"github.com/reddit/baseplate.go/internal/thriftint"
"github.com/reddit/baseplate.go/prometheusbp"
)

var (
logWriteDurationSeconds = promauto.With(prometheusbpint.GlobalRegistry).NewHistogram(
prometheus.HistogramOpts{
Name: "baseplate_log_write_duration_seconds",
Help: "Latency of log writes",
Buckets: []float64{
prometheusbp.HistogramOpts{
Name: "baseplate_log_write_duration_seconds",
Help: "Latency of log writes",
LegacyBuckets: []float64{
0.000_005,
0.000_010,
0.000_050,
Expand All @@ -31,7 +31,7 @@ var (
0.5,
1.0,
},
},
}.ToPrometheus(),
)
)

Expand Down
6 changes: 2 additions & 4 deletions log/wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,8 @@ type Counter interface {
//
// // a global variable
// var tracingFailures = promauto.NewCounter(prometheus.CounterOpts{
// Namespace: "myservice",
// Subsystem: "tracing",
// Name: "failures_total",
// Help: "Total number of failures when sending tracing spans to the sidecar",
// Name: "myservice_tracing_failures_total",
// Help: "Total number of failures when sending tracing spans to the sidecar",
// })
//
// // in main
Expand Down
Loading