aiapiclient

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AiAPIClient

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

AiAPIClient is used to call Application Insights Api

func NewAiAPIClient

func NewAiAPIClient() AiAPIClient

NewAiAPIClient creates a client for calling Application insights api

func (AiAPIClient) GetMetric

func (ai AiAPIClient) GetMetric(metricInfo MetricRequest) (*MetricsResponse, error)

GetMetric calls to API to retrieve a specific metric

type MetricRequest

type MetricRequest struct {
	MetricName  string
	Aggregation string
	Timespan    string
	Interval    string
	Segment     string
	OrderBy     string
	Filter      string
}

MetricRequest represents options for the AI endpoint

func NewMetricRequest

func NewMetricRequest(metricName string) MetricRequest

NewMetricRequest creates a new metric request with defaults for optional parameters

type MetricsResponse

type MetricsResponse struct {
	StatusCode int
	Value      struct {
		Start        time.Time `json:"start"`
		End          time.Time `json:"end"`
		Interval     string    `json:"interval"`
		Segments     []Segment `json:"segments"`
		MetricValues Segment
	} `json:"value"`
}

MetricsResponse is the response from the api that holds metric values and segments

type Segment

type Segment struct {
	Start        time.Time `json:"start"`
	End          time.Time `json:"end"`
	MetricValues map[string]map[string]interface{}
}

Segment holds the metric values for a given segment

func (*Segment) UnmarshalJSON

func (s *Segment) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom UnMarshaler that parses the Segment information

Jump to

Keyboard shortcuts

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