Merge pull request #8935 from lengrongfu/feat/add-metrics-for-dropped-events

add metrics for discarding events
This commit is contained in:
Phil Estes 2023-08-22 09:09:31 -04:00 committed by GitHub
commit de066a37dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 10 deletions

View File

@ -457,6 +457,7 @@ func (c *criService) generateAndSendContainerEvent(ctx context.Context, containe
select { select {
case c.containerEventsChan <- event: case c.containerEventsChan <- event:
default: default:
containerEventsDroppedCount.Inc()
log.G(ctx).Debugf("containerEventsChan is full, discarding event %+v", event) log.G(ctx).Debugf("containerEventsChan is full, discarding event %+v", event)
} }
} }

View File

@ -29,11 +29,12 @@ var (
sandboxRuntimeStopTimer metrics.LabeledTimer sandboxRuntimeStopTimer metrics.LabeledTimer
sandboxRemoveTimer metrics.LabeledTimer sandboxRemoveTimer metrics.LabeledTimer
containerListTimer metrics.Timer containerListTimer metrics.Timer
containerRemoveTimer metrics.LabeledTimer containerRemoveTimer metrics.LabeledTimer
containerCreateTimer metrics.LabeledTimer containerCreateTimer metrics.LabeledTimer
containerStopTimer metrics.LabeledTimer containerStopTimer metrics.LabeledTimer
containerStartTimer metrics.LabeledTimer containerStartTimer metrics.LabeledTimer
containerEventsDroppedCount metrics.Counter
networkPluginOperations metrics.LabeledCounter networkPluginOperations metrics.LabeledCounter
networkPluginOperationsErrors metrics.LabeledCounter networkPluginOperationsErrors metrics.LabeledCounter
@ -57,6 +58,7 @@ func init() {
containerCreateTimer = ns.NewLabeledTimer("container_create", "time to create a container", "runtime") containerCreateTimer = ns.NewLabeledTimer("container_create", "time to create a container", "runtime")
containerStopTimer = ns.NewLabeledTimer("container_stop", "time to stop a container", "runtime") containerStopTimer = ns.NewLabeledTimer("container_stop", "time to stop a container", "runtime")
containerStartTimer = ns.NewLabeledTimer("container_start", "time to start a container", "runtime") containerStartTimer = ns.NewLabeledTimer("container_start", "time to start a container", "runtime")
containerEventsDroppedCount = ns.NewCounter("container_events_dropped", "count container discarding event total from server start")
networkPluginOperations = ns.NewLabeledCounter("network_plugin_operations_total", "cumulative number of network plugin operations by operation type", "operation_type") networkPluginOperations = ns.NewLabeledCounter("network_plugin_operations_total", "cumulative number of network plugin operations by operation type", "operation_type")
networkPluginOperationsErrors = ns.NewLabeledCounter("network_plugin_operations_errors_total", "cumulative number of network plugin operations by operation type", "operation_type") networkPluginOperationsErrors = ns.NewLabeledCounter("network_plugin_operations_errors_total", "cumulative number of network plugin operations by operation type", "operation_type")

View File

@ -534,6 +534,7 @@ func (c *criService) generateAndSendContainerEvent(ctx context.Context, containe
select { select {
case c.containerEventsChan <- event: case c.containerEventsChan <- event:
default: default:
containerEventsDroppedCount.Inc()
logrus.Debugf("containerEventsChan is full, discarding event %+v", event) logrus.Debugf("containerEventsChan is full, discarding event %+v", event)
} }
} }

View File

@ -30,11 +30,12 @@ var (
sandboxRuntimeStopTimer metrics.LabeledTimer sandboxRuntimeStopTimer metrics.LabeledTimer
sandboxRemoveTimer metrics.LabeledTimer sandboxRemoveTimer metrics.LabeledTimer
containerListTimer metrics.Timer containerListTimer metrics.Timer
containerRemoveTimer metrics.LabeledTimer containerRemoveTimer metrics.LabeledTimer
containerCreateTimer metrics.LabeledTimer containerCreateTimer metrics.LabeledTimer
containerStopTimer metrics.LabeledTimer containerStopTimer metrics.LabeledTimer
containerStartTimer metrics.LabeledTimer containerStartTimer metrics.LabeledTimer
containerEventsDroppedCount metrics.Counter
networkPluginOperations metrics.LabeledCounter networkPluginOperations metrics.LabeledCounter
networkPluginOperationsErrors metrics.LabeledCounter networkPluginOperationsErrors metrics.LabeledCounter
@ -68,6 +69,7 @@ func init() {
containerCreateTimer = ns.NewLabeledTimer("container_create", "time to create a container", "runtime") containerCreateTimer = ns.NewLabeledTimer("container_create", "time to create a container", "runtime")
containerStopTimer = ns.NewLabeledTimer("container_stop", "time to stop a container", "runtime") containerStopTimer = ns.NewLabeledTimer("container_stop", "time to stop a container", "runtime")
containerStartTimer = ns.NewLabeledTimer("container_start", "time to start a container", "runtime") containerStartTimer = ns.NewLabeledTimer("container_start", "time to start a container", "runtime")
containerEventsDroppedCount = ns.NewCounter("container_events_dropped", "count container discarding event total from server start")
networkPluginOperations = ns.NewLabeledCounter("network_plugin_operations_total", "cumulative number of network plugin operations by operation type", "operation_type") networkPluginOperations = ns.NewLabeledCounter("network_plugin_operations_total", "cumulative number of network plugin operations by operation type", "operation_type")
networkPluginOperationsErrors = ns.NewLabeledCounter("network_plugin_operations_errors_total", "cumulative number of network plugin operations by operation type", "operation_type") networkPluginOperationsErrors = ns.NewLabeledCounter("network_plugin_operations_errors_total", "cumulative number of network plugin operations by operation type", "operation_type")