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 = standard.ServiceNamespaceKey KeyServiceName = standard.ServiceNameKey KeyServiceInstanceID = standard.ServiceInstanceIDKey KeyServiceVersion = standard.ServiceVersionKey KeyHostID = standard.HostIDKey KeyHostName = standard.HostNameKey KeyCloudProvider = standard.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.
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 ¶ added in v1.2.0
WithResource sets resource tags.
Notes ¶
Bugs ¶
currently, FindHosts supports seraching by CustomIdentifier only.
The pull mode don't support to post the service metrics.