Skip to content

Gitlab Collector: Xid collector and test #848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Change to Gauge
Signed-off-by: Felix Yuan <[email protected]>
  • Loading branch information
Sticksman committed Jul 10, 2023
commit 4d68e2df6880262c7f99aa650e6c314e190be341
4 changes: 2 additions & 2 deletions collector/pg_xid.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ func (PGXidCollector) Update(ctx context.Context, instance *instance, ch chan<-

ch <- prometheus.MustNewConstMetric(
xidCurrent,
prometheus.CounterValue,
prometheus.GaugeValue,
current,
)
ch <- prometheus.MustNewConstMetric(
xidXmin,
prometheus.CounterValue,
prometheus.GaugeValue,
xmin,
)
ch <- prometheus.MustNewConstMetric(
Expand Down
8 changes: 4 additions & 4 deletions collector/pg_xid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ func TestPgXidCollector(t *testing.T) {
}
}()
expected := []MetricResult{
{labels: labelMap{}, value: 22, metricType: dto.MetricType_COUNTER},
{labels: labelMap{}, value: 25, metricType: dto.MetricType_COUNTER},
{labels: labelMap{}, value: 22, metricType: dto.MetricType_GAUGE},
{labels: labelMap{}, value: 25, metricType: dto.MetricType_GAUGE},
{labels: labelMap{}, value: 30, metricType: dto.MetricType_GAUGE},
}
convey.Convey("Metrics comparison", t, func() {
Expand Down Expand Up @@ -92,8 +92,8 @@ func TestPgNanCollector(t *testing.T) {
}
}()
expected := []MetricResult{
{labels: labelMap{}, value: math.NaN(), metricType: dto.MetricType_COUNTER},
{labels: labelMap{}, value: math.NaN(), metricType: dto.MetricType_COUNTER},
{labels: labelMap{}, value: math.NaN(), metricType: dto.MetricType_GAUGE},
{labels: labelMap{}, value: math.NaN(), metricType: dto.MetricType_GAUGE},
{labels: labelMap{}, value: math.NaN(), metricType: dto.MetricType_GAUGE},
}
convey.Convey("Metrics comparison", t, func() {
Expand Down