Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( // see https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/resource/semantic_conventions/README.md KeyServiceNS = semconv.ServiceNamespaceKey KeyServiceName = semconv.ServiceNameKey KeyServiceInstanceID = semconv.ServiceInstanceIDKey KeyServiceVersion = semconv.ServiceVersionKey KeyHostID = semconv.HostIDKey KeyHostName = semconv.HostNameKey KeyCloudProvider = semconv.CloudProviderKey )
These keys are handled for creating hosts, graph-defs, or metrics.
Functions ¶
func InstallNewPipeline ¶
func InstallNewPipeline(opts ...Option) (*push.Controller, http.HandlerFunc, error)
InstallNewPipeline instantiates a NewExportPipeline and registers it globally.
Example (PullMode) ¶
pusher, handler, err := mackerel.InstallNewPipeline( mackerel.WithQuantiles([]float64{0.99, 0.90, 0.85}), mackerel.WithResource( mackerel.KeyHostID.String("1-2-3-4"), mackerel.KeyHostName.String("localhost"), mackerel.KeyServiceNS.String("service"), mackerel.KeyServiceName.String("role"), ), ) if err != nil { log.Fatal(err) } defer pusher.Stop() http.HandleFunc("/metrics", handler)
Output:
Example (PushMode) ¶
apiKey := os.Getenv("MACKEREL_APIKEY") pusher, _, err := mackerel.InstallNewPipeline( mackerel.WithAPIKey(apiKey), mackerel.WithQuantiles([]float64{0.99, 0.90, 0.85}), mackerel.WithResource( mackerel.KeyHostID.String("1-2-3-4"), mackerel.KeyHostName.String("localhost"), mackerel.KeyServiceNS.String("service"), mackerel.KeyServiceName.String("role"), ), ) if err != nil { log.Fatal(err) } defer pusher.Stop()
Output:
func NewExportPipeline ¶
func NewExportPipeline(opts ...Option) (*push.Controller, http.HandlerFunc, error)
NewExportPipeline sets up a complete export pipeline.
Types ¶
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter is a stats exporter that uploads data to Mackerel.
func NewExporter ¶
NewExporter creates a new Exporter.
func (*Exporter) ExportKindFor ¶ added in v0.6.0
func (e *Exporter) ExportKindFor(*metric.Descriptor, aggregation.Kind) export.ExportKind
ExportKindFor implements ExportKindSelector.
type Option ¶
type Option func(*options)
Option is function type that is passed to NewExporter function.
func WithBaseURL ¶
WithBaseURL sets base URL for Mackerel API.
func WithQuantiles ¶
WithQuantiles sets quantiles for recording measure metrics. Each quantiles must be unique and its precision must be greater or equal than 0.01.
func WithResource ¶
WithResource sets resource tags.
Notes ¶
Bugs ¶
currently, FindHosts supports seraching by CustomIdentifier only.
The pull mode don't support to post the service metrics.