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
9 changes: 0 additions & 9 deletions sensor/common/networkflow/updatecomputer/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
func init() {
prometheus.MustRegister(
UpdateEvents,
UpdateEventsGauge,
periodicCleanupDurationSeconds,
)
}
Expand All @@ -22,14 +21,6 @@ var (
"The 'transition' allows counting the transitions of connections between states 'open' and 'closed'." +
"Action stores the decision whether a given update was sent to Central.",
}, []string{"transition", "entity", "action", "reason"})
UpdateEventsGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: metrics.PrometheusNamespace,
Subsystem: metrics.SensorSubsystem.String(),
Name: "update_computer_update_events_current",
Help: "Counts the internal update events for the categorizeUpdate method in TransitionBased updateComputer in a single tick. " +
"The 'transition' allows counting the transitions of connections between states 'open' and 'closed'. in a given tick." +
"Action stores the decision whether a given update was sent to Central.",
}, []string{"transition", "entity", "action", "reason"})
periodicCleanupDurationSeconds = prometheus.NewHistogram(prometheus.HistogramOpts{
Namespace: metrics.PrometheusNamespace,
Subsystem: metrics.SensorSubsystem.String(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,6 @@ func NewTransitionBased() *TransitionBased {
func (c *TransitionBased) ComputeUpdatedConns(current map[indicator.NetworkConn]timestamp.MicroTS) []*storage.NetworkFlow {
var updates []*storage.NetworkFlow
ee := ConnectionEnrichedEntity
// Reset the gauge metric only on the first call to the ComputeUpdated.
// The current state assumes that `ComputeUpdatedConns` is always called before other ComputeUpdated functions.
// Calling Reset in other ComputeUpdated functions would remove the data collected in the metric in this function.
UpdateEventsGauge.Reset()
if len(current) == 0 {
// Received an empty map with current state. This may happen because:
// - Some items were discarded during the enrichment process, so none made it through.
Expand Down Expand Up @@ -292,8 +288,6 @@ func updateMetrics(update bool, tt TransitionType, ee EnrichedEntity) {
}
}
UpdateEvents.WithLabelValues(tt.String(), string(ee), action, reason).Inc()
// This metric must be reset on each tick, otherwise it would behave as a counter.
UpdateEventsGauge.WithLabelValues(tt.String(), string(ee), action, reason).Inc()
}

// categorizeUpdateNoPast determines whether an update to Central should be sent for a given enrichment update.
Expand Down
Loading