MCPcopy
hub / github.com/prometheus/pushgateway / newTimestampGauge

Function newTimestampGauge

storage/diskmetricstore.go:510–529  ·  view source on GitHub ↗
(name, help string, groupingLabels map[string]string, t time.Time)

Source from the content-addressed store, hash-verified

508}
509
510func newTimestampGauge(name, help string, groupingLabels map[string]string, t time.Time) *dto.MetricFamily {
511 var ts float64
512 if !t.IsZero() {
513 ts = float64(t.UnixNano()) / 1e9
514 }
515 mf := &dto.MetricFamily{
516 Name: proto.String(name),
517 Help: proto.String(help),
518 Type: dto.MetricType_GAUGE.Enum(),
519 Metric: []*dto.Metric{
520 {
521 Gauge: &dto.Gauge{
522 Value: proto.Float64(ts),
523 },
524 },
525 },
526 }
527 sanitizeLabels(mf, groupingLabels)
528 return mf
529}
530
531// sanitizeLabels ensures that all the labels in groupingLabels and the
532// `instance` label are present in the MetricFamily. The label values from

Callers 2

newPushTimestampGaugeFunction · 0.85

Calls 1

sanitizeLabelsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…