apminsight-server-sdk-go

module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: Apache-2.0

README

APMInsight Server SDK Golang

Installation

Get the code with:

go get github.com/volcengine/apminsight-server-sdk-go

recommend go >= 1.13.1

Usage

see CODE EXAMPLE

Build Client

create a new client:

client := metrics.NewMetricClient(metrics.WithPrefix("your metric common prefix"))
client.Close()

or init with default client:

metrics.Init(metrics.WithPrefix("your metric common prefix"))
metrics.Close()
Metrics

emit with your client

//without tags
client.EmitCounter("example_counter_metric", 1, nil)
client.EmitTimer("example_timer_metric", 1000, nil)
client.EmitGauge("example_gauge_metric", 100, nil)

//with tags
tags := map[string]string{
    "tagKey": "tagValue",
}
client.EmitCounter("example_counter_metric", 1, tags)
client.EmitTimer("example_timer_metric", 1000, tags)
client.EmitGauge("example_gauge_metric", 100, tags)

or emit with default client

//without tags
metrics.EmitCounter("example_counter_metric", 1, nil)
metrics.EmitTimer("example_timer_metric", 1000, nil)
metrics.EmitGauge("example_gauge_metric", 100, nil)

//with tags
tags := map[string]string{
    "tagKey": "tagValue",
}
metrics.EmitCounter("example_counter_metric", 1, tags)
metrics.EmitTimer("example_timer_metric", 1000, tags)
metrics.EmitGauge("example_gauge_metric", 100, tags)
Configuration

you can config client with metrics.WithXXX(value)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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