@azure/monitor-query-metrics 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +243 -0
- package/dist/browser/api/index.d.ts +4 -0
- package/dist/browser/api/index.d.ts.map +1 -0
- package/dist/browser/api/index.js +5 -0
- package/dist/browser/api/index.js.map +1 -0
- package/dist/browser/api/metricsContext.d.ts +15 -0
- package/dist/browser/api/metricsContext.d.ts.map +1 -0
- package/dist/browser/api/metricsContext.js +38 -0
- package/dist/browser/api/metricsContext.js.map +1 -0
- package/dist/browser/api/operations.d.ts +9 -0
- package/dist/browser/api/operations.d.ts.map +1 -0
- package/dist/browser/api/operations.js +49 -0
- package/dist/browser/api/operations.js.map +1 -0
- package/dist/browser/api/options.d.ts +57 -0
- package/dist/browser/api/options.d.ts.map +1 -0
- package/dist/browser/api/options.js +4 -0
- package/dist/browser/api/options.js.map +1 -0
- package/dist/browser/index.d.ts +5 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +6 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/internalMetricsClient.d.ts +15 -0
- package/dist/browser/internalMetricsClient.d.ts.map +1 -0
- package/dist/browser/internalMetricsClient.js +23 -0
- package/dist/browser/internalMetricsClient.js.map +1 -0
- package/dist/browser/logger.d.ts +2 -0
- package/dist/browser/logger.d.ts.map +1 -0
- package/dist/browser/logger.js +5 -0
- package/dist/browser/logger.js.map +1 -0
- package/dist/browser/metricsClient.d.ts +28 -0
- package/dist/browser/metricsClient.d.ts.map +1 -0
- package/dist/browser/metricsClient.js +48 -0
- package/dist/browser/metricsClient.js.map +1 -0
- package/dist/browser/models/index.d.ts +2 -0
- package/dist/browser/models/index.d.ts.map +1 -0
- package/dist/browser/models/index.js +4 -0
- package/dist/browser/models/index.js.map +1 -0
- package/dist/browser/models/models.d.ts +141 -0
- package/dist/browser/models/models.d.ts.map +1 -0
- package/dist/browser/models/models.js +136 -0
- package/dist/browser/models/models.js.map +1 -0
- package/dist/browser/models.d.ts +167 -0
- package/dist/browser/models.d.ts.map +1 -0
- package/dist/browser/models.js +46 -0
- package/dist/browser/models.js.map +1 -0
- package/dist/browser/package.json +3 -0
- package/dist/browser/static-helpers/urlTemplate.d.ts +5 -0
- package/dist/browser/static-helpers/urlTemplate.d.ts.map +1 -0
- package/dist/browser/static-helpers/urlTemplate.js +186 -0
- package/dist/browser/static-helpers/urlTemplate.js.map +1 -0
- package/dist/browser/utils.d.ts +13 -0
- package/dist/browser/utils.d.ts.map +1 -0
- package/dist/browser/utils.js +54 -0
- package/dist/browser/utils.js.map +1 -0
- package/dist/commonjs/api/index.d.ts +4 -0
- package/dist/commonjs/api/index.d.ts.map +1 -0
- package/dist/commonjs/api/index.js +10 -0
- package/dist/commonjs/api/index.js.map +1 -0
- package/dist/commonjs/api/metricsContext.d.ts +15 -0
- package/dist/commonjs/api/metricsContext.d.ts.map +1 -0
- package/dist/commonjs/api/metricsContext.js +41 -0
- package/dist/commonjs/api/metricsContext.js.map +1 -0
- package/dist/commonjs/api/operations.d.ts +9 -0
- package/dist/commonjs/api/operations.d.ts.map +1 -0
- package/dist/commonjs/api/operations.js +54 -0
- package/dist/commonjs/api/operations.js.map +1 -0
- package/dist/commonjs/api/options.d.ts +57 -0
- package/dist/commonjs/api/options.d.ts.map +1 -0
- package/dist/commonjs/api/options.js +5 -0
- package/dist/commonjs/api/options.js.map +1 -0
- package/dist/commonjs/index.d.ts +5 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +13 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/internalMetricsClient.d.ts +15 -0
- package/dist/commonjs/internalMetricsClient.d.ts.map +1 -0
- package/dist/commonjs/internalMetricsClient.js +27 -0
- package/dist/commonjs/internalMetricsClient.js.map +1 -0
- package/dist/commonjs/logger.d.ts +2 -0
- package/dist/commonjs/logger.d.ts.map +1 -0
- package/dist/commonjs/logger.js +8 -0
- package/dist/commonjs/logger.js.map +1 -0
- package/dist/commonjs/metricsClient.d.ts +28 -0
- package/dist/commonjs/metricsClient.d.ts.map +1 -0
- package/dist/commonjs/metricsClient.js +52 -0
- package/dist/commonjs/metricsClient.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +2 -0
- package/dist/commonjs/models/index.d.ts.map +1 -0
- package/dist/commonjs/models/index.js +8 -0
- package/dist/commonjs/models/index.js.map +1 -0
- package/dist/commonjs/models/models.d.ts +141 -0
- package/dist/commonjs/models/models.d.ts.map +1 -0
- package/dist/commonjs/models/models.js +157 -0
- package/dist/commonjs/models/models.js.map +1 -0
- package/dist/commonjs/models.d.ts +167 -0
- package/dist/commonjs/models.d.ts.map +1 -0
- package/dist/commonjs/models.js +49 -0
- package/dist/commonjs/models.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/static-helpers/urlTemplate.d.ts +5 -0
- package/dist/commonjs/static-helpers/urlTemplate.d.ts.map +1 -0
- package/dist/commonjs/static-helpers/urlTemplate.js +189 -0
- package/dist/commonjs/static-helpers/urlTemplate.js.map +1 -0
- package/dist/commonjs/tsdoc-metadata.json +11 -0
- package/dist/commonjs/utils.d.ts +13 -0
- package/dist/commonjs/utils.d.ts.map +1 -0
- package/dist/commonjs/utils.js +60 -0
- package/dist/commonjs/utils.js.map +1 -0
- package/dist/esm/api/index.d.ts +4 -0
- package/dist/esm/api/index.d.ts.map +1 -0
- package/dist/esm/api/index.js +5 -0
- package/dist/esm/api/index.js.map +1 -0
- package/dist/esm/api/metricsContext.d.ts +15 -0
- package/dist/esm/api/metricsContext.d.ts.map +1 -0
- package/dist/esm/api/metricsContext.js +38 -0
- package/dist/esm/api/metricsContext.js.map +1 -0
- package/dist/esm/api/operations.d.ts +9 -0
- package/dist/esm/api/operations.d.ts.map +1 -0
- package/dist/esm/api/operations.js +49 -0
- package/dist/esm/api/operations.js.map +1 -0
- package/dist/esm/api/options.d.ts +57 -0
- package/dist/esm/api/options.d.ts.map +1 -0
- package/dist/esm/api/options.js +4 -0
- package/dist/esm/api/options.js.map +1 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internalMetricsClient.d.ts +15 -0
- package/dist/esm/internalMetricsClient.d.ts.map +1 -0
- package/dist/esm/internalMetricsClient.js +23 -0
- package/dist/esm/internalMetricsClient.js.map +1 -0
- package/dist/esm/logger.d.ts +2 -0
- package/dist/esm/logger.d.ts.map +1 -0
- package/dist/esm/logger.js +5 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/metricsClient.d.ts +28 -0
- package/dist/esm/metricsClient.d.ts.map +1 -0
- package/dist/esm/metricsClient.js +48 -0
- package/dist/esm/metricsClient.js.map +1 -0
- package/dist/esm/models/index.d.ts +2 -0
- package/dist/esm/models/index.d.ts.map +1 -0
- package/dist/esm/models/index.js +4 -0
- package/dist/esm/models/index.js.map +1 -0
- package/dist/esm/models/models.d.ts +141 -0
- package/dist/esm/models/models.d.ts.map +1 -0
- package/dist/esm/models/models.js +136 -0
- package/dist/esm/models/models.js.map +1 -0
- package/dist/esm/models.d.ts +167 -0
- package/dist/esm/models.d.ts.map +1 -0
- package/dist/esm/models.js +46 -0
- package/dist/esm/models.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/static-helpers/urlTemplate.d.ts +5 -0
- package/dist/esm/static-helpers/urlTemplate.d.ts.map +1 -0
- package/dist/esm/static-helpers/urlTemplate.js +186 -0
- package/dist/esm/static-helpers/urlTemplate.js.map +1 -0
- package/dist/esm/utils.d.ts +13 -0
- package/dist/esm/utils.d.ts.map +1 -0
- package/dist/esm/utils.js +54 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/react-native/api/index.d.ts +4 -0
- package/dist/react-native/api/index.d.ts.map +1 -0
- package/dist/react-native/api/index.js +5 -0
- package/dist/react-native/api/index.js.map +1 -0
- package/dist/react-native/api/metricsContext.d.ts +15 -0
- package/dist/react-native/api/metricsContext.d.ts.map +1 -0
- package/dist/react-native/api/metricsContext.js +38 -0
- package/dist/react-native/api/metricsContext.js.map +1 -0
- package/dist/react-native/api/operations.d.ts +9 -0
- package/dist/react-native/api/operations.d.ts.map +1 -0
- package/dist/react-native/api/operations.js +49 -0
- package/dist/react-native/api/operations.js.map +1 -0
- package/dist/react-native/api/options.d.ts +57 -0
- package/dist/react-native/api/options.d.ts.map +1 -0
- package/dist/react-native/api/options.js +4 -0
- package/dist/react-native/api/options.js.map +1 -0
- package/dist/react-native/index.d.ts +5 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +6 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/internalMetricsClient.d.ts +15 -0
- package/dist/react-native/internalMetricsClient.d.ts.map +1 -0
- package/dist/react-native/internalMetricsClient.js +23 -0
- package/dist/react-native/internalMetricsClient.js.map +1 -0
- package/dist/react-native/logger.d.ts +2 -0
- package/dist/react-native/logger.d.ts.map +1 -0
- package/dist/react-native/logger.js +5 -0
- package/dist/react-native/logger.js.map +1 -0
- package/dist/react-native/metricsClient.d.ts +28 -0
- package/dist/react-native/metricsClient.d.ts.map +1 -0
- package/dist/react-native/metricsClient.js +48 -0
- package/dist/react-native/metricsClient.js.map +1 -0
- package/dist/react-native/models/index.d.ts +2 -0
- package/dist/react-native/models/index.d.ts.map +1 -0
- package/dist/react-native/models/index.js +4 -0
- package/dist/react-native/models/index.js.map +1 -0
- package/dist/react-native/models/models.d.ts +141 -0
- package/dist/react-native/models/models.d.ts.map +1 -0
- package/dist/react-native/models/models.js +136 -0
- package/dist/react-native/models/models.js.map +1 -0
- package/dist/react-native/models.d.ts +167 -0
- package/dist/react-native/models.d.ts.map +1 -0
- package/dist/react-native/models.js +46 -0
- package/dist/react-native/models.js.map +1 -0
- package/dist/react-native/package.json +3 -0
- package/dist/react-native/static-helpers/urlTemplate.d.ts +5 -0
- package/dist/react-native/static-helpers/urlTemplate.d.ts.map +1 -0
- package/dist/react-native/static-helpers/urlTemplate.js +186 -0
- package/dist/react-native/static-helpers/urlTemplate.js.map +1 -0
- package/dist/react-native/utils.d.ts +13 -0
- package/dist/react-native/utils.d.ts.map +1 -0
- package/dist/react-native/utils.js +54 -0
- package/dist/react-native/utils.js.map +1 -0
- package/package.json +130 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Copyright (c) Microsoft Corporation.
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Azure Monitor Query Metrics client library for JavaScript
|
|
2
|
+
|
|
3
|
+
The Azure Monitor Query Metrics client library is used to execute read-only queries against [Azure Monitor][azure_monitor_overview]'s metrics data platform:
|
|
4
|
+
|
|
5
|
+
- [Metrics](https://learn.microsoft.com/azure/azure-monitor/essentials/data-platform-metrics) - 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 useful for alerting and fast detection of issues.
|
|
6
|
+
|
|
7
|
+
## Migrating from @azure/monitor-query advisory ⚠️
|
|
8
|
+
|
|
9
|
+
Checkout the [Migration Guide](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/monitor/monitor-query-metrics/MIGRATION.md) for detailed instructions on how to update your application code from the original `@azure/monitor-query` package to the `@azure/monitor-query-metrics` library.
|
|
10
|
+
|
|
11
|
+
**Resources:**
|
|
12
|
+
|
|
13
|
+
- [Source code][source]
|
|
14
|
+
- [Package (npm)][package]
|
|
15
|
+
- [API reference documentation][msdocs_apiref]
|
|
16
|
+
- [Service documentation][azure_monitor_overview]
|
|
17
|
+
- [Samples][samples]
|
|
18
|
+
- [Change log][changelog]
|
|
19
|
+
|
|
20
|
+
## Getting started
|
|
21
|
+
|
|
22
|
+
### Supported environments
|
|
23
|
+
|
|
24
|
+
- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
|
|
25
|
+
- Latest versions of Safari, Chrome, Microsoft Edge, and Firefox
|
|
26
|
+
|
|
27
|
+
For more information, see our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md).
|
|
28
|
+
|
|
29
|
+
### Prerequisites
|
|
30
|
+
|
|
31
|
+
- An [Azure subscription][azure_subscription]
|
|
32
|
+
- A [TokenCredential](https://learn.microsoft.com/javascript/api/@azure/core-auth/tokencredential?view=azure-node-latest) implementation, such as an [Azure Identity library credential type](https://learn.microsoft.com/javascript/api/overview/azure/identity-readme?view=azure-node-latest#credential-classes).
|
|
33
|
+
- To query Metrics, you need an Azure resource of any kind (Storage Account, Key Vault, Cosmos DB, etc.).
|
|
34
|
+
|
|
35
|
+
### Install the package
|
|
36
|
+
|
|
37
|
+
Install the Azure Monitor Query Metrics client library for JavaScript with npm:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install --save @azure/monitor-query-metrics
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Create the client
|
|
44
|
+
|
|
45
|
+
An authenticated client is required to query Metrics. To authenticate, the following example uses [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/README.md#defaultazurecredential) from the [@azure/identity](https://www.npmjs.com/package/@azure/identity) package.
|
|
46
|
+
|
|
47
|
+
```ts snippet:ReadmeSampleCreateClient
|
|
48
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
49
|
+
import { MetricsClient } from "@azure/monitor-query-metrics";
|
|
50
|
+
|
|
51
|
+
const credential = new DefaultAzureCredential();
|
|
52
|
+
|
|
53
|
+
// Create a MetricsClient
|
|
54
|
+
const endpoint = " https://<endpoint>.monitor.azure.com/";
|
|
55
|
+
const metricsClient = new MetricsClient(endpoint, credential);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
#### Configure client for Azure sovereign cloud
|
|
59
|
+
|
|
60
|
+
By default, the library's clients are configured to use the Azure Public Cloud. To use a sovereign cloud instead, provide the correct endpoint and audience value when instantiating a client. For example:
|
|
61
|
+
|
|
62
|
+
```ts snippet:ReadmeSampleCreateClientSovereign
|
|
63
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
64
|
+
import { MetricsClient } from "@azure/monitor-query-metrics";
|
|
65
|
+
|
|
66
|
+
const credential = new DefaultAzureCredential();
|
|
67
|
+
|
|
68
|
+
// Create a MetricsClient
|
|
69
|
+
const endpoint = " https://<endpoint>.monitor.azure.cn/";
|
|
70
|
+
const metricsClient = new MetricsClient(endpoint, credential, {
|
|
71
|
+
audience: "https://monitor.azure.cn/.default",
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Execute the query
|
|
76
|
+
|
|
77
|
+
For examples of Metrics queries, see the [Examples](#examples) section.
|
|
78
|
+
|
|
79
|
+
## Key concepts
|
|
80
|
+
|
|
81
|
+
### Metrics data structure
|
|
82
|
+
|
|
83
|
+
Each set of metric values is a time series with the following characteristics:
|
|
84
|
+
|
|
85
|
+
- The time the value was collected
|
|
86
|
+
- The resource associated with the value
|
|
87
|
+
- A namespace that acts like a category for the metric
|
|
88
|
+
- A metric name
|
|
89
|
+
- The value itself
|
|
90
|
+
- Some metrics have multiple dimensions as described in multi-dimensional metrics. Custom metrics can have up to 10 dimensions.
|
|
91
|
+
|
|
92
|
+
## Examples
|
|
93
|
+
|
|
94
|
+
- [Metrics query](#metrics-query)
|
|
95
|
+
- [Handle metrics query response](#handle-metrics-query-response)
|
|
96
|
+
|
|
97
|
+
### Metrics query
|
|
98
|
+
|
|
99
|
+
To query metrics for one or more Azure resources, use the `queryResources` method of `MetricsClient`. This method requires a regional endpoint when creating the client. For example, `https://westus3.metrics.monitor.azure.com`.
|
|
100
|
+
|
|
101
|
+
Each Azure resource must reside in:
|
|
102
|
+
|
|
103
|
+
- The same region as the endpoint specified when creating the client.
|
|
104
|
+
- The same Azure subscription.
|
|
105
|
+
|
|
106
|
+
The resource IDs must be that of the resources for which metrics are being queried. It's normally of the format `/subscriptions/<id>/resourceGroups/<rg-name>/providers/<source>/topics/<resource-name>`.
|
|
107
|
+
|
|
108
|
+
To find the resource ID/URI:
|
|
109
|
+
|
|
110
|
+
1. Navigate to your resource's page in the Azure portal.
|
|
111
|
+
2. Select the **JSON View** link in the **Overview** section.
|
|
112
|
+
3. Copy the value in the **Resource ID** text box at the top of the JSON view.
|
|
113
|
+
|
|
114
|
+
Furthermore:
|
|
115
|
+
|
|
116
|
+
- The user must be authorized to read monitoring data at the Azure subscription level. For example, the [Monitoring Reader role](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles/monitor#monitoring-reader) on the subscription to be queried.
|
|
117
|
+
- The metric namespace containing the metrics to be queried must be provided. For a list of metric namespaces, see [Supported metrics and log categories by resource type][metric_namespaces].
|
|
118
|
+
|
|
119
|
+
```ts snippet:ReadmeSampleMetricsQueryMultipleResources
|
|
120
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
121
|
+
import { MetricsClient } from "@azure/monitor-query-metrics";
|
|
122
|
+
|
|
123
|
+
const resourceIds = [
|
|
124
|
+
"/subscriptions/0000000-0000-000-0000-000000/resourceGroups/test/providers/Microsoft.OperationalInsights/workspaces/test-logs",
|
|
125
|
+
"/subscriptions/0000000-0000-000-0000-000000/resourceGroups/test/providers/Microsoft.OperationalInsights/workspaces/test-logs2",
|
|
126
|
+
];
|
|
127
|
+
const metricsNamespace = "Microsoft.OperationalInsights/workspaces";
|
|
128
|
+
const metricNames = ["Heartbeat"];
|
|
129
|
+
const endpoint = "https://westus3.metrics.monitor.azure.com";
|
|
130
|
+
|
|
131
|
+
const credential = new DefaultAzureCredential();
|
|
132
|
+
const metricsClient = new MetricsClient(endpoint, credential);
|
|
133
|
+
|
|
134
|
+
const result = await metricsClient.queryResources(resourceIds, metricNames, metricsNamespace, {
|
|
135
|
+
aggregation: "Count",
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
console.log(`Retrieved metrics for ${result.length} resources`);
|
|
139
|
+
for (const resource of result) {
|
|
140
|
+
console.log(`Resource: ${resource.resourceId}`);
|
|
141
|
+
console.log(`Metrics: ${resource.metrics.length}`);
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
#### Handle metrics query response
|
|
146
|
+
|
|
147
|
+
The metrics query API returns a list of `MetricsQueryResult` objects. The `MetricsQueryResult` object contains properties such as a list of `Metric`-typed objects, `granularity`, `namespace`, and `timespan`. The `Metric` objects list can be accessed using the `metrics` property. Each `Metric` object in this list contains a list of `TimeSeriesElement` objects. Each `TimeSeriesElement` object contains `data` and `metadatavalues` properties. In visual form, the object hierarchy of the response resembles the following structure:
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
MetricsQueryResult
|
|
151
|
+
|---granularity
|
|
152
|
+
|---timespan
|
|
153
|
+
|---cost
|
|
154
|
+
|---namespace
|
|
155
|
+
|---resourceRegion
|
|
156
|
+
|---metrics (list of `Metric` objects)
|
|
157
|
+
|---id
|
|
158
|
+
|---type
|
|
159
|
+
|---name
|
|
160
|
+
|---unit
|
|
161
|
+
|---timeseries (list of `TimeSeriesElement` objects)
|
|
162
|
+
|---metadatavalues
|
|
163
|
+
|---data (list of data points)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Note:** Each `MetricsQueryResult` is returned in the same order as the corresponding resource in the `resourceIds` parameter. If multiple different metrics are queried, the metrics are returned in the order of the `metricNames` sent.
|
|
167
|
+
|
|
168
|
+
Example of handling response:
|
|
169
|
+
|
|
170
|
+
```ts snippet:ReadmeSampleMetricsAdvanced
|
|
171
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
172
|
+
import { MetricsClient, Durations } from "@azure/monitor-query-metrics";
|
|
173
|
+
|
|
174
|
+
const resourceIds = [
|
|
175
|
+
"/subscriptions/0000000-0000-000-0000-000000/resourceGroups/test/providers/Microsoft.OperationalInsights/workspaces/test-logs",
|
|
176
|
+
];
|
|
177
|
+
const metricsNamespace = "Microsoft.OperationalInsights/workspaces";
|
|
178
|
+
const metricNames = ["Heartbeat"];
|
|
179
|
+
const endpoint = "https://westus3.metrics.monitor.azure.com";
|
|
180
|
+
|
|
181
|
+
const credential = new DefaultAzureCredential();
|
|
182
|
+
const metricsClient = new MetricsClient(endpoint, credential);
|
|
183
|
+
|
|
184
|
+
const endTime = new Date();
|
|
185
|
+
const startTime = new Date(endTime.getTime() - 60 * 60 * 1000); // 1 hour ago
|
|
186
|
+
|
|
187
|
+
const result = await metricsClient.queryResources(resourceIds, metricNames, metricsNamespace, {
|
|
188
|
+
aggregation: "Count,Average", // Multiple aggregations
|
|
189
|
+
startTime: startTime,
|
|
190
|
+
endTime: endTime,
|
|
191
|
+
interval: Durations.fiveMinutes,
|
|
192
|
+
top: 10, // Limit results
|
|
193
|
+
orderBy: "count desc", // Sort by count descending
|
|
194
|
+
filter: "Computer eq '*'", // Filter criteria
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
console.log(`Retrieved ${result.length} resources with advanced filtering`);
|
|
198
|
+
for (const resource of result) {
|
|
199
|
+
for (const metric of resource.metrics) {
|
|
200
|
+
console.log(`Metric: ${metric.name}`);
|
|
201
|
+
console.log(`Time series count: ${metric.timeseries.length}`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
For an inventory of metrics and dimensions available for each Azure resource type, see [Supported metrics with Azure Monitor](https://learn.microsoft.com/azure/azure-monitor/essentials/metrics-supported).
|
|
207
|
+
|
|
208
|
+
## Troubleshooting
|
|
209
|
+
|
|
210
|
+
To diagnose various failure scenarios, see the [troubleshooting guide](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/monitor/monitor-query-metrics/TROUBLESHOOTING.md).
|
|
211
|
+
|
|
212
|
+
## Next steps
|
|
213
|
+
|
|
214
|
+
To learn more about Azure Monitor, see the [Azure Monitor service documentation][azure_monitor_overview].
|
|
215
|
+
|
|
216
|
+
## Contributing
|
|
217
|
+
|
|
218
|
+
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.
|
|
219
|
+
|
|
220
|
+
This module's tests are a mixture of live and unit tests, which require you to have an Azure Monitor instance. To execute the tests, you'll need to run:
|
|
221
|
+
|
|
222
|
+
1. `rush update`
|
|
223
|
+
2. `rush build -t @azure/monitor-query-metrics`
|
|
224
|
+
3. `cd into sdk/monitor/monitor-query-metrics`
|
|
225
|
+
4. Copy the `sample.env` file to `.env`
|
|
226
|
+
5. Open the `.env` file in an editor and fill in the values.
|
|
227
|
+
6. `npm run test`.
|
|
228
|
+
|
|
229
|
+
For more details, view our [tests](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/monitor/monitor-query-metrics/test) folder.
|
|
230
|
+
|
|
231
|
+
## Related projects
|
|
232
|
+
|
|
233
|
+
- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)
|
|
234
|
+
- [Azure Monitor][azure_monitor_overview]
|
|
235
|
+
|
|
236
|
+
[azure_monitor_overview]: https://learn.microsoft.com/azure/azure-monitor/overview
|
|
237
|
+
[azure_subscription]: https://azure.microsoft.com/free/
|
|
238
|
+
[changelog]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/monitor/monitor-query-metrics/CHANGELOG.md
|
|
239
|
+
[metric_namespaces]: https://learn.microsoft.com/azure/azure-monitor/reference/supported-metrics/metrics-index#supported-metrics-and-log-categories-by-resource-type
|
|
240
|
+
[msdocs_apiref]: https://learn.microsoft.com/javascript/api/@azure/monitor-query
|
|
241
|
+
[package]: https://www.npmjs.com/package/@azure/monitor-query-metrics
|
|
242
|
+
[samples]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/monitor/monitor-query-metrics/samples
|
|
243
|
+
[source]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/monitor/monitor-query-metrics/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAA+C,MAAM,qBAAqB,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { createMetrics, MetricsContext, MetricsClientOptionalParams } from \"./metricsContext.js\";\nexport { queryResources } from \"./operations.js\";\nexport { QueryResourcesOptionalParams } from \"./options.js\";\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Client, ClientOptions } from "@azure-rest/core-client";
|
|
2
|
+
import type { TokenCredential } from "@azure/core-auth";
|
|
3
|
+
export interface MetricsContext extends Client {
|
|
4
|
+
/** The API version to use for this operation. */
|
|
5
|
+
/** Known values of {@link KnownVersions} that the service accepts. */
|
|
6
|
+
apiVersion: string;
|
|
7
|
+
}
|
|
8
|
+
/** Optional parameters for the client. */
|
|
9
|
+
export interface MetricsClientOptionalParams extends ClientOptions {
|
|
10
|
+
/** The API version to use for this operation. */
|
|
11
|
+
/** Known values of {@link KnownVersions} that the service accepts. */
|
|
12
|
+
apiVersion?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function createMetrics(endpointParam: string, credential: TokenCredential, options?: MetricsClientOptionalParams): MetricsContext;
|
|
15
|
+
//# sourceMappingURL=metricsContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metricsContext.d.ts","sourceRoot":"","sources":["../../../src/api/metricsContext.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,WAAW,cAAe,SAAQ,MAAM;IAC5C,iDAAiD;IACjD,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,0CAA0C;AAC1C,MAAM,WAAW,2BAA4B,SAAQ,aAAa;IAChE,iDAAiD;IACjD,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,aAAa,CAC3B,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,eAAe,EAC3B,OAAO,GAAE,2BAAgC,GACxC,cAAc,CAmChB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { logger } from "../logger.js";
|
|
4
|
+
import { getClient } from "@azure-rest/core-client";
|
|
5
|
+
export function createMetrics(endpointParam, credential, options = {}) {
|
|
6
|
+
const endpointUrl = options.endpoint ?? String(endpointParam);
|
|
7
|
+
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
|
|
8
|
+
const userAgentInfo = `azsdk-js-monitor-query-metrics/1.0.0`;
|
|
9
|
+
const userAgentPrefix = prefixFromOptions
|
|
10
|
+
? `${prefixFromOptions} ${userAgentInfo}`
|
|
11
|
+
: `${userAgentInfo}`;
|
|
12
|
+
const { apiVersion: _, ...updatedOptions } = {
|
|
13
|
+
...options,
|
|
14
|
+
userAgentOptions: { userAgentPrefix },
|
|
15
|
+
loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },
|
|
16
|
+
credentials: {
|
|
17
|
+
scopes: options.credentials?.scopes ?? ["https://metrics.monitor.azure.com/.default"],
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
const clientContext = getClient(endpointUrl, credential, updatedOptions);
|
|
21
|
+
clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" });
|
|
22
|
+
const apiVersion = options.apiVersion ?? "2024-02-01";
|
|
23
|
+
clientContext.pipeline.addPolicy({
|
|
24
|
+
name: "ClientApiVersionPolicy",
|
|
25
|
+
sendRequest: (req, next) => {
|
|
26
|
+
// Use the apiVersion defined in request url directly
|
|
27
|
+
// Append one if there is no apiVersion and we have one at client options
|
|
28
|
+
const url = new URL(req.url);
|
|
29
|
+
if (!url.searchParams.get("api-version")) {
|
|
30
|
+
// eslint-disable-next-line no-param-reassign
|
|
31
|
+
req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"}api-version=${apiVersion}`;
|
|
32
|
+
}
|
|
33
|
+
return next(req);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
return { ...clientContext, apiVersion };
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=metricsContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metricsContext.js","sourceRoot":"","sources":["../../../src/api/metricsContext.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAgBpD,MAAM,UAAU,aAAa,CAC3B,aAAqB,EACrB,UAA2B,EAC3B,UAAuC,EAAE;IAEzC,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC;IAC9D,MAAM,iBAAiB,GAAG,OAAO,EAAE,gBAAgB,EAAE,eAAe,CAAC;IACrE,MAAM,aAAa,GAAG,sCAAsC,CAAC;IAC7D,MAAM,eAAe,GAAG,iBAAiB;QACvC,CAAC,CAAC,GAAG,iBAAiB,IAAI,aAAa,EAAE;QACzC,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACvB,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,GAAG;QAC3C,GAAG,OAAO;QACV,gBAAgB,EAAE,EAAE,eAAe,EAAE;QACrC,cAAc,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE;QACzE,WAAW,EAAE;YACX,MAAM,EAAE,OAAO,CAAC,WAAW,EAAE,MAAM,IAAI,CAAC,4CAA4C,CAAC;SACtF;KACF,CAAC;IACF,MAAM,aAAa,GAAG,SAAS,CAAC,WAAW,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC;IACzE,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAClE,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,YAAY,CAAC;IACtD,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC/B,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;gBACzC,6CAA6C;gBAC7C,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,EAAE,GAAG,aAAa,EAAE,UAAU,EAAoB,CAAC;AAC5D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { logger } from \"../logger.js\";\nimport { KnownVersions } from \"../models/models.js\";\nimport type { Client, ClientOptions } from \"@azure-rest/core-client\";\nimport { getClient } from \"@azure-rest/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\n\nexport interface MetricsContext extends Client {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion: string;\n}\n\n/** Optional parameters for the client. */\nexport interface MetricsClientOptionalParams extends ClientOptions {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownVersions} that the service accepts. */\n apiVersion?: string;\n}\n\nexport function createMetrics(\n endpointParam: string,\n credential: TokenCredential,\n options: MetricsClientOptionalParams = {},\n): MetricsContext {\n const endpointUrl = options.endpoint ?? String(endpointParam);\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentInfo = `azsdk-js-monitor-query-metrics/1.0.0`;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} ${userAgentInfo}`\n : `${userAgentInfo}`;\n const { apiVersion: _, ...updatedOptions } = {\n ...options,\n userAgentOptions: { userAgentPrefix },\n loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://metrics.monitor.azure.com/.default\"],\n },\n };\n const clientContext = getClient(endpointUrl, credential, updatedOptions);\n clientContext.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n const apiVersion = options.apiVersion ?? \"2024-02-01\";\n clientContext.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\")) {\n // eslint-disable-next-line no-param-reassign\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n return { ...clientContext, apiVersion } as MetricsContext;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MetricsContext as Client } from "./index.js";
|
|
2
|
+
import type { ResourceIdList, MetricResultsResponse } from "../models/models.js";
|
|
3
|
+
import type { QueryResourcesOptionalParams } from "./options.js";
|
|
4
|
+
import type { StreamableMethod, PathUncheckedResponse } from "@azure-rest/core-client";
|
|
5
|
+
export declare function _queryResourcesSend(context: Client, subscriptionId: string, metricNamespace: string, metricNames: string[], batchRequest: ResourceIdList, options?: QueryResourcesOptionalParams): StreamableMethod;
|
|
6
|
+
export declare function _queryResourcesDeserialize(result: PathUncheckedResponse): Promise<MetricResultsResponse>;
|
|
7
|
+
/** Lists the metric values for multiple resources. */
|
|
8
|
+
export declare function queryResources(context: Client, subscriptionId: string, metricNamespace: string, metricNames: string[], batchRequest: ResourceIdList, options?: QueryResourcesOptionalParams): Promise<MetricResultsResponse>;
|
|
9
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/api/operations.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,IAAI,MAAM,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAOjF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGvF,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EAAE,EACrB,YAAY,EAAE,cAAc,EAC5B,OAAO,GAAE,4BAAqD,GAC7D,gBAAgB,CAgClB;AAED,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,CAShC;AAED,sDAAsD;AACtD,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EAAE,EACrB,YAAY,EAAE,cAAc,EAC5B,OAAO,GAAE,4BAAqD,GAC7D,OAAO,CAAC,qBAAqB,CAAC,CAUhC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { resourceIdListSerializer, metricResultsResponseDeserializer, errorResponseDeserializer, } from "../models/models.js";
|
|
4
|
+
import { expandUrlTemplate } from "../static-helpers/urlTemplate.js";
|
|
5
|
+
import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client";
|
|
6
|
+
export function _queryResourcesSend(context, subscriptionId, metricNamespace, metricNames, batchRequest, options = { requestOptions: {} }) {
|
|
7
|
+
const path = expandUrlTemplate("/subscriptions/{subscriptionId}/metrics:getBatch{?api%2Dversion,starttime,endtime,interval,metricnamespace,metricnames,aggregation,top,orderby,filter,rollupby}", {
|
|
8
|
+
subscriptionId: subscriptionId,
|
|
9
|
+
"api%2Dversion": context.apiVersion,
|
|
10
|
+
starttime: options?.startTime,
|
|
11
|
+
endtime: options?.endTime,
|
|
12
|
+
interval: options?.interval,
|
|
13
|
+
metricnamespace: metricNamespace,
|
|
14
|
+
metricnames: metricNames.map((p) => {
|
|
15
|
+
return p;
|
|
16
|
+
}),
|
|
17
|
+
aggregation: options?.aggregation,
|
|
18
|
+
top: options?.top,
|
|
19
|
+
orderby: options?.orderBy,
|
|
20
|
+
filter: options?.filter,
|
|
21
|
+
rollupby: options?.rollUpBy,
|
|
22
|
+
}, {
|
|
23
|
+
allowReserved: options?.requestOptions?.skipUrlEncoding,
|
|
24
|
+
});
|
|
25
|
+
return context.path(path).post({
|
|
26
|
+
...operationOptionsToRequestParameters(options),
|
|
27
|
+
contentType: "application/json",
|
|
28
|
+
headers: {
|
|
29
|
+
accept: "application/json",
|
|
30
|
+
...options.requestOptions?.headers,
|
|
31
|
+
},
|
|
32
|
+
body: resourceIdListSerializer(batchRequest),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export async function _queryResourcesDeserialize(result) {
|
|
36
|
+
const expectedStatuses = ["200"];
|
|
37
|
+
if (!expectedStatuses.includes(result.status)) {
|
|
38
|
+
const error = createRestError(result);
|
|
39
|
+
error.details = errorResponseDeserializer(result.body);
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
return metricResultsResponseDeserializer(result.body);
|
|
43
|
+
}
|
|
44
|
+
/** Lists the metric values for multiple resources. */
|
|
45
|
+
export async function queryResources(context, subscriptionId, metricNamespace, metricNames, batchRequest, options = { requestOptions: {} }) {
|
|
46
|
+
const result = await _queryResourcesSend(context, subscriptionId, metricNamespace, metricNames, batchRequest, options);
|
|
47
|
+
return _queryResourcesDeserialize(result);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../src/api/operations.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EACL,wBAAwB,EACxB,iCAAiC,EACjC,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAGrE,OAAO,EAAE,eAAe,EAAE,mCAAmC,EAAE,MAAM,yBAAyB,CAAC;AAE/F,MAAM,UAAU,mBAAmB,CACjC,OAAe,EACf,cAAsB,EACtB,eAAuB,EACvB,WAAqB,EACrB,YAA4B,EAC5B,UAAwC,EAAE,cAAc,EAAE,EAAE,EAAE;IAE9D,MAAM,IAAI,GAAG,iBAAiB,CAC5B,iKAAiK,EACjK;QACE,cAAc,EAAE,cAAc;QAC9B,eAAe,EAAE,OAAO,CAAC,UAAU;QACnC,SAAS,EAAE,OAAO,EAAE,SAAS;QAC7B,OAAO,EAAE,OAAO,EAAE,OAAO;QACzB,QAAQ,EAAE,OAAO,EAAE,QAAQ;QAC3B,eAAe,EAAE,eAAe;QAChC,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE;YACtC,OAAO,CAAC,CAAC;QACX,CAAC,CAAC;QACF,WAAW,EAAE,OAAO,EAAE,WAAW;QACjC,GAAG,EAAE,OAAO,EAAE,GAAG;QACjB,OAAO,EAAE,OAAO,EAAE,OAAO;QACzB,MAAM,EAAE,OAAO,EAAE,MAAM;QACvB,QAAQ,EAAE,OAAO,EAAE,QAAQ;KAC5B,EACD;QACE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe;KACxD,CACF,CAAC;IACF,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;QAC7B,GAAG,mCAAmC,CAAC,OAAO,CAAC;QAC/C,WAAW,EAAE,kBAAkB;QAC/B,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;YAC1B,GAAG,OAAO,CAAC,cAAc,EAAE,OAAO;SACnC;QACD,IAAI,EAAE,wBAAwB,CAAC,YAAY,CAAC;KAC7C,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,MAA6B;IAE7B,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9C,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QACtC,KAAK,CAAC,OAAO,GAAG,yBAAyB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACvD,MAAM,KAAK,CAAC;IACd,CAAC;IAED,OAAO,iCAAiC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACxD,CAAC;AAED,sDAAsD;AACtD,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAAe,EACf,cAAsB,EACtB,eAAuB,EACvB,WAAqB,EACrB,YAA4B,EAC5B,UAAwC,EAAE,cAAc,EAAE,EAAE,EAAE;IAE9D,MAAM,MAAM,GAAG,MAAM,mBAAmB,CACtC,OAAO,EACP,cAAc,EACd,eAAe,EACf,WAAW,EACX,YAAY,EACZ,OAAO,CACR,CAAC;IACF,OAAO,0BAA0B,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { MetricsContext as Client } from \"./index.js\";\nimport type { ResourceIdList, MetricResultsResponse } from \"../models/models.js\";\nimport {\n resourceIdListSerializer,\n metricResultsResponseDeserializer,\n errorResponseDeserializer,\n} from \"../models/models.js\";\nimport { expandUrlTemplate } from \"../static-helpers/urlTemplate.js\";\nimport type { QueryResourcesOptionalParams } from \"./options.js\";\nimport type { StreamableMethod, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { createRestError, operationOptionsToRequestParameters } from \"@azure-rest/core-client\";\n\nexport function _queryResourcesSend(\n context: Client,\n subscriptionId: string,\n metricNamespace: string,\n metricNames: string[],\n batchRequest: ResourceIdList,\n options: QueryResourcesOptionalParams = { requestOptions: {} },\n): StreamableMethod {\n const path = expandUrlTemplate(\n \"/subscriptions/{subscriptionId}/metrics:getBatch{?api%2Dversion,starttime,endtime,interval,metricnamespace,metricnames,aggregation,top,orderby,filter,rollupby}\",\n {\n subscriptionId: subscriptionId,\n \"api%2Dversion\": context.apiVersion,\n starttime: options?.startTime,\n endtime: options?.endTime,\n interval: options?.interval,\n metricnamespace: metricNamespace,\n metricnames: metricNames.map((p: any) => {\n return p;\n }),\n aggregation: options?.aggregation,\n top: options?.top,\n orderby: options?.orderBy,\n filter: options?.filter,\n rollupby: options?.rollUpBy,\n },\n {\n allowReserved: options?.requestOptions?.skipUrlEncoding,\n },\n );\n return context.path(path).post({\n ...operationOptionsToRequestParameters(options),\n contentType: \"application/json\",\n headers: {\n accept: \"application/json\",\n ...options.requestOptions?.headers,\n },\n body: resourceIdListSerializer(batchRequest),\n });\n}\n\nexport async function _queryResourcesDeserialize(\n result: PathUncheckedResponse,\n): Promise<MetricResultsResponse> {\n const expectedStatuses = [\"200\"];\n if (!expectedStatuses.includes(result.status)) {\n const error = createRestError(result);\n error.details = errorResponseDeserializer(result.body);\n throw error;\n }\n\n return metricResultsResponseDeserializer(result.body);\n}\n\n/** Lists the metric values for multiple resources. */\nexport async function queryResources(\n context: Client,\n subscriptionId: string,\n metricNamespace: string,\n metricNames: string[],\n batchRequest: ResourceIdList,\n options: QueryResourcesOptionalParams = { requestOptions: {} },\n): Promise<MetricResultsResponse> {\n const result = await _queryResourcesSend(\n context,\n subscriptionId,\n metricNamespace,\n metricNames,\n batchRequest,\n options,\n );\n return _queryResourcesDeserialize(result);\n}\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { OperationOptions } from "@azure-rest/core-client";
|
|
2
|
+
/** Optional parameters. */
|
|
3
|
+
export interface QueryResourcesOptionalParams extends OperationOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The start time of the query. It is a string in the format
|
|
6
|
+
* 'yyyy-MM-ddTHH:mm:ss.fffZ'. If you have specified the endtime parameter, then
|
|
7
|
+
* this parameter is required.
|
|
8
|
+
* If only starttime is specified, then endtime defaults to the current time.
|
|
9
|
+
* If no time interval is specified, the default is 1 hour.
|
|
10
|
+
*/
|
|
11
|
+
startTime?: string;
|
|
12
|
+
/** The end time of the query. It is a string in the format 'yyyy-MM-ddTHH:mm:ss.fffZ'. */
|
|
13
|
+
endTime?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The interval (i.e. timegrain) of the query in ISO 8601 duration format.
|
|
16
|
+
* Defaults to PT1M. Special case for 'FULL' value that returns single datapoint
|
|
17
|
+
* for entire time span requested.
|
|
18
|
+
* *Examples: PT15M, PT1H, P1D, FULL*
|
|
19
|
+
*
|
|
20
|
+
* {@link Durations}
|
|
21
|
+
*/
|
|
22
|
+
interval?: string;
|
|
23
|
+
/** The list of aggregation types (comma separated) to retrieve. *Examples: average, minimum, maximum* */
|
|
24
|
+
aggregation?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The maximum number of records to retrieve per resource ID in the request.
|
|
27
|
+
* Valid only if filter is specified.
|
|
28
|
+
* Defaults to 10.
|
|
29
|
+
*/
|
|
30
|
+
top?: number;
|
|
31
|
+
/**
|
|
32
|
+
* The aggregation to use for sorting results and the direction of the sort.
|
|
33
|
+
* Only one order can be specified.
|
|
34
|
+
* *Examples: sum asc*
|
|
35
|
+
*/
|
|
36
|
+
orderBy?: string;
|
|
37
|
+
/**
|
|
38
|
+
* The filter is used to reduce the set of metric data
|
|
39
|
+
* returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all
|
|
40
|
+
* time series of C where A = a1 and B = b1 or b2<br>**filter=A eq ‘a1’ and B eq
|
|
41
|
+
* ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**filter=A eq ‘a1’
|
|
42
|
+
* and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical
|
|
43
|
+
* or operator cannot separate two different metadata names.<br>- Return all time
|
|
44
|
+
* series where A = a1, B = b1 and C = c1:<br>**filter=A eq ‘a1’ and B eq ‘b1’ and
|
|
45
|
+
* C eq ‘c1’**<br>- Return all time series where A = a1<br>**filter=A eq ‘a1’ and
|
|
46
|
+
* B eq ‘*’ and C eq ‘*’**.
|
|
47
|
+
*/
|
|
48
|
+
filter?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Dimension name(s) to rollup results by. For example if you only want to see
|
|
51
|
+
* metric values with a filter like 'City eq Seattle or City eq Tacoma' but don't
|
|
52
|
+
* want to see separate values for each city, you can specify 'RollUpBy=City' to
|
|
53
|
+
* see the results for Seattle and Tacoma rolled up into one timeseries.
|
|
54
|
+
*/
|
|
55
|
+
rollUpBy?: string;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/api/options.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,2BAA2B;AAC3B,MAAM,WAAW,4BAA6B,SAAQ,gBAAgB;IACpE;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yGAAyG;IACzG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/api/options.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure-rest/core-client\";\n\n/** Optional parameters. */\nexport interface QueryResourcesOptionalParams extends OperationOptions {\n /**\n * The start time of the query. It is a string in the format\n * 'yyyy-MM-ddTHH:mm:ss.fffZ'. If you have specified the endtime parameter, then\n * this parameter is required.\n * If only starttime is specified, then endtime defaults to the current time.\n * If no time interval is specified, the default is 1 hour.\n */\n startTime?: string;\n /** The end time of the query. It is a string in the format 'yyyy-MM-ddTHH:mm:ss.fffZ'. */\n endTime?: string;\n /**\n * The interval (i.e. timegrain) of the query in ISO 8601 duration format.\n * Defaults to PT1M. Special case for 'FULL' value that returns single datapoint\n * for entire time span requested.\n * *Examples: PT15M, PT1H, P1D, FULL*\n *\n * {@link Durations}\n */\n interval?: string;\n /** The list of aggregation types (comma separated) to retrieve. *Examples: average, minimum, maximum* */\n aggregation?: string;\n /**\n * The maximum number of records to retrieve per resource ID in the request.\n * Valid only if filter is specified.\n * Defaults to 10.\n */\n top?: number;\n /**\n * The aggregation to use for sorting results and the direction of the sort.\n * Only one order can be specified.\n * *Examples: sum asc*\n */\n orderBy?: string;\n /**\n * The filter is used to reduce the set of metric data\n * returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all\n * time series of C where A = a1 and B = b1 or b2<br>**filter=A eq ‘a1’ and B eq\n * ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**filter=A eq ‘a1’\n * and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical\n * or operator cannot separate two different metadata names.<br>- Return all time\n * series where A = a1, B = b1 and C = c1:<br>**filter=A eq ‘a1’ and B eq ‘b1’ and\n * C eq ‘c1’**<br>- Return all time series where A = a1<br>**filter=A eq ‘a1’ and\n * B eq ‘*’ and C eq ‘*’**.\n */\n filter?: string;\n /**\n * Dimension name(s) to rollup results by. For example if you only want to see\n * metric values with a filter like 'City eq Seattle or City eq Tacoma' but don't\n * want to see separate values for each city, you can specify 'RollUpBy=City' to\n * see the results for Seattle and Tacoma rolled up into one timeseries.\n */\n rollUpBy?: string;\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { MetricsClient } from "./metricsClient.js";
|
|
2
|
+
export { MetricsQueryResourcesOptions, MetricsQueryResult, QueryTimeInterval, Durations, KnownMonitorMetricsQueryAudience, MetricsClientOptions, } from "./models.js";
|
|
3
|
+
export { ResourceIdList, MetricResultsResponse, MetricResultsResponseValuesItem, Metric, MetricUnit, TimeSeriesElement, MetadataValue, MetricValue, ErrorResponse, ErrorDetail, ErrorAdditionalInfo, KnownVersions, } from "./models/index.js";
|
|
4
|
+
export { MetricsClientOptionalParams } from "./api/index.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,EACT,gCAAgC,EAChC,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,+BAA+B,EAC/B,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
export { MetricsClient } from "./metricsClient.js";
|
|
4
|
+
export { Durations, KnownMonitorMetricsQueryAudience, } from "./models.js";
|
|
5
|
+
export { KnownVersions, } from "./models/index.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAIL,SAAS,EACT,gCAAgC,GAEjC,MAAM,aAAa,CAAC;AACrB,OAAO,EAYL,aAAa,GACd,MAAM,mBAAmB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { MetricsClient } from \"./metricsClient.js\";\nexport {\n MetricsQueryResourcesOptions,\n MetricsQueryResult,\n QueryTimeInterval,\n Durations,\n KnownMonitorMetricsQueryAudience,\n MetricsClientOptions,\n} from \"./models.js\";\nexport {\n ResourceIdList,\n MetricResultsResponse,\n MetricResultsResponseValuesItem,\n Metric,\n MetricUnit,\n TimeSeriesElement,\n MetadataValue,\n MetricValue,\n ErrorResponse,\n ErrorDetail,\n ErrorAdditionalInfo,\n KnownVersions,\n} from \"./models/index.js\";\nexport { MetricsClientOptionalParams } from \"./api/index.js\";\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MetricsClientOptionalParams } from "./api/index.js";
|
|
2
|
+
import type { QueryResourcesOptionalParams } from "./api/options.js";
|
|
3
|
+
import type { ResourceIdList, MetricResultsResponse } from "./models/models.js";
|
|
4
|
+
import type { TokenCredential } from "@azure/core-auth";
|
|
5
|
+
import type { Pipeline } from "@azure/core-rest-pipeline";
|
|
6
|
+
export { MetricsClientOptionalParams } from "./api/metricsContext.js";
|
|
7
|
+
export declare class MetricsClient {
|
|
8
|
+
private _client;
|
|
9
|
+
/** The pipeline used by this client to make requests */
|
|
10
|
+
readonly pipeline: Pipeline;
|
|
11
|
+
constructor(endpointParam: string, credential: TokenCredential, options?: MetricsClientOptionalParams);
|
|
12
|
+
/** Lists the metric values for multiple resources. */
|
|
13
|
+
queryResources(subscriptionId: string, metricNamespace: string, metricNames: string[], batchRequest: ResourceIdList, options?: QueryResourcesOptionalParams): Promise<MetricResultsResponse>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=internalMetricsClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internalMetricsClient.d.ts","sourceRoot":"","sources":["../../src/internalMetricsClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAkB,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAGlF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAEtE,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAiB;IAChC,wDAAwD;IACxD,SAAgB,QAAQ,EAAE,QAAQ,CAAC;gBAGjC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,eAAe,EAC3B,OAAO,GAAE,2BAAgC;IAW3C,sDAAsD;IACtD,cAAc,CACZ,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EAAE,EACrB,YAAY,EAAE,cAAc,EAC5B,OAAO,GAAE,4BAAqD,GAC7D,OAAO,CAAC,qBAAqB,CAAC;CAUlC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { createMetrics } from "./api/index.js";
|
|
4
|
+
import { queryResources } from "./api/operations.js";
|
|
5
|
+
export class MetricsClient {
|
|
6
|
+
_client;
|
|
7
|
+
/** The pipeline used by this client to make requests */
|
|
8
|
+
pipeline;
|
|
9
|
+
constructor(endpointParam, credential, options = {}) {
|
|
10
|
+
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
|
|
11
|
+
const userAgentPrefix = prefixFromOptions;
|
|
12
|
+
this._client = createMetrics(endpointParam, credential, {
|
|
13
|
+
...options,
|
|
14
|
+
userAgentOptions: { userAgentPrefix },
|
|
15
|
+
});
|
|
16
|
+
this.pipeline = this._client.pipeline;
|
|
17
|
+
}
|
|
18
|
+
/** Lists the metric values for multiple resources. */
|
|
19
|
+
queryResources(subscriptionId, metricNamespace, metricNames, batchRequest, options = { requestOptions: {} }) {
|
|
20
|
+
return queryResources(this._client, subscriptionId, metricNamespace, metricNames, batchRequest, options);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=internalMetricsClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internalMetricsClient.js","sourceRoot":"","sources":["../../src/internalMetricsClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAQrD,MAAM,OAAO,aAAa;IAChB,OAAO,CAAiB;IAChC,wDAAwD;IACxC,QAAQ,CAAW;IAEnC,YACE,aAAqB,EACrB,UAA2B,EAC3B,UAAuC,EAAE;QAEzC,MAAM,iBAAiB,GAAG,OAAO,EAAE,gBAAgB,EAAE,eAAe,CAAC;QACrE,MAAM,eAAe,GAAG,iBAAiB,CAAC;QAC1C,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC,aAAa,EAAE,UAAU,EAAE;YACtD,GAAG,OAAO;YACV,gBAAgB,EAAE,EAAE,eAAe,EAAE;SACtC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IACxC,CAAC;IAED,sDAAsD;IACtD,cAAc,CACZ,cAAsB,EACtB,eAAuB,EACvB,WAAqB,EACrB,YAA4B,EAC5B,UAAwC,EAAE,cAAc,EAAE,EAAE,EAAE;QAE9D,OAAO,cAAc,CACnB,IAAI,CAAC,OAAO,EACZ,cAAc,EACd,eAAe,EACf,WAAW,EACX,YAAY,EACZ,OAAO,CACR,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { MetricsContext, MetricsClientOptionalParams } from \"./api/index.js\";\nimport { createMetrics } from \"./api/index.js\";\nimport { queryResources } from \"./api/operations.js\";\nimport type { QueryResourcesOptionalParams } from \"./api/options.js\";\nimport type { ResourceIdList, MetricResultsResponse } from \"./models/models.js\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport type { Pipeline } from \"@azure/core-rest-pipeline\";\n\nexport { MetricsClientOptionalParams } from \"./api/metricsContext.js\";\n\nexport class MetricsClient {\n private _client: MetricsContext;\n /** The pipeline used by this client to make requests */\n public readonly pipeline: Pipeline;\n\n constructor(\n endpointParam: string,\n credential: TokenCredential,\n options: MetricsClientOptionalParams = {},\n ) {\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentPrefix = prefixFromOptions;\n this._client = createMetrics(endpointParam, credential, {\n ...options,\n userAgentOptions: { userAgentPrefix },\n });\n this.pipeline = this._client.pipeline;\n }\n\n /** Lists the metric values for multiple resources. */\n queryResources(\n subscriptionId: string,\n metricNamespace: string,\n metricNames: string[],\n batchRequest: ResourceIdList,\n options: QueryResourcesOptionalParams = { requestOptions: {} },\n ): Promise<MetricResultsResponse> {\n return queryResources(\n this._client,\n subscriptionId,\n metricNamespace,\n metricNames,\n batchRequest,\n options,\n );\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM,qCAA8C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,uBAAuB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"monitor-query-metrics\");\n"]}
|