Skip to content

Commit

Permalink
change from seconds to ns
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme committed Oct 17, 2024
1 parent 6d14f57 commit 17f6908
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions receiver/ntpreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ metrics:
### ntp.offset
Time difference between local and NTP server clocks in seconds.
Time difference between local and NTP server clocks
| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| s | Gauge | Double |
| ns | Gauge | Int |
## Resource Attributes
Expand Down
3 changes: 1 addition & 2 deletions receiver/ntpreceiver/generated_package_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions receiver/ntpreceiver/internal/metadata/generated_metrics.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions receiver/ntpreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ resource_attributes:

metrics:
ntp.offset:
description: Time difference between local and NTP server clocks in seconds.
unit: "s"
description: Time difference between local and NTP server clocks
unit: "ns"
gauge:
value_type: double
value_type: int
enabled: true

tests:
3 changes: 1 addition & 2 deletions receiver/ntpreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ func (s *scraper) scrape(context.Context) (pmetric.Metrics, error) {
if err != nil {
return pmetric.Metrics{}, err
}
clockOffset := response.ClockOffset.Seconds()
s.mb.RecordNtpOffsetDataPoint(pcommon.NewTimestampFromTime(time.Now()), clockOffset)
s.mb.RecordNtpOffsetDataPoint(pcommon.NewTimestampFromTime(time.Now()), response.ClockOffset.Nanoseconds())
s.mb.NewResourceBuilder().SetNtpHost(s.endpoint)
return s.mb.Emit(), nil
}
Expand Down

0 comments on commit 17f6908

Please sign in to comment.