I am creating an Azure Workbook to query some data in App Insights and I need it to accept a time range parameter in which you can enter custom start and end dates for the query in UTC. I also then need to display this data in UTC, so that the query results are the same regardless of where in the world the data is being queried.
There does not seem to be any Microsoft documentation that I can find to explain whether you can set this time range to be treated as local time or UTC. My current implementation appears to only treat the time range as local time. This causes issues when querying the data, as it converts any datetimes to UTC before querying, then converts data back to local time, so the result timestamps are misleading for the purpose of the workbook.
Here is the time range parameter I’m using to create the time range parameter in the workbook:
Image of custom time range parameter
...
"content": {
"version": "KqlParameterItem/1.0",
"parameters": [
{
"id": "ad71f14d-05e5-47d3-9d8a-79ebc1e0fab7",
"version": "KqlParameterItem/1.0",
"name": "TimeRange",
"type": 4,
"isRequired": true,
"typeSettings": {
"selectableValues": [],
"allowCustom": true
}
}
...
I have this simple app insights query in the workbook to debug the issue which uses this time range.
Image of app insights query in the workbook. As you can see in this Image of app insights query in app insights, our logs are stored in UTC.
How can this time range parameter be amended so that it treats any custom datetimes as UTC rather than local time? If this is not possible, is there any best way to convert the time range type to UTC without actually changing the represented datetime before executing the query? Any help would be appreciated.
natashar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.