Documentation
¶
Index ¶
- Constants
- type AggregationType
- type BatchQueryRequest
- type BatchQueryRequestMethod
- type BatchQueryRequestPath
- type BatchQueryResponse
- type BatchQueryResults
- type BatchRequest
- type BatchResponse
- type Body
- type Column
- type ErrorInfo
- type LocalizableString
- type LogsClient
- func (client *LogsClient) QueryBatch(ctx context.Context, body BatchRequest, options *LogsClientQueryBatchOptions) (LogsClientQueryBatchResponse, error)
- func (client *LogsClient) QueryResource(ctx context.Context, resourceID string, body Body, ...) (LogsClientQueryResourceResponse, error)
- func (client *LogsClient) QueryWorkspace(ctx context.Context, workspaceID string, body Body, ...) (LogsClientQueryWorkspaceResponse, error)
- type LogsClientOptions
- type LogsClientQueryBatchOptions
- type LogsClientQueryBatchResponse
- type LogsClientQueryResourceOptions
- type LogsClientQueryResourceResponse
- type LogsClientQueryWorkspaceOptions
- type LogsClientQueryWorkspaceResponse
- type LogsColumnType
- type LogsQueryOptions
- type MetadataValue
- type Metric
- type MetricAvailability
- type MetricClass
- type MetricDefinition
- type MetricDefinitionCollection
- type MetricNamespace
- type MetricNamespaceCollection
- type MetricNamespaceName
- type MetricResults
- type MetricUnit
- type MetricValue
- type MetricValues
- type MetricsBatchClient
- type MetricsBatchClientOptions
- type MetricsBatchClientQueryBatchOptions
- type MetricsBatchClientQueryBatchResponse
- type MetricsClient
- func (client *MetricsClient) NewListDefinitionsPager(resourceURI string, options *MetricsClientListDefinitionsOptions) *runtime.Pager[MetricsClientListDefinitionsResponse]
- func (client *MetricsClient) NewListNamespacesPager(resourceURI string, options *MetricsClientListNamespacesOptions) *runtime.Pager[MetricsClientListNamespacesResponse]
- func (client *MetricsClient) QueryResource(ctx context.Context, resourceURI string, ...) (MetricsClientQueryResourceResponse, error)
- type MetricsClientListDefinitionsOptions
- type MetricsClientListDefinitionsResponse
- type MetricsClientListNamespacesOptions
- type MetricsClientListNamespacesResponse
- type MetricsClientOptions
- type MetricsClientQueryResourceOptions
- type MetricsClientQueryResourceResponse
- type NamespaceClassification
- type ResourceIDList
- type Response
- type ResultType
- type Results
- type Row
- type Table
- type TimeInterval
- type TimeSeriesElement
Examples ¶
Constants ¶
const ( ServiceNameLogs cloud.ServiceName = "azqueryLogs" ServiceNameMetrics cloud.ServiceName = "azqueryMetrics" )
Cloud Service Names for Monitor Query Logs and Metrics, used to identify the respective cloud.ServiceConfiguration
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregationType ¶
type AggregationType string
AggregationType - the aggregation type of the metric.
const ( AggregationTypeAverage AggregationType = "Average" AggregationTypeCount AggregationType = "Count" AggregationTypeMaximum AggregationType = "Maximum" AggregationTypeMinimum AggregationType = "Minimum" AggregationTypeNone AggregationType = "None" AggregationTypeTotal AggregationType = "Total" )
func PossibleAggregationTypeValues ¶
func PossibleAggregationTypeValues() []AggregationType
PossibleAggregationTypeValues returns the possible values for the AggregationType const type.
type BatchQueryRequest ¶
type BatchQueryRequest struct {
// REQUIRED; The Analytics query. Learn more about the Analytics query syntax [https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/]
Body *Body
// REQUIRED; Unique ID corresponding to each request in the batch.
CorrelationID *string
// REQUIRED; Primary Workspace ID of the query. This is the Workspace ID from the Properties blade in the Azure portal.
WorkspaceID *string
// Headers of the request. Can use prefer header to set server timeout and to query statistics and visualization information.
Headers map[string]*string
// The method of a single request in a batch, defaults to POST
Method *BatchQueryRequestMethod
// The query path of a single request in a batch, defaults to /query
Path *BatchQueryRequestPath
}
BatchQueryRequest - An single request in a batch.
func NewBatchQueryRequest ¶
func NewBatchQueryRequest(workspaceID string, query string, timespan TimeInterval, correlationID string, options LogsQueryOptions) BatchQueryRequest
NewBatchQueryRequest creates a new BatchQueryRequest.
func (BatchQueryRequest) MarshalJSON ¶
func (b BatchQueryRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BatchQueryRequest.
func (*BatchQueryRequest) UnmarshalJSON ¶
func (b *BatchQueryRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BatchQueryRequest.
type BatchQueryRequestMethod ¶
type BatchQueryRequestMethod string
BatchQueryRequestMethod - The method of a single request in a batch, defaults to POST
const (
BatchQueryRequestMethodPOST BatchQueryRequestMethod = "POST"
)
func PossibleBatchQueryRequestMethodValues ¶
func PossibleBatchQueryRequestMethodValues() []BatchQueryRequestMethod
PossibleBatchQueryRequestMethodValues returns the possible values for the BatchQueryRequestMethod const type.
type BatchQueryRequestPath ¶
type BatchQueryRequestPath string
BatchQueryRequestPath - The query path of a single request in a batch, defaults to /query
const (
BatchQueryRequestPathQuery BatchQueryRequestPath = "/query"
)
func PossibleBatchQueryRequestPathValues ¶
func PossibleBatchQueryRequestPathValues() []BatchQueryRequestPath
PossibleBatchQueryRequestPathValues returns the possible values for the BatchQueryRequestPath const type.
type BatchQueryResponse ¶
type BatchQueryResponse struct {
// Contains the tables, columns & rows resulting from a query.
Body *BatchQueryResults
CorrelationID *string
// Dictionary of
Headers map[string]*string
Status *int32
}
BatchQueryResponse - Contains the batch query response and the headers, id, and status of the request
func (BatchQueryResponse) MarshalJSON ¶
func (b BatchQueryResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BatchQueryResponse.
func (*BatchQueryResponse) UnmarshalJSON ¶
func (b *BatchQueryResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BatchQueryResponse.
type BatchQueryResults ¶
type BatchQueryResults struct {
// The code and message for an error.
Error *ErrorInfo
// Statistics represented in JSON format.
Statistics []byte
// The results of the query in tabular format.
Tables []*Table
// Visualization data in JSON format.
Visualization []byte
}
BatchQueryResults - Contains the tables, columns & rows resulting from a query.
func (BatchQueryResults) MarshalJSON ¶
func (b BatchQueryResults) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BatchQueryResults.
func (*BatchQueryResults) UnmarshalJSON ¶
func (b *BatchQueryResults) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BatchQueryResults.
type BatchRequest ¶
type BatchRequest struct {
// REQUIRED; An single request in a batch.
Requests []*BatchQueryRequest
}
BatchRequest - An array of requests.
func (BatchRequest) MarshalJSON ¶
func (b BatchRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BatchRequest.
func (*BatchRequest) UnmarshalJSON ¶
func (b *BatchRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BatchRequest.
type BatchResponse ¶
type BatchResponse struct {
// An array of responses corresponding to each individual request in a batch.
Responses []*BatchQueryResponse
}
BatchResponse - Response to a batch query.
func (BatchResponse) MarshalJSON ¶
func (b BatchResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type BatchResponse.
func (*BatchResponse) UnmarshalJSON ¶
func (b *BatchResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type BatchResponse.
type Body ¶
type Body struct {
// REQUIRED; The query to execute.
Query *string
// A list of workspaces to query in addition to the primary workspace.
AdditionalWorkspaces []*string
// Optional. The timespan over which to query data. This is an ISO8601 time period value. This timespan is applied in addition
// to any that are specified in the query expression.
Timespan *TimeInterval
}
Body - The Analytics query. Learn more about the Analytics query syntax [https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/]
func (Body) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Body.
func (*Body) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface for type Body.
type Column ¶
type Column struct {
// The name of this column.
Name *string
// The data type of this column.
Type *LogsColumnType
}
Column - A column in a table.
func (Column) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Column.
func (*Column) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface for type Column.
type ErrorInfo ¶
type ErrorInfo struct {
// REQUIRED; A machine readable error code.
Code string
// contains filtered or unexported fields
}
ErrorInfo - The code and message for an error.
func (*ErrorInfo) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface for type ErrorInfo.
type LocalizableString ¶
type LocalizableString struct {
// REQUIRED; The invariant value.
Value *string
// The display name.
LocalizedValue *string
}
LocalizableString - The localizable string class.
func (LocalizableString) MarshalJSON ¶
func (l LocalizableString) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type LocalizableString.
func (*LocalizableString) UnmarshalJSON ¶
func (l *LocalizableString) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type LocalizableString.
type LogsClient ¶
type LogsClient struct {
// contains filtered or unexported fields
}
LogsClient contains the methods for the Logs group. Don't use this type directly, use a constructor function instead.
func NewLogsClient ¶
func NewLogsClient(credential azcore.TokenCredential, options *LogsClientOptions) (*LogsClient, error)
NewLogsClient creates a client that accesses Azure Monitor logs data.
Example ¶
package main
import (
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
//TODO: handle error
}
client, err := azquery.NewLogsClient(cred, nil)
if err != nil {
//TODO: handle error
}
_ = client
}
func (*LogsClient) QueryBatch ¶
func (client *LogsClient) QueryBatch(ctx context.Context, body BatchRequest, options *LogsClientQueryBatchOptions) (LogsClientQueryBatchResponse, error)
QueryBatch - Executes a batch of Analytics queries for data. Here [https://learn.microsoft.com/azure/azure-monitor/logs/api/batch-queries] is an example for using POST with an Analytics query. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2022-10-27
- body - The batch request body
- options - LogsClientQueryBatchOptions contains the optional parameters for the LogsClient.QueryBatch method.
Example ¶
package main
import (
"context"
"fmt"
"time"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery"
)
var logsClient azquery.LogsClient
var kustoQuery1 string
var kustoQuery2 string
var kustoQuery3 string
func main() {
// `QueryBatch` is an advanced method allowing users to execute multiple log queries in a single request.
// For help formatting a `BatchRequest`, please use the method `NewBatchQueryRequest`.
workspaceID := "g4d1e129-fb1e-4b0a-b234-250abc987ea65" // example Azure Log Analytics Workspace ID
timespan := azquery.NewTimeInterval(time.Date(2022, 12, 25, 0, 0, 0, 0, time.UTC), time.Date(2022, 12, 25, 12, 0, 0, 0, time.UTC))
batchRequest := azquery.BatchRequest{[]*azquery.BatchQueryRequest{
{Body: &azquery.Body{Query: to.Ptr(kustoQuery1), Timespan: to.Ptr(timespan)}, CorrelationID: to.Ptr("1"), WorkspaceID: to.Ptr(workspaceID)},
{Body: &azquery.Body{Query: to.Ptr(kustoQuery2), Timespan: to.Ptr(timespan)}, CorrelationID: to.Ptr("2"), WorkspaceID: to.Ptr(workspaceID)},
{Body: &azquery.Body{Query: to.Ptr(kustoQuery3), Timespan: to.Ptr(timespan)}, CorrelationID: to.Ptr("3"), WorkspaceID: to.Ptr(workspaceID)},
}}
res, err := logsClient.QueryBatch(context.TODO(), batchRequest, nil)
if err != nil {
//TODO: handle error
}
// `QueryBatch` can return results in any order, usually by time it takes each individual query to complete.
// Use the `CorrelationID` field to identify the correct response.
responses := res.BatchResponse.Responses
fmt.Println("ID's of successful responses:")
for _, response := range responses {
if response.Body.Error == nil {
fmt.Println(*response.CorrelationID)
}
}
}
func (*LogsClient) QueryResource ¶
func (client *LogsClient) QueryResource(ctx context.Context, resourceID string, body Body, options *LogsClientQueryResourceOptions) (LogsClientQueryResourceResponse, error)
QueryResource - Executes an Analytics query for data in the context of a resource. Here [https://learn.microsoft.com/azure/azure-monitor/logs/api/azure-resource-queries] is an example for using POST with an Analytics query. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2022-10-27
- resourceID - The identifier of the resource.
- body - The Analytics query. Learn more about the Analytics query syntax [https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/]
- options - LogsClientQueryResourceOptions contains the optional parameters for the LogsClient.QueryResource method.
Example ¶
package main
import (
"context"
"fmt"
"time"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery"
)
var logsClient azquery.LogsClient
func main() {
// Instead of requiring a Log Analytics workspace,
// QueryResource allows users to query logs directly from an Azure resource through a resource ID.
// To find the resource ID:
// 1. Navigate to your resource's page in the Azure portal.
// 2. From the **Overview** blade, select the **JSON View** link.
// 3. In the resulting JSON, copy the value of the `id` property.
resourceID := "/subscriptions/fajfkx93-c1d8-40ad-9cce-e49c10ca8qe6/resourceGroups/testgroup/providers/Microsoft.Storage/storageAccounts/mystorageacount" // example resource ID
res, err := logsClient.QueryResource(
context.TODO(),
resourceID,
azquery.Body{
Query: to.Ptr("StorageBlobLogs | where TimeGenerated > ago(3d)"), // example Kusto query
Timespan: to.Ptr(azquery.NewTimeInterval(time.Date(2022, 12, 25, 0, 0, 0, 0, time.UTC), time.Date(2022, 12, 25, 12, 0, 0, 0, time.UTC))),
},
nil)
if err != nil {
//TODO: handle error
}
if res.Error != nil {
//TODO: handle partial error
}
// Print Rows
for _, table := range res.Tables {
for _, row := range table.Rows {
fmt.Println(row)
}
}
}
func (*LogsClient) QueryWorkspace ¶
func (client *LogsClient) QueryWorkspace(ctx context.Context, workspaceID string, body Body, options *LogsClientQueryWorkspaceOptions) (LogsClientQueryWorkspaceResponse, error)
QueryWorkspace - Executes an Analytics query for data. Here [https://learn.microsoft.com/azure/azure-monitor/logs/api/request-format] is an example for using POST with an Analytics query. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2022-10-27
- workspaceID - Primary Workspace ID of the query. This is the Workspace ID from the Properties blade in the Azure portal.
- body - The Analytics query. Learn more about the Analytics query syntax [https://azure.microsoft.com/documentation/articles/app-insights-analytics-reference/]
- options - LogsClientQueryWorkspaceOptions contains the optional parameters for the LogsClient.QueryWorkspace method.
Example ¶
package main
import (
"context"
"fmt"
"time"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery"
)
var logsClient azquery.LogsClient
func main() {
// QueryWorkspace allows users to query log data.
// A workspace ID is required to query logs. To find the workspace ID:
// 1. If not already made, create a Log Analytics workspace (https://learn.microsoft.com/azure/azure-monitor/logs/quick-create-workspace).
// 2. Navigate to your workspace's page in the Azure portal.
// 3. From the **Overview** blade, copy the value of the ***Workspace ID*** property.
workspaceID := "g4d1e129-fb1e-4b0a-b234-250abc987ea65" // example Azure Log Analytics Workspace ID
res, err := logsClient.QueryWorkspace(
context.TODO(),
workspaceID,
azquery.Body{
Query: to.Ptr("AzureActivity | top 10 by TimeGenerated"), // example Kusto query
Timespan: to.Ptr(azquery.NewTimeInterval(time.Date(2022, 12, 25, 0, 0, 0, 0, time.UTC), time.Date(2022, 12, 25, 12, 0, 0, 0, time.UTC))),
},
nil)
if err != nil {
//TODO: handle error
}
if res.Error != nil {
//TODO: handle partial error
}
// Print Rows
for _, table := range res.Tables {
for _, row := range table.Rows {
fmt.Println(row)
}
}
}
Example (Second) ¶
// `QueryWorkspace` also has more advanced options, including querying multiple workspaces
// and LogsQueryOptions (including statistics and visualization information and increasing default timeout).
// 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.
workspaceID1 := "g4d1e129-fb1e-4b0a-b234-250abc987ea65" // example Azure Log Analytics Workspace ID
workspaceID2 := "h4bc4471-2e8c-4b1c-8f47-12b9a4d5ac71"
additionalWorkspaces := []*string{to.Ptr(workspaceID2)}
// Advanced query options
// Setting Statistics to true returns stats information in Results.Statistics
// Setting Visualization to true returns visualization information in Results.Visualization
options := &azquery.LogsClientQueryWorkspaceOptions{
Options: &azquery.LogsQueryOptions{
Statistics: to.Ptr(true),
Visualization: to.Ptr(true),
Wait: to.Ptr(600),
},
}
res, err := logsClient.QueryWorkspace(
context.TODO(),
workspaceID1,
azquery.Body{
Query: to.Ptr(query),
Timespan: to.Ptr(azquery.NewTimeInterval(time.Date(2022, 12, 25, 0, 0, 0, 0, time.UTC), time.Date(2022, 12, 25, 12, 0, 0, 0, time.UTC))),
AdditionalWorkspaces: additionalWorkspaces,
},
options)
if err != nil {
//TODO: handle error
}
if res.Error != nil {
//TODO: handle partial error
}
// Example of converting table data into a slice of structs.
// Query results are returned in Table Rows and are of type any.
// Type assertion is required to access the underlying value of each index in a Row.
var QueryResults []queryResult
for _, table := range res.Tables {
QueryResults = make([]queryResult, len(table.Rows))
for index, row := range table.Rows {
QueryResults[index] = queryResult{
Bool: row[0].(bool),
Long: int64(row[1].(float64)),
Double: float64(row[2].(float64)),
String: row[3].(string),
}
}
}
fmt.Println(QueryResults)
// Print out Statistics
fmt.Printf("Statistics: %s", string(res.Statistics))
// Print out Visualization information
fmt.Printf("Visualization: %s", string(res.Visualization))
type LogsClientOptions ¶
type LogsClientOptions struct {
azcore.ClientOptions
}
LogsClientOptions contains optional settings for LogsClient.
type LogsClientQueryBatchOptions ¶
type LogsClientQueryBatchOptions struct {
}
LogsClientQueryBatchOptions contains the optional parameters for the LogsClient.QueryBatch method.
type LogsClientQueryBatchResponse ¶
type LogsClientQueryBatchResponse struct {
// Response to a batch query.
BatchResponse
}
LogsClientQueryBatchResponse contains the response from method LogsClient.QueryBatch.
type LogsClientQueryResourceOptions ¶
type LogsClientQueryResourceOptions struct {
// Optional. The prefer header to set server timeout, query statistics and visualization information.
Options *LogsQueryOptions
}
LogsClientQueryResourceOptions contains the optional parameters for the LogsClient.QueryResource method.
type LogsClientQueryResourceResponse ¶
type LogsClientQueryResourceResponse struct {
// Contains the tables, columns & rows resulting from a query.
Results
}
LogsClientQueryResourceResponse contains the response from method LogsClient.QueryResource.
type LogsClientQueryWorkspaceOptions ¶
type LogsClientQueryWorkspaceOptions struct {
// Optional. The prefer header to set server timeout, query statistics and visualization information.
Options *LogsQueryOptions
}
LogsClientQueryWorkspaceOptions contains the optional parameters for the LogsClient.QueryWorkspace method.
type LogsClientQueryWorkspaceResponse ¶
type LogsClientQueryWorkspaceResponse struct {
// Contains the tables, columns & rows resulting from a query.
Results
}
LogsClientQueryWorkspaceResponse contains the response from method LogsClient.QueryWorkspace.
type LogsColumnType ¶
type LogsColumnType string
LogsColumnType - The data type of this column.
const ( LogsColumnTypeBool LogsColumnType = "bool" LogsColumnTypeDatetime LogsColumnType = "datetime" LogsColumnTypeDecimal LogsColumnType = "decimal" LogsColumnTypeDynamic LogsColumnType = "dynamic" LogsColumnTypeGUID LogsColumnType = "guid" LogsColumnTypeInt LogsColumnType = "int" LogsColumnTypeLong LogsColumnType = "long" LogsColumnTypeReal LogsColumnType = "real" LogsColumnTypeString LogsColumnType = "string" LogsColumnTypeTimespan LogsColumnType = "timespan" )
func PossibleLogsColumnTypeValues ¶
func PossibleLogsColumnTypeValues() []LogsColumnType
PossibleLogsColumnTypeValues returns the possible values for the LogsColumnType const type.
type LogsQueryOptions ¶
type LogsQueryOptions struct {
// Set Statistics to true to get logs query execution statistics,
// such as CPU and memory consumption. Defaults to false.
Statistics *bool
// Set Visualization to true to get visualization
// data for logs queries. Defaults to false.
Visualization *bool
// By default, the Azure Monitor Query service will run your
// query for up to three minutes. To increase the default timeout,
// set Wait to desired number of seconds.
// Max wait time the service will allow is ten minutes (600 seconds).
Wait *int
}
LogsQueryOptions sets server timeout, query statistics and visualization information
type MetadataValue ¶
type MetadataValue struct {
// The name of the metadata.
Name *LocalizableString
// The value of the metadata.
Value *string
}
MetadataValue - Represents a metric metadata value.
func (MetadataValue) MarshalJSON ¶
func (m MetadataValue) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MetadataValue.
func (*MetadataValue) UnmarshalJSON ¶
func (m *MetadataValue) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MetadataValue.
type Metric ¶
type Metric struct {
// REQUIRED; the metric Id.
ID *string
// REQUIRED; the name and the display name of the metric, i.e. it is localizable string.
Name *LocalizableString
// REQUIRED; the time series returned when a data query is performed.
TimeSeries []*TimeSeriesElement
// REQUIRED; the resource type of the metric resource.
Type *string
// REQUIRED; The unit of the metric.
Unit *MetricUnit
// Detailed description of this metric.
DisplayDescription *string
// 'Success' or the error details on query failures for this metric.
ErrorCode *string
// Error message encountered querying this specific metric.
ErrorMessage *string
}
Metric - The result data of a query.
func (Metric) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Metric.
func (*Metric) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface for type Metric.
type MetricAvailability ¶
type MetricAvailability struct {
// the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc.
Retention *string
// the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc.
TimeGrain *string
}
MetricAvailability - Metric availability specifies the time grain (aggregation interval or frequency) and the retention period for that time grain.
func (MetricAvailability) MarshalJSON ¶
func (m MetricAvailability) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MetricAvailability.
func (*MetricAvailability) UnmarshalJSON ¶
func (m *MetricAvailability) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MetricAvailability.
type MetricClass ¶
type MetricClass string
MetricClass - The class of the metric.
const ( MetricClassAvailability MetricClass = "Availability" MetricClassErrors MetricClass = "Errors" MetricClassLatency MetricClass = "Latency" MetricClassSaturation MetricClass = "Saturation" MetricClassTransactions MetricClass = "Transactions" )
func PossibleMetricClassValues ¶
func PossibleMetricClassValues() []MetricClass
PossibleMetricClassValues returns the possible values for the MetricClass const type.
type MetricDefinition ¶
type MetricDefinition struct {
// Custom category name for this metric.
Category *string
// the name and the display name of the dimension, i.e. it is a localizable string.
Dimensions []*LocalizableString
// Detailed description of this metric.
DisplayDescription *string
// the resource identifier of the metric definition.
ID *string
// Flag to indicate whether the dimension is required.
IsDimensionRequired *bool
// the collection of what aggregation intervals are available to be queried.
MetricAvailabilities []*MetricAvailability
// The class of the metric.
MetricClass *MetricClass
// the name and the display name of the metric, i.e. it is a localizable string.
Name *LocalizableString
// the namespace the metric belongs to.
Namespace *string
// the primary aggregation type value defining how to use the values for display.
PrimaryAggregationType *AggregationType
// the resource identifier of the resource that emitted the metric.
ResourceID *string
// the collection of what aggregation types are supported.
SupportedAggregationTypes []*AggregationType
// The unit of the metric.
Unit *MetricUnit
}
MetricDefinition - Metric definition class specifies the metadata for a metric.
func (MetricDefinition) MarshalJSON ¶
func (m MetricDefinition) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MetricDefinition.
func (*MetricDefinition) UnmarshalJSON ¶
func (m *MetricDefinition) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MetricDefinition.
type MetricDefinitionCollection ¶
type MetricDefinitionCollection struct {
// REQUIRED; the values for the metric definitions.
Value []*MetricDefinition
}
MetricDefinitionCollection - Represents collection of metric definitions.
func (MetricDefinitionCollection) MarshalJSON ¶
func (m MetricDefinitionCollection) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MetricDefinitionCollection.
func (*MetricDefinitionCollection) UnmarshalJSON ¶
func (m *MetricDefinitionCollection) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MetricDefinitionCollection.
type MetricNamespace ¶
type MetricNamespace struct {
// Kind of namespace
Classification *NamespaceClassification
// The ID of the metric namespace.
ID *string
// The escaped name of the namespace.
Name *string
// Properties which include the fully qualified namespace name.
Properties *MetricNamespaceName
// The type of the namespace.
Type *string
}
MetricNamespace - Metric namespace class specifies the metadata for a metric namespace.
func (MetricNamespace) MarshalJSON ¶
func (m MetricNamespace) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MetricNamespace.
func (*MetricNamespace) UnmarshalJSON ¶
func (m *MetricNamespace) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MetricNamespace.
type MetricNamespaceCollection ¶
type MetricNamespaceCollection struct {
// REQUIRED; The values for the metric namespaces.
Value []*MetricNamespace
}
MetricNamespaceCollection - Represents collection of metric namespaces.
func (MetricNamespaceCollection) MarshalJSON ¶
func (m MetricNamespaceCollection) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MetricNamespaceCollection.
func (*MetricNamespaceCollection) UnmarshalJSON ¶
func (m *MetricNamespaceCollection) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MetricNamespaceCollection.
type MetricNamespaceName ¶
type MetricNamespaceName struct {
// The metric namespace name.
MetricNamespaceName *string
}
MetricNamespaceName - The fully qualified metric namespace name.
func (MetricNamespaceName) MarshalJSON ¶
func (m MetricNamespaceName) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MetricNamespaceName.
func (*MetricNamespaceName) UnmarshalJSON ¶
func (m *MetricNamespaceName) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MetricNamespaceName.
type MetricResults ¶
type MetricResults struct {
// The collection of metric data responses per resource, per metric.
Values []*MetricValues
}
MetricResults - The metrics result for a resource.
func (MetricResults) MarshalJSON ¶
func (m MetricResults) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MetricResults.
func (*MetricResults) UnmarshalJSON ¶
func (m *MetricResults) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MetricResults.
type MetricUnit ¶
type MetricUnit string
MetricUnit - The unit of the metric.
const ( MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" MetricUnitByteSeconds MetricUnit = "ByteSeconds" MetricUnitBytes MetricUnit = "Bytes" MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" MetricUnitCores MetricUnit = "Cores" MetricUnitCount MetricUnit = "Count" MetricUnitCountPerSecond MetricUnit = "CountPerSecond" MetricUnitMilliCores MetricUnit = "MilliCores" MetricUnitMilliSeconds MetricUnit = "MilliSeconds" MetricUnitNanoCores MetricUnit = "NanoCores" MetricUnitPercent MetricUnit = "Percent" MetricUnitSeconds MetricUnit = "Seconds" MetricUnitUnspecified MetricUnit = "Unspecified" )
func PossibleMetricUnitValues ¶
func PossibleMetricUnitValues() []MetricUnit
PossibleMetricUnitValues returns the possible values for the MetricUnit const type.
type MetricValue ¶
type MetricValue struct {
// REQUIRED; The timestamp for the metric value in ISO 8601 format.
TimeStamp *time.Time
// The average value in the time range.
Average *float64
// The number of samples in the time range. Can be used to determine the number of values that contributed to the average
// value.
Count *float64
// The greatest value in the time range.
Maximum *float64
// The least value in the time range.
Minimum *float64
// The sum of all of the values in the time range.
Total *float64
}
MetricValue - Represents a metric value.
func (MetricValue) MarshalJSON ¶
func (m MetricValue) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MetricValue.
func (*MetricValue) UnmarshalJSON ¶
func (m *MetricValue) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MetricValue.
type MetricValues ¶
type MetricValues struct {
// REQUIRED; The end time, in datetime format, for which the data was retrieved.
EndTime *string
// REQUIRED; The start time, in datetime format, for which the data was retrieved.
StartTime *string
// REQUIRED; The value of the collection.
Values []*Metric
// The interval (window size) for which the metric data was returned in. Follows the IS8601/RFC3339 duration format (e.g.
// 'P1D' for 1 day). This may be adjusted in the future and returned back from what
// was originally requested. This is not present if a metadata request was made.
Interval *string
// The namespace of the metrics been queried
Namespace *string
// The resource that has been queried for metrics.
ResourceID *string
// The region of the resource been queried for metrics.
ResourceRegion *string
}
MetricValues - Metric data values.
func (MetricValues) MarshalJSON ¶
func (m MetricValues) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type MetricValues.
func (*MetricValues) UnmarshalJSON ¶
func (m *MetricValues) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type MetricValues.
type MetricsBatchClient ¶
type MetricsBatchClient struct {
// contains filtered or unexported fields
}
MetricsBatchClient contains the methods for the MetricsBatch group. Don't use this type directly, use a constructor function instead.
func NewMetricsBatchClient ¶
func NewMetricsBatchClient(endpoint string, credential azcore.TokenCredential, options *MetricsBatchClientOptions) (*MetricsBatchClient, error)
NewMetricsBatchClient creates a client that accesses Azure Monitor metrics data. MetricsBatchClient should be used for performing metrics queries on multiple monitored resources in the same region. A credential with authorization at the subscription level is required when using this client.
endpoint - The regional endpoint to use, for example https://eastus.metrics.monitor.azure.com. The region should match the region of the requested resources. For global resources, the region should be 'global'.
Example ¶
package main
import (
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery"
)
func main() {
// The regional endpoint to use. The region should match the region of the requested resources.
// For global resources, the region should be 'global'
endpoint := "https://eastus.metrics.monitor.azure.com"
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
//TODO: handle error
}
client, err := azquery.NewMetricsBatchClient(endpoint, cred, nil)
if err != nil {
//TODO: handle error
}
_ = client
}
func (*MetricsBatchClient) QueryBatch ¶
func (client *MetricsBatchClient) QueryBatch(ctx context.Context, subscriptionID string, metricNamespace string, metricNames []string, resourceIDs ResourceIDList, options *MetricsBatchClientQueryBatchOptions) (MetricsBatchClientQueryBatchResponse, error)
QueryBatch - Lists the metric values for multiple resources. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2023-05-01-preview
- subscriptionID - The subscription identifier for the resources in this batch.
- metricNamespace - Metric namespace that contains the requested metric names.
- metricNames - The names of the metrics (comma separated) to retrieve.
- resourceIDs - The comma separated list of resource IDs to query metrics for.
- options - MetricsBatchClientQueryBatchOptions contains the optional parameters for the MetricsBatchClient.QueryBatch method.
Example ¶
// This sample uses the MetricsBatchClient to retrieve the "Ingress"
// metric along with the "Average" aggregation type for multiple resources.
// The query will execute over a timespan of 2 hours with a interval (granularity) of 5 minutes.
// In this example, storage account resource URIs are queried for metrics.
resourceURI1 := "/subscriptions/<id>/resourceGroups/<rg>/providers/Microsoft.Storage/storageAccounts/<account-1>"
resourceURI2 := "/subscriptions/<id>/resourceGroups/<rg>/providers/Microsoft.Storage/storageAccounts/<account-2>"
res, err := metricsBatchClient.QueryBatch(
context.Background(),
subscriptionID,
"Microsoft.Storage/storageAccounts",
[]string{"Ingress"},
azquery.ResourceIDList{ResourceIDs: to.SliceOfPtrs(resourceURI1, resourceURI2)},
&azquery.MetricsBatchClientQueryBatchOptions{
Aggregation: to.SliceOfPtrs(azquery.AggregationTypeAverage),
StartTime: to.Ptr("2023-11-15"),
EndTime: to.Ptr("2023-11-16"),
Interval: to.Ptr("PT5M"),
},
)
if err != nil {
//TODO: handle error
}
// Print out results
for _, result := range res.Values {
for _, metric := range result.Values {
fmt.Println(*metric.Name.Value + ": " + *metric.DisplayDescription)
for _, timeSeriesElement := range metric.TimeSeries {
for _, metricValue := range timeSeriesElement.Data {
fmt.Printf("The ingress at %v is %v.\n", metricValue.TimeStamp.String(), *metricValue.Average)
}
}
}
}
type MetricsBatchClientOptions ¶
type MetricsBatchClientOptions struct {
azcore.ClientOptions
}
MetricsBatchClientOptions contains optional settings for MetricsBatchClient.
type MetricsBatchClientQueryBatchOptions ¶
type MetricsBatchClientQueryBatchOptions struct {
// The list of aggregation types to retrieve
Aggregation []*AggregationType
// The end time of the query. It is a string in the format 'yyyy-MM-ddTHH:mm:ss.fffZ'.
EndTime *string
// The filter is used to reduce the set of metric data returned.
// Example:
// Metric contains metadata A, B and C.
// - Return all time series of C where A = a1 and B = b1 or b2
// filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘’
// - Invalid variant:
// filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘’ or B = ‘b2’
// This is invalid because the logical or operator cannot separate two different metadata names.
// - Return all time series where A = a1, B = b1 and C = c1:
// filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’
// - Return all time series where A = a1
// filter=A eq ‘a1’ and B eq ‘’ and C eq ‘’.
Filter *string
// The interval (i.e. timegrain) of the query.Examples: PT15M, PT1H, P1D
Interval *string
// The aggregation to use for sorting results and the direction of the sort. Only one order can be specified.Examples: sum
// asc
OrderBy *string
// The start time of the query. It is a string in the format 'yyyy-MM-ddTHH:mm:ss.fffZ'. If you have specified the endtime
// parameter, then this parameter is required. If only starttime is specified, then
// endtime defaults to the current time. If no time interval is specified, the default is 1 hour.
StartTime *string
// The maximum number of records to retrieve per resource ID in the request. Valid only if filter is specified. Defaults to
// 10.
Top *int32
}
MetricsBatchClientQueryBatchOptions contains the optional parameters for the MetricsBatchClient.QueryBatch method.
type MetricsBatchClientQueryBatchResponse ¶
type MetricsBatchClientQueryBatchResponse struct {
// The metrics result for a resource.
MetricResults
}
MetricsBatchClientQueryBatchResponse contains the response from method MetricsBatchClient.QueryBatch.
type MetricsClient ¶
type MetricsClient struct {
// contains filtered or unexported fields
}
MetricsClient contains the methods for the Metrics group. Don't use this type directly, use a constructor function instead.
func NewMetricsClient ¶
func NewMetricsClient(credential azcore.TokenCredential, options *MetricsClientOptions) (*MetricsClient, error)
NewMetricsClient creates a client that accesses Azure Monitor metrics data.
Example ¶
package main
import (
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery"
)
func main() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
//TODO: handle error
}
client, err := azquery.NewMetricsClient(cred, nil)
if err != nil {
//TODO: handle error
}
_ = client
}
func (*MetricsClient) NewListDefinitionsPager ¶
func (client *MetricsClient) NewListDefinitionsPager(resourceURI string, options *MetricsClientListDefinitionsOptions) *runtime.Pager[MetricsClientListDefinitionsResponse]
NewListDefinitionsPager - Lists the metric definitions for the resource.
Generated from API version 2018-01-01
- resourceURI - The identifier of the resource.
- options - MetricsClientListDefinitionsOptions contains the optional parameters for the MetricsClient.NewListDefinitionsPager method.
Example ¶
pager := metricsClient.NewListDefinitionsPager(resourceURI, &azquery.MetricsClientListDefinitionsOptions{MetricNamespace: to.Ptr("microsoft.insights/components")})
for pager.More() {
nextResult, err := pager.NextPage(context.TODO())
if err != nil {
//TODO: handle error
}
for _, v := range nextResult.Value {
// TODO: use page item
_ = v
}
}
func (*MetricsClient) NewListNamespacesPager ¶
func (client *MetricsClient) NewListNamespacesPager(resourceURI string, options *MetricsClientListNamespacesOptions) *runtime.Pager[MetricsClientListNamespacesResponse]
NewListNamespacesPager - Lists the metric namespaces for the resource.
Generated from API version 2017-12-01-preview
- resourceURI - The identifier of the resource.
- options - MetricsClientListNamespacesOptions contains the optional parameters for the MetricsClient.NewListNamespacesPager method.
Example ¶
pager := metricsClient.NewListNamespacesPager(resourceURI, &azquery.MetricsClientListNamespacesOptions{StartTime: to.Ptr("2020-08-31T15:53:00Z")})
for pager.More() {
nextResult, err := pager.NextPage(context.TODO())
if err != nil {
//TODO: handle error
}
for _, v := range nextResult.Value {
// TODO: use page item
_ = v
}
}
func (*MetricsClient) QueryResource ¶
func (client *MetricsClient) QueryResource(ctx context.Context, resourceURI string, options *MetricsClientQueryResourceOptions) (MetricsClientQueryResourceResponse, error)
QueryResource - Lists the metric values for a resource. If the operation fails it returns an *azcore.ResponseError type.
Generated from API version 2018-01-01
- resourceURI - The identifier of the resource.
- options - MetricsClientQueryResourceOptions contains the optional parameters for the MetricsClient.QueryResource method.
Example ¶
package main
import (
"context"
"fmt"
"time"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery"
)
var metricsClient azquery.MetricsClient
func main() {
// QueryResource is used to query metrics on an Azure resource.
// For each requested metric, a set of aggregated values is returned inside the `TimeSeries` collection.
// resource ID is required to query metrics. To find the resource ID:
// 1. Navigate to your resource's page in the Azure portal.
// 2. From the **Overview** blade, select the **JSON View** link.
// 3. In the resulting JSON, copy the value of the `id` property.
resourceURI := "subscriptions/182c901a-129a-4f5d-86e4-afdsb294590a2/resourceGroups/test-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions"
res, err := metricsClient.QueryResource(context.TODO(), resourceURI,
&azquery.MetricsClientQueryResourceOptions{
Timespan: to.Ptr(azquery.NewTimeInterval(time.Date(2022, 12, 25, 0, 0, 0, 0, time.UTC), time.Date(2022, 12, 25, 12, 0, 0, 0, time.UTC))),
Interval: to.Ptr("PT1M"),
MetricNames: nil,
Aggregation: to.SliceOfPtrs(azquery.AggregationTypeAverage, azquery.AggregationTypeCount),
Top: to.Ptr[int32](3),
OrderBy: to.Ptr("Average asc"),
Filter: to.Ptr("BlobType eq '*'"),
ResultType: nil,
MetricNamespace: to.Ptr("Microsoft.Storage/storageAccounts/blobServices"),
})
if err != nil {
//TODO: handle error
}
// Print out metric name and the time stamps of each metric data point
for _, metric := range res.Value {
fmt.Println(*metric.Name.Value)
for _, timeSeriesElement := range metric.TimeSeries {
for _, metricValue := range timeSeriesElement.Data {
fmt.Println(metricValue.TimeStamp)
}
}
}
}
type MetricsClientListDefinitionsOptions ¶
type MetricsClientListDefinitionsOptions struct {
// Metric namespace to query metric definitions for.
MetricNamespace *string
}
MetricsClientListDefinitionsOptions contains the optional parameters for the MetricsClient.NewListDefinitionsPager method.
type MetricsClientListDefinitionsResponse ¶
type MetricsClientListDefinitionsResponse struct {
// Represents collection of metric definitions.
MetricDefinitionCollection
}
MetricsClientListDefinitionsResponse contains the response from method MetricsClient.NewListDefinitionsPager.
type MetricsClientListNamespacesOptions ¶
type MetricsClientListNamespacesOptions struct {
// The ISO 8601 conform Date start time from which to query for metric namespaces.
StartTime *string
}
MetricsClientListNamespacesOptions contains the optional parameters for the MetricsClient.NewListNamespacesPager method.
type MetricsClientListNamespacesResponse ¶
type MetricsClientListNamespacesResponse struct {
// Represents collection of metric namespaces.
MetricNamespaceCollection
}
MetricsClientListNamespacesResponse contains the response from method MetricsClient.NewListNamespacesPager.
type MetricsClientOptions ¶
type MetricsClientOptions struct {
azcore.ClientOptions
}
MetricsClientOptions contains optional settings for MetricsClient.
type MetricsClientQueryResourceOptions ¶
type MetricsClientQueryResourceOptions struct {
// The list of aggregation types to retrieve
Aggregation []*AggregationType
// The $filter is used to reduce the set of metric data returned. Example: Metric contains metadata A, B and C. - Return all
// time series of C where A = a1 and B = b1 or b2 $filter=A eq 'a1' and B eq 'b1'
// or B eq 'b2' and C eq ” - Invalid variant: $filter=A eq 'a1' and B eq 'b1' and C eq ” or B = 'b2' This is invalid because
// the logical or operator cannot separate two different metadata names. -
// Return all time series where A = a1, B = b1 and C = c1: $filter=A eq 'a1' and B eq 'b1' and C eq 'c1' - Return all time
// series where A = a1 $filter=A eq 'a1' and B eq ” and C eq ”. Special case:
// When dimension name or dimension value uses round brackets. Eg: When dimension name is dim (test) 1 Instead of using $filter=
// "dim (test) 1 eq ” " use $filter= "dim %2528test%2529 1 eq ” " When
// dimension name is dim (test) 3 and dimension value is dim3 (test) val Instead of using $filter= "dim (test) 3 eq 'dim3
// (test) val' " use $filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' "
Filter *string
// The interval (i.e. timegrain) of the query in ISO 8601 duration format. Defaults to PT1M. Special case for 'FULL' value
// that returns single datapoint for entire time span requested.Examples: PT15M,
// PT1H, P1D, FULL
Interval *string
// The names of the metrics (comma separated) to retrieve. Special case: If a metricname itself has a comma in it then use
// %2 to indicate it. Eg: 'Metric,Name1' should be 'Metric%2Name1'
MetricNames *string
// Metric namespace to query metric definitions for.
MetricNamespace *string
// The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum
// asc.
OrderBy *string
// Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details.
ResultType *ResultType
// The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'.
Timespan *TimeInterval
// The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10.
Top *int32
}
MetricsClientQueryResourceOptions contains the optional parameters for the MetricsClient.QueryResource method.
type MetricsClientQueryResourceResponse ¶
type MetricsClientQueryResourceResponse struct {
// The response to a metrics query.
Response
}
MetricsClientQueryResourceResponse contains the response from method MetricsClient.QueryResource.
type NamespaceClassification ¶
type NamespaceClassification string
NamespaceClassification - Kind of namespace
const ( NamespaceClassificationCustom NamespaceClassification = "Custom" NamespaceClassificationPlatform NamespaceClassification = "Platform" NamespaceClassificationQos NamespaceClassification = "Qos" )
func PossibleNamespaceClassificationValues ¶
func PossibleNamespaceClassificationValues() []NamespaceClassification
PossibleNamespaceClassificationValues returns the possible values for the NamespaceClassification const type.
type ResourceIDList ¶
type ResourceIDList struct {
// The list of resource IDs to query metrics for.
ResourceIDs []*string
}
ResourceIDList - The comma separated list of resource IDs to query metrics for.
func (ResourceIDList) MarshalJSON ¶
func (r ResourceIDList) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ResourceIDList.
func (*ResourceIDList) UnmarshalJSON ¶
func (r *ResourceIDList) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ResourceIDList.
type Response ¶
type Response struct {
// REQUIRED; The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by
// '/'. This may be adjusted in the future and returned back from what was originally
// requested.
Timespan *TimeInterval
// REQUIRED; the value of the collection.
Value []*Metric
// The integer value representing the relative cost of the query.
Cost *int32
// The interval (window size) for which the metric data was returned in ISO 8601 duration format with a special case for 'FULL'
// value that returns single datapoint for entire time span requested (
// Examples: PT15M, PT1H, P1D, FULL). This may be adjusted and different from what was originally requested if AutoAdjustTimegrain=true
// is specified. This is not present if a metadata request was made.
Interval *string
// The namespace of the metrics being queried
Namespace *string
// The region of the resource being queried for metrics.
ResourceRegion *string
}
Response - The response to a metrics query.
func (Response) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Response.
func (*Response) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface for type Response.
type ResultType ¶
type ResultType string
ResultType - Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details.
const ( ResultTypeData ResultType = "Data" ResultTypeMetadata ResultType = "Metadata" )
func PossibleResultTypeValues ¶
func PossibleResultTypeValues() []ResultType
PossibleResultTypeValues returns the possible values for the ResultType const type.
type Results ¶
type Results struct {
// REQUIRED; The results of the query in tabular format.
Tables []*Table
// The code and message for an error.
Error *ErrorInfo
// Statistics represented in JSON format.
Statistics []byte
// Visualization data in JSON format.
Visualization []byte
}
Results - Contains the tables, columns & rows resulting from a query.
func (Results) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Results.
func (*Results) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface for type Results.
type Row ¶
type Row []any
Row of data in a table, types of data used by service specified in LogsColumnType
type Table ¶
type Table struct {
// REQUIRED; The list of columns in this table.
Columns []*Column
// REQUIRED; The name of the table.
Name *string
// REQUIRED; The resulting rows from this query.
Rows []Row
}
Table - Contains the columns and rows for one table in a query response.
func (Table) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type Table.
func (*Table) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface for type Table.
type TimeInterval ¶
type TimeInterval string
TimeInterval specifies the time range over which to query. Use NewTimeInterval() for help formatting. Follows the ISO8601 time interval standard with most common format being startISOTime/endISOTime. ISO8601 durations also supported (ex "PT2H" for last two hours). Use UTC for all times.
func NewTimeInterval ¶
func NewTimeInterval(start time.Time, end time.Time) TimeInterval
NewTimeInterval creates a TimeInterval for use in a query. Use UTC for start and end times.
type TimeSeriesElement ¶
type TimeSeriesElement struct {
// An array of data points representing the metric values. This is only returned if a result type of data is specified.
Data []*MetricValue
// the metadata values returned if $filter was specified in the call.
MetadataValues []*MetadataValue
}
TimeSeriesElement - A time series result type. The discriminator value is always TimeSeries in this case.
func (TimeSeriesElement) MarshalJSON ¶
func (t TimeSeriesElement) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type TimeSeriesElement.
func (*TimeSeriesElement) UnmarshalJSON ¶
func (t *TimeSeriesElement) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type TimeSeriesElement.