I'm trying to process my Application Insights data using Application Insights Analytics and Log Analytics Query Language. What I'd like to have is something like switch statement in C# or pattern matchng in F#. So the pseudocode would be like this:
requests
| where timestamp > now(-1d)
| project endpoint = (switch(name){ {case: "POST /api/jobs/search", then: "Jobs Search"}, {case: "POST /api/offices/search", then: "Office Search"} ...})
Or maybe there is some kind of workaround to define a dictionary-like structure and then use that structure in my query
Any ideas ?
What you're looking for is the case() function.
requests
| where timestamp > ago(1d)
| project endpoint = case(
name == "POST /api/jobs/search", "Jobs Search",
name == "POST /api/offices/search", "Office Search",
"Unknown")