Azure / azure-sdk-for-rust

This repository is for active development of the *unofficial* Azure SDK for Rust. This repository is *not* supported by the Azure SDK team.
MIT License
676 stars 231 forks source link

Need to design a context that doesn't always flow to callees #1655

Open heaths opened 2 months ago

heaths commented 2 months ago

We need a way to start over with a new Context - optionally keeping telemetry spans - when calling into other crates' methods like azure_identity. We don't want, for example, Retry options for Key Vault clients to pass through to DefaultAzureCredential. See Go for more context and solution concept ideas.

heaths commented 2 months ago

One idea might be to define a trait that anything added to the Context's HashMap has to implement that says whether it's durable. A client or token credential can specify whether non-durable context should be dropped when crossing boundaries. This would allow spans through.

To actually trace, like Go and some other languages, a non-durable context object could be the trace listener (tracer) such that a user can specify tracing for one client but not another.