Skip to content

Commit

Permalink
Make metrics private
Browse files Browse the repository at this point in the history
Signed-off-by: Pavol Loffay <[email protected]>
  • Loading branch information
pavolloffay committed Jul 27, 2021
1 parent 55694da commit c29ac4a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ username:
password:
# Database name. Default is "default".
database:
# Endpoint for scraping prometheus metrics. Default localhost:9090
# Endpoint for scraping prometheus metrics. Default localhost:9090.
metrics_endpoint: localhost:9090
# Table with spans. Default "jaeger_spans_local".
spans_table:
Expand Down
12 changes: 6 additions & 6 deletions storage/clickhousespanstore/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ const (
)

var (
NumWritesWithBatchSize = prometheus.NewCounter(prometheus.CounterOpts{
numWritesWithBatchSize = prometheus.NewCounter(prometheus.CounterOpts{
Name: "jaeger_clickhouse_writes_with_batch_size_total",
Help: "Number of clickhouse writes due to batch size criteria",
})
NumWritesWithFlushInterval = prometheus.NewCounter(prometheus.CounterOpts{
numWritesWithFlushInterval = prometheus.NewCounter(prometheus.CounterOpts{
Name: "jaeger_clickhouse_writes_with_flush_interval_total",
Help: "Number of clickhouse writes due to flush interval criteria",
})
Expand Down Expand Up @@ -76,8 +76,8 @@ func NewSpanWriter(logger hclog.Logger, db *sql.DB, indexTable string, spansTabl

func (w *SpanWriter) registerMetrics() {
registerMetrics.Do(func() {
prometheus.MustRegister(NumWritesWithBatchSize)
prometheus.MustRegister(NumWritesWithFlushInterval)
prometheus.MustRegister(numWritesWithBatchSize)
prometheus.MustRegister(numWritesWithFlushInterval)
})
}

Expand All @@ -99,14 +99,14 @@ func (w *SpanWriter) backgroundWriter() {
flush = len(batch) == cap(batch)
if flush {
w.logger.Debug("Flush due to batch size", "size", len(batch))
NumWritesWithBatchSize.Inc()
numWritesWithBatchSize.Inc()
}
case <-timer:
timer = time.After(w.delay)
flush = time.Since(last) > w.delay && len(batch) > 0
if flush {
w.logger.Debug("Flush due to timer")
NumWritesWithFlushInterval.Inc()
numWritesWithFlushInterval.Inc()
}
case <-w.finish:
finish = true
Expand Down

0 comments on commit c29ac4a

Please sign in to comment.