Skip to content

Commit e90f0b5

Browse files
committed
Fixing up metric definition values
1 parent 1d42a96 commit e90f0b5

File tree

6 files changed

+26
-32
lines changed

6 files changed

+26
-32
lines changed

receiver/hostmetricsreceiver/internal/scraper/processscraper/documentation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ Process threads count.
174174
175175
### process.uptime
176176
177-
The total duration the process has been running for.
177+
The time the process has been running.
178178
179-
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
180-
| ---- | ----------- | ---------- | ----------------------- | --------- |
181-
| s | Sum | Int | Cumulative | false |
179+
| Unit | Metric Type | Value Type |
180+
| ---- | ----------- | ---------- |
181+
| s | Gauge | Double |
182182
183183
## Resource Attributes
184184

receiver/hostmetricsreceiver/internal/scraper/processscraper/internal/metadata/generated_metrics.go

Lines changed: 9 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/hostmetricsreceiver/internal/scraper/processscraper/internal/metadata/generated_metrics_test.go

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

receiver/hostmetricsreceiver/internal/scraper/processscraper/metadata.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,7 @@ metrics:
210210

211211
process.uptime:
212212
enabled: false
213-
description: The total duration the process has been running for.
213+
description: The time the process has been running.
214214
unit: s
215-
sum:
216-
value_type: int
217-
aggregation_temporality: cumulative
218-
monotonic: false
215+
gauge:
216+
value_type: double

receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ func (s *processScraper) scrapeAndAppendUptimeMetric(ctx context.Context, now pc
484484
// Since create time is in milliseconds, it needs to be multiplied
485485
// by the constant value so that it can be used as part of the time.Unix function.
486486
uptime := now.AsTime().Sub(time.Unix(0, ts*int64(time.Millisecond)))
487-
s.mb.RecordProcessUptimeDataPoint(now, int64(uptime.Seconds()))
487+
s.mb.RecordProcessUptimeDataPoint(now, uptime.Seconds())
488488

489489
return nil
490490
}

receiver/hostmetricsreceiver/internal/scraper/processscraper/process_scraper_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,9 @@ func assertUptimeMetricValid(t *testing.T, resourceMetrics pmetric.ResourceMetri
359359
m := getMetric(t, "process.uptime", resourceMetrics)
360360
assert.Equal(t, "process.uptime", m.Name())
361361

362-
for i := 0; i < m.Sum().DataPoints().Len(); i++ {
363-
dp := m.Sum().DataPoints().At(i)
364-
assert.Equal(t, int64(199), dp.IntValue(), "Must have an uptime of 199s")
362+
for i := 0; i < m.Gauge().DataPoints().Len(); i++ {
363+
dp := m.Gauge().DataPoints().At(i)
364+
assert.Equal(t, float64(199.9), dp.DoubleValue(), "Must have an uptime of 199s")
365365
}
366366
}
367367

0 commit comments

Comments
 (0)