Documentation ¶
Index ¶
- func BeDaemon(arg string)
- func Bootstrap(serviceInfo *ServiceInfo) (*conf.Bootstrap, log.Logger, registry.Registrar)
- func CreateGrpcClient(ctx context.Context, r registry.Discovery, serviceName string, ...) grpc.ClientConnInterface
- func CreateGrpcServer(cfg *conf.Bootstrap, m ...middleware.Middleware) *kratosGrpc.Server
- func CreateRestServer(cfg *conf.Bootstrap, m ...middleware.Middleware) *kratosRest.Server
- func LoadBootstrapConfig(configPath string) error
- func LoadRemoteConfigSourceConfigs(configPath string) (error, *conf.RemoteConfig)
- func NewAliyunLogger(cfg *conf.Logger) log.Logger
- func NewApolloConfigSource(c *conf.RemoteConfig) config.Source
- func NewConfigProvider(configPath string) config.Config
- func NewConsulConfigSource(c *conf.RemoteConfig) config.Source
- func NewConsulRegistry(c *conf.Registry) *consulKratos.Registry
- func NewDiscovery(cfg *conf.Registry) registry.Discovery
- func NewEtcdConfigSource(c *conf.RemoteConfig) config.Source
- func NewEtcdRegistry(c *conf.Registry) *etcdKratos.Registry
- func NewEurekaRegistry(c *conf.Registry) *eurekaKratos.Registry
- func NewFileConfigSource(filePath string) config.Source
- func NewFluentLogger(cfg *conf.Logger) log.Logger
- func NewKubernetesConfigSource(c *conf.RemoteConfig) config.Source
- func NewKubernetesRegistry(_ *conf.Registry) *k8sRegistry.Registry
- func NewLogger(cfg *conf.Logger) log.Logger
- func NewLoggerProvider(cfg *conf.Logger, serviceInfo *ServiceInfo) log.Logger
- func NewLogrusLogger(cfg *conf.Logger) log.Logger
- func NewMinIoClient(conf *conf.OSS) *minio.Client
- func NewNacosConfigSource(c *conf.RemoteConfig) config.Source
- func NewNacosRegistry(c *conf.Registry) *nacosKratos.Registry
- func NewOtlpGrpcExporter(ctx context.Context, endpoint string, insecure bool, ...) (traceSdk.SpanExporter, error)
- func NewOtlpHttpExporter(ctx context.Context, endpoint string, insecure bool, ...) (traceSdk.SpanExporter, error)
- func NewPolarisConfigSource(_ *conf.RemoteConfig) config.Source
- func NewRedisClient(conf *conf.Data) *redis.Client
- func NewRegistry(cfg *conf.Registry) registry.Registrar
- func NewRemoteConfigSource(c *conf.RemoteConfig) config.Source
- func NewServicecombRegistry(c *conf.Registry) *servicecombKratos.Registry
- func NewStdLogger() log.Logger
- func NewTencentLogger(cfg *conf.Logger) log.Logger
- func NewTracerExporter(exporterName, endpoint string, insecure bool) (traceSdk.SpanExporter, error)
- func NewTracerProvider(cfg *conf.Tracer, serviceInfo *ServiceInfo) error
- func NewZapLogger(cfg *conf.Logger) log.Logger
- func NewZipkinExporter(_ context.Context, endpoint string) (traceSdk.SpanExporter, error)
- func NewZooKeeperRegistry(c *conf.Registry) *zookeeperKratos.Registry
- func RegisterConfig(c interface{})
- type CommandFlags
- type ConfigType
- type LoggerType
- type RegistryType
- type ServiceInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateGrpcClient ¶
func CreateGrpcClient(ctx context.Context, r registry.Discovery, serviceName string, cfg *conf.Bootstrap, m ...middleware.Middleware) grpc.ClientConnInterface
CreateGrpcClient 创建GRPC客户端
func CreateGrpcServer ¶
func CreateGrpcServer(cfg *conf.Bootstrap, m ...middleware.Middleware) *kratosGrpc.Server
CreateGrpcServer 创建GRPC服务端
func CreateRestServer ¶
func CreateRestServer(cfg *conf.Bootstrap, m ...middleware.Middleware) *kratosRest.Server
CreateRestServer 创建REST服务端
func LoadBootstrapConfig ¶
LoadBootstrapConfig 加载程序引导配置
func LoadRemoteConfigSourceConfigs ¶
func LoadRemoteConfigSourceConfigs(configPath string) (error, *conf.RemoteConfig)
LoadRemoteConfigSourceConfigs 加载远程配置源的本地配置
func NewAliyunLogger ¶
NewAliyunLogger 创建一个新的日志记录器 - Aliyun
func NewApolloConfigSource ¶
func NewApolloConfigSource(c *conf.RemoteConfig) config.Source
NewApolloConfigSource 创建一个远程配置源 - Apollo
func NewConfigProvider ¶
NewConfigProvider 创建一个配置
func NewConsulConfigSource ¶
func NewConsulConfigSource(c *conf.RemoteConfig) config.Source
NewConsulConfigSource 创建一个远程配置源 - Consul
func NewConsulRegistry ¶
func NewConsulRegistry(c *conf.Registry) *consulKratos.Registry
NewConsulRegistry 创建一个注册发现客户端 - Consul
func NewEtcdConfigSource ¶
func NewEtcdConfigSource(c *conf.RemoteConfig) config.Source
NewEtcdConfigSource 创建一个远程配置源 - Etcd
func NewEtcdRegistry ¶
func NewEtcdRegistry(c *conf.Registry) *etcdKratos.Registry
NewEtcdRegistry 创建一个注册发现客户端 - Etcd
func NewEurekaRegistry ¶
func NewEurekaRegistry(c *conf.Registry) *eurekaKratos.Registry
NewEurekaRegistry 创建一个注册发现客户端 - Eureka
func NewFileConfigSource ¶
NewFileConfigSource 创建一个本地文件配置源
func NewFluentLogger ¶
NewFluentLogger 创建一个新的日志记录器 - Fluent
func NewKubernetesConfigSource ¶
func NewKubernetesConfigSource(c *conf.RemoteConfig) config.Source
NewKubernetesConfigSource 创建一个远程配置源 - Kubernetes
func NewKubernetesRegistry ¶
func NewKubernetesRegistry(_ *conf.Registry) *k8sRegistry.Registry
NewKubernetesRegistry 创建一个注册发现客户端 - Kubernetes
func NewLoggerProvider ¶
func NewLoggerProvider(cfg *conf.Logger, serviceInfo *ServiceInfo) log.Logger
NewLoggerProvider 创建一个新的日志记录器提供者
func NewLogrusLogger ¶
NewLogrusLogger 创建一个新的日志记录器 - Logrus
func NewMinIoClient ¶
func NewNacosConfigSource ¶
func NewNacosConfigSource(c *conf.RemoteConfig) config.Source
NewNacosConfigSource 创建一个远程配置源 - Nacos
func NewNacosRegistry ¶
func NewNacosRegistry(c *conf.Registry) *nacosKratos.Registry
NewNacosRegistry 创建一个注册发现客户端 - Nacos
func NewOtlpGrpcExporter ¶
func NewOtlpGrpcExporter(ctx context.Context, endpoint string, insecure bool, options ...otlptracegrpc.Option) (traceSdk.SpanExporter, error)
NewOtlpGrpcExporter 创建OTLP/gRPC导出器,默认端口:4317
func NewOtlpHttpExporter ¶
func NewOtlpHttpExporter(ctx context.Context, endpoint string, insecure bool, options ...otlptracehttp.Option) (traceSdk.SpanExporter, error)
NewOtlpHttpExporter 创建OTLP/HTTP导出器,默认端口:4318
func NewPolarisConfigSource ¶
func NewPolarisConfigSource(_ *conf.RemoteConfig) config.Source
NewPolarisConfigSource 创建一个远程配置源 - Polaris
func NewRemoteConfigSource ¶
func NewRemoteConfigSource(c *conf.RemoteConfig) config.Source
NewRemoteConfigSource 创建一个远程配置源
func NewServicecombRegistry ¶
func NewServicecombRegistry(c *conf.Registry) *servicecombKratos.Registry
NewServicecombRegistry 创建一个注册发现客户端 - Servicecomb
func NewTencentLogger ¶
NewTencentLogger 创建一个新的日志记录器 - Tencent
func NewTracerExporter ¶
func NewTracerExporter(exporterName, endpoint string, insecure bool) (traceSdk.SpanExporter, error)
NewTracerExporter 创建一个导出器,支持:zipkin、otlp-http、otlp-grpc
func NewTracerProvider ¶
func NewTracerProvider(cfg *conf.Tracer, serviceInfo *ServiceInfo) error
NewTracerProvider 创建一个链路追踪器
func NewZipkinExporter ¶
NewZipkinExporter 创建一个zipkin导出器,默认对端地址:http://localhost:9411/api/v2/spans
func NewZooKeeperRegistry ¶
func NewZooKeeperRegistry(c *conf.Registry) *zookeeperKratos.Registry
NewZooKeeperRegistry 创建一个注册发现客户端 - ZooKeeper
Types ¶
type CommandFlags ¶
type CommandFlags struct { Conf string // 引导配置文件路径,默认为:../../configs Env string // 开发环境:dev、debug…… ConfigHost string // 远程配置服务端地址 ConfigType string // 远程配置服务端类型 Daemon bool // 是否转为守护进程 }
func NewCommandFlags ¶
func NewCommandFlags() *CommandFlags
func (*CommandFlags) Init ¶
func (f *CommandFlags) Init()
type ConfigType ¶
type ConfigType string
const ( ConfigTypeLocalFile ConfigType = "file" ConfigTypeNacos ConfigType = "nacos" ConfigTypeConsul ConfigType = "consul" ConfigTypeEtcd ConfigType = "etcd" ConfigTypeApollo ConfigType = "apollo" ConfigTypeKubernetes ConfigType = "kubernetes" ConfigTypePolaris ConfigType = "polaris" )
type LoggerType ¶
type LoggerType string
const ( LoggerTypeStd LoggerType = "std" LoggerTypeFluent LoggerType = "fluent" LoggerTypeLogrus LoggerType = "logrus" LoggerTypeZap LoggerType = "zap" LoggerTypeAliyun LoggerType = "aliyun" LoggerTypeTencent LoggerType = "tencent" )
type RegistryType ¶
type RegistryType string
const ( RegistryTypeConsul RegistryType = "consul" LoggerTypeEtcd RegistryType = "etcd" LoggerTypeZooKeeper RegistryType = "zookeeper" LoggerTypeNacos RegistryType = "nacos" LoggerTypeKubernetes RegistryType = "kubernetes" LoggerTypeEureka RegistryType = "eureka" LoggerTypePolaris RegistryType = "polaris" LoggerTypeServicecomb RegistryType = "servicecomb" )
type ServiceInfo ¶
func NewServiceInfo ¶
func NewServiceInfo(name, version, id string) *ServiceInfo
func (*ServiceInfo) GetInstanceId ¶
func (s *ServiceInfo) GetInstanceId() string
func (*ServiceInfo) SetMataData ¶
func (s *ServiceInfo) SetMataData(k, v string)