agent

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

Agent is the agent entry.

func New

func New(config *Config) (*Agent, error)

New creates an agent.

func NewWithOptions

func NewWithOptions(options ...ConfigOption) (*Agent, error)

NewWithOptions returns a new Agent.

func (*Agent) GetPlugin

func (a *Agent) GetPlugin(name string) plugins.Plugin

GetPlugin gets Plugin by name

func (*Agent) ServeHTTP

func (a *Agent) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP invokes every plugin which is http.Handler to handle the request. NOTE: If the request is not matched for your plugin, don't do anything.

func (*Agent) WrapHTTPRequest

func (a *Agent) WrapHTTPRequest(parent context.Context, req *http.Request) *http.Request

WrapHTTPRequest wraps the request with the parent conext from every enabled plugin.

func (*Agent) WrapUserClient

func (a *Agent) WrapUserClient(httpDoer plugins.HTTPDoer) plugins.HTTPDoer

WrapUserClient wraps the client with the wrap functions from every enabled plugin.

func (*Agent) WrapUserHandler

func (a *Agent) WrapUserHandler(handler http.Handler) http.Handler

WrapUserHandler wraps the handler with the wrap functions from every enabled plugin.

func (*Agent) WrapUserHandlerFunc

func (a *Agent) WrapUserHandlerFunc(handlerFunc http.HandlerFunc) http.HandlerFunc

WrapUserHandlerFunc wraps the handlerFunc with the wrap functions from every plugin.

type Config

type Config struct {
	Address string         `json:"address"`
	Plugins []plugins.Spec `json:"plugins"`
}

Config is the Agent config.

type ConfigOption

type ConfigOption func(c *Config)

ConfigOption allows for functional options to adjust behavior and payload of the Config to be created with agent.Agent().

func WithAddress

func WithAddress(address string) ConfigOption

WithAddress Sets address to Config. @param address string agent http api address @return ConfigOption

func WithEaseMeshYAML

func WithEaseMeshYAML(yamlFile string) ConfigOption

WithZipkinYAML Append easemesh spec load from yaml file to the Agent Plugin Spec. @param yamlFile string yaml file path. use yamlFile="" is use easemesh.DefaultSpec() for @return ConfigOption

func WithSpec

func WithSpec(spec plugins.Spec) ConfigOption

WithSpec Append spec the Agent Plugin Spec. @param spec plugins.Spec @return ConfigOption

func WithYAML

func WithYAML(yamlFile string, localHostPort string) ConfigOption

WithYAML sets address, Append health, easemesh and zipkin spec load from yaml file to the Agent Plugin Spec. @param yamlFile string yaml file path. use yamlFile="" is use easemesh.DefaultSpec() and Console Reporter for tracing. @param localHostPort string host and port of the tracer Span.localEndpoint.

By default, use localHostPort="" is not sets host and port of Span.localEndpoint.

@return ConfigOption

func WithZipkinTags

func WithZipkinTags(tags map[string]string) ConfigOption

WithZipkinTags sets tags of Zipkin Plugin Spec @param tags the Span tags of tracing

func WithZipkinYAML

func WithZipkinYAML(yamlFile string, localHostPort string) ConfigOption

WithZipkinYAML Append zipkin spec load from yaml file to the Agent Plugin Spec.

sets host and port of the tracer Span.localEndpoint.

@param yamlFile string yaml file path. use yamlFile="" is Console Reporter for tracing. @param localHostPort string host and port of the tracer Span.localEndpoint.

By default, use localHostPort="" is not sets host and port of Span.localEndpoint.

@return ConfigOption

type HandlerWrapper

type HandlerWrapper struct {
	// contains filtered or unexported fields
}

HandlerWrapper is the HTTP handler wrapper.

func (*HandlerWrapper) ServeHTTP

func (h *HandlerWrapper) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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