{
  "version": "Notebook/1.0",
  "items": [
    {
      "type": 9,
      "content": {
        "version": "KqlParameterItem/1.0",
        "parameters": [
          {
            "version": "KqlParameterItem/1.0",
            "name": "TimeRange",
            "label": "Time range",
            "type": 4,
            "isRequired": true,
            "value": {
              "durationMs": 604800000
            },
            "typeSettings": {
              "selectableValues": [
                {
                  "durationMs": 300000
                },
                {
                  "durationMs": 900000
                },
                {
                  "durationMs": 1800000
                },
                {
                  "durationMs": 3600000
                },
                {
                  "durationMs": 14400000
                },
                {
                  "durationMs": 43200000
                },
                {
                  "durationMs": 86400000
                },
                {
                  "durationMs": 172800000
                },
                {
                  "durationMs": 259200000
                },
                {
                  "durationMs": 604800000
                },
                {
                  "durationMs": 1209600000
                },
                {
                  "durationMs": 2419200000
                },
                {
                  "durationMs": 2592000000
                },
                {
                  "durationMs": 5184000000
                },
                {
                  "durationMs": 7776000000
                }
              ],
              "allowCustom": true
            },
            "id": "ff8bb1b2-e10e-4ed4-b0d7-35e68a66bb77"
          },
          {
            "id": "5d5e080d-1485-465e-8ad0-3320591d8675",
            "version": "KqlParameterItem/1.0",
            "name": "FunctionID",
            "label": "Function ID",
            "type": 2,
            "description": "Filter By Function ID",
            "isRequired": true,
            "multiSelect": true,
            "quote": "'",
            "delimiter": ",",
            "query": "traces\r\n| where timestamp > ago(7d)\r\n| where message has \"function_id\"\r\n| extend FunctionID = extract(@\"function_id:\\s*([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})\", 1, message)\r\n| where isnotempty(FunctionID)\r\n| distinct FunctionID\r\n| project value = FunctionID, label = FunctionID\r\n| sort by label asc",
            "typeSettings": {
              "additionalResourceOptions": [
                "value::all"
              ]
            },
            "queryType": 0,
            "resourceType": "microsoft.insights/components",
            "value": [
              "value::all"
            ]
          }
        ],
        "style": "pills",
        "queryType": 0,
        "resourceType": "microsoft.insights/components"
      },
      "name": "parameters"
    },
    {
      "type": 3,
      "content": {
        "version": "KqlItem/1.0",
        "query": "customMetrics\n| where name == \"FpsInstrument\"\n| extend function_id = tostring(customDimensions[\"function_id\"])\n| extend fps = value / valueCount\n| where function_id in ({FunctionID})\n| summarize AvgFps = avg(fps) by timestamp, function_id\n",
        "size": 0,
        "aggregation": 3,
        "title": "FPS by Function ID",
        "timeContextFromParameter": "TimeRange",
        "queryType": 0,
        "resourceType": "microsoft.insights/components",
        "visualization": "barchart",
        "graphSettings": {
          "type": 0,
          "topContent": {
            "columnMatch": "function_id",
            "formatter": 1
          },
          "centerContent": {
            "columnMatch": "AvgFps",
            "formatter": 1,
            "numberFormat": {
              "unit": 17,
              "options": {
                "maximumSignificantDigits": 3,
                "maximumFractionDigits": 2
              }
            }
          }
        },
        "chartSettings": {
          "ySettings": {
            "min": 0,
            "label": "FPS"
          }
        }
      },
      "name": "query - 5"
    },
    {
      "type": 3,
      "content": {
        "version": "KqlItem/1.0",
        "query": "customMetrics\n| where name == \"FpsInstrument\"\n| extend function_id = tostring(customDimensions[\"function_id\"])\n| extend fps = value / valueCount\n| summarize AvgFps = avg(fps) by function_id\n| sort by AvgFps\n| take 10\n",
        "size": 0,
        "aggregation": 3,
        "title": "Top 10 FPS by Function ID",
        "timeContextFromParameter": "TimeRange",
        "queryType": 0,
        "resourceType": "microsoft.insights/components",
        "gridSettings": {
          "formatters": [
            {
              "columnMatch": "AvgFps",
              "formatter": 0,
              "numberFormat": {
                "unit": 0,
                "options": {
                  "style": "decimal",
                  "maximumFractionDigits": 1
                }
              }
            }
          ],
          "labelSettings": [
            {
              "columnId": "function_id",
              "label": "Function ID"
            },
            {
              "columnId": "AvgFps",
              "label": "Average FPS over Time Range"
            }
          ]
        },
        "graphSettings": {
          "type": 0,
          "topContent": {
            "columnMatch": "function_id",
            "formatter": 1
          },
          "centerContent": {
            "columnMatch": "AvgFps",
            "formatter": 1,
            "numberFormat": {
              "unit": 17,
              "options": {
                "maximumSignificantDigits": 3,
                "maximumFractionDigits": 2
              }
            }
          }
        },
        "chartSettings": {
          "ySettings": {
            "min": 0,
            "label": "FPS"
          }
        }
      },
      "name": "query - 5 - Copy"
    },
    {
      "type": 3,
      "content": {
        "version": "KqlItem/1.0",
        "query": "customMetrics\n| where name == \"BpsInstrument\"\n| extend function_id = tostring(customDimensions[\"function_id\"])\n| extend bps = valueSum / valueCount\n| where function_id in ({FunctionID})\n| summarize AvgBps = avg(bps) by timestamp, function_id\n",
        "size": 0,
        "aggregation": 3,
        "title": "BPS by Function ID",
        "timeContextFromParameter": "TimeRange",
        "queryType": 0,
        "resourceType": "microsoft.insights/components",
        "visualization": "barchart",
        "gridSettings": {
          "sortBy": [
            {
              "itemKey": "timestamp",
              "sortOrder": 2
            }
          ]
        },
        "sortBy": [
          {
            "itemKey": "timestamp",
            "sortOrder": 2
          }
        ],
        "chartSettings": {
          "ySettings": {
            "numberFormatSettings": {
              "unit": 45,
              "options": {
                "style": "decimal",
                "useGrouping": true
              }
            },
            "min": 0,
            "label": "BPS"
          }
        }
      },
      "name": "query - 5 - Copy"
    },
    {
      "type": 3,
      "content": {
        "version": "KqlItem/1.0",
        "query": "customMetrics\n| where name == \"BpsInstrument\"\n| extend function_id = tostring(customDimensions[\"function_id\"])\n| extend bps = valueSum / valueCount\n| where function_id in ({FunctionID})\n| summarize AvgBps = avg(bps) by function_id\n| sort by AvgBps\n| take 10\n",
        "size": 0,
        "aggregation": 3,
        "title": "Top 10 BPS by Function ID",
        "timeContextFromParameter": "TimeRange",
        "queryType": 0,
        "resourceType": "microsoft.insights/components",
        "gridSettings": {
          "formatters": [
            {
              "columnMatch": "AvgBps",
              "formatter": 0,
              "numberFormat": {
                "unit": 45,
                "options": {
                  "style": "decimal"
                }
              }
            }
          ],
          "labelSettings": [
            {
              "columnId": "function_id",
              "label": "Function ID"
            },
            {
              "columnId": "AvgBps",
              "label": "Average BPS over Time Range"
            }
          ]
        },
        "sortBy": [],
        "chartSettings": {
          "ySettings": {
            "numberFormatSettings": {
              "unit": 45,
              "options": {
                "style": "decimal",
                "useGrouping": true
              }
            },
            "min": 0,
            "label": "BPS"
          }
        }
      },
      "name": "query - 5 - Copy - Copy"
    },
    {
      "type": 3,
      "content": {
        "version": "KqlItem/1.0",
        "query": "customMetrics\n| where name == \"StageOpenDuration\"\n| extend function_id = tostring(customDimensions[\"function_id\"])\n| extend sod = value / valueCount / 1000\n| where function_id in ({FunctionID})\n| summarize AvgSOD = avg(sod) by timestamp, function_id\n",
        "size": 0,
        "aggregation": 3,
        "title": "Stage Open Duration by Function ID",
        "timeContextFromParameter": "TimeRange",
        "queryType": 0,
        "resourceType": "microsoft.insights/components",
        "visualization": "barchart",
        "gridSettings": {
          "sortBy": [
            {
              "itemKey": "timestamp",
              "sortOrder": 2
            }
          ]
        },
        "sortBy": [
          {
            "itemKey": "timestamp",
            "sortOrder": 2
          }
        ],
        "chartSettings": {
          "ySettings": {
            "numberFormatSettings": {
              "unit": 24,
              "options": {
                "style": "decimal",
                "useGrouping": true
              }
            }
          }
        }
      },
      "name": "query - 5 - Copy - Copy"
    },
    {
      "type": 3,
      "content": {
        "version": "KqlItem/1.0",
        "query": "customMetrics\n| where name == \"StageOpenDuration\"\n| extend function_id = tostring(customDimensions[\"function_id\"])\n| extend sod = value / valueCount / 1000\n| summarize AvgSOD = avg(sod) by function_id\n| sort by AvgSOD\n| take 10\n",
        "size": 0,
        "aggregation": 3,
        "title": "Top 10 Stage Open Duration by Function ID",
        "timeContextFromParameter": "TimeRange",
        "queryType": 0,
        "resourceType": "microsoft.insights/components",
        "gridSettings": {
          "formatters": [
            {
              "columnMatch": "AvgSOD",
              "formatter": 0,
              "formatOptions": {
                "customColumnWidthSetting": "23ch"
              },
              "numberFormat": {
                "unit": 24,
                "options": {
                  "style": "decimal",
                  "maximumFractionDigits": 1
                }
              }
            }
          ],
          "labelSettings": [
            {
              "columnId": "function_id",
              "label": "Function ID"
            },
            {
              "columnId": "AvgSOD",
              "label": "Average SOD"
            }
          ]
        },
        "sortBy": [],
        "chartSettings": {
          "ySettings": {
            "numberFormatSettings": {
              "unit": 24,
              "options": {
                "style": "decimal",
                "useGrouping": true
              }
            }
          }
        }
      },
      "name": "query - 5 - Copy - Copy - Copy"
    }
  ],
  "$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json"
}
