zipkin

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: Apache-2.0, MIT Imports: 19 Imported by: 0

README

tRPC zipkin plugin

Go Reference Go Report Card LICENSE Releases Docs Tests Coverage

Configuration example:

plugins:
  tracing:
    zipkin:
      service_name: HelloTestService
      host_port:  120.0.0.1:8080
      reporter:
        type: http  # types: http kafka noop
        http:
          url: http://localhost:9411/api/v2/spans
      sampler:
        type: always  # types: never always modulo boundary counting
  • The plugin contains a global tracer, and each service has a corresponding tracer.
  • The above example is the configuration of the global tracer; The reporting endpoint corresponds to (service_name, host_port). If these two items are not configured, (server.server, global.local_ip) will be used by default.
  • For the tracer of each service, its reporting endpoint uses the (Name, ip:port) configured by the service by default.

Documentation

Overview

Package zipkin provides implementation for zipkin plugin.

Index

Constants

View Source
const (
	NeverSampler    = "never"
	AlwaysSampler   = "always"
	ModuloSampler   = "modulo"
	BoundarySampler = "boundary"
	CountingSampler = "counting"

	HTTPReporter  = "http"
	KafkaReporter = "kafka"
	NoopReporter  = "noop"
)

Zipkin plugin constants.

Variables

This section is empty.

Functions

func ClientFilter

func ClientFilter(z *zipkinPlugin) filter.ClientFilter

ClientFilter returns a distributed tracing filter for RPC client

func ServerFilter

func ServerFilter(z *zipkinPlugin) filter.ServerFilter

ServerFilter returns a distributed tracing filter for RPC server

Types

type BoundarySamplerConfig

type BoundarySamplerConfig struct {
	Rate float64 `yaml:"rate"`
	Salt int64   `yaml:"salt"`
}

BoundarySamplerConfig holds the configuration for boundary sampler

type Config

type Config struct {
	ServiceName string          `yaml:"service_name"`
	HostPort    string          `yaml:"host_port"`
	TraceID128  bool            `yaml:"trace_id_128"`
	Sampler     *SamplerConfig  `yaml:"sampler"`
	Reporter    *ReporterConfig `yaml:"reporter"`
}

Config holds the configuration

func (*Config) NewOpenTracingTracer

func (c *Config) NewOpenTracingTracer() (opentracing.Tracer, error)

NewOpenTracingTracer news a opentracing tracer

func (*Config) NewZipkinTracer

func (c *Config) NewZipkinTracer() (*zipkin.Tracer, error)

NewZipkinTracer news a zipkin tracer

type CountingSamplerConfig

type CountingSamplerConfig struct {
	Rate float64 `yaml:"rate"`
}

CountingSamplerConfig holds the configuration for counting sampler

type HTTPReporterConfig

type HTTPReporterConfig struct {
	Url                  string `yaml:"url"`
	TimeoutSeconds       int    `yaml:"time_out_seconds"`
	BatchIntervalSeconds int    `yaml:"batch_interval_seconds"`
	BatchSize            int    `yaml:"batch_size"`
	MaxBacklog           int    `yaml:"max_backlog"`
}

HTTPReporterConfig holds the configuration for http reporter defaultTimeout = time.Second * 5 // timeout for http request in seconds defaultBatchInterval = time.Second * 1 // BatchInterval in seconds defaultBatchSize = 100 defaultMaxBacklog = 1000

type KafkaProducerFlushConfig

type KafkaProducerFlushConfig struct {
	// The best-effort number of bytes needed to trigger a flush. Use the
	// global sarama.MaxRequestSize to set a hard upper limit.
	Bytes int `yaml:"bytes"`
	// The best-effort number of messages needed to trigger a flush. Use
	// `MaxMessages` to set a hard upper limit.
	Messages int `yaml:"messages"`
	// The best-effort frequency of flushes. Equivalent to
	// `queue.buffering.max.ms` setting of JVM producer.
	Frequency time.Duration `yaml:"frequency"`
	// The maximum number of messages the producer will send in a single
	// broker request. Defaults to 0 for unlimited. Similar to
	// `queue.buffering.max.messages` in the JVM producer.
	MaxMessages int `yaml:"max_messages"`
}

KafkaProducerFlushConfig holds the configuration for kafka producer

type KafkaReporterConfig

type KafkaReporterConfig struct {
	Urls                []string                  `yaml:"urls"`
	ProducerFlushConfig *KafkaProducerFlushConfig `yaml:"producer_flush_config"`
}

KafkaReporterConfig holds the configuration for kafka reporter

type ModuloSamplerConfig

type ModuloSamplerConfig struct {
	Mod uint64 `yaml:"mod"`
}

ModuloSamplerConfig holds the configuration for modulo sampler

type NoopReporterConfig

type NoopReporterConfig struct {
}

NoopReporterConfig holds the configuration for noop reporter

type ReporterConfig

type ReporterConfig struct {
	Type  string               `yaml:"type"`
	HTTP  *HTTPReporterConfig  `yaml:"http"`
	Kafka *KafkaReporterConfig `yaml:"kafka"`
}

ReporterConfig holds the configuration for reporter

type SamplerConfig

type SamplerConfig struct {
	// Type can be: Never Always Modulo Boundary Counting
	Type string `yaml:"type"`
	// Modulo sampler
	Modulo *ModuloSamplerConfig `yaml:"const"`
	// Boundary sampler
	Boundary *BoundarySamplerConfig `yaml:"mix"`
	// Counting sampler
	Counting *CountingSamplerConfig `yaml:"counting"`
}

SamplerConfig holds the sampler configuration

Jump to

Keyboard shortcuts

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