appconfig

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

README

agent本身配置

Documentation

Overview

Package appconfig 应用程序级别的全局配置, 它在初始化顺序里是第一顺位, 不要依赖其他的业务包

Index

Constants

This section is empty.

Variables

View Source
var (
	StdAgentConfig = AgentConfig{}
)

Functions

func IsDev

func IsDev() bool

func IsK8sMode

func IsK8sMode() bool

func SetDev

func SetDev(enabled bool)

func SetupAppConfig

func SetupAppConfig() error

func SetupDevAppConfig

func SetupDevAppConfig(apikey string) error

Types

type AgentConfig

type AgentConfig struct {
	App      string         `json:"app" yaml:"app" toml:"app"`
	ApiKey   string         `json:"apikey" yaml:"apikey" toml:"apikey"`
	Mode     core.AgentMode `json:"mode" yaml:"mode" toml:"mode"`
	Registry RegistryConfig `json:"registry" yaml:"registry" toml:"registry"`
	Gateway  GatewayConfig  `json:"gateway" yaml:"gateway" toml:"gateway"`
	Version  string         `json:"version" yaml:"version" toml:"version"`
	// 该配置存在的原因: toml 根表无法后置, 因此不太好在shell里进行配置 " echo "a=1" >> xxx.toml " 于是单独给它分配一个节
	Basic       *BasicConfig      `json:"basic" yaml:"basic" toml:"basic"`
	Central     CentralConfig     `json:"central" yaml:"central" toml:"central"`
	K8s         K8sConfig         `json:"k8s" yaml:"k8s" toml:"k8s"`
	Workspace   string            `json:"workspace" yaml:"workspace" toml:"workspace"`
	Cluster     string            `json:"cluster" yaml:"cluster" toml:"cluster"`
	Data        DataConfig        `json:"data" yaml:"data" toml:"data"`
	Daemonagent DaemonagentConfig `json:"daemonagent" yaml:"daemonagent" toml:"daemonagent"`
}

func (*AgentConfig) IsDaemonset

func (c *AgentConfig) IsDaemonset() bool

type BasicConfig

type BasicConfig struct {
	App       string         `json:"app" yaml:"app" toml:"app"`
	ApiKey    string         `json:"apikey" yaml:"apikey" toml:"apikey"`
	Mode      core.AgentMode `json:"mode" yaml:"mode" toml:"mode"`
	Workspace string         `json:"workspace" yaml:"workspace" toml:"workspace"`
}

type CentralConfig

type CentralConfig struct {
	Name                       string `json:"name" yaml:"name" toml:"name"`
	AlibabacloudMetricEndpoint string `json:"aliyunMetricEndpoint" yaml:"aliyunMetricEndpoint" toml:"aliyunMetricEndpoint"`
}

type DaemonagentConfig

type DaemonagentConfig struct {
}

DaemonagentConfig daemonagent config

type DataConfig

type DataConfig struct {
	Metric DataConfig_Metric `json:"metric" yaml:"metric" toml:"metric"`
}

type DataConfig_Metric

type DataConfig_Metric struct {
	RefLabels DataConfig_Metric_RefLabels `json:"refLabels" yaml:"refLabels" toml:"refLabels"`
	// SuppressedTags remove common tags whose keys are in this slice
	SuppressedTags []string `json:"suppressedTags,omitempty" yaml:"suppressedTags" toml:"suppressedTags"`
}

type DataConfig_Metric_RefLabels

type DataConfig_Metric_RefLabels struct {
	Items []*DataConfig_Metric_RefLabels_Item `json:"items" yaml:"items" toml:"items"`
}

type DataConfig_Metric_RefLabels_Item

type DataConfig_Metric_RefLabels_Item struct {
	// Tag key
	Key string `json:"key" yaml:"key" toml:"key" `
	// Find first non-empty label
	Labels []string `json:"labels" yaml:"labels" toml:"labels" `
	// If all label values are empty, this DefaultValue will be used
	DefaultValue string `json:"defaultValue" yaml:"defaultValue" toml:"defaultValue" `
}

Ref a label as a tag

type GatewayConfig

type GatewayConfig struct {
	Addr        string `json:"addr" yaml:"addr" toml:"addr"`
	Secure      bool   `json:"secure" yaml:"secure" toml:"secure"`
	ServiceName string `json:"serviceName,omitempty" yaml:"serviceName" toml:"serviceName"`
	CaCert      string `json:"caCert,omitempty" yaml:"caCert" toml:"caCert"`
}

type K8sConfig

type K8sConfig struct {
	Meta    K8sMetaConfig    `json:"meta,omitempty" yaml:"meta" toml:"meta"`
	Cri     K8sConfig_Cri    `json:"cri,omitempty" yaml:"cri" toml:"cri"`
	Metrics K8sMetricsConfig `json:"metrics" yaml:"metrics" toml:"metrics"`
}

type K8sConfig_Cri

type K8sConfig_Cri struct {
	// docker pouch
	Type  string            `json:"type,omitempty" yaml:"type" toml:"type"`
	Pouch K8sCriPouchConfig `json:"pouch,omitempty" yaml:"pouch" toml:"pouch"`
	// If GetPodsFromKubeletAPI is not empty, it means to get pods information from the kubelet http API of the physical machine.
	// It supports the following values:
	// - http://127.0.0.1:10255/pods requires the agent to use the host network
	// - http://%s:10255/pods where %s will be automatically replaced with the Node IP
	GetPodsFromKubeletAPI string `json:"getPodsFromKubeletAPI" yaml:"getPodsFromKubeletAPI"`
}

type K8sCriPouchConfig

type K8sCriPouchConfig struct {
	CpWorkaroundEnabled bool `json:"cpWorkaroundEnabled,omitempty" yaml:"cpWorkaroundEnabled"`
}

type K8sMetaConfig

type K8sMetaConfig struct {
	AppRef          string                `json:"appRef,omitempty" yaml:"appRef" toml:"appRef"`
	HostnameRef     string                `json:"hostnameRef,omitempty" yaml:"hostnameRef" toml:"hostnameRef"`
	NodeHostnameRef string                `json:"nodeHostnameRef,omitempty" yaml:"nodeHostnameRef" toml:"nodeHostnameRef"`
	SidecarCheck    string                `json:"sidecarCheck,omitempty" yaml:"sidecarCheck" toml:"sidecarCheck"`
	Sandbox         K8sMetaConfig_Sandbox `json:"sandbox,omitempty" yaml:"sandbox" toml:"sandbox"`
}

type K8sMetaConfig_Sandbox

type K8sMetaConfig_Sandbox struct {
	Labels map[string]string `json:"labels,omitempty" yaml:"labels" toml:"labels"`
}

type K8sMetricsConfig

type K8sMetricsConfig struct {
	FiveSecondsEnabled bool `json:"fiveSecondsEnabled,omitempty" yaml:"fiveSecondsEnabled" toml:"fiveSecondsEnabled"`
}

type PrometheusConfig

type PrometheusConfig struct {
	AutoScapeK8s bool `json:"autoScapeK8s,omitempty" yaml:"autoScapeK8s" toml:"autoScapeK8s"`
}

type RegistryConfig

type RegistryConfig struct {
	Addr        string `json:"addr" yaml:"addr" toml:"addr"`
	Secure      bool   `json:"secure" yaml:"secure" toml:"secure"`
	ServiceName string `json:"serviceName,omitempty" yaml:"serviceName" toml:"serviceName"`
	CaCert      string `json:"caCert,omitempty" yaml:"caCert" toml:"caCert"`
}

Jump to

Keyboard shortcuts

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