AzureMonitor: Application Insights Traces (#64859)

* Build out barebones Traces editor

- Add Traces query type and operation ID prop to query type
- Add necessary header types
- Update resource picker to appropriately work with traces query type
- Build out TracesQueryEditor component
- Include logic to retrieve operationId's for AI Workspaces
- Add backend route mapping
- Update macro to use timestamp as default time field for traces

* AzureMonitor: Traces - Response parsing (#65442)

* Update FormatAsField component

- Add trace ResultFormat type
- Generalise FormatAsField component
- Add component to TracesQueryEditor
- Remove duplicate code in setQueryValue

* Add custom filter function to improve performance

* Add basic conversion for logs to trace

- Add serviceTags converter
- Pass through required parameters (queryType and resultFormat)
- Appropriately set visualisation

* Update parsing to also fill trace tags

- Add constant values for each table schema (include legacy mapping for now if needed)
- Add constant for list of table tags
- Set the foundation for dynamic query building
- Update query to build tags value
- Appropriately set operationName
- Update tagsConverter to filter empty values

* Fix lint and test issues

* AzureMonitor: Traces - Data links (#65566)

* Add portal link for traces

- Pull out necessary values (itemId and itemType)
- Appropriately construct
- Fix ordering

* Set default format as value

- Also set default visualisation

* Fix event schema

* Set default formatAsField value

* Include logs link on traces results

- Adapt config links to allow custom title to be set

* Correctly set operationId for query

* Update backend types

- Include OperationID in query
- Pass forward datasource name and UID

* Ensure setTime doesn't consistently get called if operationID is defined

* Add explore link

- Update util functions to allow setting custom datalinks

* Fix tests

* AzureMonitor: Traces - Query and Editor updates (#66076)

* Add initial query

- Will query the resource as soon as a resource has been selected
- Updates the data links for the query without operationId
- Remove initial operationId query and timeRange dependency
- Update query building

* Add entirely separate traces query property

- Update shared types (also including future types for Azure traces)
- Update backend log analytics datasource to accept both azureLogAnalytics and azureTraces queries
- Update backend specific types
- Update frontend datasource for new properties
- Update mock query

* Update FormatAsField to be entirely generic

* Update query building to be done in backend

- Add required mappings in backend
- Update frontend querying

* Fix query and explore data link

* Add trace type selection

* Better method for setting explore link

* Fix operationId updating

* Run go mod tidy

* Unnecessary changes

* Fix tests

* AzureMonitor: Traces - Add correlation API support (#65855)

Add correlation API support

- Add necessary types
- Add correlation API request when conditions are met
- Update query

* Fix property from merge

* AzureMonitor: Traces - Filtering (#66303)

* Add initial query

- Will query the resource as soon as a resource has been selected
- Updates the data links for the query without operationId
- Remove initial operationId query and timeRange dependency
- Update query building

* Add entirely separate traces query property

- Update shared types (also including future types for Azure traces)
- Update backend log analytics datasource to accept both azureLogAnalytics and azureTraces queries
- Update backend specific types
- Update frontend datasource for new properties
- Update mock query

* Update FormatAsField to be entirely generic

* Update query building to be done in backend

- Add required mappings in backend
- Update frontend querying

* Fix query and explore data link

* Add trace type selection

* Better method for setting explore link

* Fix operationId updating

* Run go mod tidy

* Unnecessary changes

* Fix tests

* Start building out Filters component

- Configure component to query for Filter property values when a filter property is set
- Add setFilters function
- Add typing to tablesSchema
- Use component in TracesQueryEditor

* Update Filters

- Asynchronously pull property options
- Setup list of Filter components

* Update filters component

- Remove unused imports
- Have local filters state and query filters
- Correctly set filters values
- Don't update query every time a filter property changes (not performant)

* Update properties query

- Use current timeRange
- Get count to provide informative labels

* Reset map when time changes

* Add operation selection

* Reset filters when property changes

* Appropriate label name for empty values

* Add filtering to query

* Update filter components

- Fix rendering issue
- Correctly compare and update timeRange
- Split out files for simplicity

* Add checkbox option to multiselect

- Add custom option component
- Correctly call onChange
- Add variableOptionGroup for template variable selection

* Fix adding template vars

* Improve labels and refresh labels on query prop changes

* AzureMonitor: Traces - Testing (#66474)

* Select ds for template variable interpolation

* Update az logs ds tests

- Add templateVariables test
- Add filter test
- Update mock
- Remove anys

* Update QueryEditor test

- Update mocks with timeSrv for log analytics datasource
- Fix query mock
- Use appropriate and consistent selectors

* Add TracesQueryEditor test

- Update resourcePickerRows mock to include app insights resources
- Remove comments and extra new line

* Add FormatAsField test

- Remove unneeded condition

* Update resourcePicker utils test

* Don't hide selected options in filters

* Fix multi-selection on filters

* Add TraceTypeField test

- Add test file
- Update selectors (remove copy/paste mistake)
- Update placeholder text for select and add label

* Add basic filters test

* Begin filters test

* Update filters test

* Add final tests and simplify/generalise addFilter helper

* Minor update to datasource test

* Update macros test

* Update selectors in tests

* Add response-table-frame tests

* Add datasource tests

- Use sorting where JSON models are inconsistent
- Update filters clause
- Dedupe tags
- Correct operationId conditions

* Don't set a default value for blurInputOnSelect

* Simplify datasource test

* Update to use CheckGoldenJSON utils

- Update with generated frame files
- Remove redundant expected frame code
- Update all usages

* Fix lint

* AzureMonitor: Traces feedback (#67292)

* Filter traces if the visualisation is set to trace

- Update build query logic
- Added additional test cases
- Return an error if the traces type is set by itself with the trace visualisation
- Add descriptions to event types
- Update tests

* Fix bug for error displaying traces

* Update mappings and add error field

- Update tests
- Remove unnecessary comments

* Switch location of Operation ID field

* Re-order fields

* Update link title

* Update label for event type selection

* Update correct link title

* Update logs datalink to link to Azure Logs in explore

* Fix lint
This commit is contained in:
Andreas Christou
2023-04-27 20:24:11 +01:00
committed by GitHub
parent 60c4e71962
commit 63383ef545
83 changed files with 7586 additions and 561 deletions
@@ -0,0 +1,96 @@
// 🌟 This was machine generated. Do not edit. 🌟
//
// Frame[0] {
// "typeVersion": [
// 0,
// 0
// ],
// "custom": {
// "azureColumnTypes": [
// "datetime",
// "string",
// "real"
// ]
// }
// }
// Name:
// Dimensions: 3 Fields by 3 Rows
// +---------------------------------+-----------------+------------------------+
// | Name: TimeGenerated | Name: Computer | Name: avg_CounterValue |
// | Labels: | Labels: | Labels: |
// | Type: []*time.Time | Type: []*string | Type: []*float64 |
// +---------------------------------+-----------------+------------------------+
// | 2020-04-19 19:16:06.5 +0000 UTC | grafana-vm | 1.1 |
// | 2020-04-19 19:16:16.5 +0000 UTC | grafana-vm | 2.2 |
// | 2020-04-19 19:16:26.5 +0000 UTC | grafana-vm | 3.3 |
// +---------------------------------+-----------------+------------------------+
//
//
// 🌟 This was machine generated. Do not edit. 🌟
{
"status": 200,
"frames": [
{
"schema": {
"meta": {
"typeVersion": [
0,
0
],
"custom": {
"azureColumnTypes": [
"datetime",
"string",
"real"
]
}
},
"fields": [
{
"name": "TimeGenerated",
"type": "time",
"typeInfo": {
"frame": "time.Time",
"nullable": true
}
},
{
"name": "Computer",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "avg_CounterValue",
"type": "number",
"typeInfo": {
"frame": "float64",
"nullable": true
}
}
]
},
"data": {
"values": [
[
1587323766500,
1587323776500,
1587323786500
],
[
"grafana-vm",
"grafana-vm",
"grafana-vm"
],
[
1.1,
2.2,
3.3
]
]
}
}
]
}
@@ -0,0 +1,87 @@
// 🌟 This was machine generated. Do not edit. 🌟
//
// Frame[0] {
// "typeVersion": [
// 0,
// 0
// ],
// "custom": {
// "azureColumnTypes": [
// "string",
// "string"
// ]
// },
// "notices": [
// {
// "severity": "warning",
// "text": "There were some errors when processing your query. Something went wrong processing your query on the server. Not sure what happened."
// }
// ]
// }
// Name:
// Dimensions: 2 Fields by 1 Rows
// +----------------------------------+-----------------+
// | Name: OperationName | Name: Level |
// | Labels: | Labels: |
// | Type: []*string | Type: []*string |
// +----------------------------------+-----------------+
// | Create or Update Virtual Machine | Informational |
// +----------------------------------+-----------------+
//
//
// 🌟 This was machine generated. Do not edit. 🌟
{
"status": 200,
"frames": [
{
"schema": {
"meta": {
"typeVersion": [
0,
0
],
"custom": {
"azureColumnTypes": [
"string",
"string"
]
},
"notices": [
{
"severity": "warning",
"text": "There were some errors when processing your query. Something went wrong processing your query on the server. Not sure what happened."
}
]
},
"fields": [
{
"name": "OperationName",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "Level",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
}
]
},
"data": {
"values": [
[
"Create or Update Virtual Machine"
],
[
"Informational"
]
]
}
}
]
}
@@ -0,0 +1,5 @@
// 🌟 This was machine generated. Do not edit. 🌟
// 🌟 This was machine generated. Do not edit. 🌟
{
"status": 200
}
@@ -0,0 +1,201 @@
// 🌟 This was machine generated. Do not edit. 🌟
//
// Frame[0] {
// "typeVersion": [
// 0,
// 0
// ],
// "custom": {
// "azureColumnTypes": [
// "string",
// "string",
// "string",
// "string",
// "string",
// "real",
// "real",
// "int",
// "real",
// "datetime"
// ]
// }
// }
// Name:
// Dimensions: 10 Fields by 3 Rows
// +--------------------------------------+-----------------+------------------+-------------------------+--------------------+------------------+------------------+-------------------+--------------------+-----------------------------------+
// | Name: TenantId | Name: Computer | Name: ObjectName | Name: CounterName | Name: InstanceName | Name: Min | Name: Max | Name: SampleCount | Name: CounterValue | Name: TimeGenerated |
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
// | Type: []*string | Type: []*string | Type: []*string | Type: []*string | Type: []*string | Type: []*float64 | Type: []*float64 | Type: []*int32 | Type: []*float64 | Type: []*time.Time |
// +--------------------------------------+-----------------+------------------+-------------------------+--------------------+------------------+------------------+-------------------+--------------------+-----------------------------------+
// | a2c1b44e-3e57-4410-b027-6cc0ae6dee67 | grafana-vm | Memory | Available MBytes Memory | Memory | null | null | null | 2040 | 2020-04-23 11:46:03.857 +0000 UTC |
// | a2c1b44e-3e57-4410-b027-6cc0ae6dee67 | grafana-vm | Memory | Available MBytes Memory | Memory | null | null | null | 2066 | 2020-04-23 11:46:13.857 +0000 UTC |
// | a2c1b44e-3e57-4410-b027-6cc0ae6dee67 | grafana-vm | Memory | Available MBytes Memory | Memory | null | null | null | 2066 | 2020-04-23 11:46:23.857 +0000 UTC |
// +--------------------------------------+-----------------+------------------+-------------------------+--------------------+------------------+------------------+-------------------+--------------------+-----------------------------------+
//
//
// 🌟 This was machine generated. Do not edit. 🌟
{
"status": 200,
"frames": [
{
"schema": {
"meta": {
"typeVersion": [
0,
0
],
"custom": {
"azureColumnTypes": [
"string",
"string",
"string",
"string",
"string",
"real",
"real",
"int",
"real",
"datetime"
]
}
},
"fields": [
{
"name": "TenantId",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "Computer",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "ObjectName",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "CounterName",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "InstanceName",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "Min",
"type": "number",
"typeInfo": {
"frame": "float64",
"nullable": true
}
},
{
"name": "Max",
"type": "number",
"typeInfo": {
"frame": "float64",
"nullable": true
}
},
{
"name": "SampleCount",
"type": "number",
"typeInfo": {
"frame": "int32",
"nullable": true
}
},
{
"name": "CounterValue",
"type": "number",
"typeInfo": {
"frame": "float64",
"nullable": true
}
},
{
"name": "TimeGenerated",
"type": "time",
"typeInfo": {
"frame": "time.Time",
"nullable": true
}
}
]
},
"data": {
"values": [
[
"a2c1b44e-3e57-4410-b027-6cc0ae6dee67",
"a2c1b44e-3e57-4410-b027-6cc0ae6dee67",
"a2c1b44e-3e57-4410-b027-6cc0ae6dee67"
],
[
"grafana-vm",
"grafana-vm",
"grafana-vm"
],
[
"Memory",
"Memory",
"Memory"
],
[
"Available MBytes Memory",
"Available MBytes Memory",
"Available MBytes Memory"
],
[
"Memory",
"Memory",
"Memory"
],
[
null,
null,
null
],
[
null,
null,
null
],
[
null,
null,
null
],
[
2040,
2066,
2066
],
[
1587642363857,
1587642373857,
1587642383857
]
]
}
}
]
}
@@ -0,0 +1,205 @@
// 🌟 This was machine generated. Do not edit. 🌟
//
// Frame[0] {
// "typeVersion": [
// 0,
// 0
// ],
// "custom": {
// "azureColumnTypes": [
// "bool",
// "string",
// "datetime",
// "dynamic",
// "guid",
// "int",
// "long",
// "real",
// "timespan",
// "decimal",
// "object",
// "number"
// ]
// }
// }
// Name:
// Dimensions: 12 Fields by 1 Rows
// +---------------+-----------------+---------------------------------+---------------------------------------------------------------+--------------------------------------+----------------+---------------------+-------------------------+------------------+-----------------------+--------------------------------------------------------------------------+-----------------------+
// | Name: XBool | Name: XString | Name: XDateTime | Name: XDynamic | Name: XGuid | Name: XInt | Name: XLong | Name: XReal | Name: XTimeSpan | Name: XDecimal | Name: XObject | Name: XNumber |
// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: |
// | Type: []*bool | Type: []*string | Type: []*time.Time | Type: []*string | Type: []*string | Type: []*int32 | Type: []*int64 | Type: []*float64 | Type: []*string | Type: []*float64 | Type: []*string | Type: []*float64 |
// +---------------+-----------------+---------------------------------+---------------------------------------------------------------+--------------------------------------+----------------+---------------------+-------------------------+------------------+-----------------------+--------------------------------------------------------------------------+-----------------------+
// | true | Grafana | 2006-01-02 22:04:05.1 +0000 UTC | [{"person":"Daniel"},{"cats":23},{"diagnosis":"cat problem"}] | 74be27de-1e4e-49d9-b579-fe0b331d3642 | 2147483647 | 9223372036854775807 | 1.7976931348623157e+308 | 00:00:00.0000001 | 7.922816251426434e+28 | "{\"person\": \"Daniel\", \"cats\": 23, \"diagnosis\": \"cat problem\"}" | 7.922816251426434e+28 |
// +---------------+-----------------+---------------------------------+---------------------------------------------------------------+--------------------------------------+----------------+---------------------+-------------------------+------------------+-----------------------+--------------------------------------------------------------------------+-----------------------+
//
//
// 🌟 This was machine generated. Do not edit. 🌟
{
"status": 200,
"frames": [
{
"schema": {
"meta": {
"typeVersion": [
0,
0
],
"custom": {
"azureColumnTypes": [
"bool",
"string",
"datetime",
"dynamic",
"guid",
"int",
"long",
"real",
"timespan",
"decimal",
"object",
"number"
]
}
},
"fields": [
{
"name": "XBool",
"type": "boolean",
"typeInfo": {
"frame": "bool",
"nullable": true
}
},
{
"name": "XString",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "XDateTime",
"type": "time",
"typeInfo": {
"frame": "time.Time",
"nullable": true
}
},
{
"name": "XDynamic",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "XGuid",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "XInt",
"type": "number",
"typeInfo": {
"frame": "int32",
"nullable": true
}
},
{
"name": "XLong",
"type": "number",
"typeInfo": {
"frame": "int64",
"nullable": true
}
},
{
"name": "XReal",
"type": "number",
"typeInfo": {
"frame": "float64",
"nullable": true
}
},
{
"name": "XTimeSpan",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "XDecimal",
"type": "number",
"typeInfo": {
"frame": "float64",
"nullable": true
}
},
{
"name": "XObject",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "XNumber",
"type": "number",
"typeInfo": {
"frame": "float64",
"nullable": true
}
}
]
},
"data": {
"values": [
[
true
],
[
"Grafana"
],
[
1136239445100
],
[
"[{\"person\":\"Daniel\"},{\"cats\":23},{\"diagnosis\":\"cat problem\"}]"
],
[
"74be27de-1e4e-49d9-b579-fe0b331d3642"
],
[
2147483647
],
[
9223372036854775807
],
[
1.7976931348623157e+308
],
[
"00:00:00.0000001"
],
[
7.922816251426434e+28
],
[
"\"{\\\"person\\\": \\\"Daniel\\\", \\\"cats\\\": 23, \\\"diagnosis\\\": \\\"cat problem\\\"}\""
],
[
7.922816251426434e+28
]
]
}
}
]
}
@@ -0,0 +1,105 @@
// 🌟 This was machine generated. Do not edit. 🌟
//
// Frame[0] {
// "typeVersion": [
// 0,
// 0
// ],
// "custom": {
// "azureColumnTypes": [
// "real",
// "real",
// "real"
// ]
// }
// }
// Name:
// Dimensions: 3 Fields by 1 Rows
// +------------------+------------------+------------------+
// | Name: XInf | Name: XInfNeg | Name: XNan |
// | Labels: | Labels: | Labels: |
// | Type: []*float64 | Type: []*float64 | Type: []*float64 |
// +------------------+------------------+------------------+
// | +Inf | -Inf | NaN |
// +------------------+------------------+------------------+
//
//
// 🌟 This was machine generated. Do not edit. 🌟
{
"status": 200,
"frames": [
{
"schema": {
"meta": {
"typeVersion": [
0,
0
],
"custom": {
"azureColumnTypes": [
"real",
"real",
"real"
]
}
},
"fields": [
{
"name": "XInf",
"type": "number",
"typeInfo": {
"frame": "float64",
"nullable": true
}
},
{
"name": "XInfNeg",
"type": "number",
"typeInfo": {
"frame": "float64",
"nullable": true
}
},
{
"name": "XNan",
"type": "number",
"typeInfo": {
"frame": "float64",
"nullable": true
}
}
]
},
"data": {
"values": [
[
null
],
[
null
],
[
null
]
],
"entities": [
{
"Inf": [
0
]
},
{
"NegInf": [
0
]
},
{
"NaN": [
0
]
}
]
}
}
]
}
@@ -0,0 +1,87 @@
// 🌟 This was machine generated. Do not edit. 🌟
//
// Frame[0] {
// "typeVersion": [
// 0,
// 0
// ],
// "custom": {
// "azureColumnTypes": [
// "string",
// "string"
// ]
// },
// "notices": [
// {
// "severity": "error",
// "text": "There were some errors when processing your query. Something went wrong processing your query on the server. The results of this query exceed the set limit of 1 records."
// }
// ]
// }
// Name:
// Dimensions: 2 Fields by 1 Rows
// +----------------------------------+-----------------+
// | Name: OperationName | Name: Level |
// | Labels: | Labels: |
// | Type: []*string | Type: []*string |
// +----------------------------------+-----------------+
// | Create or Update Virtual Machine | Informational |
// +----------------------------------+-----------------+
//
//
// 🌟 This was machine generated. Do not edit. 🌟
{
"status": 200,
"frames": [
{
"schema": {
"meta": {
"typeVersion": [
0,
0
],
"custom": {
"azureColumnTypes": [
"string",
"string"
]
},
"notices": [
{
"severity": "error",
"text": "There were some errors when processing your query. Something went wrong processing your query on the server. The results of this query exceed the set limit of 1 records."
}
]
},
"fields": [
{
"name": "OperationName",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
},
{
"name": "Level",
"type": "string",
"typeInfo": {
"frame": "string",
"nullable": true
}
}
]
},
"data": {
"values": [
[
"Create or Update Virtual Machine"
],
[
"Informational"
]
]
}
}
]
}