dynatrace

package
v0.0.0-...-8987cd1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrAPIMsg = "provider api response: %s"
)

Variables

View Source
var ErrDQLQueryTimeout = errors.New("timed out waiting for result of DQL query")
View Source
var ErrInvalidAuthURL = errors.New("the Dynatrace auth URL is not a valid URL")
View Source
var ErrInvalidResult = errors.New("the answer does not contain any data")
View Source
var ErrInvalidToken = errors.New("the Dynatrace token has an invalid format")
View Source
var ErrSecretKeyRefNotDefined = errors.New("the SecretKeyRef property with the Dynatrace token is missing")

Functions

func NewKeptnDynatraceDQLProvider

func NewKeptnDynatraceDQLProvider(k8sClient client.Client, opts ...KeptnDynatraceDQLProviderOption) *keptnDynatraceDQLProvider

NewKeptnDynatraceDQLProvider creates and returns a new KeptnDynatraceDQLProvider

Types

type DQLMetric

type DQLMetric struct {
	Count int64   `json:"count"`
	Sum   float64 `json:"sum"`
	Min   float64 `json:"min"`
	Avg   float64 `json:"avg"`
	Max   float64 `json:"max"`
}

type DQLRequest

type DQLRequest struct {
	Query                      string `json:"query"`
	DefaultTimeframeStart      string `json:"defaultTimeframeStart,omitempty"`
	DefaultTimeframeEnd        string `json:"defaultTimeframeEnd,omitempty"`
	Timezone                   string `json:"timezone"`
	Locale                     string `json:"locale"`
	FetchTimeoutSeconds        int    `json:"fetchTimeoutSeconds"`
	RequestTimeoutMilliseconds int    `json:"requestTimeoutMilliseconds"`
}

type DQLResult

type DQLResult struct {
	Records []map[string]any `json:"records"`
}

type DQLSecret

type DQLSecret struct {
	Token   string `json:"token"`
	AuthUrl string `json:"authUrl"`
}

type DynatraceDQLHandler

type DynatraceDQLHandler struct {
	RequestToken string `json:"requestToken"`
}

type DynatraceDQLResult

type DynatraceDQLResult struct {
	State  string    `json:"state"`
	Result DQLResult `json:"result,omitempty"`
	Error  `json:"error"`
}

type DynatraceData

type DynatraceData struct {
	Timestamps []int64    `json:"timestamps"`
	Values     []*float64 `json:"values"`
}

type DynatraceResponse

type DynatraceResponse struct {
	TotalCount int               `json:"totalCount"`
	Resolution string            `json:"resolution"`
	Result     []DynatraceResult `json:"result"`
	Error      `json:"error"`
}

type DynatraceResult

type DynatraceResult struct {
	MetricId string          `json:"metricId"`
	Data     []DynatraceData `json:"data"`
}

type Error

type Error struct {
	Code    int    `json:"-"` // optional
	Message string `json:"message"`
}

type KeptnDynatraceDQLProviderOption

type KeptnDynatraceDQLProviderOption func(provider *keptnDynatraceDQLProvider)

func WithDTAPIClient

func WithDTAPIClient(dtApiClient dtclient.DTAPIClient) KeptnDynatraceDQLProviderOption

type KeptnDynatraceProvider

type KeptnDynatraceProvider struct {
	Log        logr.Logger
	HttpClient http.Client
	K8sClient  client.Client
}

func (*KeptnDynatraceProvider) EvaluateQuery

EvaluateQuery fetches the SLI values from dynatrace provider

func (*KeptnDynatraceProvider) EvaluateQueryForStep

func (d *KeptnDynatraceProvider) EvaluateQueryForStep(ctx context.Context, metric metricsapi.KeptnMetric, provider metricsapi.KeptnMetricsProvider) ([]string, []byte, error)

func (*KeptnDynatraceProvider) FetchAnalysisValue

func (d *KeptnDynatraceProvider) FetchAnalysisValue(ctx context.Context, query string, analysis metricsapi.Analysis, provider *metricsapi.KeptnMetricsProvider) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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