MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / client_id

Method client_id

crates/chat-cli/src/telemetry/mod.rs:538–565  ·  view source on GitHub ↗
(env: &Env, database: &mut Database, telemetry_enabled: bool)

Source from the content-addressed store, hash-verified

536 };
537
538 fn client_id(env: &Env, database: &mut Database, telemetry_enabled: bool) -> Result<Uuid, TelemetryError> {
539 if !telemetry_enabled {
540 return Ok(uuid!("ffffffff-ffff-ffff-ffff-ffffffffffff"));
541 }
542
543 if let Ok(client_id) = crate::util::env_var::get_telemetry_client_id(env) {
544 if let Ok(uuid) = Uuid::from_str(&client_id) {
545 return Ok(uuid);
546 }
547 }
548
549 Ok(match database.get_client_id()? {
550 Some(uuid) => uuid,
551 None => {
552 let uuid = database
553 .settings
554 .get_string(Setting::OldClientId)
555 .and_then(|id| Uuid::try_parse(&id).ok())
556 .unwrap_or_else(Uuid::new_v4);
557
558 if let Err(err) = database.set_client_id(uuid) {
559 error!(%err, "Failed to set client id in state");
560 }
561
562 uuid
563 },
564 })
565 }
566
567 // cw telemetry is only available with bearer token auth.
568 let codewhisperer_client = if crate::util::env_var::is_sigv4_enabled(&Env::new()) {

Callers 2

user_contextMethod · 0.45

Calls 4

get_telemetry_client_idFunction · 0.85
get_stringMethod · 0.80
get_client_idMethod · 0.45
set_client_idMethod · 0.45

Tested by

no test coverage detected