Documentation ¶
Index ¶
- Constants
- func DefaultSpec() plugins.Spec
- func New(pluginSpec plugins.Spec) (plugins.Plugin, error)
- func NewEndpoint(serviceName string, hostPort string) (*model.Endpoint, error)
- func NewEndpointByName(serviceName string) *model.Endpoint
- type AuthTransport
- type HTTPClientWrapper
- type HTTPHandlerWrapper
- type MiddlewareType
- type Span
- type SpanModel
- type Spec
- type Tracing
- type Zipkin
- func (z *Zipkin) Close() error
- func (z *Zipkin) Name() string
- func (z *Zipkin) StartMWSpan(parent zipkin.Span, name string, mwType MiddlewareType, ...) zipkin.Span
- func (z *Zipkin) StartMWSpanFromCtx(parent context.Context, name string, mwType MiddlewareType, ...) (zipkin.Span, context.Context)
- func (z *Zipkin) StartSpan(parent zipkin.Span, name string, options ...zipkin.SpanOption) zipkin.Span
- func (z *Zipkin) StartSpanFromCtx(parent context.Context, name string, options ...zipkin.SpanOption) (zipkin.Span, context.Context)
- func (z *Zipkin) Tracer() *zipkin.Tracer
- func (z *Zipkin) WrapUserClient(c plugins.HTTPDoer) plugins.HTTPDoer
- func (z *Zipkin) WrapUserClientRequest(current context.Context, req *http.Request) *http.Request
- func (z *Zipkin) WrapUserHandlerFunc(handlerFunc http.HandlerFunc) http.HandlerFunc
Constants ¶
const ( HTTPTagAttributeRoute = "http.route" HTTPTagMethod = "http.method" HTTPTagPath = "http.path" HTTPTagStatusCode = "http.status_code" HTTPTagScriptFilename = "http.script.filename" HTTPTagClientAddress = "Client Address" MysqlTagSQL = "sql" MysqlTagURL = "url" RedisTagMethod = "redis.method" ElasticsearchTagIndex = "es.index" ElasticsearchTagOperation = "es.operation" ElasticsearchTagBody = "es.body" KafkaTagTopic = "kafka.topic" KafkaTagKey = "kafka.key" KafkaTagOroker = "kafka.broker" RabbitTagExchange = "rabbit.exchange" RabbitTagRoutingKey = "rabbit.routing_key" RabbitTagQueue = "rabbit.queue" RabbitTagBroker = "rabbit.broker" MongodbTagCommand = "mongodb.command" MongodbTagCollection = "mongodb.collection" MongodbTagClusterID = "mongodb.cluster_id" )
For details, please see https://github.com/megaease/easeagent-sdk-go/blob/main/doc/middleware-span.md
const ( MiddlewareTag string = "component.type" MySQL MiddlewareType = "mysql" Redis MiddlewareType = "redis" ElasticSearch MiddlewareType = "elasticsearch" Kafka MiddlewareType = "kafka" RabbitMQ MiddlewareType = "rabbitmq" MongoDB MiddlewareType = "mongodb" )
decorate a special type Span by tag
const ( // Kind is the kind of Zipkin plugin. Kind = "Zipkin" // Name is the name of Zipkin plugin. Name = "Zipkin" )
Variables ¶
This section is empty.
Functions ¶
func NewEndpoint ¶
NewEndpoint new a model.Endpoint
func NewEndpointByName ¶
NewEndpointByName new a model.Endpoint by service name
Types ¶
type AuthTransport ¶
type AuthTransport struct {
// contains filtered or unexported fields
}
AuthTransport is a http.RoundTripper that adds basic auth to requests.
type HTTPClientWrapper ¶
type HTTPClientWrapper struct {
// contains filtered or unexported fields
}
HTTPClientWrapper is the wrapper of http.Client.
type HTTPHandlerWrapper ¶
type HTTPHandlerWrapper struct {
// contains filtered or unexported fields
}
HTTPHandlerWrapper is the wrapper of http.Handler.
func (*HTTPHandlerWrapper) ServeHTTP ¶
func (h *HTTPHandlerWrapper) ServeHTTP(w http.ResponseWriter, r *http.Request)
type MiddlewareType ¶
type MiddlewareType string
MiddlewareType A special type about middleware
func (MiddlewareType) TagValue ¶
func (t MiddlewareType) TagValue() string
TagValue return the middleware tag value for decorate Span
type Span ¶
type Span struct { SpanModel `json:",inline"` Type string `json:"type,omitempty"` Service string `json:"service,omitempty"` }
Span represents a Zipkin span.
func (Span) MarshalJSON ¶
MarshalJSON exports our Model into the correct format for the Zipkin V2 API.
func (*Span) UnmarshalJSON ¶
UnmarshalJSON imports our Model from a Zipkin V2 API compatible span representation.
type Spec ¶
type Spec struct { plugins.BaseSpec `json:",inline"` OutputServerURL string `json:"reporter.output.server"` EnableTLS bool `json:"reporter.output.server.tls.enable"` TLSKey string `json:"reporter.output.server.tls.key"` TLSCert string `json:"reporter.output.server.tls.cert"` TLSCaCert string `json:"reporter.output.server.tls.caCert"` EnableBasicAuth bool `json:"reporter.output.server.auth.enable"` Username string `json:"reporter.output.server.auth.username"` Password string `json:"reporter.output.server.auth.password"` ServiceName string `json:"serviceName"` TracingType string `json:"tracing.type"` LocalHostport string `json:"-"` Tags map[string]string `json:"-"` EnableTracing bool `json:"tracing.enable" jsonschema:"required,minimum=0,maximum=1"` SampleRate float64 `json:"tracing.sample.rate" jsonschema:"required,minimum=0,maximum=1"` ID128Bit bool `json:"tracing.id128bit"` }
Spec is the Zipkin spec.
func NewConsoleReportSpec ¶
NewConsoleReportSpec new a Console Reporter Spec
type Tracing ¶
type Tracing interface { //get zipkin Tracer Tracer() *zipkin.Tracer //start a Span from parent StartSpan(parent zipkin.Span, name string, options ...zipkin.SpanOption) zipkin.Span //start a Span from context.Context StartSpanFromCtx(parent context.Context, name string, options ...zipkin.SpanOption) (zipkin.Span, context.Context) //start a middleware span from parent StartMWSpan(parent zipkin.Span, name string, mwType MiddlewareType, options ...zipkin.SpanOption) zipkin.Span //start a middleware span from context.Context StartMWSpanFromCtx(parent context.Context, name string, mwType MiddlewareType, options ...zipkin.SpanOption) (zipkin.Span, context.Context) }
Tracing the tracing interface
type Zipkin ¶
type Zipkin struct {
// contains filtered or unexported fields
}
Zipkin is the Zipkin dedicated plugin.
func (*Zipkin) StartMWSpan ¶
func (z *Zipkin) StartMWSpan(parent zipkin.Span, name string, mwType MiddlewareType, options ...zipkin.SpanOption) zipkin.Span
StartMWSpan start a middleware span from parent
func (*Zipkin) StartMWSpanFromCtx ¶
func (z *Zipkin) StartMWSpanFromCtx(parent context.Context, name string, mwType MiddlewareType, options ...zipkin.SpanOption) (zipkin.Span, context.Context)
StartMWSpanFromCtx start a middleware span from context.Context
func (*Zipkin) StartSpan ¶
func (z *Zipkin) StartSpan(parent zipkin.Span, name string, options ...zipkin.SpanOption) zipkin.Span
StartSpan start a Span from parent
func (*Zipkin) StartSpanFromCtx ¶
func (z *Zipkin) StartSpanFromCtx(parent context.Context, name string, options ...zipkin.SpanOption) (zipkin.Span, context.Context)
StartSpanFromCtx start a Span from context.Context
func (*Zipkin) WrapUserClient ¶
WrapUserClient wraps the http client.
func (*Zipkin) WrapUserClientRequest ¶
WrapUserClientRequest wraps the user's http request.
func (*Zipkin) WrapUserHandlerFunc ¶
func (z *Zipkin) WrapUserHandlerFunc(handlerFunc http.HandlerFunc) http.HandlerFunc
WrapUserHandlerFunc wraps the user's http handler.