mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Azure monitor: Basic Logs frontend (#85905) * adds datasource level config for enabling basic logs * add basiclogsquery type to query json * add toggle between basic and analytics * adds basic logs toggle from UI, blocks time picker to only dashboard if basic logs is selected * add check to remove UI if alerting * tests for logsmanagement component * tests for logs query editor * tests for time mangement control * remove unused imports * clears query whenever toggle changes from basic <-> analytics * add test to account for clearning query * Update public/app/plugins/datasource/azuremonitor/components/ConfigEditor/BasicLogsToggle.tsx wording Co-authored-by: Andreas Christou <andreas.christou@grafana.com> * Update public/app/plugins/datasource/azuremonitor/components/LogsQueryEditor/LogsQueryEditor.tsx spelling Co-authored-by: Andreas Christou <andreas.christou@grafana.com> * Update public/app/plugins/datasource/azuremonitor/components/LogsQueryEditor/LogsQueryEditor.tsx spelling Co-authored-by: Andreas Christou <andreas.christou@grafana.com> * update dependency list * clear basic logs if resources change * fix tests --------- Co-authored-by: Andreas Christou <andreas.christou@grafana.com> * Azure Monitor: Basic Logs modal acknowledgement (#86244) * adds datasource level config for enabling basic logs * add basiclogsquery type to query json * add toggle between basic and analytics * adds basic logs toggle from UI, blocks time picker to only dashboard if basic logs is selected * add check to remove UI if alerting * tests for logsmanagement component * tests for logs query editor * tests for time mangement control * remove unused imports * add confirm modal * clears query whenever toggle changes from basic <-> analytics * add test to account for clearning query * adds modal acknowledgement for basic logs query * tests for handling modal logic * basic logs ack type * Update public/app/plugins/datasource/azuremonitor/components/ConfigEditor/BasicLogsToggle.tsx wording Co-authored-by: Andreas Christou <andreas.christou@grafana.com> * Update public/app/plugins/datasource/azuremonitor/components/LogsQueryEditor/LogsQueryEditor.tsx spelling Co-authored-by: Andreas Christou <andreas.christou@grafana.com> * Update public/app/plugins/datasource/azuremonitor/components/LogsQueryEditor/LogsQueryEditor.tsx spelling Co-authored-by: Andreas Christou <andreas.christou@grafana.com> * update dependency list * clear basic logs if resources change * remove modal from config page * remove basic logs query ack type * add modal acknowledgement to toggle between basic and analytics * clear query if resources change * fix tests * fix tests * Update public/app/plugins/datasource/azuremonitor/components/LogsQueryEditor/LogsManagement.tsx Co-authored-by: Andreas Christou <andreas.christou@grafana.com> * fix tests --------- Co-authored-by: Andreas Christou <andreas.christou@grafana.com> * Azure Monitor: Basic Logs Backend (#87653) * fix logic for showingBasicLogsToggle * move to utils function and add basiclogsquery in apply template variable * add backend safeguards for basiclogsqueries * adds support for calling search or query apis based on whether it is basic logs or not * add tests for utils * initial test for basic logs query in the backend * tests for basic logs * remve comment * simplify checks for basic logs * adds fromAlert prop for azure monitor backend services * adds fromAlert check fo basic logs * fix working and empty tags * add telemetry for basic logs * remove import from grafana core package * change fromAlert true in tests * change the way tests catch errors * Update pkg/tsdb/azuremonitor/loganalytics/utils.go Co-authored-by: Andreas Christou <andreas.christou@grafana.com> * Update pkg/tsdb/azuremonitor/loganalytics/utils.go Co-authored-by: Andreas Christou <andreas.christou@grafana.com> * Update pkg/tsdb/azuremonitor/loganalytics/utils.go Co-authored-by: Andreas Christou <andreas.christou@grafana.com> * Update pkg/tsdb/azuremonitor/loganalytics/azure-log-analytics-datasource.go Co-authored-by: Andreas Christou <andreas.christou@grafana.com> * restructure code to only run basic logs checks if basiclogsflag is true * data retention warning * tests for calculate time range * Simplify determining if request is from alerting * Fix lint and bool check * Fix tests * clarify data retention --------- Co-authored-by: Jocelyn <jcolladokuri@microsoft.com> Co-authored-by: jcolladokuri <jocelyncollado52@gmail.com> * Azure Monitor: Basic Logs data volume notification (#88009) * frontend changes for data ingested warning * initial logic for getResource * payload processing * create basicLogs usage function * add utils for converting time and getting the data volume query for basic logs * frontend updates for showing the data ingested for the given query * frontend tests * add check for when no dataIngested is returned * remove backend.logger prints * comment on what function does * fix merge * make resource URI regex case insensitive * add support for workspace variables in basic logs flow * add undefined check * structure and add tests for variable support * Update pkg/tsdb/azuremonitor/loganalytics/azure-log-analytics-datasource.go Co-authored-by: Andreas Christou <andreas.christou@grafana.com> * add tracing for basic logs usage request * clean up data volume query struct * use async/await instead of callback * fix parameters for getApiURL * restrict time on usage query to 8 days max * add time to dependency array to refetch basic logs usage * move time check implementation to backend * fix utils tests --------- Co-authored-by: Jocelyn <jcolladokuri@microsoft.com> Co-authored-by: jcolladokuri <jocelyncollado52@gmail.com> --------- Co-authored-by: jcolladokuri <jcolladokuri@microsoft.com> Co-authored-by: jcolladokuri <jocelyncollado52@gmail.com>
126 lines
4.8 KiB
Go
126 lines
4.8 KiB
Go
package loganalytics
|
|
|
|
var Tables = []string{"availabilityResults", "dependencies", "customEvents", "exceptions", "pageViews", "requests", "traces"}
|
|
|
|
var MaxHoursBasicLogs = 192 // 8 days in hours
|
|
|
|
// AttributesOmit - Properties to omit when generating the attributes bag
|
|
var AttributesOmit = map[string]string{"operationId": "operationId", "duration": "duration", "id": "id", "name": "name", "problemId": "problemId", "operation_ParentId": "operation_ParentId", "timestamp": "timestamp", "customDimensions": "customDimensions", "operation_Name": "operation_Name"}
|
|
|
|
// CommonProperties - common resource centric properties mapped to legacy property names
|
|
var CommonProperties = map[string]string{
|
|
"appId": "ResourceGUID",
|
|
"application_Version": "AppVersion",
|
|
"appName": "_ResourceId",
|
|
"client_Browser": "ClientBrowser",
|
|
"client_City": "ClientCity",
|
|
"client_CountryOrRegion": "ClientCountryOrRegion",
|
|
"client_IP": "ClientIP",
|
|
"client_Model": "ClientModel",
|
|
"client_OS": "ClientOS",
|
|
"client_StateOrProvince": "ClientStateOrProvince",
|
|
"client_Type": "ClientType",
|
|
"cloud_RoleInstance": "AppRoleInstance",
|
|
"cloud_RoleName": "AppRoleName",
|
|
"customDimensions": "Properties",
|
|
"customMeasurements": "Measurements",
|
|
"duration": "DurationMs",
|
|
"id": "Id",
|
|
"iKey": "IKey",
|
|
"itemCount": "ItemCount",
|
|
"itemId": "_ItemId",
|
|
"itemType": "Type",
|
|
"name": "Name",
|
|
"operation_Id": "OperationId",
|
|
"operation_Name": "OperationName",
|
|
"operation_ParentId": "OperationParentId",
|
|
"operation_SyntheticSource": "OperationSyntheticSource",
|
|
"performanceBucket": "PerformanceBucket",
|
|
"sdkVersion": "SDKVersion",
|
|
"session_Id": "SessionId",
|
|
"success": "Success",
|
|
"timestamp": "TimeGenerated",
|
|
"user_AccountId": "UserAccountId",
|
|
"user_AuthenticatedId": "UserAuthenticatedId",
|
|
"user_Id": "UserId",
|
|
}
|
|
|
|
func copyCommonProperties(dst map[string]string, omit map[string]string) map[string]string {
|
|
for k, v := range CommonProperties {
|
|
if _, ok := omit[k]; !ok {
|
|
dst[k] = v
|
|
}
|
|
}
|
|
return dst
|
|
}
|
|
|
|
var emptyMap = map[string]string{}
|
|
|
|
var AvailabilityResultsSchema = copyCommonProperties(map[string]string{
|
|
"location": "Location",
|
|
"message": "Message",
|
|
"size": "Size",
|
|
}, emptyMap)
|
|
|
|
var DependenciesSchema = copyCommonProperties(map[string]string{
|
|
"data": "Data",
|
|
"resultCode": "ResultCode",
|
|
"target": "Target",
|
|
"type": "DependencyType",
|
|
}, emptyMap)
|
|
|
|
var EventsSchema = copyCommonProperties(map[string]string{}, map[string]string{"duration": "duration", "id": "id", "success": "success", "performanceBucket": "performanceBucket"})
|
|
|
|
var PageViewsSchema = copyCommonProperties(map[string]string{"url": "Url"}, map[string]string{"success": "success"})
|
|
|
|
var RequestsSchema = copyCommonProperties(map[string]string{"resultCode": "ResultCode",
|
|
"source": "Source",
|
|
"url": "Url"}, map[string]string{})
|
|
|
|
var ExceptionsSchema = copyCommonProperties(map[string]string{
|
|
"assembly": "Assembly",
|
|
"details": "Details",
|
|
"handledAt": "HandledAt",
|
|
"innermostAssembly": "InnermostAssembly",
|
|
"innermostMessage": "InnermostMessage",
|
|
"innermostMethod": "InnermostMethod",
|
|
"innermostType": "InnermostType",
|
|
"message": "Message",
|
|
"method": "Method",
|
|
"outerAssembly": "OuterAssembly",
|
|
"outerMessage": "OuterMessage",
|
|
"outerMethod": "OuterMethod",
|
|
"outerType": "OuterType",
|
|
"problemId": "ProblemId",
|
|
"severityLevel": "SeverityLevel",
|
|
"type": "ExceptionType",
|
|
// Grafana specific error tag
|
|
"error": "error",
|
|
}, map[string]string{"duration": "duration", "id": "id", "name": "name", "performanceBucket": "performanceBucket", "success": "success"})
|
|
|
|
var TracesSchema = copyCommonProperties(map[string]string{
|
|
"message": "Message",
|
|
"severityLevel": "SeverityLevel",
|
|
}, map[string]string{"duration": "duration", "id": "id", "name": "name", "performanceBucket": "performanceBucket", "success": "success"})
|
|
|
|
var TablesSchema = map[string]map[string]string{
|
|
"availabilityResults": AvailabilityResultsSchema,
|
|
"dependencies": DependenciesSchema,
|
|
"customEvents": EventsSchema,
|
|
"exceptions": ExceptionsSchema,
|
|
"pageViews": PageViewsSchema,
|
|
"requests": RequestsSchema,
|
|
"traces": TracesSchema,
|
|
}
|
|
|
|
func getTagsForTable(table string) []string {
|
|
tagsMap := TablesSchema[table]
|
|
tags := []string{}
|
|
|
|
for k := range tagsMap {
|
|
tags = append(tags, k)
|
|
}
|
|
|
|
return tags
|
|
}
|