utils

package module
v0.52.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Overview

Package utils offers a number of high level helpers to work with the configuration

Index

Constants

View Source
const (
	// InfraURLPrefix is the default infra URL prefix for datadog
	InfraURLPrefix = "https://app."
)

Variables

This section is empty.

Functions

func AddAgentVersionToDomain

func AddAgentVersionToDomain(DDURL string, app string) (string, error)

AddAgentVersionToDomain prefixes the domain with the agent version: X-Y-Z.domain

func BuildURLWithPrefix added in v0.52.0

func BuildURLWithPrefix(prefix, site string) string

BuildURLWithPrefix will return an HTTP(s) URL for a site given a certain prefix

func ConfFileDirectory

func ConfFileDirectory(c pkgconfigmodel.Reader) string

ConfFileDirectory returns the absolute path to the folder containing the config file used to populate the registry

func GetConfiguredTags

func GetConfiguredTags(c pkgconfigmodel.Reader, includeDogstatsd bool) []string

GetConfiguredTags returns list of tags from a configuration, based on `tags` (DD_TAGS) and `extra_tags“ (DD_EXTRA_TAGS), with `dogstatsd_tags` (DD_DOGSTATSD_TAGS) if includeDogdstatsd is true.

func GetHAEndpoint added in v0.52.0

func GetHAEndpoint(c pkgconfigmodel.Reader, prefix, ddHaURLKey string) string

GetHAEndpoint returns the HA DD URL defined in the config, based on `ha.site` and the prefix, or ddHaURLKey

func GetInfraEndpoint

func GetInfraEndpoint(c pkgconfigmodel.Reader) string

GetInfraEndpoint returns the main DD Infra URL defined in config, based on the value of `site` and `dd_url`

func GetMainEndpoint

func GetMainEndpoint(c pkgconfigmodel.Reader, prefix string, ddURLKey string) string

GetMainEndpoint returns the main DD URL defined in the config, based on `site` and the prefix, or ddURLKey

func GetMainEndpointBackwardCompatible

func GetMainEndpointBackwardCompatible(c pkgconfigmodel.Reader, prefix string, ddURLKey string, backwardKey string) string

GetMainEndpointBackwardCompatible implements the logic to extract the DD URL from a config, based on `site`,ddURLKey and a backward compatible key

func GetMultipleEndpoints

func GetMultipleEndpoints(c pkgconfigmodel.Reader) (map[string][]string, error)

GetMultipleEndpoints returns the api keys per domain specified in the main agent config

func GetTraceAgentDefaultEnv

func GetTraceAgentDefaultEnv(c pkgconfigmodel.Reader) string

GetTraceAgentDefaultEnv returns the default env for the trace agent

func IsCheckTelemetryEnabled

func IsCheckTelemetryEnabled(checkName string, cfg pkgconfigmodel.Reader) bool

IsCheckTelemetryEnabled returns if we want telemetry for the given check. Returns true if a * is present in the telemetry.checks list.

func IsTelemetryEnabled

func IsTelemetryEnabled(cfg pkgconfigmodel.Reader) bool

IsTelemetryEnabled returns whether or not telemetry is enabled

func SanitizeAPIKey

func SanitizeAPIKey(key string) string

SanitizeAPIKey strips newlines and other control characters from a given string.

Types

type MetadataProviders

type MetadataProviders struct {
	Name     string        `mapstructure:"name"`
	Interval time.Duration `mapstructure:"interval"`
}

MetadataProviders helps unmarshalling `metadata_providers` config param

func GetMetadataProviders

func GetMetadataProviders(c pkgconfigmodel.Reader) ([]MetadataProviders, error)

GetMetadataProviders returns the "metadata_providers" set in the configuration

Jump to

Keyboard shortcuts

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