Documentation ¶
Index ¶
- Variables
- func HandleRequest(config *Config, r *http.Request, toProxy, toLoadBalancer chan *Span) (int, int, error)
- func Listen(terminate chan os.Signal, config *Config, started chan bool)
- func NormalizeURL(raw string) string
- func Proxy(proxyChannel, toLoadBalancer chan *Span, config *Config)
- func SetLogger(logger *logging.Logger)
- type Chain
- type Config
- type Document
- type ESBulkRequest
- type ESBulkService
- type ESClient
- type HTTPClient
- type Span
- type SpanAnnotations
- type SpanMap
- type SpanTimeline
- type SpanTimestamp
- type Trace
- type TraceMap
Constants ¶
This section is empty.
Variables ¶
var ESClientFactory = newESClient
ESClientFactory is a factory to create ESClient
Functions ¶
func HandleRequest ¶
func HandleRequest(config *Config, r *http.Request, toProxy, toLoadBalancer chan *Span) (int, int, error)
HandleRequest parse json body and send it to elasticsearch channel
func NormalizeURL ¶
NormalizeURL tries to parse raw url and replace hex sequenses with <hex>
Types ¶
type Chain ¶
type Chain struct { Path string `json:"path"` Prefix string `json:"prefix"` Level int `json:"level"` Duration int64 `json:"duration"` }
Chain struct
type Config ¶
type Config struct { Enable bool `yaml:"enable"` Address string `yaml:"address"` MaxActiveRequests int64 `yaml:"max_active_requests"` ElasticSearch []string `yaml:"elasticsearch"` BulkSize int `yaml:"bulk_size"` Sampling uint64 `yaml:"sampling"` Replicas []string `yaml:"replicas"` MyReplicaIndex int `yaml:"my_replica_index"` MinTTL int `yaml:"min_ttl"` MaxTTL int `yaml:"max_ttl"` }
Config settings
type ESBulkRequest ¶
type ESBulkRequest interface { Index(name string) ESBulkRequest Type(name string) ESBulkRequest Doc(doc interface{}) ESBulkRequest }
ESBulkRequest is the interface for elasticsearch bulk request
type ESBulkService ¶
type ESBulkService interface { Add(ESBulkRequest) ESBulkService Do() (*elastic.BulkResponse, error) }
ESBulkService is the interface for elasticsearch bulk service
type ESClient ¶
type ESClient interface { Bulk() ESBulkService NewBulkIndexRequest() ESBulkRequest }
ESClient is the interface for elasticsearch client
type HTTPClient ¶
HTTPClient is client to send proxy requests
var ProxyClient HTTPClient = &realHTTPClient{ client: &http.Client{ Timeout: time.Second * 5, }, }
ProxyClient implementing HTTPClient interface
type Span ¶
type Span struct { System string TraceID string ProfileID string ParentSpanID string ID string `json:"spanid"` Annotations SpanAnnotations Timeline SpanTimeline Revision int Prefix string TraceHashSum uint64 RawString string }
Span struct
func (*Span) CalculateTraceHashSum ¶
func (span *Span) CalculateTraceHashSum()
CalculateTraceHashSum calculates hash sum for trace id
type SpanAnnotations ¶
type SpanAnnotations map[string]interface{}
SpanAnnotations is map[string]interface{}
type SpanTimeline ¶
type SpanTimeline map[string]SpanTimestamp
SpanTimeline is map[string]SpanTimestamp
type SpanTimestamp ¶
SpanTimestamp struct
func (*SpanTimestamp) UnmarshalJSON ¶
func (st *SpanTimestamp) UnmarshalJSON(bytes []byte) (err error)
UnmarshalJSON implements json.Unmarshaler interface
type Trace ¶
type Trace struct { ID string Roots SpanMap Children map[string]SpanMap Spans SpanMap Timestamp time.Time ProfileID string Root *Span Completed bool }
Trace struct
func (*Trace) GetESDocuments ¶
GetESDocuments returns document for elasticsearch