Mobile App: MAUI auto instrument

Afternoon community,

we currently host a mobile Maui app for which we’d like to implement auto instrumentation.
I think part of the auto-instrumentation is Step number 5 mentioned in the doc (Enabling automatic web request instrumentation )

The dev implementing this is using httpclient factory which brings complexity in implementing the suggestion in Step 5.
Has anyone experienced such complexity and how did you solve this?

Regards

I don’t have direct experience with the HttpClientFactory, but documentation shows how to create the HttpMessageHandler.

and in your documentation example about the usage of HttpClientFactory I can see the following:

builder.Services.AddHttpClient();

So I would assume the following usage:

builder.Services.AddHttpClient()
.ConfigureHttpMessageHandler(() => { 
   return Agent.Instance.GetHttpMessageHandler();
});

or

builder.Services.AddHttpClient()
.ConfigureHttpMessageHandlerBuilder((builder) => { 
   builder.PrimaryHandler = Agent.Instance.GetHttpMessageHandler();
   builder.Build();
});​

See Use the IHttpClientFactory - .NET | Microsoft Learn