Skip to content

Commit 5d81a5b

Browse files
author
Memfault Inc.
committed
memfaultd 1.18.0 (Build 2847622)
1 parent 28d0de2 commit 5d81a5b

File tree

59 files changed

+1455
-528
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1455
-528
lines changed

CHANGELOG.md

Lines changed: 65 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,77 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to
77
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9+
## [1.18.0] - 2024-01-16
10+
11+
### Added
12+
13+
- `mar.mar_entry_max_count`, which allows for setting the max number of MAR
14+
entries in your tmp directory. This will default to 1000.
15+
- `logs.max_buffered_lines`, which sets the max number of lines that will be
16+
kept in memory before lines are dropped. Note that this is the same as
17+
`fluent-bit.max_buffered_lines`, but will apply to both the `fluent-bit` log
18+
source as well as the `journald` log source. If you have previously configured
19+
`fluent-bit.max_buffered_lines` that value will be used instead of the general
20+
config.
21+
- Added the `kind` field to the MAR POST body. This is a field that is used by
22+
Memfault to differentiate the source of a MAR entry.
23+
- Added `logs.extra_attributes` option to configure extra log attributes to keep
24+
in the log file (similar to
25+
[`fluent-bit.extra_attributes`](https://docs.memfault.com/docs/linux/reference-memfaultd-configuration#fluent-bit)
26+
which still works but will be deprecated)
27+
28+
### Changed
29+
30+
- The `LogCollector` has gone through a refactor to make the concurrency methods
31+
more consistent with the rest of the code base. This has also allowed us to
32+
make the following change.
33+
- Moved recovery of logs in the `logs` directory into the `LogCollector` thread.
34+
This prevents a case where `memfaultd` could be slow to start when there is a
35+
large number of MAR entries on disk, and depending on systemd configuration,
36+
could be considered crashed and restarted before booting completely.
37+
38+
### Fixed
39+
40+
- When passing a null to disable a feature there was a case where the config
41+
merging logic would fail. This would result in a case where a subset of
42+
configs were not possible. Fixed this logic to allow these valid use cases.
43+
944
## [1.17.0] - 2024-01-16
10-
This release introduces the new `memfaultctl write-metrics` command
11-
as well as some important bugfixes.
45+
46+
This release introduces the new `memfaultctl write-metrics` command as well as
47+
some important bugfixes.
1248

1349
### Added
14-
- `memfaultctl write-metrics`, which allows users to write
15-
metrics to `memfaultd` from a script or shell by specifying
16-
them as arguments to the command in the form `KEY=VALUE`.
17-
- 2 new built-in system metrics under the new `diskstats`
18-
metric category. These metrics follow the naming pattern
19-
`diskstats/<device name>/reads_per_second` and
20-
`diskstats/<device name>/writes_per_second` where
21-
`<device name>` is the name of a device listed in
22-
`/proc/diskstats`. The list of devices monitored
23-
can be configured with the `metrics.system_metric_collection.diskstats`
24-
configuration field.
50+
51+
- `memfaultctl write-metrics`, which allows users to write metrics to
52+
`memfaultd` from a script or shell by specifying them as arguments to the
53+
command in the form `KEY=VALUE`.
54+
- 2 new built-in system metrics under the new `diskstats` metric category. These
55+
metrics follow the naming pattern `diskstats/<device name>/reads_per_second`
56+
and `diskstats/<device name>/writes_per_second` where `<device name>` is the
57+
name of a device listed in `/proc/diskstats`. The list of devices monitored
58+
can be configured with the `metrics.system_metric_collection.diskstats`
59+
configuration field.
2560

2661
### Changed
27-
- The log message emitted when the MAR cleaner
28-
encounters an invalid MAR entry in the MAR
29-
staging area has been lowered from `WARN` level
30-
to `DEBUG` level.
62+
63+
- The log message emitted when the MAR cleaner encounters an invalid MAR entry
64+
in the MAR staging area has been lowered from `WARN` level to `DEBUG` level.
3165
- A log message emitted when the configured
32-
`high_resolution_telemetry.max_samples_per_minute`
33-
rate limit is violated has been lowered from `WARN`
34-
level to `DEBUG`. This is to avoid repeatedly
35-
logging the same message at a high frequency
36-
when the system is sending more readings than
37-
permitted.
66+
`high_resolution_telemetry.max_samples_per_minute` rate limit is violated has
67+
been lowered from `WARN` level to `DEBUG`. This is to avoid repeatedly logging
68+
the same message at a high frequency when the system is sending more readings
69+
than permitted.
3870

3971
### Fixed
40-
- All deltas calculated based on a current and previous
41-
counter from procfs now take potential overflow into account.
42-
- Fixed a sequencing issue with the cleaning of the MAR directory
43-
concerning an edge case where logs would fail to recover on
44-
devices that are near their disk space or inode quotas.
45-
This would result in stranded log files that would not
46-
get deleted or uploaded to Memfault until there is enough
47-
space to recover them.
72+
73+
- All deltas calculated based on a current and previous counter from procfs now
74+
take potential overflow into account.
75+
- Fixed a sequencing issue with the cleaning of the MAR directory concerning an
76+
edge case where logs would fail to recover on devices that are near their disk
77+
space or inode quotas. This would result in stranded log files that would not
78+
get deleted or uploaded to Memfault until there is enough space to recover
79+
them.
4880

4981
## [1.16.1] - 2024-01-06
5082

@@ -1224,3 +1256,5 @@ package][nginx-pid-report] for a discussion on the topic.
12241256
https://github.com/memfault/memfault-linux-sdk/releases/tag/1.16.1-kirkstone
12251257
[1.17.0]:
12261258
https://github.com/memfault/memfault-linux-sdk/releases/tag/1.17.0-kirkstone
1259+
[1.18.0]:
1260+
https://github.com/memfault/memfault-linux-sdk/releases/tag/1.18.0-kirkstone

Cargo.lock

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

VERSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
BUILD ID: 2808159
2-
GIT COMMIT: 9c4f0059da
3-
VERSION: 1.17.0
1+
BUILD ID: 2847622
2+
GIT COMMIT: 6d720d165b
3+
VERSION: 1.18.0

memfault-ssf/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "memfault-ssf"
3-
version = "1.17.0"
3+
version = "1.18.0"
44
edition = "2021"
55
description = "Supporting crate for the Memfault memfaultd embedded Linux agent"
66
homepage = "https://github.com/memfault/memfaultd"

memfault-ssf/VERSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
BUILD ID: 2808159
2-
GIT COMMIT: 9c4f0059da
3-
VERSION: 1.17.0
1+
BUILD ID: 2847622
2+
GIT COMMIT: 6d720d165b
3+
VERSION: 1.18.0

memfault-ssf/src/mailbox.rs

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use std::{
55
error::Error,
66
fmt::Display,
7-
sync::mpsc::{channel, Receiver, Sender},
7+
sync::mpsc::{channel, sync_channel, Receiver, Sender, SyncSender, TrySendError},
88
};
99

1010
use crate::{Envelope, Handler, Message, Service};
@@ -16,6 +16,7 @@ use crate::{Envelope, Handler, Message, Service};
1616
pub enum MailboxError {
1717
SendChannelClosed,
1818
NoResponse,
19+
SendChannelFull,
1920
}
2021

2122
impl Display for MailboxError {
@@ -67,3 +68,50 @@ impl<S: Service> Clone for Mailbox<S> {
6768
}
6869
}
6970
}
71+
72+
pub struct BoundedMailbox<S: Service> {
73+
sender: SyncSender<Envelope<S>>,
74+
}
75+
76+
impl<S: Service> BoundedMailbox<S> {
77+
pub fn create(channel_size: usize) -> (Self, Receiver<Envelope<S>>) {
78+
let (sender, receiver) = sync_channel(channel_size);
79+
(BoundedMailbox { sender }, receiver)
80+
}
81+
82+
pub fn send_and_forget<M>(&self, message: M) -> Result<(), MailboxError>
83+
where
84+
M: Message,
85+
S: Handler<M>,
86+
{
87+
self.sender
88+
.try_send(Envelope::wrap(message))
89+
.map_err(|e| match e {
90+
std::sync::mpsc::TrySendError::Full(_) => MailboxError::SendChannelFull,
91+
std::sync::mpsc::TrySendError::Disconnected(_) => MailboxError::SendChannelClosed,
92+
})
93+
}
94+
95+
pub fn send_and_wait_for_reply<M>(&self, message: M) -> Result<M::Reply, MailboxError>
96+
where
97+
M: Message,
98+
S: Handler<M>,
99+
{
100+
let (envelope, ack_receiver) = Envelope::wrap_with_reply(message);
101+
102+
self.sender.try_send(envelope).map_err(|e| match e {
103+
TrySendError::Full(_) => MailboxError::SendChannelFull,
104+
TrySendError::Disconnected(_) => MailboxError::SendChannelClosed,
105+
})?;
106+
107+
ack_receiver.recv().map_err(|_e| MailboxError::NoResponse)
108+
}
109+
}
110+
111+
impl<S: Service> Clone for BoundedMailbox<S> {
112+
fn clone(&self) -> Self {
113+
BoundedMailbox {
114+
sender: self.sender.clone(),
115+
}
116+
}
117+
}

0 commit comments

Comments
 (0)