mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-03-15 00:36:33 +00:00
Merge bf3c631eaaf4cf6cae8ff14dd6f2955d5099fd70 into 3e7f09db626e46092181714ccd5cef1aba507daa
This commit is contained in:
commit
429cdd936e
@ -41,6 +41,11 @@ struct UplinkLabels {
|
||||
m_type: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Hash, PartialEq, Eq, EncodeLabelSet, Debug)]
|
||||
struct UplinkMacCommandLabels {
|
||||
mac_command: String,
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref UPLINK_COUNTER: Family<UplinkLabels, Counter> = {
|
||||
let counter = Family::<UplinkLabels, Counter>::default();
|
||||
@ -51,6 +56,15 @@ lazy_static! {
|
||||
);
|
||||
counter
|
||||
};
|
||||
static ref UPLINK_MAC_COMMAND_COUNTER: Family<UplinkMacCommandLabels, Counter> = {
|
||||
let counter = Family::<UplinkMacCommandLabels, Counter>::default();
|
||||
prometheus::register(
|
||||
"uplink_mac_command_count",
|
||||
"Number of received mac commands in uplinks (after deduplication)",
|
||||
counter.clone(),
|
||||
);
|
||||
counter
|
||||
};
|
||||
static ref DEDUPLICATE_LOCKED_COUNTER: Family<(), Counter> = {
|
||||
let counter = Family::<(), Counter>::default();
|
||||
prometheus::register(
|
||||
@ -329,6 +343,16 @@ pub async fn handle_uplink(
|
||||
})
|
||||
.inc();
|
||||
|
||||
if let lrwn::Payload::MACPayload(pl) = &uplink.phy_payload.payload {
|
||||
pl.fhdr.f_opts.iter().for_each(|mac_command| {
|
||||
UPLINK_MAC_COMMAND_COUNTER
|
||||
.get_or_create(&UplinkMacCommandLabels {
|
||||
mac_command: mac_command.to_string(),
|
||||
})
|
||||
.inc();
|
||||
})
|
||||
}
|
||||
|
||||
uplink.dr = helpers::get_uplink_dr(&uplink.region_config_id, &uplink.tx_info)?;
|
||||
uplink.ch = helpers::get_uplink_ch(
|
||||
&uplink.region_config_id,
|
||||
|
@ -247,6 +247,12 @@ pub enum MACCommand {
|
||||
Raw(Vec<u8>),
|
||||
}
|
||||
|
||||
impl fmt::Display for MACCommand {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{:?}", self)
|
||||
}
|
||||
}
|
||||
|
||||
impl MACCommand {
|
||||
pub fn cid(&self) -> CID {
|
||||
match self {
|
||||
|
Loading…
x
Reference in New Issue
Block a user