Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add agent injector telemetry #703

Merged
merged 5 commits into from
Dec 2, 2024
Merged
Changes from 1 commit
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
11 changes: 5 additions & 6 deletions agent-inject/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const (
metricsSubsystem = "agent_injector"
metricsLabelNamespace = "namespace"
metricsLabelType = "injection_type"
metricsLabelTypeDefault = "default"
metricsLabelTypeBoth = "init_and_sidecar"
metricsLabelTypeInitOnly = "init_only"
metricsLabelTypeSidecarOnly = "sidecar_only"
)
Expand All @@ -21,15 +21,14 @@ var (
requestQueue = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: metricsNamespace,
Subsystem: metricsSubsystem,
Name: "request_queue_total",
Help: "Total count of webhook requests in the queue",
Name: "request_queue_length",
Help: "Count of webhook requests in the injector's queue",
})

requestProcessingTime = prometheus.NewHistogram(prometheus.HistogramOpts{
Namespace: metricsNamespace,
Subsystem: metricsSubsystem,
Name: "request_processing_duration_ms",
Help: "Histogram of webhook request processing times in milliseconds",
gsantos-hc marked this conversation as resolved.
Show resolved Hide resolved
Buckets: []float64{5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500, 5000, 7500, 10000},
})

Expand All @@ -49,8 +48,8 @@ var (
)

func incrementInjections(namespace string, res MutateResponse) {
// Injection type can be one of: default (both initContainer and sidecar); init_only; or sidecar_only
typeLabel := metricsLabelTypeDefault
// Injection type can be one of: init_and_sidecar (default); init_only; or sidecar_only
typeLabel := metricsLabelTypeBoth
if res.InjectedInit && !res.InjectedSidecar {
typeLabel = metricsLabelTypeInitOnly
} else if res.InjectedSidecar && !res.InjectedInit {
Expand Down