AzureMonitor: Prometheus exemplars support (#87742)

* Update types

* Mark datasource as supporting traces

* Add logic to transform exemplar query to traces query

* Render appropriate editor

* Run trace query for exemplars

* Refactor out common functions

- Add function to retrieve first/default subscription

* Add route for trace exemplars

* Update logic to appropriately query exemplars

* Update traces query builder

* Update instance test

* Remove unneeded import

* Set traces pseudo data source

* Replace deprecated function calls

* Add helper for setting default traces query

* Don't show resource field for exemplars query

* When resetting operation ID for exemplars set query to default

- Update tests

* Update query header to appropriately set the service value

* Fix response frame creation and update tests

* Correctly select resource

* Convert subscriptionsApiVersion to const

* Add feature toggle
This commit is contained in:
Andreas Christou
2024-06-06 17:53:17 +01:00
committed by GitHub
parent 5f33943397
commit c9778c3332
32 changed files with 715 additions and 97 deletions

View File

@ -0,0 +1,321 @@
// 🌟 This was machine generated. Do not edit. 🌟
//
// Frame[0] {
// "typeVersion": [
// 0,
// 0
// ],
// "custom": {
// "azureColumnTypes": [
// "string",
// "string",
// "string",
// "real",
// "string",
// "string",
// "datetime",
// "dynamic",
// "dynamic",
// "string",
// "string"
// ]
// }
// }
// Name:
// Dimensions: 11 Fields by 1 Rows
// +----------------------------------+--------------------------------------+------------------------------------+------------------+-------------------+-------------------------------------+-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+-----------------+
// | Name: traceID | Name: spanID | Name: parentSpanID | Name: duration | Name: serviceName | Name: operationName | Name: startTime | Name: serviceTags | Name: tags | Name: itemId | Name: itemType |
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
// | Type: []*string | Type: []*string | Type: []*string | Type: []*float64 | Type: []*string | Type: []*string | Type: []*time.Time | Type: []*json.RawMessage | Type: []*json.RawMessage | Type: []*string | Type: []*string |
// +----------------------------------+--------------------------------------+------------------------------------+------------------+-------------------+-------------------------------------+-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+-----------------+
// | cfae497bfd7a44169f35643940820938 | b52403c5-5b27-43a8-9bc6-5938667a4470 | |cfae497bfd7a44169f35643940820938. | 0 | | GET /github/grafana/grafana/commits | 2023-04-17 14:58:10.176 +0000 UTC | [{"value":"5000","key":"limit"},{"value":"4351","key":"remaining"},{"value":"1681746512","key":"reset"},{"value":"github-test-data","key":"service"},{"value":"2023-04-17T14:58:10.0000000Z","key":"timestamp"},{"value":"649","key":"used"}] | [{"value":"4ad5a808-11f7-49d5-9713-f6ede83141e4","key":"appId"},{"value":"test-app","key":"appName"},{"value":"1.0.0","key":"application_Version"},{"value":"Dublin","key":"client_City"},{"value":"Ireland","key":"client_CountryOrRegion"},{"value":"0.0.0.0","key":"client_IP"},{"value":"Linux 5.4.0-1036-azure","key":"client_OS"},{"value":"Dublin","key":"client_StateOrProvince"},{"value":"PC","key":"client_Type"},{"value":"test-vm","key":"cloud_RoleInstance"},{"value":"Web","key":"cloud_RoleName"},{"value":{"limit":"5000","remaining":"4351","reset":"1681746512","service":"github-test-data","timestamp":"2023-04-17T14:58:10.0000000Z","used":"649"},"key":"customDimensions"},{"value":0,"key":"duration"},{"value":"195b4fe4-7b01-4814-abca-ffceb1f62c8f","key":"iKey"},{"value":1,"key":"itemCount"},{"value":"65863e6b-dd30-11ed-a808-002248268105","key":"itemId"},{"value":"trace","key":"itemType"},{"value":"github commits rate limiting info","key":"message"},{"value":"cfae497bfd7a44169f35643940820938","key":"operation_Id"},{"value":"GET /github/grafana/grafana/commits","key":"operation_Name"},{"value":"|cfae497bfd7a44169f35643940820938.","key":"operation_ParentId"},{"value":"node:1.8.9","key":"sdkVersion"},{"value":1,"key":"severityLevel"},{"value":"2023-04-17T14:58:10.1760000Z","key":"timestamp"}] | 65863e6b-dd30-11ed-a808-002248268105 | trace |
// +----------------------------------+--------------------------------------+------------------------------------+------------------+-------------------+-------------------------------------+-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------+-----------------+
//
//
// 🌟 This was machine generated. Do not edit. 🌟
{
"status": 200,
"frames": [
{
"schema": {
"meta": {
"typeVersion": [
0,
0
],
"custom": {
"azureColumnTypes": [
"string",
"string",
"string",
"real",
"string",
"string",
"datetime",
"dynamic",
"dynamic",
"string",
"string"
]
}
},
"fields": [
{
"name": "traceID",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "spanID",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "parentSpanID",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "duration",
"type": "number",
"typeInfo": {
"frame": "float64",
"nullable": true
}
},
{
"name": "serviceName",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "operationName",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "startTime",
"type": "time",
"typeInfo": {
"frame": "time.Time",
"nullable": true
}
},
{
"name": "serviceTags",
"type": "other",
"typeInfo": {
"frame": "json.RawMessage",
"nullable": true
}
},
{
"name": "tags",
"type": "other",
"typeInfo": {
"frame": "json.RawMessage",
"nullable": true
}
},
{
"name": "itemId",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "itemType",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
}
]
},
"data": {
"values": [
[
"cfae497bfd7a44169f35643940820938"
],
[
"b52403c5-5b27-43a8-9bc6-5938667a4470"
],
[
"|cfae497bfd7a44169f35643940820938."
],
[
0
],
[
""
],
[
"GET /github/grafana/grafana/commits"
],
[
1681743490176
],
[
[
{
"value": "5000",
"key": "limit"
},
{
"value": "4351",
"key": "remaining"
},
{
"value": "1681746512",
"key": "reset"
},
{
"value": "github-test-data",
"key": "service"
},
{
"value": "2023-04-17T14:58:10.0000000Z",
"key": "timestamp"
},
{
"value": "649",
"key": "used"
}
]
],
[
[
{
"value": "4ad5a808-11f7-49d5-9713-f6ede83141e4",
"key": "appId"
},
{
"value": "test-app",
"key": "appName"
},
{
"value": "1.0.0",
"key": "application_Version"
},
{
"value": "Dublin",
"key": "client_City"
},
{
"value": "Ireland",
"key": "client_CountryOrRegion"
},
{
"value": "0.0.0.0",
"key": "client_IP"
},
{
"value": "Linux 5.4.0-1036-azure",
"key": "client_OS"
},
{
"value": "Dublin",
"key": "client_StateOrProvince"
},
{
"value": "PC",
"key": "client_Type"
},
{
"value": "test-vm",
"key": "cloud_RoleInstance"
},
{
"value": "Web",
"key": "cloud_RoleName"
},
{
"value": {
"limit": "5000",
"remaining": "4351",
"reset": "1681746512",
"service": "github-test-data",
"timestamp": "2023-04-17T14:58:10.0000000Z",
"used": "649"
},
"key": "customDimensions"
},
{
"value": 0,
"key": "duration"
},
{
"value": "195b4fe4-7b01-4814-abca-ffceb1f62c8f",
"key": "iKey"
},
{
"value": 1,
"key": "itemCount"
},
{
"value": "65863e6b-dd30-11ed-a808-002248268105",
"key": "itemId"
},
{
"value": "trace",
"key": "itemType"
},
{
"value": "github commits rate limiting info",
"key": "message"
},
{
"value": "cfae497bfd7a44169f35643940820938",
"key": "operation_Id"
},
{
"value": "GET /github/grafana/grafana/commits",
"key": "operation_Name"
},
{
"value": "|cfae497bfd7a44169f35643940820938.",
"key": "operation_ParentId"
},
{
"value": "node:1.8.9",
"key": "sdkVersion"
},
{
"value": 1,
"key": "severityLevel"
},
{
"value": "2023-04-17T14:58:10.1760000Z",
"key": "timestamp"
}
]
],
[
"65863e6b-dd30-11ed-a808-002248268105"
],
[
"trace"
]
]
}
}
]
}