xfer

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2015 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ScopeProbeIDHeader = "X-Scope-Probe-ID"

ScopeProbeIDHeader is the header we use to carry the probe's unique ID. The ID is currently set to the probe's hostname. It's designed to deduplicate reports from the same probe to the same receiver, in case the probe is configured to publish to multiple receivers that resolve to the same app.

Variables

View Source
var (
	// AppPort is the default port that the app will use for its HTTP server.
	// The app publishes the API and user interface, and receives reports from
	// probes, on this port.
	AppPort = 4040
)

Functions

func AuthorizationHeader added in v0.6.0

func AuthorizationHeader(token string) string

AuthorizationHeader returns a value suitable for an HTTP Authorization header, based on the passed token string.

Types

type Adder added in v0.6.0

type Adder interface {
	Add(report.Report)
}

Adder is something that can accept reports. It's a convenient interface for parts of the app, and several experimental components.

type BackgroundPublisher added in v0.7.0

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

BackgroundPublisher is a publisher which does the publish asynchronously. It will only do one publish at once; if there is an ongoing publish, concurrent publishes are dropped.

func NewBackgroundPublisher added in v0.7.0

func NewBackgroundPublisher(p Publisher) *BackgroundPublisher

NewBackgroundPublisher creates a new BackgroundPublisher with the given publisher

func (*BackgroundPublisher) Publish added in v0.7.0

func (bp *BackgroundPublisher) Publish(r io.Reader) error

Publish implements Publisher

func (*BackgroundPublisher) Stop added in v0.7.0

func (bp *BackgroundPublisher) Stop()

Stop implements Publisher

type Collector

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

Collector receives published reports from multiple producers. It yields a single merged report, representing all collected reports.

func NewCollector

func NewCollector(window time.Duration) *Collector

NewCollector returns a collector ready for use.

func (*Collector) Add added in v0.3.0

func (c *Collector) Add(rpt report.Report)

Add adds a report to the collector's internal state. It implements Adder.

func (*Collector) Report added in v0.6.0

func (c *Collector) Report() report.Report

Report returns a merged report over all added reports. It implements Reporter.

type HTTPPublisher added in v0.6.0

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

HTTPPublisher publishes buffers by POST to a fixed endpoint.

func NewHTTPPublisher added in v0.6.0

func NewHTTPPublisher(target, token, probeID string) (string, *HTTPPublisher, error)

NewHTTPPublisher returns an HTTPPublisher ready for use.

func (HTTPPublisher) Publish added in v0.6.0

func (p HTTPPublisher) Publish(r io.Reader) error

Publish publishes the report to the URL.

func (HTTPPublisher) Stop added in v0.7.0

func (p HTTPPublisher) Stop()

Stop implements Publisher

func (HTTPPublisher) String added in v0.7.0

func (p HTTPPublisher) String() string

type MultiPublisher added in v0.6.0

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

MultiPublisher implements publisher over a collection of heterogeneous targets. See documentation of each method to understand the semantics.

func NewMultiPublisher added in v0.6.0

func NewMultiPublisher(factory func(endpoint string) (string, Publisher, error)) *MultiPublisher

NewMultiPublisher returns a new MultiPublisher ready for use.

func (*MultiPublisher) Delete added in v0.8.0

func (p *MultiPublisher) Delete(target string)

Delete removes all endpoints that match the given target.

func (*MultiPublisher) Publish added in v0.6.0

func (p *MultiPublisher) Publish(r io.Reader) error

Publish implements Publisher by publishing the reader to all of the underlying publishers sequentially. To do that, it needs to drain the reader, and recreate new readers for each publisher. Note that it will publish to one endpoint for each unique ID. Failed publishes don't count.

func (*MultiPublisher) Set added in v0.8.0

func (p *MultiPublisher) Set(target string, endpoints []string)

Set declares that the target (DNS name) resolves to the provided endpoints (IPs), and that we want to publish to each of those endpoints. Set replaces any existing publishers to the given target. Set invokes the factory method to convert each endpoint to a publisher, and to get the remote receiver's unique ID.

func (*MultiPublisher) Stop added in v0.7.0

func (p *MultiPublisher) Stop()

Stop invokes stop on all underlying publishers and removes them.

type Publisher

type Publisher interface {
	Publish(io.Reader) error
	Stop()
}

Publisher is something which can send a stream of data somewhere, probably to a remote collector.

type ReportPublisher added in v0.7.0

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

A ReportPublisher uses a buffer pool to serialise reports, which it then passes to a publisher

func NewReportPublisher added in v0.7.0

func NewReportPublisher(publisher Publisher) *ReportPublisher

NewReportPublisher creates a new report publisher

func (*ReportPublisher) Publish added in v0.7.0

func (p *ReportPublisher) Publish(r report.Report) error

Publish serialises and compresses a report, then passes it to a publisher

type Reporter added in v0.6.0

type Reporter interface {
	Report() report.Report
}

Reporter is something that can produce reports on demand. It's a convenient interface for parts of the app, and several experimental components.

Jump to

Keyboard shortcuts

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