1
votes

Using Azure App Insights, I'm wanting to generate statistics for controller endpoints. The catch is the URL path might look something like:

/api/v1/test/val1/statistics /api/v1/test/val2/statistics

Where val1, val2 etc are varying to a large degree. I'm wanting to determine how many times /api/v1/test/*/statistics has been loaded (and also generate average durations, percentiles etc).

I've started with examples from Azure, such as :

requests | summarize RequestsCount=sum(itemCount), AverageDuration=avg(duration), percentiles(duration, 50, 95, 99) by operation_Name | order by RequestsCount desc

Have also started to split the URL by:

extend urlParts = parseurl(url)| project url, urlParts.Path|

but no luck.

1

1 Answers

1
votes

I think you can leverage Parse operator for this purpose:

| parse url with * "/api/" version "/" environment "/" valueParameter "/" * 

This will produce parts of the url you can then concatenate in a required way by ignoring unnecessary parameters. (Or use parameters for some other calculation..)

Alternatively, you can amend URL before it is sent from AI SDK to put "*" at the locations you'd like to ignore, then all default visualization will have the URL you'd like to see. You can do it with Telemetry Initializer or Telemetry Processor.