Skip to content
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

Additions for 3.0.8 release #40

Merged
merged 3 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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