azure-monitorazure-monitor-workbooks

Format time range parameter Azure Monitor Workbook in custom endpoint


Have an Azure Monitor Workbook with a time range date picker that filters Kusto expressions and metrics but trouble controlling the format in custom endpoints. For example, the a custom endpoint against a REST API and a URL parameter value:

Created ge {TimeRange:start}

the resulted is

Created ge datetime(\"2023-05-23T09:30:00.000Z\)

whereas I would like:

Created ge datetime'2023-05-23T09:30:00.000Z'

Any way to apply a function on the parameter expression?


Solution

  • the default implementation of the TimeRange parameter formatter was built for KQL.

    if you need other formats, there are things like {TimeRange:startISO}

    some are shown at from: https://learn.microsoft.com/en-us/azure/azure-monitor/visualize/workbooks-time#time-parameter-options (i'll look at getting that list updated in docs)

    in the parameter editing view you can see examples if you scroll down:

    parameter formatting options screenshot

    text form for searching:

    When replaced in a query or text item, {timerange} will become:
    {timerange} ==> Last hour
    {timerange:label} ==> Last hour
    {timerange:value} ==> > ago(1h)
    {timerange:query} ==> > ago(1h)
    {timerange:start} ==> 5/25/2023 8:27 AM
    {timerange:end} ==> 5/25/2023 9:27 AM
    {timerange:startISO} ==> 2023-05-25T15:27:59.833Z
    {timerange:endISO} ==> 2023-05-25T16:27:59.833Z
    {timerange:startUnix} ==> 1685028479
    {timerange:endUnix} ==> 1685032079
    {timerange:grain} ==> 1m
    {timerange:seconds} ==> 3600