collectors

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GTMTrafficLongTimeFormat string = "2006-01-02T15:04:05Z"
	GTMTrafficDateFormat     string = "2006-01-02"
)
View Source
const (
	HoursInDay = 24
)

Variables

View Source
var (
	DefaultDomainTraffic = DomainTraffic{
		Properties:  make([]*TrafficPropertyConfig, 0),
		Datacenters: make([]*TrafficDatacenterConfig, 0),
		Liveness:    make([]*LivenessTestConfig, 0),
	}
)
View Source
var (
	// EdgegridConfig contains the Akamai OPEN Edgegrid API credentials for automatic signing of requests
	EdgegridConfig edgegrid.Config = edgegrid.Config{}
)

Functions

func EdgeInit

func EdgeInit(config edgegrid.Config) error

Finish edgegrid init

func EdgegridInit

func EdgegridInit(edgercpath, section string) error

Init edgegrid Config

Types

type DomainTraffic

type DomainTraffic struct {
	Name        string                     `yaml:"domain_name"`
	Properties  []*TrafficPropertyConfig   `yaml:"properties,omitempty"`
	Datacenters []*TrafficDatacenterConfig `yaml:"datacenters,omitempty"`
	Liveness    []*LivenessTestConfig      `yaml:"liveness_tests,omitempty"`
}

func (*DomainTraffic) UnmarshalYAML

func (c *DomainTraffic) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type GTMDatacenterTrafficExporter

type GTMDatacenterTrafficExporter struct {
	GTMConfig          GTMMetricsConfig
	DCMetricPrefix     string
	DCLookbackDuration time.Duration
	LastTimestamp      map[string]map[int]time.Time // index by domain, datacenterid
	DCRegistry         *prometheus.Registry
}

func NewDatacenterTrafficCollector

func NewDatacenterTrafficCollector(r *prometheus.Registry, gtmMetricsConfig GTMMetricsConfig, gtmMetricPrefix string, tstart time.Time, lookbackDuration time.Duration) *GTMDatacenterTrafficExporter

func (*GTMDatacenterTrafficExporter) Collect

func (d *GTMDatacenterTrafficExporter) Collect(ch chan<- prometheus.Metric)

Collect function

func (*GTMDatacenterTrafficExporter) Describe

func (d *GTMDatacenterTrafficExporter) Describe(ch chan<- *prometheus.Desc)

Describe function

type GTMLivenessTrafficExporter

type GTMLivenessTrafficExporter struct {
	GTMConfig                GTMMetricsConfig
	LivenessMetricPrefix     string
	LivenessLookbackDuration time.Duration
	LastTimestamp            map[string]map[string]time.Time // index by domain, liveness
	LivenessRegistry         *prometheus.Registry
}

func NewLivenessTrafficCollector

func NewLivenessTrafficCollector(r *prometheus.Registry, gtmMetricsConfig GTMMetricsConfig, gtmMetricPrefix string, tstart time.Time, lookbackDuration time.Duration) *GTMLivenessTrafficExporter

func (*GTMLivenessTrafficExporter) Collect

func (l *GTMLivenessTrafficExporter) Collect(ch chan<- prometheus.Metric)

Collect function

func (*GTMLivenessTrafficExporter) Describe

func (l *GTMLivenessTrafficExporter) Describe(ch chan<- *prometheus.Desc)

Describe function

type GTMMetricsConfig

type GTMMetricsConfig struct {
	Domains       []*DomainTraffic `yaml:"domains"`
	EdgercPath    string           `yaml:"edgerc_path"`
	EdgercSection string           `yaml:"edgerc_section"`
	SummaryWindow string           `yaml:"summary_window"` // mins, hours, days, [weeks]. Default lookbackDefaultDays
	PreFillWindow string           `yaml:"prefill_window"`
	TSLabel       bool             `yaml:"timestamp_label"`             // Creates time series with traffic timestamp as label
	UseTimestamp  *bool            `yaml:"traffic_timestamp,omitempty"` // Create time series with traffic timestamp
}

Exporter config

type GTMPropertyTrafficExporter

type GTMPropertyTrafficExporter struct {
	GTMConfig                GTMMetricsConfig
	PropertyMetricPrefix     string
	PropertyLookbackDuration time.Duration
	LastTimestamp            map[string]map[string]time.Time // index by domain, property
	PropertyRegistry         *prometheus.Registry
}

func NewPropertyTrafficCollector

func NewPropertyTrafficCollector(r *prometheus.Registry, gtmMetricsConfig GTMMetricsConfig, gtmMetricPrefix string, tstart time.Time, lookbackDuration time.Duration) *GTMPropertyTrafficExporter

func (*GTMPropertyTrafficExporter) Collect

func (p *GTMPropertyTrafficExporter) Collect(ch chan<- prometheus.Metric)

Collect function

func (*GTMPropertyTrafficExporter) Describe

func (p *GTMPropertyTrafficExporter) Describe(ch chan<- *prometheus.Desc)

Describe function

type GTMReportQueryArgs

type GTMReportQueryArgs struct {
	End      string `json:"end"`   // YYYY-MM-DDThh:mm:ssZ in UTC
	Start    string `json:"start"` // YYYY-MM-DDThh:mm:ssZ in UTC
	Date     string `json:"date"`  // YYYY-MM-DD format
	AgentIP  string `json:"agentIp"`
	TargetIP string `json:"targetIp"`
}

GTM Reports Query args struct

func NewGTMReportQueryArgs

func NewGTMReportQueryArgs() *GTMReportQueryArgs

Create and return new GTMReportQueryArgs object

type LivenessDRow

type LivenessDRow struct {
	Nickname          string `json:"nickname"`
	DatacenterID      int    `json:"datacenterId"`
	TrafficTargetName string `json:"trafficTargetName"`
	ErrorCode         int64  `json:"errorCode"`
	Duration          int64  `json:"duration"`
	TestName          string `json:"testName"`
	AgentIP           string `json:"agentIp"`
	TargetIP          string `json:"targetIp"`
}

type LivenessErrorsResponse

type LivenessErrorsResponse struct {
	Metadata    *LivenessTMeta    `json:"metadata"`
	DataRows    []*LivenessTData  `json:"dataRows"`
	DataSummary interface{}       `json:"dataSummary"`
	Links       []*configgtm.Link `json:"links"`
}

The Liveness Errors Response structure returned by the Reports API

func GetLivenessErrorsReport

func GetLivenessErrorsReport(domainName, propertyName string, livenessReportQueryArgs map[string]string) (*LivenessErrorsResponse, error)

GetLivenessErrorsReport retrieves and returns a liveness errors report slice of slices with provided query filters See https://developer.akamai.com/api/web_performance/global_traffic_management_reporting/v1.html#getgetlivenesstestresultsforaproperty

type LivenessTData

type LivenessTData struct {
	Timestamp   string          `json:"timestamp"`
	Datacenters []*LivenessDRow `json:"datacenters"`
}

type LivenessTMeta

type LivenessTMeta struct {
	URI      string
	Domain   string `json:"domain"`
	Property string `json:"property"`
	Date     string `json:"date"`
}

Liveness Errors Report Structs

type LivenessTestConfig

type LivenessTestConfig struct {
	PropertyName string `yaml:"property_name"`
	AgentIP      string `yaml:"agent_ip,omitempty"`
	TargetIP     string `yaml:"target_ip,omitempty"`
	ErrorCode    bool   `yaml:"track_by_errorcode"`
	Duration     bool   `yaml:"duration_sum"`
}

func (*LivenessTestConfig) UnmarshalYAML

func (p *LivenessTestConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type TrafficDatacenterConfig

type TrafficDatacenterConfig struct {
	DatacenterID int      `yaml:"datacenter_id"` // Required
	Properties   []string `yaml:"property,omitempty"`
}

func (*TrafficDatacenterConfig) UnmarshalYAML

func (d *TrafficDatacenterConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type TrafficPropertyConfig

type TrafficPropertyConfig struct {
	Name          string   `yaml:"property_name"`
	DatacenterIDs []int    `yaml:"datacenter,omitempty"`
	DCNicknames   []string `yaml:"dc_nickname,omitempty"`
	Targets       []string `yaml:"target_name,omitempty"`
}

func (*TrafficPropertyConfig) UnmarshalYAML

func (p *TrafficPropertyConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

Jump to

Keyboard shortcuts

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