Skip to content

Commit d2534f7

Browse files
authored
[Azquery][Readme] Edit pass (Azure#20382)
* [Azquery][Readme] Edit pass * review comments
1 parent e9c77a5 commit d2534f7

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

sdk/monitor/azquery/README.md

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
# Azure Monitor Query client module for Go
22

3-
The Azure Monitor Query client library is used to execute read-only queries against [Azure Monitor][azure_monitor_overview]'s two data platforms:
3+
The Azure Monitor Query client module is used to execute read-only queries against [Azure Monitor][azure_monitor_overview]'s two data platforms:
44

55
- [Logs][logs_overview] - Collects and organizes log and performance data from monitored resources. Data from different sources such as platform logs from Azure services, log and performance data from virtual machines agents, and usage and performance data from apps can be consolidated into a single [Azure Log Analytics workspace][log_analytics_workspace]. The various data types can be analyzed together using the [Kusto Query Language][kusto_query_language]. See the [Kusto to SQL cheat sheet][kusto_to_sql] for more information.
66
- [Metrics][metrics_overview] - Collects numeric data from monitored resources into a time series database. Metrics are numerical values that are collected at regular intervals and describe some aspect of a system at a particular time. Metrics are lightweight and capable of supporting near real-time scenarios, making them particularly useful for alerting and fast detection of issues.
77

8-
[Source code][azquery_repo] | [Package (pkg.go.dev)][azquery_pkg_go] | [Product documentation][monitor_docs] | [Samples][azquery_pkg_go_samples]
8+
[Source code][azquery_repo] | [Package (pkg.go.dev)][azquery_pkg_go] | [REST API documentation][monitor_rest_docs] | [Product documentation][monitor_docs] | [Samples][azquery_pkg_go_samples]
99

1010
## Getting started
1111

12-
### Install packages
12+
### Prerequisites
13+
14+
* Go, version 1.18 or higher - [Install Go](https://go.dev/doc/install)
15+
* Azure subscription - [Create a free account][azure_sub]
16+
* To query logs, an Azure Log Analytics workspace ID - Create an [Azure Log Analytics workspace][log_analytics_workspace_create]
17+
* To query metrics, the Resource URI of an Azure resource (Storage Account, Key Vault, CosmosDB, etc.) that you plan to monitor
18+
19+
### Install the packages
1320

14-
Install `azquery` and `azidentity` with `go get`:
15-
```Bash
21+
Install the `azquery` and `azidentity` modules with `go get`:
22+
23+
```bash
1624
go get github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery
1725
go get github.com/Azure/azure-sdk-for-go/sdk/azidentity
1826
```
19-
[azidentity][azure_identity] is used for Azure Active Directory authentication during client construction.
20-
21-
### Prerequisites
2227

23-
* An [Azure subscription][azure_sub]
24-
* A supported Go version (the Azure SDK supports the two most recent Go releases)
25-
* For log queries, an [Azure Log Analytics workspace][log_analytics_workspace_create] ID.
26-
* For metric queries, the Resource URI of any Azure resource (Storage Account, Key Vault, CosmosDB, etc).
28+
The [azidentity][azure_identity] module is used for Azure Active Directory authentication during client construction.
2729

2830
### Authentication
2931

30-
This document demonstrates using [azidentity.NewDefaultAzureCredential][default_cred_ref] to authenticate. The client accepts any [azidentity][azure_identity] credential. See the [azidentity][azure_identity] documentation for more information about other credential types.
32+
An authenticated client object is required to execute a query. The examples demonstrate using [azidentity.NewDefaultAzureCredential][default_cred_ref] to authenticate; however, the client accepts any [azidentity][azure_identity] credential. See the [azidentity][azure_identity] documentation for more information about other credential types.
3133

32-
The clients default to the Azure Public Cloud. See the [cloud][cloud_documentation] documentation for more information about other cloud configurations.
34+
The clients default to the Azure public cloud. For other cloud configurations, see the [cloud][cloud_documentation] package documentation.
3335

3436
#### Create a logs client
3537

@@ -43,7 +45,7 @@ Example [metrics client][example_metrics_client]
4345

4446
### Timespan
4547

46-
It's best practice to always query with a timespan (type `TimeInterval`) to prevent excessive queries of the entire logs or metrics data set. Log queries uses the ISO8601 Time Interval Standard. All time should be represented in UTC. If the timespan is included in both the Kusto query string and `Timespan` field, the timespan will be the intersection of the two values.
48+
It's best practice to always query with a timespan (type `TimeInterval`) to prevent excessive queries of the entire logs or metrics data set. Log queries use the ISO8601 Time Interval Standard. All time should be represented in UTC. If the timespan is included in both the Kusto query string and `Timespan` field, the timespan is the intersection of the two values.
4749

4850
Use the `NewTimeInterval()` method for easy creation.
4951

@@ -56,31 +58,31 @@ Each set of metric values is a time series with the following characteristics:
5658
- A namespace that acts like a category for the metric
5759
- A metric name
5860
- The value itself
59-
- Some metrics may have multiple dimensions as described in multi-dimensional metrics. Custom metrics can have up to 10 dimensions.
61+
- Some metrics may have multiple dimensions as described in [multi-dimensional metrics][multi-metrics]. Custom metrics can have up to 10 dimensions.
6062

6163
### Logs query rate limits and throttling
6264

6365
The Log Analytics service applies throttling when the request rate is too high. Limits, such as the maximum number of rows returned, are also applied on the Kusto queries. For more information, see [Query API][service_limits].
6466

6567
If you're executing a batch logs query, a throttled request will return a `ErrorInfo` object. That object's `code` value will be `ThrottledError`.
6668

67-
### Advanced logs query
69+
### Advanced logs queries
6870

6971
#### Query multiple workspaces
7072

7173
To run the same query against multiple Log Analytics workspaces, add the additional workspace ID strings to the `AdditionalWorkspaces` slice in the `Body` struct.
7274

73-
When multiple workspaces are included in the query, the logs in the result table are not grouped according to the workspace from which it was retrieved.
75+
When multiple workspaces are included in the query, the logs in the result table are not grouped according to the workspace from which they were retrieved.
7476

7577
#### Increase wait time, include statistics, include render (visualization)
7678

7779
The `LogsQueryOptions` type is used for advanced logs options.
7880

79-
By default, your query will run for up to three minutes. To increase the default timeout, set `LogsQueryOptions.Wait` to the desired number of seconds. The maximum wait time the service will allow is ten minutes (600 seconds).
81+
* By default, your query will run for up to three minutes. To increase the default timeout, set `LogsQueryOptions.Wait` to the desired number of seconds. The maximum wait time is 10 minutes (600 seconds).
8082

81-
To get logs query execution statistics, such as CPU and memory consumption, set `LogsQueryOptions.Statistics` to `true`.
83+
* To get logs query execution statistics, such as CPU and memory consumption, set `LogsQueryOptions.Statistics` to `true`.
8284

83-
To get visualization data for logs queries, set `LogsQueryOptions.Visualization` to `true`.
85+
* To get visualization data for logs queries, set `LogsQueryOptions.Visualization` to `true`.
8486

8587
```go
8688
azquery.LogsClientQueryWorkspaceOptions{
@@ -98,9 +100,9 @@ To do the same with `QueryBatch`, set the values in the `BatchQueryRequest.Heade
98100

99101
Get started with our [examples][azquery_pkg_go_samples].
100102

101-
For the majority of log queries, use the `LogsClient.QueryWorkspace` method. The `LogsClient.QueryBatch` method should only be used in advanced scenerios.
103+
* For the majority of log queries, use the `LogsClient.QueryWorkspace` method. Only use the `LogsClient.QueryBatch` method in advanced scenerios.
102104

103-
Use `MetricsClient.QueryResource` for metric queries.
105+
* Use `MetricsClient.QueryResource` for metric queries.
104106

105107
## Troubleshooting
106108

@@ -121,6 +123,7 @@ comments.
121123
<!-- LINKS -->
122124
[azquery_repo]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/monitor/azquery
123125
[azquery_pkg_go]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery
126+
[azquery_pkg_go_docs]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery#section-documentation
124127
[azquery_pkg_go_samples]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery#pkg-examples
125128
[azure_identity]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity
126129
[azure_sub]: https://azure.microsoft.com/free/
@@ -130,13 +133,16 @@ comments.
130133
[default_cred_ref]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/azidentity#defaultazurecredential
131134
[example_logs_client]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery#example-NewLogsClient
132135
[example_metrics_client]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery#example-NewMetricsClient
136+
[go_samples]: (https://github.com/Azure-Samples/azure-sdk-for-go-samples)
133137
[kusto_query_language]: https://learn.microsoft.com/azure/data-explorer/kusto/query/
134138
[kusto_to_sql]: https://learn.microsoft.com/azure/data-explorer/kusto/query/sqlcheatsheet
135139
[log_analytics_workspace]: https://learn.microsoft.com/azure/azure-monitor/logs/log-analytics-workspace-overview
136140
[log_analytics_workspace_create]: https://learn.microsoft.com/azure/azure-monitor/logs/quick-create-workspace
137141
[logs_overview]: https://learn.microsoft.com/azure/azure-monitor/logs/data-platform-logs
138142
[metrics_overview]: https://learn.microsoft.com/azure/azure-monitor/essentials/data-platform-metrics
139143
[monitor_docs]: https://learn.microsoft.com/azure/azure-monitor/
144+
[monitor_rest_docs]: https://learn.microsoft.com/rest/api/monitor/
145+
[multi-metrics]: https://learn.microsoft.com/azure/azure-monitor/essentials/data-platform-metrics#multi-dimensional-metrics
140146
[service_limits]: https://learn.microsoft.com/azure/azure-monitor/service-limits#la-query-api
141147
[troubleshooting_guide]: https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/monitor/azquery/TROUBLESHOOTING.md
142148
[cla]: https://cla.microsoft.com

0 commit comments

Comments
 (0)