Skip to content

Commit

Permalink
moved new operational metric together with others
Browse files Browse the repository at this point in the history
  • Loading branch information
KalmanMeth committed Mar 13, 2023
1 parent d5acdf3 commit b56c584
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
8 changes: 8 additions & 0 deletions docs/operational-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ Each table below provides documentation for an exported flowlogs-pipeline operat
| **Labels** | error, metric, key |


### encode_prom_metrics_reported
| **Name** | encode_prom_metrics_reported |
|:---|:---|
| **Description** | Total number of prometheus metrics reported by this stage |
| **Type** | gauge |
| **Labels** | stage |


### ingest_batch_size_bytes
| **Name** | ingest_batch_size_bytes |
|:---|:---|
Expand Down
16 changes: 8 additions & 8 deletions pkg/pipeline/encode/encode_prom.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type EncodeProm struct {
aggHistos []histoInfo
expiryTime time.Duration
mCache *putils.TimedCache
mChacheLen prometheus.Gauge
mChacheLenMetric prometheus.Gauge
exitChan <-chan struct{}
metricsProcessed prometheus.Counter
metricsDropped prometheus.Counter
Expand All @@ -82,6 +82,12 @@ var (
operational.TypeCounter,
"error", "metric", "key",
)
mChacheLen = operational.DefineMetric(
"encode_prom_metrics_reported",
"Total number of prometheus metrics reported by this stage",
operational.TypeGauge,
"stage",
)
)

// Encode encodes a metric before being stored
Expand Down Expand Up @@ -335,12 +341,6 @@ func NewEncodeProm(opMetrics *operational.Metrics, params config.StageParam) (En
log.Debugf("histos = %v", histos)
log.Debugf("aggHistos = %v", aggHistos)

mChacheLen := operational.DefineMetric(
"encode_prom_metrics_reported",
"Total number of prometheus metrics reported by this stage",
operational.TypeGauge,
"stage",
)
mChacheLenMetric := opMetrics.NewGauge(&mChacheLen, params.Name)

w := &EncodeProm{
Expand All @@ -350,7 +350,7 @@ func NewEncodeProm(opMetrics *operational.Metrics, params config.StageParam) (En
aggHistos: aggHistos,
expiryTime: expiryTime,
mCache: putils.NewTimedCache(cfg.MaxMetrics, mChacheLenMetric),
mChacheLen: mChacheLenMetric,
mChacheLenMetric: mChacheLenMetric,
exitChan: putils.ExitChannel(),
metricsProcessed: opMetrics.NewCounter(&metricsProcessed, params.Name),
metricsDropped: opMetrics.NewCounter(&metricsDropped, params.Name),
Expand Down

0 comments on commit b56c584

Please sign in to comment.