azure

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2020 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AzureAPICallsTotal Total number of Azure API calls
	AzureAPICallsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "azure_api",
			Subsystem: "",
			Name:      "calls_total",
			Help:      "Total number of successful calls to the Azure API",
		},
		[]string{},
	)

	// AzureAPICallsFailedTotal Total number of failed Azure API calls
	AzureAPICallsFailedTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "azure_api",
			Subsystem: "",
			Name:      "calls_failed_total",
			Help:      "Total number of failed calls to the Azure API",
		},
		[]string{},
	)

	// AzureAPICallsDurationSecondsBuckets Histograms of Azure API calls durations in seconds
	AzureAPICallsDurationSecondsBuckets = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "azure_api",
			Subsystem: "",
			Name:      "calls_duration_seconds",
			Help:      "Histograms of successful Azure API calls durations in seconds",
			Buckets:   []float64{0.02, 0.03, 0.04, 0.05, 0.10, 0.20, 0.30, 0.40, 0.50, 0.75, 1.0, 2.0},
		},
		[]string{},
	)

	// AzureAPITenantReadRateLimitRemaining Gauge describing the current number of remaining read API calls
	AzureAPITenantReadRateLimitRemaining = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: "azure_api",
			Subsystem: "tenant",
			Name:      "read_rate_limit_remaining",
			Help:      "Gauge describing the current number of remaining read API calls allowed for the tenant",
		},
		[]string{"tenant"},
	)

	// AzureAPITenantWriteRateLimitRemaining Gauge describing the current number of remaining write API calls
	AzureAPITenantWriteRateLimitRemaining = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: "azure_api",
			Subsystem: "tenant",
			Name:      "write_rate_limit_remaining",
			Help:      "Gauge describing the current number of remaining write API calls allowed for the tenant",
		},
		[]string{"tenant"},
	)

	// AzureAPISubscriptionReadRateLimitRemaining Gauge describing the current number of remaining read API calls
	AzureAPISubscriptionReadRateLimitRemaining = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: "azure_api",
			Subsystem: "subscription",
			Name:      "read_rate_limit_remaining",
			Help:      "Gauge describing the current number of remaining read API calls allowed for the subscription",
		},
		[]string{"subscription"},
	)

	// AzureAPISubscriptionReadRateLimitLastUpdateTime Gauge describing the current number of remaining read API calls
	AzureAPISubscriptionReadRateLimitLastUpdateTime = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: "azure_api",
			Subsystem: "subscription",
			Name:      "read_rate_limit_remaining_last_update_time",
			Help:      "Time of the last update of azure_api_subscription_read_rate_limit_remaining",
		},
		[]string{"subscription"},
	)

	// AzureAPISubscriptionWriteRateLimitRemaining Gauge describing the current number of remaining write API calls
	AzureAPISubscriptionWriteRateLimitRemaining = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: "azure_api",
			Subsystem: "subscription",
			Name:      "write_rate_limit_remaining",
			Help:      "Gauge describing the current number of remaining write API calls allowed for the subscription",
		},
		[]string{"subscription"},
	)

	// AzureAPISubscriptionWriteRateLimitLastUpdateTime Gauge describing the current number of remaining write API calls
	AzureAPISubscriptionWriteRateLimitLastUpdateTime = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: "azure_api",
			Subsystem: "subscription",
			Name:      "write_rate_limit_remaining_last_update_time",
			Help:      "Time of the last update of azure_api_subscription_write_rate_limit_remaining",
		},
		[]string{"subscription"},
	)
)
View Source
var (
	// AzureAPIBatchCallsTotal Total number of Azure Batch API calls
	AzureAPIBatchCallsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "azure_api",
			Subsystem: "batch",
			Name:      "calls_total",
			Help:      "Total number of calls to the Azure API",
		},
		[]string{"subscription", "resource_group", "account"},
	)

	// AzureAPIBatchCallsFailedTotal Total number of failed Azure Batch API calls
	AzureAPIBatchCallsFailedTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "azure_api",
			Subsystem: "batch",
			Name:      "calls_failed_total",
			Help:      "Total number of failed calls to the Azure API",
		},
		[]string{"subscription", "resource_group", "account"},
	)

	// AzureAPIBatchCallsDurationSecondsBuckets Histograms of Azure Batch API calls durations in seconds
	AzureAPIBatchCallsDurationSecondsBuckets = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "azure_api",
			Subsystem: "batch",
			Name:      "calls_duration_seconds",
			Help:      "Histograms of successful Azure Batch API calls durations in seconds",
			Buckets:   []float64{0.02, 0.03, 0.04, 0.05, 0.10, 0.20, 0.30, 0.40, 0.50, 0.75, 1.0, 2.0},
		},
		[]string{"subscription", "resource_group", "account"},
	)
)
View Source
var (
	// AzureAPIGraphCallsTotal Total number of Azure Graph API calls
	AzureAPIGraphCallsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "azure_api",
			Subsystem: "graph",
			Name:      "calls_total",
			Help:      "Total number of calls to the Azure Graph API",
		},
		[]string{},
	)

	// AzureAPIGraphCallsFailedTotal Total number of failed Azure Graph API calls
	AzureAPIGraphCallsFailedTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "azure_api",
			Subsystem: "graph",
			Name:      "calls_failed_total",
			Help:      "Total number of failed calls to the Azure Graph API",
		},
		[]string{},
	)

	// AzureAPIGraphCallsDurationSecondsBuckets Histograms of Azure Graph API calls durations in seconds
	AzureAPIGraphCallsDurationSecondsBuckets = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "azure_api",
			Subsystem: "graph",
			Name:      "calls_duration_seconds",
			Help:      "Histograms of successful Azure Graph API calls durations in seconds",
			Buckets:   []float64{0.02, 0.03, 0.04, 0.05, 0.10, 0.20, 0.30, 0.40, 0.50, 0.75, 1.0, 2.0},
		},
		[]string{},
	)
)
View Source
var (
	// AzureAPIStorageCallsTotal Total number of Azure Storage API calls
	AzureAPIStorageCallsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "azure_api",
			Subsystem: "storage",
			Name:      "calls_total",
			Help:      "Total number of calls to the Azure API",
		},
		[]string{"subscription", "resource_group", "account"},
	)

	// AzureAPIStorageCallsFailedTotal Total number of failed Azure Storage API calls
	AzureAPIStorageCallsFailedTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: "azure_api",
			Subsystem: "storage",
			Name:      "calls_failed_total",
			Help:      "Total number of failed calls to the Azure API",
		},
		[]string{"subscription", "resource_group", "account"},
	)

	// AzureAPIStorageCallsDurationSecondsBuckets Histograms of Azure Storage API calls durations in seconds
	AzureAPIStorageCallsDurationSecondsBuckets = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: "azure_api",
			Subsystem: "storage",
			Name:      "calls_duration_seconds",
			Help:      "Histograms of successful Azure Storage API calls durations in seconds",
			Buckets:   []float64{0.02, 0.03, 0.04, 0.05, 0.10, 0.20, 0.30, 0.40, 0.50, 0.75, 1.0, 2.0},
		},
		[]string{"subscription", "resource_group", "account"},
	)
)

Functions

func GetAuthorizer added in v0.2.0

func GetAuthorizer() (autorest.Authorizer, error)

GetAuthorizer get graph authorizer

func GetBatchAuthorizer

func GetBatchAuthorizer() (autorest.Authorizer, error)

GetBatchAuthorizer get batch authorizer

func GetBatchAuthorizerWithResource

func GetBatchAuthorizerWithResource(resource string) (autorest.Authorizer, error)

GetBatchAuthorizerWithResource get batch authorizer with resource

func GetBatchJobTaskCounts

func GetBatchJobTaskCounts(ctx context.Context, clients *AzureClients, subscription *subscription.Model, account *azurebatch.Account, job *batch.CloudJob) (*batch.TaskCounts, error)

GetBatchJobTaskCounts get job tasks metrics

func GetGraphAuthorizer

func GetGraphAuthorizer() (autorest.Authorizer, error)

GetGraphAuthorizer get graph authorizer

func GetResourceGroup added in v0.2.0

func GetResourceGroup(ctx context.Context, clients *AzureClients, subscription *subscription.Model, name string) (*resources.Group, error)

GetResourceGroup returns a Group

func GetStorageAuthorizer added in v0.2.0

func GetStorageAuthorizer() (autorest.Authorizer, error)

GetStorageAuthorizer get storage authorizer

func GetStorageAuthorizerWithResource added in v0.2.0

func GetStorageAuthorizerWithResource(resource string) (autorest.Authorizer, error)

GetStorageAuthorizerWithResource get storage authorizer with resource

func GetStorageToken added in v0.2.0

func GetStorageToken(ctx context.Context) (*adal.ServicePrincipalToken, error)

GetStorageToken ...

func GetSubscription

func GetSubscription(ctx context.Context, clients *AzureClients, subscriptionID string) (*subscription.Model, error)

GetSubscription returns a subscription

func ListApplications

func ListApplications(ctx context.Context, clients *AzureClients) (*[]graph.Application, error)

ListApplications list applications

func ListBatchAccountJobs

func ListBatchAccountJobs(ctx context.Context, clients *AzureClients, subscription *subscription.Model, account *azurebatch.Account) ([]batch.CloudJob, error)

ListBatchAccountJobs list batch account jobs

func ListBatchAccountPools

func ListBatchAccountPools(ctx context.Context, clients *AzureClients, subscription *subscription.Model, account *azurebatch.Account) ([]azurebatch.Pool, error)

ListBatchAccountPools List all batch account's pools

func ListBatchComputeNodes added in v0.7.0

func ListBatchComputeNodes(ctx context.Context, clients *AzureClients, subscription *subscription.Model, account *azurebatch.Account, pool *azurebatch.Pool) (*[]batch.ComputeNode, error)

ListBatchComputeNodes get job tasks metrics

func ListStorageAccountContainers added in v0.2.0

func ListStorageAccountContainers(ctx context.Context, clients *AzureClients, subscription *subscription.Model, account *storage.Account) (*[]storage.ListContainerItem, error)

ListStorageAccountContainers ...

func ListStorageAccountKeys added in v0.2.0

func ListStorageAccountKeys(ctx context.Context, clients *AzureClients, subscription *subscription.Model, account *storage.Account) (*[]storage.AccountKey, error)

ListStorageAccountKeys ...

func ListSubscriptionBatchAccounts

func ListSubscriptionBatchAccounts(ctx context.Context, clients *AzureClients, subscription *subscription.Model) (*[]azurebatch.Account, error)

ListSubscriptionBatchAccounts List all subscription batch accounts

func ListSubscriptionStorageAccounts added in v0.2.0

func ListSubscriptionStorageAccounts(ctx context.Context, clients *AzureClients, subscription *subscription.Model) (*[]storage.Account, error)

ListSubscriptionStorageAccounts ...

func ObserveAzureAPICall

func ObserveAzureAPICall(duration float64)

ObserveAzureAPICall ...

func ObserveAzureAPICallFailed

func ObserveAzureAPICallFailed(duration float64)

ObserveAzureAPICallFailed ...

func ObserveAzureBatchAPICall

func ObserveAzureBatchAPICall(duration float64, labels ...string)

ObserveAzureBatchAPICall ...

func ObserveAzureBatchAPICallFailed

func ObserveAzureBatchAPICallFailed(duration float64, labels ...string)

ObserveAzureBatchAPICallFailed ...

func ObserveAzureGraphAPICall

func ObserveAzureGraphAPICall(duration float64, labels ...string)

ObserveAzureGraphAPICall ...

func ObserveAzureGraphAPICallFailed

func ObserveAzureGraphAPICallFailed(duration float64, labels ...string)

ObserveAzureGraphAPICallFailed ...

func ObserveAzureStorageAPICall added in v0.2.0

func ObserveAzureStorageAPICall(duration float64, labels ...string)

ObserveAzureStorageAPICall ...

func ObserveAzureStorageAPICallFailed added in v0.2.0

func ObserveAzureStorageAPICallFailed(duration float64, labels ...string)

ObserveAzureStorageAPICallFailed ...

func SetReadRateLimitRemaining added in v0.1.2

func SetReadRateLimitRemaining(tenant string, subscription string, response *http.Response)

SetReadRateLimitRemaining ...

func SetWriteRateLimitRemaining added in v0.6.0

func SetWriteRateLimitRemaining(tenant string, subscription string, response *http.Response)

SetWriteRateLimitRemaining ...

func WalkStorageAccountContainer added in v0.2.0

func WalkStorageAccountContainer(ctx context.Context, clients *AzureClients, subscription *subscription.Model, account *storage.Account, container *storage.ListContainerItem, walker StorageAccountContainerWalker) error

WalkStorageAccountContainer applies a function on all storage account container blobs.

Types

type AzureClients

type AzureClients struct {
	// contains filtered or unexported fields
}

AzureClients Collection of Azure clients

func NewAzureClients

func NewAzureClients() *AzureClients

NewAzureClients makes new AzureClients object

func (*AzureClients) GetApplicationsClient

func (azc *AzureClients) GetApplicationsClient(tenantID string) (*graph.ApplicationsClient, error)

GetApplicationsClient get applications client

func (*AzureClients) GetBatchAccountClient

func (azc *AzureClients) GetBatchAccountClient(subscriptionID string) (*azurebatch.AccountClient, error)

GetBatchAccountClient return batch account client for specific subscription

func (*AzureClients) GetBatchComputeNodeClient added in v0.7.0

func (azc *AzureClients) GetBatchComputeNodeClient(accountEndpoint string) (*batch.ComputeNodeClient, error)

GetBatchComputeNodeClient get compute node client

func (*AzureClients) GetBatchComputeNodeClientWithResource added in v0.7.0

func (azc *AzureClients) GetBatchComputeNodeClientWithResource(accountEndpoint string, resource string) (*batch.ComputeNodeClient, error)

GetBatchComputeNodeClientWithResource get compute node client with resource

func (*AzureClients) GetBatchJobClient

func (azc *AzureClients) GetBatchJobClient(accountEndpoint string) (*batch.JobClient, error)

GetBatchJobClient get batch job client

func (*AzureClients) GetBatchJobClientWithResource

func (azc *AzureClients) GetBatchJobClientWithResource(accountEndpoint string, resource string) (*batch.JobClient, error)

GetBatchJobClientWithResource get job client with resource

func (*AzureClients) GetBatchPoolClient

func (azc *AzureClients) GetBatchPoolClient(subscriptionID string) (*azurebatch.PoolClient, error)

GetBatchPoolClient get batch pool client

func (*AzureClients) GetBlobContainersClient added in v0.2.0

func (azc *AzureClients) GetBlobContainersClient(subscriptionID string) (*storage.BlobContainersClient, error)

GetBlobContainersClient get storage account client

func (*AzureClients) GetBlobContainersClientWithResource added in v0.2.0

func (azc *AzureClients) GetBlobContainersClientWithResource(subscriptionID string, accountEndpoint string, resource string) (*storage.BlobContainersClient, error)

GetBlobContainersClientWithResource get storage account client

func (*AzureClients) GetGroupClient added in v0.2.0

func (azc *AzureClients) GetGroupClient(subscriptionID string) (*resources.GroupsClient, error)

GetGroupClient return group client

func (*AzureClients) GetStorageAccountUsagesClient added in v0.2.0

func (azc *AzureClients) GetStorageAccountUsagesClient(subscriptionID string) (*storage.UsagesClient, error)

GetStorageAccountUsagesClient get storage account client

func (*AzureClients) GetStorageAccountsClient added in v0.2.0

func (azc *AzureClients) GetStorageAccountsClient(subscriptionID string) (*storage.AccountsClient, error)

GetStorageAccountsClient get storage account client

func (*AzureClients) GetStorageAccountsClientWithResource added in v0.2.0

func (azc *AzureClients) GetStorageAccountsClientWithResource(subscriptionID string, accountEndpoint string, resource string) (*storage.AccountsClient, error)

GetStorageAccountsClientWithResource get storage account client

func (*AzureClients) GetSubscriptionClient

func (azc *AzureClients) GetSubscriptionClient(subscriptionID string) (*subscription.SubscriptionsClient, error)

GetSubscriptionClient return subscription client

type ResourceDetails

type ResourceDetails struct {
	SubscriptionID string
	ResourceGroup  string
	Provider       string
	Type           string
	Name           string
}

ResourceDetails contains details about an Azure resource

func ParseResourceID

func ParseResourceID(resourceID string) (*ResourceDetails, error)

ParseResourceID parses a resource ID into a ResourceDetails struct Original code from: https://gist.github.com/vladbarosan/fb2528754cbd97df51ca11fe7be27d2f

type StorageAccountContainerWalker added in v0.2.0

type StorageAccountContainerWalker interface {
	// Lock prevents concurrent process to WalkBlob().
	Lock()
	// Unlock releases the lock.
	Unlock()
	// WalkBlob is called for all blobs listed by the Walking function.
	WalkBlob(*subscription.Model, *resources.Group, *storage.Account, *storage.ListContainerItem, *azblob.BlobItem)
}

StorageAccountContainerWalker in an interface that is to be implemented by struct you want to pass to Walking functions like WalkStorageAccount().

type StorageAccountMetrics added in v0.2.0

type StorageAccountMetrics struct {
	ContainerBlobSizeHistogram *prometheus.HistogramVec
	// contains filtered or unexported fields
}

StorageAccountMetrics ...

func (*StorageAccountMetrics) DeleteLabelValues added in v0.2.0

func (s *StorageAccountMetrics) DeleteLabelValues(labels ...string)

DeleteLabelValues deletes histogram's data associated with given labels.

func (*StorageAccountMetrics) Lock added in v0.2.0

func (s *StorageAccountMetrics) Lock()

Lock is here to make sure several Walkers do not update ContainerBlobSizeHistogram at the same time.

func (*StorageAccountMetrics) Reset added in v0.2.0

func (s *StorageAccountMetrics) Reset()

Reset resets the histogram data.

func (*StorageAccountMetrics) Unlock added in v0.2.0

func (s *StorageAccountMetrics) Unlock()

Unlock releases the lock.

func (*StorageAccountMetrics) WalkBlob added in v0.2.0

func (s *StorageAccountMetrics) WalkBlob(subscription *subscription.Model, group *resources.Group, account *storage.Account, container *storage.ListContainerItem, blob *azblob.BlobItem)

WalkBlob is called over each blobs listed by the function walking the storage account container.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL