Skip to content

Commit

Permalink
fix(state-machine): remove claims from license state log (#6795)
Browse files Browse the repository at this point in the history
Co-authored-by: Renée <renee.kooi@apollographql.com>
  • Loading branch information
aaronArinder and goto-bus-stop authored Feb 18, 2025
1 parent e8b7a06 commit 550d5d7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apollo-router/src/state_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,13 @@ where

// Process all the events in turn until we get to error state or we run out of events.
while let Some(event) = messages.next().await {
let event_name = format!("{event:?}");
let event_name = match &event {
Event::UpdateLicense(license_state) => {
format!("UpdateLicense({})", license_state.get_name())
}
event => format!("{event:?}"),
};

let previous_state = format!("{state:?}");

state = match event {
Expand Down
9 changes: 9 additions & 0 deletions apollo-router/src/uplink/license_enforcement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,15 @@ impl LicenseState {
_ => None,
}
}

pub(crate) fn get_name(&self) -> &'static str {
match self {
Self::Licensed { limits: _ } => "Licensed",
Self::LicensedWarn { limits: _ } => "LicensedWarn",
Self::LicensedHalt { limits: _ } => "LicensedHalt",
Self::Unlicensed => "Unlicensed",
}
}
}

impl Display for License {
Expand Down

0 comments on commit 550d5d7

Please sign in to comment.