Azure / azure-relay-dotnet

☁️ .NET Standard client library for Azure Relay Hybrid Connections

Home Page:https://docs.microsoft.com/en-us/azure/service-bus-relay/relay-what-is-it

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expose trackingContext for external correlation

ltrain777 opened this issue · comments

We would like to propose making the TrackingContext property public (getter) instead of internal.

We are using the AcceptHandler to parse the Request queryString (for custom validation and to get configuration) and store the values in a dictionary. Currently we ToString() the RelayedHttpListenerContext to get the TrackingId from regex in the AcceptHandler, after it successfully returns true from the AcceptHandler, we ToString() the HybridConnectionStream to get the TrackingId again to correlate.

This seems error prone and could break due to name changes. Is there a reason why the TrackingContext is internal only?

We can have a PR for this if there are no objections to exposing the TrackingContext.

  • Do you want the whole TrackingContext class?
  • The string TrackingId { get; } (looks like "dd3df943-2b50-4f9d-b701-d8179f0520b3_G4")?
  • The Guid ActivityId { get; }?
  • The poorly named string SubsystemId { get; }, which is basically the Uri with the query string stripped (could have secrets) which is nice for tracing the address?

We just want the TrackingId and ActivityId, but the SubsystemId would be nice for tracing.

We are using the RelayedHttpListenerContext and the HybridConnectionStream class where the TrackingContext property is internal.

We won't need to create our own TrackingContext instance so that class can remain internal.

Are you suggesting just adding the two string properties on the ListenerContext and Stream classes? I'm actually leaning more towards making TrackingContext and the getters public.

Also, can you help me think of any better name for TrackingContext.SubsystemId? This entire TrackingContext concept came from Microsoft.ServiceBus.dll's TrackingContext. There it's called SystemTracker and I always disliked that name. It's a context specific representation of some address which makes sense for whatever subsystem it's in. It's usually something like contoso.servicebus.windows.net/hybridconnection1 but, at least in service bus, it will also change, sometimes looking like contoso:Queue:my_queue, other times simply looking like SuperAwesomeCloudServiceComponent when there's no user specific info (like a background timer which isn't directly related to a user request). My intent was that it always be traceable. So the query string, which could contain secrets, is stripped off before it's stored in TrackingContext.SubsystemId. Any ideas for names?

TrackingAddress?

I think your idea of making TrackingContext and the getters public will work. I like TrackingAddress better than SubsystemId or any ideas I came up with.