Documentation ¶
Index ¶
- type AggregationType
- type BatchQueryRequest
- type BatchQueryRequestMethod
- type BatchQueryRequestPath
- type BatchQueryResponse
- type BatchQueryResults
- type BatchRequest
- type BatchResponse
- type Body
- type Column
- type ErrorDetail
- type ErrorInfo
- type LocalizableString
- type LogsClient
- type LogsClientBatchOptions
- type LogsClientBatchResponse
- type LogsClientOptions
- type LogsClientQueryWorkspaceOptions
- type LogsClientQueryWorkspaceResponse
- type LogsColumnType
- type MetadataValue
- type Metric
- type MetricAvailability
- type MetricClass
- type MetricDefinition
- type MetricDefinitionCollection
- type MetricNamespace
- type MetricNamespaceCollection
- type MetricNamespaceName
- type MetricUnit
- type MetricValue
- type MetricsClient
- func (client *MetricsClient) NewListMetricDefinitionsPager(resourceURI string, options *MetricsClientListMetricDefinitionsOptions) *runtime.Pager[MetricsClientListMetricDefinitionsResponse]
- func (client *MetricsClient) NewListMetricNamespacesPager(resourceURI string, options *MetricsClientListMetricNamespacesOptions) *runtime.Pager[MetricsClientListMetricNamespacesResponse]
- func (client *MetricsClient) QueryResource(ctx context.Context, resourceURI string, ...) (MetricsClientQueryResourceResponse, error)
- type MetricsClientListMetricDefinitionsOptions
- type MetricsClientListMetricDefinitionsResponse
- type MetricsClientListMetricNamespacesOptions
- type MetricsClientListMetricNamespacesResponse
- type MetricsClientOptions
- type MetricsClientQueryResourceOptions
- type MetricsClientQueryResourceResponse
- type NamespaceClassification
- type Response
- type ResultType
- type Results
- type Table
- type TimeSeriesElement
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregationType ¶
type AggregationType string
AggregationType - the aggregation type of the metric.
const ( AggregationTypeNone AggregationType = "None" AggregationTypeAverage AggregationType = "Average" AggregationTypeCount AggregationType = "Count" AggregationTypeMinimum AggregationType = "Minimum" AggregationTypeMaximum AggregationType = "Maximum" 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 `json:"body,omitempty"` // REQUIRED; The error details. ID *string `json:"id,omitempty"` // REQUIRED; Workspace Id to be included in the query Workspace *string `json:"workspace,omitempty"` // Dictionary of Headers map[string]*string `json:"headers,omitempty"` // The method of a single request in a batch, defaults to POST Method *BatchQueryRequestMethod `json:"method,omitempty"` // The query path of a single request in a batch, defaults to /query Path *BatchQueryRequestPath `json:"path,omitempty"` }
BatchQueryRequest - An single request in a batch.
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 `json:"body,omitempty"` // Dictionary of Headers map[string]*string `json:"headers,omitempty"` ID *string `json:"id,omitempty"` Status *int32 `json:"status,omitempty"` }
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 `json:"error,omitempty"` // Visualization data in JSON format. Render interface{} `json:"render,omitempty"` // Statistics represented in JSON format. Statistics interface{} `json:"statistics,omitempty"` // The list of tables, columns and rows. Tables []*Table `json:"tables,omitempty"` }
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 `json:"requests,omitempty"` }
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 `json:"responses,omitempty"` }
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 `json:"query,omitempty"` // 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 *string `json:"timespan,omitempty"` // A list of workspaces that are included in the query. Workspaces []*string `json:"workspaces,omitempty"` }
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 `json:"name,omitempty"` // The data type of this column. Type *LogsColumnType `json:"type,omitempty"` }
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 ErrorDetail ¶
type ErrorDetail struct { // REQUIRED; The error's code. Code *string `json:"code,omitempty"` // REQUIRED; A human readable error message. Message *string `json:"message,omitempty"` // Additional properties that can be provided on the error details object AdditionalProperties interface{} `json:"additionalProperties,omitempty"` // Indicates resources which were responsible for the error. Resources []*string `json:"resources,omitempty"` // Indicates which property in the request is responsible for the error. Target *string `json:"target,omitempty"` // Indicates which value in 'target' is responsible for the error. Value *string `json:"value,omitempty"` }
ErrorDetail - Error details.
func (ErrorDetail) MarshalJSON ¶
func (e ErrorDetail) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaller interface for type ErrorDetail.
func (*ErrorDetail) UnmarshalJSON ¶
func (e *ErrorDetail) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail.
type ErrorInfo ¶
type ErrorInfo struct { // REQUIRED; A machine readable error code. Code *string `json:"code,omitempty"` // REQUIRED; A human readable error message. Message *string `json:"message,omitempty"` // Additional properties that can be provided on the error info object AdditionalProperties interface{} `json:"additionalProperties,omitempty"` // error details. Details []*ErrorDetail `json:"details,omitempty"` // Inner error details if they exist. Innererror *ErrorInfo `json:"innererror,omitempty"` }
ErrorInfo - The code and message for an error.
func (ErrorInfo) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface for type ErrorInfo.
func (*ErrorInfo) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface for type ErrorInfo.
type LocalizableString ¶
type LocalizableString struct { // REQUIRED; the invariant value. Value *string `json:"value,omitempty"` // the locale specific value. LocalizedValue *string `json:"localizedValue,omitempty"` }
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 LogsClient group. Don't use this type directly, use NewLogsClient() instead.
func NewLogsClient ¶
func NewLogsClient(credential azcore.TokenCredential, options *LogsClientOptions) *LogsClient
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 { panic(err) } client := azquery.NewLogsClient(cred, nil) _ = client }
Output:
func (*LogsClient) Batch ¶
func (client *LogsClient) Batch(ctx context.Context, body BatchRequest, options *LogsClientBatchOptions) (LogsClientBatchResponse, error)
Batch - Executes a batch of Analytics queries for data. Here [https://dev.loganalytics.io/documentation/Using-the-API] is an example for using POST with an Analytics query. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-05-19_Preview body - The batch request body options - LogsClientBatchOptions contains the optional parameters for the LogsClient.Batch method.
Example ¶
client := azquery.NewLogsClient(cred, nil) timespan := "2022-08-30/2022-08-31" batchRequest := azquery.BatchRequest{[]*azquery.BatchQueryRequest{ {Body: &azquery.Body{Query: to.Ptr(kustoQuery1), Timespan: to.Ptr(timespan)}, ID: to.Ptr("1"), Workspace: to.Ptr(workspaceID)}, {Body: &azquery.Body{Query: to.Ptr(kustoQuery2), Timespan: to.Ptr(timespan)}, ID: to.Ptr("2"), Workspace: to.Ptr(workspaceID)}, {Body: &azquery.Body{Query: to.Ptr(kustoQuery3), Timespan: to.Ptr(timespan)}, ID: to.Ptr("3"), Workspace: to.Ptr(workspaceID)}, }} res, err := client.Batch(context.TODO(), batchRequest, nil) if err != nil { panic(err) } _ = res
Output:
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://dev.loganalytics.io/documentation/Using-the-API] is an example for using POST with an Analytics query. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-05-19_Preview workspaceID - ID of the workspace. This is 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 ¶
client := azquery.NewLogsClient(cred, nil) timespan := "2022-08-30/2022-08-31" res, err := client.QueryWorkspace(context.TODO(), workspaceID, azquery.Body{Query: to.Ptr(query), Timespan: to.Ptr(timespan)}, nil) if err != nil { panic(err) } _ = res
Output:
type LogsClientBatchOptions ¶
type LogsClientBatchOptions struct { }
LogsClientBatchOptions contains the optional parameters for the LogsClient.Batch method.
type LogsClientBatchResponse ¶
type LogsClientBatchResponse struct {
BatchResponse
}
LogsClientBatchResponse contains the response from method LogsClient.Batch.
type LogsClientOptions ¶
type LogsClientOptions struct {
azcore.ClientOptions
}
LogsClientOptions contains optional settings for LogsClient.
type LogsClientQueryWorkspaceOptions ¶
type LogsClientQueryWorkspaceOptions struct { // Optional. The prefer header to set server timeout, query statistics and visualization information. Prefer *string }
LogsClientQueryWorkspaceOptions contains the optional parameters for the LogsClient.QueryWorkspace method.
type LogsClientQueryWorkspaceResponse ¶
type LogsClientQueryWorkspaceResponse struct {
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 MetadataValue ¶
type MetadataValue struct { // the name of the metadata. Name *LocalizableString `json:"name,omitempty"` // the value of the metadata. Value *string `json:"value,omitempty"` }
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 `json:"id,omitempty"` // REQUIRED; the name and the display name of the metric, i.e. it is localizable string. Name *LocalizableString `json:"name,omitempty"` // REQUIRED; the time series returned when a data query is performed. Timeseries []*TimeSeriesElement `json:"timeseries,omitempty"` // REQUIRED; the resource type of the metric resource. Type *string `json:"type,omitempty"` // REQUIRED; The unit of the metric. Unit *MetricUnit `json:"unit,omitempty"` // Detailed description of this metric. DisplayDescription *string `json:"displayDescription,omitempty"` // 'Success' or the error details on query failures for this metric. ErrorCode *string `json:"errorCode,omitempty"` // Error message encountered querying this specific metric. ErrorMessage *string `json:"errorMessage,omitempty"` }
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 `json:"retention,omitempty"` // the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. TimeGrain *string `json:"timeGrain,omitempty"` }
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 `json:"category,omitempty"` // the name and the display name of the dimension, i.e. it is a localizable string. Dimensions []*LocalizableString `json:"dimensions,omitempty"` // Detailed description of this metric. DisplayDescription *string `json:"displayDescription,omitempty"` // the resource identifier of the metric definition. ID *string `json:"id,omitempty"` // Flag to indicate whether the dimension is required. IsDimensionRequired *bool `json:"isDimensionRequired,omitempty"` // the collection of what aggregation intervals are available to be queried. MetricAvailabilities []*MetricAvailability `json:"metricAvailabilities,omitempty"` // The class of the metric. MetricClass *MetricClass `json:"metricClass,omitempty"` // the name and the display name of the metric, i.e. it is a localizable string. Name *LocalizableString `json:"name,omitempty"` // the namespace the metric belongs to. Namespace *string `json:"namespace,omitempty"` // the primary aggregation type value defining how to use the values for display. PrimaryAggregationType *AggregationType `json:"primaryAggregationType,omitempty"` // the resource identifier of the resource that emitted the metric. ResourceID *string `json:"resourceId,omitempty"` // the collection of what aggregation types are supported. SupportedAggregationTypes []*AggregationType `json:"supportedAggregationTypes,omitempty"` // The unit of the metric. Unit *MetricUnit `json:"unit,omitempty"` }
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 `json:"value,omitempty"` }
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 `json:"classification,omitempty"` // The ID of the metric namespace. ID *string `json:"id,omitempty"` // The escaped name of the namespace. Name *string `json:"name,omitempty"` // Properties which include the fully qualified namespace name. Properties *MetricNamespaceName `json:"properties,omitempty"` // The type of the namespace. Type *string `json:"type,omitempty"` }
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 `json:"value,omitempty"` }
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 `json:"metricNamespaceName,omitempty"` }
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 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 `json:"timeStamp,omitempty"` // the average value in the time range. Average *float64 `json:"average,omitempty"` // 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 `json:"count,omitempty"` // the greatest value in the time range. Maximum *float64 `json:"maximum,omitempty"` // the least value in the time range. Minimum *float64 `json:"minimum,omitempty"` // the sum of all of the values in the time range. Total *float64 `json:"total,omitempty"` }
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 MetricsClient ¶
type MetricsClient struct {
// contains filtered or unexported fields
}
MetricsClient contains the methods for the Metrics group. Don't use this type directly, use NewMetricsClient() instead.
func NewMetricsClient ¶
func NewMetricsClient(credential azcore.TokenCredential, options *MetricsClientOptions) *MetricsClient
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 { panic(err) } client := azquery.NewMetricsClient(cred, nil) _ = client }
Output:
func (*MetricsClient) NewListMetricDefinitionsPager ¶
func (client *MetricsClient) NewListMetricDefinitionsPager(resourceURI string, options *MetricsClientListMetricDefinitionsOptions) *runtime.Pager[MetricsClientListMetricDefinitionsResponse]
NewListMetricDefinitionsPager - Lists the metric definitions for the resource. Generated from API version 2018-01-01 resourceURI - The identifier of the resource. options - MetricsClientListMetricDefinitionsOptions contains the optional parameters for the MetricsClient.ListMetricDefinitions method.
func (*MetricsClient) NewListMetricNamespacesPager ¶
func (client *MetricsClient) NewListMetricNamespacesPager(resourceURI string, options *MetricsClientListMetricNamespacesOptions) *runtime.Pager[MetricsClientListMetricNamespacesResponse]
NewListMetricNamespacesPager - Lists the metric namespaces for the resource. Generated from API version 2017-12-01-preview resourceURI - The identifier of the resource. options - MetricsClientListMetricNamespacesOptions contains the optional parameters for the MetricsClient.ListMetricNamespaces method.
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 ¶
client := azquery.NewMetricsClient(cred, nil) res, err := client.QueryResource(context.Background(), resourceURI, &azquery.MetricsClientQueryResourceOptions{Timespan: to.Ptr("2017-04-14T02:20:00Z/2017-04-14T04:20:00Z"), Interval: to.Ptr("PT1M"), Metricnames: nil, Aggregation: to.Ptr("Average,count"), 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 { panic(err) } _ = res
Output:
type MetricsClientListMetricDefinitionsOptions ¶
type MetricsClientListMetricDefinitionsOptions struct { // Metric namespace to query metric definitions for. Metricnamespace *string }
MetricsClientListMetricDefinitionsOptions contains the optional parameters for the MetricsClient.ListMetricDefinitions method.
type MetricsClientListMetricDefinitionsResponse ¶
type MetricsClientListMetricDefinitionsResponse struct {
MetricDefinitionCollection
}
MetricsClientListMetricDefinitionsResponse contains the response from method MetricsClient.ListMetricDefinitions.
type MetricsClientListMetricNamespacesOptions ¶
type MetricsClientListMetricNamespacesOptions struct { // The ISO 8601 conform Date start time from which to query for metric namespaces. StartTime *string }
MetricsClientListMetricNamespacesOptions contains the optional parameters for the MetricsClient.ListMetricNamespaces method.
type MetricsClientListMetricNamespacesResponse ¶
type MetricsClientListMetricNamespacesResponse struct {
MetricNamespaceCollection
}
MetricsClientListMetricNamespacesResponse contains the response from method MetricsClient.ListMetricNamespaces.
type MetricsClientOptions ¶
type MetricsClientOptions struct {
azcore.ClientOptions
}
MetricsClientOptions contains optional settings for MetricsClient.
type MetricsClientQueryResourceOptions ¶
type MetricsClientQueryResourceOptions struct { // The list of aggregation types (comma separated) to retrieve. Aggregation *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 ”. 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. 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 *string // 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 {
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 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 *string `json:"timespan,omitempty"` // REQUIRED; the value of the collection. Value []*Metric `json:"value,omitempty"` // The integer value representing the relative cost of the query. Cost *int32 `json:"cost,omitempty"` // The interval (window size) for which the metric data was returned in. 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 `json:"interval,omitempty"` // The namespace of the metrics being queried Namespace *string `json:"namespace,omitempty"` // The region of the resource being queried for metrics. Resourceregion *string `json:"resourceregion,omitempty"` }
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 list of tables, columns and rows. Tables []*Table `json:"tables,omitempty"` // The code and message for an error. Error *ErrorInfo `json:"error,omitempty"` // Visualization data in JSON format. Render interface{} `json:"render,omitempty"` // Statistics represented in JSON format. Statistics interface{} `json:"statistics,omitempty"` }
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 Table ¶
type Table struct { // REQUIRED; The list of columns in this table. Columns []*Column `json:"columns,omitempty"` // REQUIRED; The name of the table. Name *string `json:"name,omitempty"` // REQUIRED; The resulting rows from this query. Rows [][]interface{} `json:"rows,omitempty"` }
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 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 `json:"data,omitempty"` // the metadata values returned if $filter was specified in the call. Metadatavalues []*MetadataValue `json:"metadatavalues,omitempty"` }
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.