global

package
v3.2.0-rc1 Latest Latest
Warning

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

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

Documentation

Overview

Package global defines XxxConfigs for collecting Dubbo configurations and is for internal use only.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateConfig

type AggregateConfig struct {
	Enabled           *bool `default:"false" yaml:"enabled" json:"enabled,omitempty" property:"enabled"`
	BucketNum         int   `default:"10" yaml:"bucket-num" json:"bucket-num,omitempty" property:"bucket-num"`
	TimeWindowSeconds int   `default:"120" yaml:"time-window-seconds" json:"time-window-seconds,omitempty" property:"time-window-seconds"`
}

func (*AggregateConfig) Clone

func (c *AggregateConfig) Clone() *AggregateConfig

type ApplicationConfig

type ApplicationConfig struct {
	Organization string `default:"dubbo-go" yaml:"organization" json:"organization,omitempty" property:"organization"`
	Name         string `default:"dubbo.io" yaml:"name" json:"name,omitempty" property:"name"`
	Module       string `default:"sample" yaml:"module" json:"module,omitempty" property:"module"`
	Group        string `yaml:"group" json:"group,omitempty" property:"module"`
	Version      string `yaml:"version" json:"version,omitempty" property:"version"`
	Owner        string `default:"dubbo-go" yaml:"owner" json:"owner,omitempty" property:"owner"`
	Environment  string `yaml:"environment" json:"environment,omitempty" property:"environment"`
	// the metadata type. remote or local
	MetadataType string `default:"local" yaml:"metadata-type" json:"metadataType,omitempty" property:"metadataType"`
	Tag          string `yaml:"tag" json:"tag,omitempty" property:"tag"`
}

ApplicationConfig is a configuration for current applicationConfig, whether the applicationConfig is a provider or a consumer

func DefaultApplicationConfig

func DefaultApplicationConfig() *ApplicationConfig

func (*ApplicationConfig) Clone

Clone a new ApplicationConfig

type CenterConfig

type CenterConfig struct {
	Protocol  string            `validate:"required" yaml:"protocol"  json:"protocol,omitempty"`
	Address   string            `validate:"required" yaml:"address" json:"address,omitempty"`
	DataId    string            `yaml:"data-id" json:"data-id,omitempty"`
	Cluster   string            `yaml:"cluster" json:"cluster,omitempty"`
	Group     string            `yaml:"group" json:"group,omitempty"`
	Username  string            `yaml:"username" json:"username,omitempty"`
	Password  string            `yaml:"password" json:"password,omitempty"`
	Namespace string            `yaml:"namespace"  json:"namespace,omitempty"`
	AppID     string            `default:"dubbo" yaml:"app-id"  json:"app-id,omitempty"`
	Timeout   string            `default:"10s" yaml:"timeout"  json:"timeout,omitempty"`
	Params    map[string]string `yaml:"params"  json:"parameters,omitempty"`

	//FileExtension the suffix of config dataId, also the file extension of config content
	FileExtension string `default:"yaml" yaml:"file-extension" json:"file-extension" `
}

CenterConfig is configuration for config center

ConfigCenter also introduced concepts of namespace and group to better manage Key-Value pairs by group, those configs are already built-in in many professional third-party configuration centers. In most cases, namespace is used to isolate different tenants, while group is used to divide the key set from one tenant into groups.

CenterConfig has currently supported Zookeeper, Nacos, Etcd, Consul, Apollo

func DefaultCenterConfig

func DefaultCenterConfig() *CenterConfig

func (*CenterConfig) Clone

func (c *CenterConfig) Clone() *CenterConfig

Clone a new CenterConfig

type ConsumerConfig

type ConsumerConfig struct {
	Filter          string   `yaml:"filter" json:"filter,omitempty" property:"filter"`
	RegistryIDs     []string `yaml:"registry-ids" json:"registry-ids,omitempty" property:"registry-ids"`
	Protocol        string   `yaml:"protocol" json:"protocol,omitempty" property:"protocol"`
	RequestTimeout  string   `default:"3s" yaml:"request-timeout" json:"request-timeout,omitempty" property:"request-timeout"`
	ProxyFactory    string   `default:"default" yaml:"proxy" json:"proxy,omitempty" property:"proxy"`
	Check           bool     `yaml:"check" json:"check,omitempty" property:"check"`
	AdaptiveService bool     `default:"false" yaml:"adaptive-service" json:"adaptive-service" property:"adaptive-service"`
	// there is no need to configure References, it will be replaced by instance.NewClient
	References                     map[string]*ReferenceConfig `yaml:"references" json:"references,omitempty" property:"references"`
	TracingKey                     string                      `yaml:"tracing-key" json:"tracing-key" property:"tracing-key"`
	FilterConf                     interface{}                 `yaml:"filter-conf" json:"filter-conf,omitempty" property:"filter-conf"`
	MaxWaitTimeForServiceDiscovery string                      `` /* 155-byte string literal not displayed */
	MeshEnabled                    bool                        `yaml:"mesh-enabled" json:"mesh-enabled,omitempty" property:"mesh-enabled"`
}

func DefaultConsumerConfig

func DefaultConsumerConfig() *ConsumerConfig

func (*ConsumerConfig) Clone

func (c *ConsumerConfig) Clone() *ConsumerConfig

Clone a new ConsumerConfig

type CustomConfig

type CustomConfig struct {
	ConfigMap map[string]interface{} `yaml:"config-map" json:"config-map,omitempty" property:"config-map"`
}

CustomConfig

Experimental

Notice: This struct is EXPERIMENTAL and may be changed or removed in a later release.

func DefaultCustomConfig

func DefaultCustomConfig() *CustomConfig

func (*CustomConfig) Clone

func (c *CustomConfig) Clone() *CustomConfig

Clone a new CustomConfig

type Exporter

type Exporter struct {
	Enabled *bool `default:"false" yaml:"enabled" json:"enabled,omitempty" property:"enabled"`
}

func (*Exporter) Clone

func (c *Exporter) Clone() *Exporter

type File

type File struct {
	// log file name default dubbo.log
	Name string `default:"dubbo.log" yaml:"name"`

	// log max size default 100Mb
	MaxSize int `default:"100" yaml:"max-size"`

	// log max backups default 5
	MaxBackups int `default:"5" yaml:"max-backups"`

	// log file max age default 3 day
	MaxAge int `default:"3" yaml:"max-age"`

	Compress *bool `default:"true" yaml:"compress"`
}

func (*File) Clone

func (f *File) Clone() *File

Clone a new File

type LoggerConfig

type LoggerConfig struct {
	// logger driver default zap
	Driver string `default:"zap" yaml:"driver"`

	// logger level
	Level string `default:"info" yaml:"level"`

	// logger formatter default text
	Format string `default:"text" yaml:"format"`

	// supports simultaneous file and console eg: console,file default console
	Appender string `default:"console" yaml:"appender"`

	// logger file
	File *File `yaml:"file"`
}

func DefaultLoggerConfig

func DefaultLoggerConfig() *LoggerConfig

func (*LoggerConfig) Clone

func (c *LoggerConfig) Clone() *LoggerConfig

Clone a new LoggerConfig

type MetadataReportConfig

type MetadataReportConfig struct {
	Protocol  string            `required:"true"  yaml:"protocol"  json:"protocol,omitempty"`
	Address   string            `required:"true" yaml:"address" json:"address"`
	Username  string            `yaml:"username" json:"username,omitempty"`
	Password  string            `yaml:"password" json:"password,omitempty"`
	Timeout   string            `yaml:"timeout" json:"timeout,omitempty"`
	Group     string            `yaml:"group" json:"group,omitempty"`
	Namespace string            `yaml:"namespace" json:"namespace,omitempty"`
	Params    map[string]string `yaml:"params"  json:"parameters,omitempty"`
	// contains filtered or unexported fields
}

MetadataReportConfig is app level configuration

func DefaultMetadataReportConfig

func DefaultMetadataReportConfig() *MetadataReportConfig

func (*MetadataReportConfig) Clone

Clone a new MetadataReportConfig

type MethodConfig

type MethodConfig struct {
	InterfaceId                 string
	InterfaceName               string
	Name                        string `yaml:"name"  json:"name,omitempty" property:"name"`
	Retries                     string `yaml:"retries"  json:"retries,omitempty" property:"retries"`
	LoadBalance                 string `yaml:"loadbalance"  json:"loadbalance,omitempty" property:"loadbalance"`
	Weight                      int64  `yaml:"weight"  json:"weight,omitempty" property:"weight"`
	TpsLimitInterval            string `yaml:"tps.limit.interval" json:"tps.limit.interval,omitempty" property:"tps.limit.interval"`
	TpsLimitRate                string `yaml:"tps.limit.rate" json:"tps.limit.rate,omitempty" property:"tps.limit.rate"`
	TpsLimitStrategy            string `yaml:"tps.limit.strategy" json:"tps.limit.strategy,omitempty" property:"tps.limit.strategy"`
	ExecuteLimit                string `yaml:"execute.limit" json:"execute.limit,omitempty" property:"execute.limit"`
	ExecuteLimitRejectedHandler string `` /* 127-byte string literal not displayed */
	Sticky                      bool   `yaml:"sticky"   json:"sticky,omitempty" property:"sticky"`
	RequestTimeout              string `yaml:"timeout"  json:"timeout,omitempty" property:"timeout"`
}

MethodConfig defines method config

func (*MethodConfig) Clone

func (c *MethodConfig) Clone() *MethodConfig

Clone a new MethodConfig

type MetricsConfig

type MetricsConfig struct {
	Enable             *bool             `default:"false" yaml:"enable" json:"enable,omitempty" property:"enable"`
	Port               string            `default:"9090" yaml:"port" json:"port,omitempty" property:"port"`
	Path               string            `default:"/metrics" yaml:"path" json:"path,omitempty" property:"path"`
	Protocol           string            `default:"prometheus" yaml:"protocol" json:"protocol,omitempty" property:"protocol"`
	Prometheus         *PrometheusConfig `yaml:"prometheus" json:"prometheus" property:"prometheus"`
	Aggregation        *AggregateConfig  `yaml:"aggregation" json:"aggregation" property:"aggregation"`
	EnableMetadata     *bool             `default:"true" yaml:"enable-metadata" json:"enable-metadata,omitempty" property:"enable-metadata"`
	EnableRegistry     *bool             `default:"true" yaml:"enable-registry" json:"enable-registry,omitempty" property:"enable-registry"`
	EnableConfigCenter *bool             `default:"true" yaml:"enable-config-center" json:"enable-config-center,omitempty" property:"enable-config-center"`
}

MetricsConfig This is the config struct for all metrics implementation

func DefaultMetricsConfig

func DefaultMetricsConfig() *MetricsConfig

func (*MetricsConfig) Clone

func (c *MetricsConfig) Clone() *MetricsConfig

Clone a new MetricsConfig

type OtelConfig

type OtelConfig struct {
	TracingConfig *OtelTraceConfig `yaml:"tracing" json:"trace,omitempty" property:"trace"`
}

OtelConfig is the configuration of the tracing.

func DefaultOtelConfig

func DefaultOtelConfig() *OtelConfig

func (*OtelConfig) Clone

func (c *OtelConfig) Clone() *OtelConfig

Clone a new OtelConfig

type OtelTraceConfig

type OtelTraceConfig struct {
	Enable      *bool   `default:"false" yaml:"enable" json:"enable,omitempty" property:"enable"`
	Exporter    string  `default:"stdout" yaml:"exporter" json:"exporter,omitempty" property:"exporter"` // stdout, jaeger, zipkin, otlp-http, otlp-grpc
	Endpoint    string  `default:"" yaml:"endpoint" json:"endpoint,omitempty" property:"endpoint"`
	Propagator  string  `default:"w3c" yaml:"propagator" json:"propagator,omitempty" property:"propagator"`       // one of w3c(standard), b3(for zipkin),
	SampleMode  string  `default:"ratio" yaml:"sample-mode" json:"sample-mode,omitempty" property:"sample-mode"`  // one of always, never, ratio
	SampleRatio float64 `default:"0.5" yaml:"sample-ratio" json:"sample-ratio,omitempty" property:"sample-ratio"` // [0.0, 1.0]
}

func (*OtelTraceConfig) Clone

func (c *OtelTraceConfig) Clone() *OtelTraceConfig

Clone a new OtelTraceConfig

type ProfilesConfig

type ProfilesConfig struct {
	// active profiles
	Active string
}

func DefaultProfilesConfig

func DefaultProfilesConfig() *ProfilesConfig

func (*ProfilesConfig) Clone

func (c *ProfilesConfig) Clone() *ProfilesConfig

Clone a new ProfilesConfig

type ProfilesOption

type ProfilesOption func(*ProfilesConfig)

func WithProfiles_Active

func WithProfiles_Active(active string) ProfilesOption

type PrometheusConfig

type PrometheusConfig struct {
	Exporter    *Exporter          `yaml:"exporter" json:"exporter,omitempty" property:"exporter"`
	Pushgateway *PushgatewayConfig `yaml:"pushgateway" json:"pushgateway,omitempty" property:"pushgateway"`
}

func (*PrometheusConfig) Clone

func (c *PrometheusConfig) Clone() *PrometheusConfig

type ProtocolConfig

type ProtocolConfig struct {
	Name   string      `default:"dubbo" validate:"required" yaml:"name" json:"name,omitempty" property:"name"`
	Ip     string      `yaml:"ip"  json:"ip,omitempty" property:"ip"`
	Port   string      `default:"20000" yaml:"port" json:"port,omitempty" property:"port"`
	Params interface{} `yaml:"params" json:"params,omitempty" property:"params"`

	// MaxServerSendMsgSize max size of server send message, 1mb=1000kb=1000000b 1mib=1024kb=1048576b.
	// more detail to see https://pkg.go.dev/github.com/dustin/go-humanize#pkg-constants
	MaxServerSendMsgSize string `yaml:"max-server-send-msg-size" json:"max-server-send-msg-size,omitempty"`
	// MaxServerRecvMsgSize max size of server receive message
	MaxServerRecvMsgSize string `default:"4mib" yaml:"max-server-recv-msg-size" json:"max-server-recv-msg-size,omitempty"`
}

ProtocolConfig is protocol configuration

func DefaultProtocolConfig

func DefaultProtocolConfig() *ProtocolConfig

func (*ProtocolConfig) Clone

func (c *ProtocolConfig) Clone() *ProtocolConfig

Clone a new ProtocolConfig

type ProviderConfig

type ProviderConfig struct {
	ServiceConfig
	Filter string `yaml:"filter" json:"filter,omitempty" property:"filter"`
	// Deprecated Register whether registration is required
	Register bool `yaml:"register" json:"register" property:"register"`
	// RegistryIDs is registry ids list
	RegistryIDs []string `yaml:"registry-ids" json:"registry-ids" property:"registry-ids"`
	// protocol
	ProtocolIDs []string `yaml:"protocol-ids" json:"protocol-ids" property:"protocol-ids"`
	// TracingKey is tracing ids list
	TracingKey string `yaml:"tracing-key" json:"tracing-key" property:"tracing-key"`
	// there is no need to configure Services
	// Services services
	Services     map[string]*ServiceConfig `yaml:"services" json:"services,omitempty" property:"services"`
	ProxyFactory string                    `default:"default" yaml:"proxy" json:"proxy,omitempty" property:"proxy"`
	FilterConf   interface{}               `yaml:"filter_conf" json:"filter_conf,omitempty" property:"filter_conf"`
	ConfigType   map[string]string         `yaml:"config_type" json:"config_type,omitempty" property:"config_type"`
	// adaptive service
	AdaptiveService        bool `yaml:"adaptive-service" json:"adaptive-service" property:"adaptive-service"`
	AdaptiveServiceVerbose bool `yaml:"adaptive-service-verbose" json:"adaptive-service-verbose" property:"adaptive-service-verbose"`
}

ProviderConfig is the default configuration of service provider

func DefaultProviderConfig

func DefaultProviderConfig() *ProviderConfig

func (*ProviderConfig) Clone

func (c *ProviderConfig) Clone() *ProviderConfig

Clone a new ProviderConfig

type PushgatewayConfig

type PushgatewayConfig struct {
	Enabled  *bool  `default:"false" yaml:"enabled" json:"enabled,omitempty" property:"enabled"`
	BaseUrl  string `default:"" yaml:"base-url" json:"base-url,omitempty" property:"base-url"`
	Job      string `default:"default_dubbo_job" yaml:"job" json:"job,omitempty" property:"job"`
	Username string `default:"" yaml:"username" json:"username,omitempty" property:"username"`
	Password string `default:"" yaml:"password" json:"password,omitempty" property:"password"`
	// seconds
	PushInterval int `default:"30" yaml:"push-interval" json:"push-interval,omitempty" property:"push-interval"`
}

func (*PushgatewayConfig) Clone

type ReferenceConfig

type ReferenceConfig struct {
	InterfaceName    string            `yaml:"interface"  json:"interface,omitempty" property:"interface"`
	Check            *bool             `yaml:"check"  json:"check,omitempty" property:"check"`
	URL              string            `yaml:"url"  json:"url,omitempty" property:"url"`
	Filter           string            `yaml:"filter" json:"filter,omitempty" property:"filter"`
	Protocol         string            `yaml:"protocol"  json:"protocol,omitempty" property:"protocol"`
	RegistryIDs      []string          `yaml:"registry-ids"  json:"registry-ids,omitempty"  property:"registry-ids"`
	Cluster          string            `yaml:"cluster"  json:"cluster,omitempty" property:"cluster"`
	Loadbalance      string            `yaml:"loadbalance"  json:"loadbalance,omitempty" property:"loadbalance"`
	Retries          string            `yaml:"retries"  json:"retries,omitempty" property:"retries"`
	Group            string            `yaml:"group"  json:"group,omitempty" property:"group"`
	Version          string            `yaml:"version"  json:"version,omitempty" property:"version"`
	Serialization    string            `yaml:"serialization" json:"serialization" property:"serialization"`
	ProvidedBy       string            `yaml:"provided_by"  json:"provided_by,omitempty" property:"provided_by"`
	Methods          []*MethodConfig   `yaml:"methods"  json:"methods,omitempty" property:"methods"`
	Async            bool              `yaml:"async"  json:"async,omitempty" property:"async"`
	Params           map[string]string `yaml:"params"  json:"params,omitempty" property:"params"`
	Generic          string            `yaml:"generic"  json:"generic,omitempty" property:"generic"`
	Sticky           bool              `yaml:"sticky"   json:"sticky,omitempty" property:"sticky"`
	RequestTimeout   string            `yaml:"timeout"  json:"timeout,omitempty" property:"timeout"`
	ForceTag         bool              `yaml:"force.tag"  json:"force.tag,omitempty" property:"force.tag"`
	TracingKey       string            `yaml:"tracing-key" json:"tracing-key,omitempty" propertiy:"tracing-key"`
	MeshProviderPort int               `yaml:"mesh-provider-port" json:"mesh-provider-port,omitempty" propertiy:"mesh-provider-port"`
}

ReferenceConfig is the configuration of service consumer

func DefaultReferenceConfig

func DefaultReferenceConfig() *ReferenceConfig

func (*ReferenceConfig) Clone

func (c *ReferenceConfig) Clone() *ReferenceConfig

Clone a new ReferenceConfig

type ReferenceOption

type ReferenceOption func(*ReferenceConfig)

func WithReference_Async

func WithReference_Async(async bool) ReferenceOption

func WithReference_Check

func WithReference_Check(check bool) ReferenceOption

func WithReference_Cluster

func WithReference_Cluster(cluster string) ReferenceOption

func WithReference_Filter

func WithReference_Filter(filter string) ReferenceOption

func WithReference_Force

func WithReference_Force(force bool) ReferenceOption

func WithReference_Generic

func WithReference_Generic(generic string) ReferenceOption

func WithReference_Group

func WithReference_Group(group string) ReferenceOption

func WithReference_InterfaceName

func WithReference_InterfaceName(name string) ReferenceOption

func WithReference_LoadBalance

func WithReference_LoadBalance(loadBalance string) ReferenceOption

func WithReference_MeshProviderPort

func WithReference_MeshProviderPort(port int) ReferenceOption

func WithReference_Params

func WithReference_Params(params map[string]string) ReferenceOption

func WithReference_Protocol

func WithReference_Protocol(protocol string) ReferenceOption

func WithReference_ProviderBy

func WithReference_ProviderBy(providedBy string) ReferenceOption

func WithReference_RegistryIDs

func WithReference_RegistryIDs(registryIDs []string) ReferenceOption

func WithReference_RequestTimeout

func WithReference_RequestTimeout(timeout string) ReferenceOption

func WithReference_Retries

func WithReference_Retries(retries int) ReferenceOption

func WithReference_Serialization

func WithReference_Serialization(serialization string) ReferenceOption

func WithReference_Sticky

func WithReference_Sticky(sticky bool) ReferenceOption

func WithReference_TracingKey

func WithReference_TracingKey(tracingKey string) ReferenceOption

func WithReference_URL

func WithReference_URL(url string) ReferenceOption

func WithReference_Version

func WithReference_Version(version string) ReferenceOption

type RegistryConfig

type RegistryConfig struct {
	Protocol          string            `validate:"required" yaml:"protocol"  json:"protocol,omitempty" property:"protocol"`
	Timeout           string            `default:"5s" validate:"required" yaml:"timeout" json:"timeout,omitempty" property:"timeout"` // unit: second
	Group             string            `yaml:"group" json:"group,omitempty" property:"group"`
	Namespace         string            `yaml:"namespace" json:"namespace,omitempty" property:"namespace"`
	TTL               string            `default:"15m" yaml:"ttl" json:"ttl,omitempty" property:"ttl"` // unit: minute
	Address           string            `validate:"required" yaml:"address" json:"address,omitempty" property:"address"`
	Username          string            `yaml:"username" json:"username,omitempty" property:"username"`
	Password          string            `yaml:"password" json:"password,omitempty"  property:"password"`
	Simplified        bool              `yaml:"simplified" json:"simplified,omitempty"  property:"simplified"`
	Preferred         bool              `yaml:"preferred" json:"preferred,omitempty" property:"preferred"` // Always use this registry first if set to true, useful when subscribe to multiple registriesConfig
	Zone              string            `yaml:"zone" json:"zone,omitempty" property:"zone"`                // The region where the registry belongs, usually used to isolate traffics
	Weight            int64             `yaml:"weight" json:"weight,omitempty" property:"weight"`          // Affects traffic distribution among registriesConfig, useful when subscribe to multiple registriesConfig Take effect only when no preferred registry is specified.
	Params            map[string]string `yaml:"params" json:"params,omitempty" property:"params"`
	RegistryType      string            `yaml:"registry-type"`
	UseAsMetaReport   bool              `default:"true" yaml:"use-as-meta-report" json:"use-as-meta-report,omitempty" property:"use-as-meta-report"`
	UseAsConfigCenter bool              `default:"true" yaml:"use-as-config-center" json:"use-as-config-center,omitempty" property:"use-as-config-center"`
}

RegistryConfig is the configuration of the registry center

func DefaultRegistryConfig

func DefaultRegistryConfig() *RegistryConfig

func (*RegistryConfig) Clone

func (c *RegistryConfig) Clone() *RegistryConfig

Clone a new RegistryConfig

type ServiceConfig

type ServiceConfig struct {
	Filter                      string            `yaml:"filter" json:"filter,omitempty" property:"filter"`
	ProtocolIDs                 []string          `yaml:"protocol-ids"  json:"protocol-ids,omitempty" property:"protocol-ids"` // multi protocolIDs support, split by ','
	Interface                   string            `yaml:"interface"  json:"interface,omitempty" property:"interface"`
	RegistryIDs                 []string          `yaml:"registry-ids"  json:"registry-ids,omitempty"  property:"registry-ids"`
	Cluster                     string            `default:"failover" yaml:"cluster"  json:"cluster,omitempty" property:"cluster"`
	Loadbalance                 string            `default:"random" yaml:"loadbalance"  json:"loadbalance,omitempty"  property:"loadbalance"`
	Group                       string            `yaml:"group"  json:"group,omitempty" property:"group"`
	Version                     string            `yaml:"version"  json:"version,omitempty" property:"version" `
	Methods                     []*MethodConfig   `yaml:"methods"  json:"methods,omitempty" property:"methods"`
	Warmup                      string            `yaml:"warmup"  json:"warmup,omitempty"  property:"warmup"`
	Retries                     string            `yaml:"retries"  json:"retries,omitempty" property:"retries"`
	Serialization               string            `yaml:"serialization" json:"serialization" property:"serialization"`
	Params                      map[string]string `yaml:"params"  json:"params,omitempty" property:"params"`
	Token                       string            `yaml:"token" json:"token,omitempty" property:"token"`
	AccessLog                   string            `yaml:"accesslog" json:"accesslog,omitempty" property:"accesslog"`
	TpsLimiter                  string            `yaml:"tps.limiter" json:"tps.limiter,omitempty" property:"tps.limiter"`
	TpsLimitInterval            string            `yaml:"tps.limit.interval" json:"tps.limit.interval,omitempty" property:"tps.limit.interval"`
	TpsLimitRate                string            `yaml:"tps.limit.rate" json:"tps.limit.rate,omitempty" property:"tps.limit.rate"`
	TpsLimitStrategy            string            `yaml:"tps.limit.strategy" json:"tps.limit.strategy,omitempty" property:"tps.limit.strategy"`
	TpsLimitRejectedHandler     string            `yaml:"tps.limit.rejected.handler" json:"tps.limit.rejected.handler,omitempty" property:"tps.limit.rejected.handler"`
	ExecuteLimit                string            `yaml:"execute.limit" json:"execute.limit,omitempty" property:"execute.limit"`
	ExecuteLimitRejectedHandler string            `` /* 127-byte string literal not displayed */
	Auth                        string            `yaml:"auth" json:"auth,omitempty" property:"auth"`
	NotRegister                 bool              `yaml:"not_register" json:"not_register,omitempty" property:"not_register"`
	ParamSign                   string            `yaml:"param.sign" json:"param.sign,omitempty" property:"param.sign"`
	Tag                         string            `yaml:"tag" json:"tag,omitempty" property:"tag"`
	TracingKey                  string            `yaml:"tracing-key" json:"tracing-key,omitempty" propertiy:"tracing-key"`

	RCProtocolsMap  map[string]*ProtocolConfig
	RCRegistriesMap map[string]*RegistryConfig
	ProxyFactoryKey string
}

ServiceConfig is the configuration of the service provider

func DefaultServiceConfig

func DefaultServiceConfig() *ServiceConfig

func (*ServiceConfig) Clone

func (c *ServiceConfig) Clone() *ServiceConfig

Clone a new ServiceConfig

type ServiceOption

type ServiceOption func(*ServiceConfig)

type ShutdownConfig

type ShutdownConfig struct {
	/*
	 * Total timeout. Even though we don't release all resources,
	 * the applicationConfig will shutdown if the costing time is over this configuration. The unit is ms.
	 * default value is 60 * 1000 ms = 1 minutes
	 * In general, it should be bigger than 3 * StepTimeout.
	 */
	Timeout string `default:"60s" yaml:"timeout" json:"timeout,omitempty" property:"timeout"`
	/*
	 * the timeout on each step. You should evaluate the response time of request
	 * and the time that client noticed that server shutdown.
	 * For example, if your client will received the notification within 10s when you start to close server,
	 * and the 99.9% requests will return response in 2s, so the StepTimeout will be bigger than(10+2) * 1000ms,
	 * maybe (10 + 2*3) * 1000ms is a good choice.
	 */
	StepTimeout string `default:"3s" yaml:"step-timeout" json:"step.timeout,omitempty" property:"step.timeout"`

	/*
	 * ConsumerUpdateWaitTime means when provider is shutting down, after the unregister, time to wait for client to
	 * update invokers. During this time, incoming invocation can be treated normally.
	 */
	ConsumerUpdateWaitTime string `default:"3s" yaml:"consumer-update-wait-time" json:"consumerUpdate.waitTIme,omitempty" property:"consumerUpdate.waitTIme"`
	// when we try to shutdown the applicationConfig, we will reject the new requests. In most cases, you don't need to configure this.
	RejectRequestHandler string `yaml:"reject-handler" json:"reject-handler,omitempty" property:"reject_handler"`
	// internal listen kill signal,the default is true.
	InternalSignal *bool `default:"true" yaml:"internal-signal" json:"internal.signal,omitempty" property:"internal.signal"`
	// offline request window length
	OfflineRequestWindowTimeout string `yaml:"offline-request-window-timeout" json:"offlineRequestWindowTimeout,omitempty" property:"offlineRequestWindowTimeout"`
	// true -> new request will be rejected.
	RejectRequest atomic.Bool
	// active invocation
	ConsumerActiveCount atomic.Int32
	ProviderActiveCount atomic.Int32

	// provider last received request timestamp
	ProviderLastReceivedRequestTime atomic.Time
}

ShutdownConfig is used as configuration for graceful shutdown

func DefaultShutdownConfig

func DefaultShutdownConfig() *ShutdownConfig

func (*ShutdownConfig) Clone

func (c *ShutdownConfig) Clone() *ShutdownConfig

Clone a new ShutdownConfig

type TLSConfig

type TLSConfig struct {
	CACertFile    string `yaml:"ca-cert-file" json:"ca-cert-file" property:"ca-cert-file"`
	TLSCertFile   string `yaml:"tls-cert-file" json:"tls-cert-file" property:"tls-cert-file"`
	TLSKeyFile    string `yaml:"tls-key-file" json:"tls-key-file" property:"tls-key-file"`
	TLSServerName string `yaml:"tls-server-name" json:"tls-server-name" property:"tls-server-name"`
}

TLSConfig tls config

Experimental

Notice: This struct is EXPERIMENTAL and may be changed or removed in a later release.

func DefaultTLSConfig

func DefaultTLSConfig() *TLSConfig

func (*TLSConfig) Clone

func (c *TLSConfig) Clone() *TLSConfig

Clone a new TLSConfig

type TLSOption

type TLSOption func(*TLSConfig)

func WithTLS_CACertFile

func WithTLS_CACertFile(file string) TLSOption

func WithTLS_TLSCertFile

func WithTLS_TLSCertFile(file string) TLSOption

func WithTLS_TLSKeyFile

func WithTLS_TLSKeyFile(file string) TLSOption

func WithTLS_TLSServerName

func WithTLS_TLSServerName(name string) TLSOption

type TracingConfig

type TracingConfig struct {
	Name        string `default:"jaeger" yaml:"name" json:"name,omitempty" property:"name"` // jaeger or zipkin(todo)
	ServiceName string `yaml:"serviceName" json:"serviceName,omitempty" property:"serviceName"`
	Address     string `yaml:"address" json:"address,omitempty" property:"address"`
	UseAgent    *bool  `default:"false" yaml:"use-agent" json:"use-agent,omitempty" property:"use-agent"`
}

TracingConfig is the configuration of the tracing. Deprecated: it's designed to be replaced with global.OtelConfig

Jump to

Keyboard shortcuts

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