Skip to content

Commit 49ef030

Browse files
authored
Update readme for Azure.Monitor.Query (Azure#23934)
1 parent 19f658b commit 49ef030

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

sdk/monitor/Azure.Monitor.Query/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ All client instance methods are thread-safe and independent of each other ([guid
7272
## Examples
7373

7474
- [Logs query](#logs-query)
75+
- [Handle logs query response](#handle-logs-query-response)
7576
- [Map logs query results to a model](#map-logs-query-results-to-a-model)
7677
- [Map logs query results to a primitive](#map-logs-query-results-to-a-primitive)
7778
- [Print logs query results as a table](#print-logs-query-results-as-a-table)
@@ -80,6 +81,7 @@ All client instance methods are thread-safe and independent of each other ([guid
8081
- [Set logs query timeout](#set-logs-query-timeout)
8182
- [Query multiple workspaces](#query-multiple-workspaces)
8283
- [Metrics query](#metrics-query)
84+
- [Handle metrics query response](#handle-metrics-query-response)
8385

8486
### Logs query
8587

@@ -101,6 +103,23 @@ foreach (var row in table.Rows)
101103
}
102104
```
103105

106+
#### Handle logs query response
107+
The `Query` method returns the `LogsQueryResult`, while the `QueryBatch` method returns the `LogsBatchQueryResult`. Here's a hierarchy of the response:
108+
109+
```
110+
LogsQueryResult
111+
|---Error
112+
|---Status
113+
|---Table
114+
|---Name
115+
|---Columns (list of `LogsTableColumn` objects)
116+
|---Name
117+
|---Type
118+
|---Rows (list of `LogsTableRows` objects)
119+
|---Count
120+
|---AllTables (list of `LogsTable` objects)
121+
```
122+
104123
#### Map logs query results to a model
105124

106125
You can map logs query results to a model using the `LogsQueryClient.QueryAsync<T>` method.
@@ -307,6 +326,31 @@ foreach (var metric in results.Value.Metrics)
307326
}
308327
```
309328

329+
#### Handle metrics query response
330+
331+
The metrics query API returns a `MetricsQueryResult` object. The `MetricsQueryResult` object contains properties such as a list of `MetricResult`-typed objects, `Cost`, `Namespace`, `ResourceRegion`, `TimeSpan`, and `Interval`. The `MetricResult` objects list can be accessed using the `metrics` param. Each `MetricResult` object in this list contains a list of `MetricTimeSeriesElement` objects. Each `MetricTimeSeriesElement` object contains `Metadata` and `Values` properties.
332+
333+
Here's a hierarchy of the response:
334+
335+
```
336+
MetricsQueryResult
337+
|---Cost
338+
|---Interval
339+
|---Namespace
340+
|---ResourceRegion
341+
|---TimeSpan
342+
|---Metrics (list of `MetricResult` objects)
343+
|---Id
344+
|---Type
345+
|---Name
346+
|---DisplayDescription
347+
|---Error
348+
|---Unit
349+
|---TimeSeries (list of `MetricTimeSeriesElement` objects)
350+
|---Metadata
351+
|---Values
352+
```
353+
310354
## Troubleshooting
311355

312356
### General

0 commit comments

Comments
 (0)