instrument

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AZAPIMetricRecorderFn

func AZAPIMetricRecorderFn(azServiceName string, err *error) func()

AZAPIMetricRecorderFn returns a function that can be used to record a prometheus metric for Azure API calls. NOTE: a pointer to an error (which itself is a fat interface pointer) is necessary to enable the callers of this function to enclose this call into a `defer` statement.

func DriverAPIMetricRecorderFn

func DriverAPIMetricRecorderFn(operation string, err *error) func()

DriverAPIMetricRecorderFn returns a function that can be used to record a prometheus metric for driver API calls. NOTE: a pointer to an error (which itself is a fat interface pointer) is necessary to enable the callers of this function to enclose this call into a `defer` statement.

func RecordAzAPIMetric

func RecordAzAPIMetric(err error, azServiceName string, invocationTime time.Time)

RecordAzAPIMetric records a prometheus metric for Azure API calls. * If there is an error then it will increment the APIFailedRequestCount counter vec metric. * If the Azure API call is successful then it will record 2 metrics:

  • It will increment APIRequestCount counter vec metric.
  • It will compute the time taken for API call completion and record it.

NOTE: If this function is called via `defer` then please keep in mind that parameters passed to defer are evaluated at the time of definition. So if you have an error that is computed later in the function then ensure that you use named return parameters.

func RecordDriverAPIMetric

func RecordDriverAPIMetric(err error, operation string, invocationTime time.Time)

RecordDriverAPIMetric records a prometheus metric capturing the total duration of a successful execution for any driver method (e.g. CreateMachine, DeleteMachine etc.). In case an error is returned then a failed counter metric is recorded.

Types

This section is empty.

Jump to

Keyboard shortcuts

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