Skip to content

Commit 2cb929b

Browse files
zirainarkodg
andauthored
feat: add runner event metrics (#8802)
* add metrics for runner Signed-off-by: zirain <zirain2009@gmail.com> * rename Signed-off-by: zirain <zirain2009@gmail.com> * rename Signed-off-by: zirain <zirain2009@gmail.com> * reuse Signed-off-by: zirain <zirain2009@gmail.com> --------- Signed-off-by: zirain <zirain2009@gmail.com> Signed-off-by: Arko Dasgupta <arkodg@users.noreply.github.com> Co-authored-by: Arko Dasgupta <arkodg@users.noreply.github.com>
1 parent 84431c9 commit 2cb929b

7 files changed

Lines changed: 31 additions & 2 deletions

File tree

internal/gatewayapi/runner/runner.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ func (r *Runner) subscribeAndTranslate(sub <-chan watchable.Snapshot[string, *re
190190
r.Logger,
191191
message.Metadata{Runner: r.Name(), Message: message.ProviderResourcesMessageName}, sub,
192192
func(update message.Update[string, *resource.ControllerResourcesContext], errChan chan error) {
193+
message.PublishRunnerEventMetric(r.Name(), update.Delete)
194+
193195
parentCtx := context.Background()
194196
if update.Value != nil && update.Value.Context != nil {
195197
parentCtx = update.Value.Context

internal/globalratelimit/runner/runner.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ func (r *Runner) translateFromSubscription(ctx context.Context, c <-chan watchab
145145
r.Logger,
146146
message.Metadata{Runner: r.Name(), Message: message.XDSIRMessageName}, c,
147147
func(update message.Update[string, *message.XdsIRWithContext], errChan chan error) {
148+
message.PublishRunnerEventMetric(r.Name(), update.Delete)
149+
148150
parentCtx := ctx
149151
if update.Value != nil && update.Value.Context != nil {
150152
parentCtx = update.Value.Context

internal/infrastructure/runner/runner.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ func (r *Runner) updateProxyInfraFromSubscription(ctx context.Context, sub <-cha
108108
default:
109109
}
110110
r.Logger.Info("received an update", "key", update.Key, "delete", update.Delete)
111+
message.PublishRunnerEventMetric(r.Name(), update.Delete)
111112
val := update.Value
112113

113114
if update.Delete {

internal/message/metrics.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ var (
3434
"Total number of published updates to watchable queue.",
3535
)
3636

37-
runnerLabel = metrics.NewLabel("runner")
38-
messageLabel = metrics.NewLabel("message")
37+
watchableEventTotal = metrics.NewCounter(
38+
"watchable_event_total",
39+
"Total number of runner events.",
40+
)
41+
42+
runnerLabel = metrics.NewLabel("runner")
43+
messageLabel = metrics.NewLabel("message")
44+
runnerEventTypeLabel = metrics.NewLabel("event_type")
3945
)

internal/message/watchutil.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ func PublishMetric(meta Metadata, count int) {
2727
watchablePublishTotal.WithSuccess(meta.LabelValues()...).Add(float64(count))
2828
}
2929

30+
func PublishRunnerEventMetric(runnerName string, isDelete bool) {
31+
eventType := "update"
32+
if isDelete {
33+
eventType = "delete"
34+
}
35+
watchableEventTotal.With(
36+
runnerEventTypeLabel.Value(eventType),
37+
runnerLabel.Value(runnerName),
38+
).Add(1)
39+
}
40+
3041
func (m Metadata) LabelValues() []metrics.LabelValue {
3142
labels := make([]metrics.LabelValue, 0, 2)
3243
if m.Runner != "" {

internal/xds/runner/runner.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ func (r *Runner) translateFromSubscription(sub <-chan watchable.Snapshot[string,
263263
r.Logger,
264264
message.Metadata{Runner: r.Name(), Message: message.XDSIRMessageName}, sub,
265265
func(update message.Update[string, *message.XdsIRWithContext], errChan chan error) {
266+
message.PublishRunnerEventMetric(r.Name(), update.Delete)
267+
266268
parentCtx := context.Background()
267269
if update.Value != nil && update.Value.Context != nil {
268270
parentCtx = update.Value.Context

release-notes/current.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@ deprecations: |
2121
2222
# Other notable changes not covered by the above sections.
2323
Other changes: |
24+
Moved Envoy Gateway CRDs into a sub-chart to avoid the Helm release secret exceeding the 1MB size limit when adding new API fields. Upgrade/Install behavior is unchanged for users.
25+
The maximum number of rules in a RateLimit policy is increased from 128 to 256.
26+
The maximum number of JWT providers allowed in `SecurityPolicy.spec.jwt.providers` is increased from 4 to 16.
27+
Added `runner_event_total` metric to track update and delete events in infrastructure and gateway API runners for improved observability.
28+

0 commit comments

Comments
 (0)