(name, help string, groupingLabels map[string]string, t time.Time)
| 508 | } |
| 509 | |
| 510 | func 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 |
no test coverage detected
searching dependent graphs…