Documentation
¶
Overview ¶
Proxy-Wasm Go SDK is for developers who wants to write an Proxy-Wasm plugin in Go. Proxy-Wasm(https://github.com/proxy-wasm) is the project for extending network proxies with WebAssembly modules, and this SDK can be used for building Proxy-Wasm compatible Wasm binaries easily without knowing its technical detail and specification. This SDK leverages TinyGo(https://tinygo.org) and cannnot be used with the official Go compiler toolchain.
Please visit Proxy-Wasm Spec(https://github.com/proxy-wasm), C++ SDK(https://github.com/proxy-wasm/proxy-wasm-cpp-sdk), Rust SDK(https://github.com/proxy-wasm/proxy-wasm-rust-sdk) for further references.
Overview ¶
There are two main packages in this SDK. The one is this "proxywasm" package and "types" package under /types subdirectory. proxywasm package depends on types package, and the types package contains the intefaces you are supposed to implement in order to extend your network proxies.
In types package, there are three types of these intefaces which we call "contexts". They are called RootContext, TcpContext and HttpContext, and their relationship can be described as the following diagram:
╱ TcpContext = handling each Tcp stream ╱ ╱ 1: N each plugin configuration = RootContext ╲ 1: N ╲ ╲ Http = handling each Http stream
In other words, RootContex is the parent of others, and responsible for creating Tcp and Http contexts corresponding to each streams if it is configured for running as a Http/Tcp stream plugin. Given that, RootContext is the primary interface everyone has to implement.
Here we "plugin configuration" means, for example, "http filter configuration" in Envoy proxy's terminology. That means the same Wasm VM can be run at multiple "http filter configuration" (e.g. multiple http listeners), and for each configuration, an user implemented instance of RootContext inteface is created in side the Wasm VM and used for creating corresponding stream contexts.
Please refer to types package's documentation for the detail of interfaces.
Entrypoint ¶
You must call "proxywasm.SetNewRootContextFn" in "main()" function so that the hosts (e.g. Envoy) can initialize your instances of RootContexts for each plugin configurations. E.g.
func main() { proxywasm.SetNewRootContextFn(newRootContext) } func newRootContext(uint32) types.RootContext { return &myRootContext{ ... } } type myRootContext struct { ... } // My implementations of types.RootContext interface..
Test Framework ¶
You can test your Proxy-Wasm program with the "proxytest" build tag without actually running proxies and Wasm VMs. "proxytest" package is under /proxytest subdirectory. It contains the host emulators which enables you to compile and run "go test" as usual on your native CPU.
Examples ¶
There are tens of examples here(https://github.com/tetratelabs/proxy-wasm-go-sdk/tree/main/examples), so please take a look there and get the sense of how to implement your own plugins!
Index ¶
- func AddHttpRequestHeader(key, value string) error
- func AddHttpRequestTrailer(key, value string) error
- func AddHttpResponseHeader(key, value string) error
- func AddHttpResponseTrailer(key, value string) error
- func AppendDownstreamData(data []byte) error
- func AppendHttpRequestBody(data []byte) error
- func AppendHttpResponseBody(data []byte) error
- func AppendUpstreamData(data []byte) error
- func CallForeignFunction(funcName string, param []byte) (ret []byte, err error)
- func CloseDownstream() error
- func CloseUpstream() error
- func ContinueTcpStream() error
- func DequeueSharedQueue(queueID uint32) ([]byte, error)
- func DispatchHttpCall(cluster string, headers [][2]string, body []byte, trailers [][2]string, ...) (calloutID uint32, err error)
- func EnqueueSharedQueue(queueID uint32, data []byte) error
- func GetDownstreamData(start, maxSize int) ([]byte, error)
- func GetHttpCallResponseBody(start, maxSize int) ([]byte, error)
- func GetHttpCallResponseHeaders() ([][2]string, error)
- func GetHttpCallResponseTrailers() ([][2]string, error)
- func GetHttpRequestBody(start, maxSize int) ([]byte, error)
- func GetHttpRequestHeader(key string) (string, error)
- func GetHttpRequestHeaders() ([][2]string, error)
- func GetHttpRequestTrailer(key string) (string, error)
- func GetHttpRequestTrailers() ([][2]string, error)
- func GetHttpResponseBody(start, maxSize int) ([]byte, error)
- func GetHttpResponseHeader(key string) (string, error)
- func GetHttpResponseHeaders() ([][2]string, error)
- func GetHttpResponseTrailer(key string) (string, error)
- func GetHttpResponseTrailers() ([][2]string, error)
- func GetPluginConfiguration(size int) ([]byte, error)
- func GetProperty(path []string) ([]byte, error)
- func GetSharedData(key string) (value []byte, cas uint32, err error)
- func GetUpstreamData(start, maxSize int) ([]byte, error)
- func GetVMConfiguration(size int) ([]byte, error)
- func LogCritical(msg string)
- func LogCriticalf(format string, args ...interface{})
- func LogDebug(msg string)
- func LogDebugf(format string, args ...interface{})
- func LogError(msg string)
- func LogErrorf(format string, args ...interface{})
- func LogInfo(msg string)
- func LogInfof(format string, args ...interface{})
- func LogTrace(msg string)
- func LogTracef(format string, args ...interface{})
- func LogWarn(msg string)
- func LogWarnf(format string, args ...interface{})
- func PluginDone()
- func PrependDownstreamData(data []byte) error
- func PrependHttpRequestBody(data []byte) error
- func PrependHttpResponseBody(data []byte) error
- func PrependUpstreamData(data []byte) error
- func RegisterSharedQueue(name string) (ququeID uint32, err error)
- func RemoveHttpRequestHeader(key string) error
- func RemoveHttpRequestTrailer(key string) error
- func RemoveHttpResponseHeader(key string) error
- func RemoveHttpResponseTrailer(key string) error
- func ReplaceDownstreamData(data []byte) error
- func ReplaceHttpRequestBody(data []byte) error
- func ReplaceHttpRequestHeader(key, value string) error
- func ReplaceHttpRequestHeaders(headers [][2]string) error
- func ReplaceHttpRequestTrailer(key, value string) error
- func ReplaceHttpRequestTrailers(trailers [][2]string) error
- func ReplaceHttpResponseBody(data []byte) error
- func ReplaceHttpResponseHeader(key, value string) error
- func ReplaceHttpResponseHeaders(headers [][2]string) error
- func ReplaceHttpResponseTrailer(key, value string) error
- func ReplaceHttpResponseTrailers(trailers [][2]string) error
- func ReplaceUpstreamData(data []byte) error
- func ResolveSharedQueue(vmID, queueName string) (ququeID uint32, err error)
- func ResumeHttpRequest() error
- func ResumeHttpResponse() error
- func SendHttpResponse(statusCode uint32, headers [][2]string, body []byte) error
- func SetNewRootContextFn(f func(contextID uint32) types.RootContext)
- func SetProperty(path []string, data []byte) error
- func SetSharedData(key string, data []byte, cas uint32) error
- func SetTickPeriodMilliSeconds(millSec uint32) error
- type MetricCounter
- type MetricGauge
- type MetricHistogram
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddHttpRequestHeader ¶ added in v0.0.5
AddHttpRequestHeader adds a value for given "key" of request headers. Only available during types.HttpContext.OnHttpRequestHeaders.
func AddHttpRequestTrailer ¶ added in v0.0.5
AddHttpRequestTrailer adds a value for given "key" of request trailers. Only available during types.HttpContext.OnHttpRequestTrailers.
func AddHttpResponseHeader ¶ added in v0.0.5
AddHttpResponseHeader adds a value for given "key" of response headers. Only available during types.HttpContext.OnHttpResponseHeaders.
func AddHttpResponseTrailer ¶ added in v0.0.5
AddHttpResponseTrailer adds a value for given "key" of response trailers. Only available during types.HttpContext.OnHttpResponseHeaders.
func AppendDownstreamData ¶ added in v0.2.0
AppendDownstreamData appends the given bytes to the downstream tcp data in buffered in the host. Only available during types.TcpContext.OnDownstreamData.
func AppendHttpRequestBody ¶ added in v0.2.0
AppendHttpRequestBody appends the given bytes to the http request body buffer. Only available during types.HttpContext.OnHttpRequestBody. Please note that you must remove "content-length" header during OnHttpRequestHeaders. Otherwise, the wrong content-length would be sent to the upstream, and might result in client crash.
func AppendHttpResponseBody ¶ added in v0.2.0
AppendHttpResponseBody appends the given bytes to the http response body buffer. Only available during types.HttpContext.OnHttpResponseBody. Please note that you must remove "content-length" header during OnHttpResponseHeaders. Otherwise, the wrong content-length would be sent to the upstream, and might result in client crash.
func AppendUpstreamData ¶ added in v0.2.0
AppendUpstreamData appends the given bytes to the upstream tcp data in buffered in the host. Only available during types.TcpContext.OnUpstreamData.
func CallForeignFunction ¶ added in v0.2.0
CallForeignFunction calls a foreign function of given funcName defined by host implementations. Foreign functions are host specific functions so please refer to the doc of your host implementation for detail.
func CloseDownstream ¶ added in v0.2.0
func CloseDownstream() error
CloseDownstream closes the downstream tcp connection for this Tcp context. Only available for types.TcpContext.
func CloseUpstream ¶ added in v0.2.0
func CloseUpstream() error
CloseUpstream closes the upstream tcp connection for this Tcp context. Only available for types.TcpContext.
func ContinueTcpStream ¶ added in v0.3.0
func ContinueTcpStream() error
ContinueTcpStream continues interating on the tcp connection after types.Action.Pause was returned by types.TcpContext. Only available for types.TcpContext.
func DequeueSharedQueue ¶ added in v0.0.5
DequeueSharedQueue dequeues an data from the shared queue of the given queueID. In order to get queue id for a target queue, use "ResolveSharedQueue" first.
func DispatchHttpCall ¶ added in v0.0.5
func DispatchHttpCall( cluster string, headers [][2]string, body []byte, trailers [][2]string, timeoutMillisecond uint32, callBack func(numHeaders, bodySize, numTrailers int), ) (calloutID uint32, err error)
DispatchHttpCall is for dipatching http calls to a remote cluster. This can be used by all contexts including Tcp and Root contexts. "cluster" arg specifies the remote cluster the host will send the request against with "headers", "body", "trailers" arguments. If the host successfully made the request and recevived the response from the remote cluster, then "callBack" function is called. During callBack is called, "GetHttpCallResponseHeaders", "GetHttpCallResponseBody", "GetHttpCallResponseTrailers" calls are available for accessing the response information.
func EnqueueSharedQueue ¶ added in v0.0.5
EnqueueSharedQueue enqueues an data to the shared queue of the given queueID. In order to get queue id for a target queue, use "ResolveSharedQueue" first.
func GetDownstreamData ¶ added in v0.2.0
GetDownstreamData can be used for retrieving tcp downstream data in buffered in the host. Returned bytes begining from "start" to "start" +"maxSize" in the buffer. Only available during types.TcpContext.OnDownstreamData.
func GetHttpCallResponseBody ¶ added in v0.0.5
GetHttpCallResponseBody is used for retrieving http response body returned by a remote cluster in reponse to the DispatchHttpCall. Only available during "callback" function passed to DispatchHttpCall.
func GetHttpCallResponseHeaders ¶ added in v0.0.5
GetHttpCallResponseHeaders is used for retrieving http response headers returned by a remote cluster in reponse to the DispatchHttpCall. Only available during "callback" function passed to DispatchHttpCall.
func GetHttpCallResponseTrailers ¶ added in v0.0.5
GetHttpCallResponseTrailers is used for retrieving http response trailers returned by a remote cluster in reponse to the DispatchHttpCall. Only available during "callback" function passed to DispatchHttpCall.
func GetHttpRequestBody ¶ added in v0.0.5
GetHttpRequestBody is used for retrieving the entire http request body. Only available during types.HttpContext.OnHttpRequestBody.
func GetHttpRequestHeader ¶ added in v0.0.5
GetHttpRequestHeader is used for retrieving a http request header value for given "key". Only available during types.HttpContext.OnHttpRequestHeaders and types.HttpContext.OnHttpStreamDone. If multiple values are present for the key, the "first" value found in the host is returned. See https://github.com/envoyproxy/envoy/blob/72bf41fb0ecc039f196be02f534bfc2c9c69f348/source/extensions/common/wasm/context.cc#L762-L763 for detail.
func GetHttpRequestHeaders ¶ added in v0.0.5
GetHttpRequestHeaders is used for retrieving http request headers. Only available during types.HttpContext.OnHttpRequestHeaders and types.HttpContext.OnHttpStreamDone.
func GetHttpRequestTrailer ¶ added in v0.0.5
GetHttpRequestTrailer is used for retrieving a http request trailer value for given "key". Only available during types.HttpContext.OnHttpRequestTrailers and types.HttpContext.OnHttpStreamDone. If multiple values are present for the key, the "first" value found in the host is returned. See https://github.com/envoyproxy/envoy/blob/72bf41fb0ecc039f196be02f534bfc2c9c69f348/source/extensions/common/wasm/context.cc#L762-L763 for detail.
func GetHttpRequestTrailers ¶ added in v0.0.5
GetHttpRequestTrailers is used for retrieving http request trailers. Only available during types.HttpContext.OnHttpRequestTrailers and types.HttpContext.OnHttpStreamDone.
func GetHttpResponseBody ¶ added in v0.0.5
GetHttpResponseBody is used for retrieving the entire http response body. Only available during types.HttpContext.OnHttpResponseBody.
func GetHttpResponseHeader ¶ added in v0.0.5
GetHttpResponseHeader is used for retrieving a http response header value for given "key". Only available during types.HttpContext.OnHttpResponseHeaders and types.HttpContext.OnHttpStreamDone. If multiple values are present for the key, the "first" value found in the host is returned. See https://github.com/envoyproxy/envoy/blob/72bf41fb0ecc039f196be02f534bfc2c9c69f348/source/extensions/common/wasm/context.cc#L762-L763 for detail.
func GetHttpResponseHeaders ¶ added in v0.0.5
GetHttpResponseHeaders is used for retrieving http response headers. Only available during types.HttpContext.OnHttpResponseHeaders and types.HttpContext.OnHttpStreamDone.
func GetHttpResponseTrailer ¶ added in v0.0.5
GetHttpResponseTrailer is used for retrieving a http response trailer value for given "key". Only available during types.HttpContext.OnHttpResponseTrailers and types.HttpContext.OnHttpStreamDone. If multiple values are present for the key, the "first" value found in the host is returned. See https://github.com/envoyproxy/envoy/blob/72bf41fb0ecc039f196be02f534bfc2c9c69f348/source/extensions/common/wasm/context.cc#L762-L763 for detail.
func GetHttpResponseTrailers ¶ added in v0.0.5
GetHttpResponseTrailers is used for retrieving http response trailers. Only available during types.HttpContext.OnHttpResponseTrailers and types.HttpContext.OnHttpStreamDone.
func GetPluginConfiguration ¶ added in v0.0.5
GetPluginConfiguration is used for retrieving configurations ginve in the "config.configuration" field. This hostcall is only available during types.RootContext.OnPluginStart call. "size" argument specifies homw many bytes you want to read. Set it to "pluginConfigurationSize" given in OnVMStart.
func GetProperty ¶ added in v0.0.5
GetProperty is used for retrieving property/metadata in the host for a given path.
func GetSharedData ¶ added in v0.0.5
GetSharedData is used for retrieving the value for given "key". Returned "cas" is be used for SetSharedData on that key.
func GetUpstreamData ¶ added in v0.0.5
GetDownstreamData can be used for retrieving upstream tcp data in buffered in the host. Returned bytes begining from "start" to "start" +"maxSize" in the buffer. Only available during types.TcpContext.OnUpstreamData.
func GetVMConfiguration ¶ added in v0.0.5
GetVMConfiguration is used for retrieving configurations ginve in the "vm_config.configuration" field. This hostcall is only available during types.RootContext.OnVMStart call. "size" argument specifies homw many bytes you want to read. Set it to "vmConfigurationSize" given in OnVMStart.
func LogCritical ¶
func LogCritical(msg string)
func LogCriticalf ¶ added in v0.0.4
func LogCriticalf(format string, args ...interface{})
func PluginDone ¶ added in v0.3.0
func PluginDone()
PluginDone must be callsed when OnPluginDone returns false indicating that the plugin is in pending state right before deletion by hosts. Only available for types.RootContext.
func PrependDownstreamData ¶ added in v0.2.0
PrependDownstreamData prepends the given bytes to the downstream tcp data in buffered in the host. Only available during types.TcpContext.OnDownstreamData.
func PrependHttpRequestBody ¶ added in v0.2.0
PrependHttpRequestBody prepends the given bytes to the http request body buffer. Only available during types.HttpContext.OnHttpRequestBody. Please note that you must remove "content-length" header during OnHttpRequestHeaders. Otherwise, the wrong content-length would be sent to the upstream, and might result in client crash.
func PrependHttpResponseBody ¶ added in v0.2.0
PrependHttpResponseBody prepends the given bytes to the http response body buffer. Only available during types.HttpContext.OnHttpResponseBody. Please note that you must remove "content-length" header during OnHttpResponseHeaders. Otherwise, the wrong content-length would be sent to the upstream, and might result in client crash.
func PrependUpstreamData ¶ added in v0.2.0
PrependUpstreamData prepends the given bytes to the upstream tcp data in buffered in the host. Only available during types.TcpContext.OnUpstreamData.
func RegisterSharedQueue ¶ added in v0.0.5
RegisterSharedQueue registers the shared queue on this root context. "Register" means that OnQueueReady is called for this root context whenever a new item is enqueued on that queueID. Only available for types.RootContext. The returned ququeID can be used for Enqueue/DequeueSharedQueue. Note that "name" must be unique across all Wasm VMs which share a same "vm_id". That means you can use "vm_id" can be used for separating shared queue namespace.
func RemoveHttpRequestHeader ¶ added in v0.0.5
GetHttpRequestHeader is used for retrieving a http request header value for given "key". Only available during types.HttpContext.OnHttpRequestHeaders.
func RemoveHttpRequestTrailer ¶ added in v0.0.5
RemoveHttpRequestTrailer removes all the values for given "key" from request trailers. Only available during types.HttpContext.OnHttpRequestTrailers.
func RemoveHttpResponseHeader ¶ added in v0.0.5
RemoveHttpResponseHeader removes all the values for given "key" from response headers. Only available during types.HttpContext.OnHttpResponseHeaders.
func RemoveHttpResponseTrailer ¶ added in v0.0.5
RemoveHttpResponseTrailer removes all the values for given "key" from response trailers. Only available during types.HttpContext.OnHttpResponseTrailers.
func ReplaceDownstreamData ¶ added in v0.2.0
ReplaceDownstreamData replaces the downstream tcp data in buffered in the host with the given bytes. Only available during types.TcpContext.OnDownstreamData.
func ReplaceHttpRequestBody ¶ added in v0.2.0
ReplaceHttpRequestBody replaces the http request body buffer with the given bytes. Only available during types.HttpContext.OnHttpRequestBody. Please note that you must remove "content-length" header during OnHttpRequestHeaders. Otherwise, the wrong content-length would be sent to the upstream, and might result in client crash, if the size of the data differs from the original one.
func ReplaceHttpRequestHeader ¶ added in v0.3.0
ReplaceHttpRequestHeader replaces a value for given "key" from request headers. Only available during types.HttpContext.OnHttpRequestHeaders. If multiple values are present for the key, only the "first" value in the host is replaced. See https://github.com/envoyproxy/envoy/blob/72bf41fb0ecc039f196be02f534bfc2c9c69f348/envoy/http/header_map.h#L547-L549 for detail.
func ReplaceHttpRequestHeaders ¶ added in v0.3.0
ReplaceHttpRequestHeaders is used for replacing http request headers with given headers. Only available during types.HttpContext.OnHttpRequestHeaders.
func ReplaceHttpRequestTrailer ¶ added in v0.3.0
ReplaceHttpRequestTrailer replaces a value for given "key" from request trailers. Only available during types.HttpContext.OnHttpRequestTrailers. If multiple values are present for the key, only the "first" value in the host is replaced. See https://github.com/envoyproxy/envoy/blob/72bf41fb0ecc039f196be02f534bfc2c9c69f348/envoy/http/header_map.h#L547-L549 for detail.
func ReplaceHttpRequestTrailers ¶ added in v0.3.0
ReplaceHttpRequestTrailers is used for replacing http request trailers with given headers. Only available during types.HttpContext.OnHttpRequestTrailers.
func ReplaceHttpResponseBody ¶ added in v0.2.0
ReplaceHttpResponseBody replaces the http response body buffer with the given bytes. Only available during types.HttpContext.OnHttpResponseBody. Please note that you must remove "content-length" header during OnHttpResponseHeaders. Otherwise, the wrong content-length would be sent to the upstream, and might result in client crash if the size of the data differs from the original one.
func ReplaceHttpResponseHeader ¶ added in v0.3.0
ReplaceHttpResponseHeader replaces a value for given "key" from response headers. Only available during types.HttpContext.OnHttpResponseHeaders. If multiple values are present for the key, only the "first" value in the host is replaced. See https://github.com/envoyproxy/envoy/blob/72bf41fb0ecc039f196be02f534bfc2c9c69f348/envoy/http/header_map.h#L547-L549 for detail.
func ReplaceHttpResponseHeaders ¶ added in v0.3.0
ReplaceHttpResponseHeaders is used for replacing http response headers with given headers. Only available during types.HttpContext.OnHttpResponseHeaders.
func ReplaceHttpResponseTrailer ¶ added in v0.3.0
ReplaceHttpResponseHeader replaces a value for given "key" from response trailers. Only available during types.HttpContext.OnHttpResponseHeaders. If multiple values are present for the key, only the "first" value in the host is replaced. See https://github.com/envoyproxy/envoy/blob/72bf41fb0ecc039f196be02f534bfc2c9c69f348/envoy/http/header_map.h#L547-L549 for detail.
func ReplaceHttpResponseTrailers ¶ added in v0.3.0
ReplaceHttpResponseTrailers is used for replacing http response trailers with given headers. Only available during types.HttpContext.OnHttpResponseTrailers.
func ReplaceUpstreamData ¶ added in v0.2.0
ReplaceUpstreamData replaces the upstream tcp data in buffered in the host with the given bytes. Only available during types.TcpContext.OnUpstreamData.
func ResolveSharedQueue ¶ added in v0.0.5
ResolveSharedQueue acquires the queueID for the given vm_id and queue name. The returned ququeID can be used for Enqueue/DequeueSharedQueue.
func ResumeHttpRequest ¶ added in v0.0.5
func ResumeHttpRequest() error
ResumeHttpRequest can be used for resuming Http request processing which is stopped after returning types.Action.Pause. Only available during types.HttpContext.
func ResumeHttpResponse ¶ added in v0.0.5
func ResumeHttpResponse() error
ResumeHttpResponse can be used for resuming Http response processing which is stopped after returning types.Action.Pause. Only available during types.HttpContext.
func SendHttpResponse ¶ added in v0.0.5
SendHttpResponse sends a http response to the downstream with given information (headers, statuscode, body). This call cannot be used outside types.HttpContext otherwise an error should be returned. Also please note that this cannot be used after types.HttpContext.OnHttpResponseHeaders returns Continue since in that case, the response headers may have already arrived at the downstream and there is no way to override the already sent headers.
func SetNewRootContextFn ¶ added in v0.3.0
func SetNewRootContextFn(f func(contextID uint32) types.RootContext)
SetNewRootContextFn is the entrypoint for setting up this entire Wasm VM. The given function is responsible for creating types.RootContext and is called when the host initializes a plugin for each plugin configuration. Please make sure that this entrypoint be called during "main()" function, otherwise this VM would fail.
func SetProperty ¶ added in v0.0.5
SetProperty is used for setting property/metadata in the host for a given path.
func SetSharedData ¶ added in v0.0.5
SetSharedData is used for seting key-value pairs in the shared data storage which is defined per "vm_config.vm_id" in the hosts. ErrorStatusNotFound will be returned when a given CAS value is mismatched with the current value. That indicates that other Wasm VMs has already succeeded to set a value on the same key and the current CAS for the key is incremented. Having retry logic in the face of this error is recommended.
func SetTickPeriodMilliSeconds ¶ added in v0.0.5
SetTickPeriodMilliSeconds sets the tick interval of types.RootContext.OnTick calls. Only available for types.RootContext.
Types ¶
type MetricCounter ¶
type MetricCounter uint32
func DefineCounterMetric ¶
func DefineCounterMetric(name string) MetricCounter
func (MetricCounter) Get ¶
func (m MetricCounter) Get() uint64
func (MetricCounter) ID ¶
func (m MetricCounter) ID() uint32
func (MetricCounter) Increment ¶
func (m MetricCounter) Increment(offset uint64)
type MetricGauge ¶
type MetricGauge uint32
func DefineGaugeMetric ¶
func DefineGaugeMetric(name string) MetricGauge
func (MetricGauge) Add ¶
func (m MetricGauge) Add(offset int64)
func (MetricGauge) Get ¶
func (m MetricGauge) Get() int64
func (MetricGauge) ID ¶
func (m MetricGauge) ID() uint32
type MetricHistogram ¶
type MetricHistogram uint32
func DefineHistogramMetric ¶
func DefineHistogramMetric(name string) MetricHistogram
func (MetricHistogram) Get ¶
func (m MetricHistogram) Get() uint64
func (MetricHistogram) ID ¶
func (m MetricHistogram) ID() uint32
func (MetricHistogram) Record ¶
func (m MetricHistogram) Record(value uint64)