Skip to content

Commit

Permalink
Additions for 3.0.8 release
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgear authored Jan 7, 2024
2 parents 6c157c7 + f674b3d commit 3e170bb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
12 changes: 7 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,18 @@ deployment very soon.

### Changed

- Ensure all telegraf metrics are timestamped in microseconds.
Because output to telegraf is buffered, we can't rely on telegraf doing the
timestamping (multiple samples get timestamped with the same or very similar
times), so we add a timestamp to every metric line as soon as we see it.
- Ensure all telegraf metrics are timestamped in microseconds. Because output to
telegraf is buffered, we can't rely on telegraf doing the timestamping
(multiple samples get timestamped with the same or very similar times), so we
add a timestamp to every metric line as soon as we see it.
- `ntpmon_info` metric in telegraf mode split into
`ntpmon_resident_set_size_bytes`, `ntpmon_virtual_memory_size_bytes`, and
`ntpmon_uptime_seconds` in prometheus mode, with tags only on
`ntpmon_uptime_seconds`, to tidy metric names and reduce tag cardinality when
used with prometheus. These retain their existing names in telegraf mode.

- Make messages from log file tailer tidier and more consistent.
- Correctly flag /etc/default/ntpmon as a configuration file in the Debian
package.

## [3.0.7] - 2024-01-05

Expand Down
1 change: 1 addition & 0 deletions debian/conffiles
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/default/ntpmon
7 changes: 4 additions & 3 deletions src/tailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def open(self) -> None:
stat = os.stat(self.file.fileno())
self.st_ino = stat.st_ino
self.st_dev = stat.st_dev
print(f"{self.filename} opened, reading from pos {self.pos}", file=sys.stderr)
except OSError:
self.clear()
finally:
Expand All @@ -54,7 +55,7 @@ def readlines(self) -> List[str]:
return None
elif pos < self.pos:
# file has been truncated; reset to beginning and read all lines
print(f"Truncated: {pos=} {self.pos=}", file=sys.stderr)
print(f"{self.filename} truncated, resetting to beginning", file=sys.stderr)
self.file.seek(0, os.SEEK_SET)
else:
# Even if we were in the right place already, we need to set our
Expand Down Expand Up @@ -85,12 +86,12 @@ def tail(self) -> List[str]:
reopen = False
if stat is None:
# file deleted - read the rest of it (if any) and reopen when available
print("Deleted file", file=sys.stderr)
print(f"{self.filename} deleted, reopening", file=sys.stderr)
reopen = True
elif stat.st_ino != self.st_ino or stat.st_dev != self.st_dev:
# It's a different file; read the rest of the open one, then open the
# new one.
print(f"Different file: {stat.st_ino=} {self.st_ino=} {stat.st_dev=} {self.st_dev=}", file=sys.stderr)
print(f"{self.filename} replaced ({self.st_dev},{self.st_ino} -> {stat.st_dev},{stat.st_ino}), reopening", file=sys.stderr)
reopen = True
else:
# Same file, just read any lines
Expand Down

0 comments on commit 3e170bb

Please sign in to comment.