Documentation ¶
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 DispatchRedisCall(cluster string, query []byte, callBack func(status, responseSize int)) (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() ([]byte, error)
- func GetProperty(path []string) ([]byte, error)
- func GetPropertyMap(path []string) ([][2]string, error)
- func GetRedisCallResponse(start, maxSize int) ([]byte, error)
- func GetSharedData(key string) (value []byte, cas uint32, err error)
- func GetUpstreamData(start, maxSize int) ([]byte, error)
- func GetVMConfiguration() ([]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 RedisInit(cluster string, username string, password string, timeout uint32) (err error)
- func RegisterSharedQueue(name string) (queueID 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) (queueID uint32, err error)
- func ResumeHttpRequest() error
- func ResumeHttpResponse() error
- func SendHttpResponse(statusCode uint32, headers [][2]string, body []byte, gRPCStatus int32) error
- func SendHttpResponseWithDetail(statusCode uint32, statusCodeDetailData string, headers [][2]string, ...) error
- func SetEffectiveContext(contextID uint32) error
- func SetProperty(path []string, data []byte) error
- func SetSharedData(key string, data []byte, cas uint32) error
- func SetTickPeriodMilliSeconds(millSec uint32) error
- func SetVMContext(ctx types.VMContext)
- type MetricCounter
- type MetricGauge
- type MetricHistogram
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddHttpRequestHeader ¶
AddHttpRequestHeader adds a value for given "key" to the request headers. Only available during types.HttpContext.OnHttpRequestHeaders.
func AddHttpRequestTrailer ¶
AddHttpRequestTrailer adds a value for given "key" to the request trailers. Only available during types.HttpContext.OnHttpRequestTrailers.
func AddHttpResponseHeader ¶
AddHttpResponseHeader adds a value for a given "key" to the response headers. Only available during types.HttpContext.OnHttpResponseHeaders.
func AddHttpResponseTrailer ¶
AddHttpResponseTrailer adds a value for given "key" to the response trailers. Only available during types.HttpContext.OnHttpResponseHeaders.
func AppendDownstreamData ¶
AppendDownstreamData appends the given bytes to the downstream TCP data buffered in the host. Only available during types.TcpContext.OnDownstreamData.
func AppendHttpRequestBody ¶
AppendHttpRequestBody appends the given bytes to the HTTP request body buffer. Only available during types.HttpContext.OnHttpRequestBody. Please note that you must remove the "content-length" header during OnHttpRequestHeaders. Otherwise, the wrong content-length is sent to the upstream and that might result in a client crash.
func AppendHttpResponseBody ¶
AppendHttpResponseBody appends the given bytes to the HTTP response body buffer. Only available during types.HttpContext.OnHttpResponseBody. Please note that you must remove the "content-length" header during OnHttpResponseHeaders. Otherwise, the wrong content-length is sent to the upstream and that might result in client crash.
func AppendUpstreamData ¶
AppendUpstreamData appends the given bytes to the upstream TCP data buffered in the host. Only available during types.TcpContext.OnUpstreamData.
func CallForeignFunction ¶
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 ¶
func CloseDownstream() error
CloseDownstream closes the downstream TCP connection for this Tcp context. Only available for types.TcpContext.
func CloseUpstream ¶
func CloseUpstream() error
CloseUpstream closes the upstream TCP connection for this Tcp context. Only available for types.TcpContext.
func ContinueTcpStream ¶
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 ¶
DequeueSharedQueue dequeues data from the shared queue of the given queueID. In order to get queue id for a target queue, use "ResolveSharedQueue" first.
func DispatchHttpCall ¶
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 dispatching 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", and "trailers" arguments. "callBack" function is called if the host successfully made the request and received the response from the remote cluster. When the callBack function is called, the "GetHttpCallResponseHeaders", "GetHttpCallResponseBody", "GetHttpCallResponseTrailers" calls are available for accessing the response information.
func DispatchRedisCall ¶
func EnqueueSharedQueue ¶
EnqueueSharedQueue enqueues data to the shared queue of the given queueID. In order to get queue id for a target queue, use "ResolveSharedQueue" first.
func GetDownstreamData ¶
GetDownstreamData can be used for retrieving TCP downstream data buffered in the host. Returned bytes beginning from "start" to "start" + "maxSize" in the buffer. Only available during types.TcpContext.OnDownstreamData.
func GetHttpCallResponseBody ¶
GetHttpCallResponseBody is used for retrieving HTTP response body returned by a remote cluster in response to the DispatchHttpCall. Only available during "callback" function passed to the DispatchHttpCall.
func GetHttpCallResponseHeaders ¶
GetHttpCallResponseHeaders is used for retrieving HTTP response headers returned by a remote cluster in response to the DispatchHttpCall. Only available during "callback" function passed to the DispatchHttpCall.
func GetHttpCallResponseTrailers ¶
GetHttpCallResponseTrailers is used for retrieving HTTP response trailers returned by a remote cluster in response to the DispatchHttpCall. Only available during "callback" function passed to DispatchHttpCall.
func GetHttpRequestBody ¶
GetHttpRequestBody is used for retrieving the entire HTTP request body. Only available during types.HttpContext.OnHttpRequestBody.
func GetHttpRequestHeader ¶
GetHttpRequestHeader is used for retrieving an 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 ¶
GetHttpRequestHeaders is used for retrieving HTTP request headers. Only available during types.HttpContext.OnHttpRequestHeaders and types.HttpContext.OnHttpStreamDone.
func GetHttpRequestTrailer ¶
GetHttpRequestTrailer is used for retrieving 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 ¶
GetHttpRequestTrailers is used for retrieving HTTP request trailers. Only available during types.HttpContext.OnHttpRequestTrailers and types.HttpContext.OnHttpStreamDone.
func GetHttpResponseBody ¶
GetHttpResponseBody is used for retrieving the entire HTTP response body. Only available during types.HttpContext.OnHttpResponseBody.
func GetHttpResponseHeader ¶
GetHttpResponseHeader is used for retrieving an HTTP response header value for a 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 ¶
GetHttpResponseHeaders is used for retrieving HTTP response headers. Only available during types.HttpContext.OnHttpResponseHeaders and types.HttpContext.OnHttpStreamDone.
func GetHttpResponseTrailer ¶
GetHttpResponseTrailer is used for retrieving an HTTP response trailer value for a 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 ¶
GetHttpResponseTrailers is used for retrieving HTTP response trailers. Only available during types.HttpContext.OnHttpResponseTrailers and types.HttpContext.OnHttpStreamDone.
func GetPluginConfiguration ¶
GetPluginConfiguration is used for retrieving configurations given in the "config.configuration" field. This hostcall is only available during types.PluginContext.OnPluginStart call.
func GetProperty ¶
GetProperty is used for retrieving property/metadata in the host for a given path. Available path and properties depend on the host implementation. For Envoy, please refer to https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/advanced/attributes
Note: if the target property is map-type, use GetPropertyMap instead. This GetProperty returns raw un-serialized bytes for such properties. For example, if you have the metadata as
clusters: - name: web_service metadata: filter_metadata: foo: my_value: '1234' my_map: k1: v1 k2: v2
Then,
- use GetPropertyMap for {"cluster_metadata", "filter_metadata", "foo", "my_map"}.
- use GetProperty for {"cluster_metadata", "filter_metadata", "foo", "my_value"}.
Note: you cannot get the raw bytes of protobuf. For example, accessing {"cluster_metadata", "filter_data", "foo"}) doesn't return the protobuf bytes, but instead this returns the serialized map of "foo". Therefore, we recommend to access individual "leaf" fields (not the middle or top field of metadata) to avoid the need to figure out the (host-dependent) encoding of properties.
func GetPropertyMap ¶
GetPropertyMap is the same as GetProperty but can be used to decode map-typed properties. See GetProperty for detail.
Note: this operates under the assumption that the path is encoded as map, therefore this might cause panic if it is used on the non-map types.
func GetRedisCallResponse ¶
func GetSharedData ¶
GetSharedData is used for retrieving the value for given "key". For thread-safe updates you must use the returned "cas" value when calling SetSharedData for the same key.
func GetUpstreamData ¶
GetUpstreamData can be used for retrieving upstream TCP data buffered in the host. Returned bytes beginning from "start" to "start" + "maxSize" in the buffer. Only available during types.TcpContext.OnUpstreamData.
func GetVMConfiguration ¶
GetVMConfiguration is used for retrieving configurations given in the "vm_config.configuration" field. This hostcall is only available during types.PluginContext.OnVMStart call.
func LogCritical ¶
func LogCritical(msg string)
LogCritical emits a message as a log with Critical log level.
func LogCriticalf ¶
func LogCriticalf(format string, args ...interface{})
LogCriticalf formats according to a format specifier and emits as a log with Critical log level.
Note that not all combinations of format and args are supported by tinygo. For example, %v with a map will cause a panic. See https://tinygo.org/docs/reference/lang-support/stdlib/#fmt for more information.
func LogDebugf ¶
func LogDebugf(format string, args ...interface{})
LogDebugf formats according to a format specifier and emits as a log with Debug log level.
Note that not all combinations of format and args are supported by tinygo. For example, %v with a map will cause a panic. See https://tinygo.org/docs/reference/lang-support/stdlib/#fmt for more information.
func LogErrorf ¶
func LogErrorf(format string, args ...interface{})
LogErrorf formats according to a format specifier and emits as a log with Error log level.
Note that not all combinations of format and args are supported by tinygo. For example, %v with a map will cause a panic. See https://tinygo.org/docs/reference/lang-support/stdlib/#fmt for more information.
func LogInfof ¶
func LogInfof(format string, args ...interface{})
LogInfof formats according to a format specifier and emits as a log with Info log level.
Note that not all combinations of format and args are supported by tinygo. For example, %v with a map will cause a panic. See https://tinygo.org/docs/reference/lang-support/stdlib/#fmt for more information.
func LogTracef ¶
func LogTracef(format string, args ...interface{})
LogTracef formats according to a format specifier and emits as a log with Trace log level.
Note that not all combinations of format and args are supported by tinygo. For example, %v with a map will cause a panic. See https://tinygo.org/docs/reference/lang-support/stdlib/#fmt for more information.
func LogWarnf ¶
func LogWarnf(format string, args ...interface{})
LogWarnf formats according to a format specifier and emits as a log with Warn log level.
Note that not all combinations of format and args are supported by tinygo. For example, %v with a map will cause a panic. See https://tinygo.org/docs/reference/lang-support/stdlib/#fmt for more information.
func PluginDone ¶
func PluginDone()
PluginDone must be called when OnPluginDone returns false indicating that the plugin is in pending state right before deletion by the hosts. Only available for types.PluginContext.
func PrependDownstreamData ¶
PrependDownstreamData prepends the given bytes to the downstream TCP data buffered in the host. Only available during types.TcpContext.OnDownstreamData.
func PrependHttpRequestBody ¶
PrependHttpRequestBody prepends the given bytes to the HTTP request body buffer. Only available during types.HttpContext.OnHttpRequestBody. Please note that you must remove the "content-length" header during OnHttpRequestHeaders. Otherwise, the wrong content-length is sent to the upstream and that might result in client crash.
func PrependHttpResponseBody ¶
PrependHttpResponseBody prepends the given bytes to the HTTP response body buffer. Only available during types.HttpContext.OnHttpResponseBody. Please note that you must remove the "content-length" header during OnHttpResponseHeaders. Otherwise, the wrong content-length is sent to the upstream and that might result in client crash.
func PrependUpstreamData ¶
PrependUpstreamData prepends the given bytes to the upstream TCP data buffered in the host. Only available during types.TcpContext.OnUpstreamData.
func RegisterSharedQueue ¶
RegisterSharedQueue registers the shared queue on this plugin context. "Register" means that OnQueueReady is called for this plugin context whenever a new item is enqueued on that queueID. Only available for types.PluginContext. The returned queueID can be used for Enqueue/DequeueSharedQueue. Note that "name" must be unique across all Wasm VMs which share the same "vm_id". That means you can use "vm_id" to separate shared queue namespace.
func RemoveHttpRequestHeader ¶
RemoveHttpRequestHeader is used for removing an HTTP request header with a given "key". Only available during types.HttpContext.OnHttpRequestHeaders.
func RemoveHttpRequestTrailer ¶
RemoveHttpRequestTrailer removes all values for given "key" from the request trailers. Only available during types.HttpContext.OnHttpRequestTrailers.
func RemoveHttpResponseHeader ¶
RemoveHttpResponseHeader removes all values for given "key" from the response headers. Only available during types.HttpContext.OnHttpResponseHeaders.
func RemoveHttpResponseTrailer ¶
RemoveHttpResponseTrailer removes all values for given "key" from the response trailers. Only available during types.HttpContext.OnHttpResponseTrailers.
func ReplaceDownstreamData ¶
ReplaceDownstreamData replaces the downstream TCP data buffered in the host with the given bytes. Only available during types.TcpContext.OnDownstreamData.
func ReplaceHttpRequestBody ¶
ReplaceHttpRequestBody replaces the HTTP request body buffer with the given bytes. Only available during types.HttpContext.OnHttpRequestBody. Please note that you must remove the "content-length" header during OnHttpRequestHeaders. Otherwise, the wrong content-length is sent to the upstream and that might result in client crash, if the size of the data differs from the original size.
func ReplaceHttpRequestHeader ¶
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 ¶
ReplaceHttpRequestHeaders is used for replacing HTTP request headers with given headers. Only available during types.HttpContext.OnHttpRequestHeaders.
func ReplaceHttpRequestTrailer ¶
ReplaceHttpRequestTrailer replaces a value for given "key" from the 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 ¶
ReplaceHttpRequestTrailers is used for replacing HTTP request trailers with given trailers. Only available during types.HttpContext.OnHttpRequestTrailers.
func ReplaceHttpResponseBody ¶
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 is sent to the upstream and that might result in client crash if the size of the data differs from the original one.
func ReplaceHttpResponseHeader ¶
ReplaceHttpResponseHeader replaces the value for given "key" from the 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 ¶
ReplaceHttpResponseHeaders is used for replacing HTTP response headers with given headers. Only available during types.HttpContext.OnHttpResponseHeaders.
func ReplaceHttpResponseTrailer ¶
ReplaceHttpResponseTrailer replaces a value for given "key" from the 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 ¶
ReplaceHttpResponseTrailers is used for replacing HTTP response trailers with given trailers. Only available during types.HttpContext.OnHttpResponseTrailers.
func ReplaceUpstreamData ¶
ReplaceUpstreamData replaces the upstream TCP data buffered in the host with the given bytes. Only available during types.TcpContext.OnUpstreamData.
func ResolveSharedQueue ¶
ResolveSharedQueue acquires the queueID for the given vmID and queueName. The returned queueID can be used for Enqueue/DequeueSharedQueue.
func ResumeHttpRequest ¶
func ResumeHttpRequest() error
ResumeHttpRequest can be used for resuming HTTP request processing that was stopped after returning the types.Action.Pause. Only available during types.HttpContext.
func ResumeHttpResponse ¶
func ResumeHttpResponse() error
ResumeHttpResponse can be used to resume the HTTP response processing that was stopped after returning types.Action.Pause. Only available during types.HttpContext.
func SendHttpResponse ¶
SendHttpResponse sends an HTTP response to the downstream with given information (headers, statusCode, body). The function returns an error if used outside the types.HttpContext. You cannot use this call after types.HttpContext.OnHttpResponseHeaders returns Continue because the response headers may have already arrived downstream, and there is no way to override the headers that were already sent. After you've invoked this function, you *must* return types.Action.Pause to stop further processing of the initial HTTP request/response. Note that the gRPCStatus can be set to -1 if this is a not gRPC stream.
func SendHttpResponseWithDetail ¶
func SendHttpResponseWithDetail(statusCode uint32, statusCodeDetailData string, headers [][2]string, body []byte, gRPCStatus int32) error
SendHttpResponseV2 sends an HTTP response to the downstream with given information (headers, statusCodeDetailData, statusCode, body). The function returns an error if used outside the types.HttpContext. You cannot use this call after types.HttpContext.OnHttpResponseHeaders returns Continue because the response headers may have already arrived downstream, and there is no way to override the headers that were already sent. After you've invoked this function, you *must* return types.Action.Pause to stop further processing of the initial HTTP request/response. Note that the gRPCStatus can be set to -1 if this is a not gRPC stream.
func SetEffectiveContext ¶
SetEffectiveContext sets the effective context to "context_id". This hostcall is usually used to change the context after receiving types.PluginContext.OnQueueReady or types.PluginContext.OnTick
func SetProperty ¶
SetProperty is used for setting property/metadata in the host for a given path. Available path and properties depend on the host implementation. For Envoy, please refer to https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/advanced/attributes
func SetSharedData ¶
SetSharedData is used for setting key-value pairs in the shared data storage which is defined per "vm_config.vm_id" in the hosts. The function returns ErrorStatusCasMismatch when the given CAS value doesn't match the current value. The error indicates other Wasm VMs have already set a value on the same key, and the current CAS for the key gets incremented. Implementing a retry logic to handle this error is recommended. Setting the cas value to 0 will never return ErrorStatusCasMismatch, and the call will always succeed. However, it is not thread-safe. Another VM may have already incremented the value, and the value you see is already different from the one stored when you call this function.
func SetTickPeriodMilliSeconds ¶
SetTickPeriodMilliSeconds sets the tick interval of types.PluginContext.OnTick calls. Only available for types.PluginContext.
func SetVMContext ¶
SetVMContext is the entrypoint for setting up the entire Wasm VM. Please make sure to call this entrypoint during "main()" function; otherwise, the VM fails.
Types ¶
type MetricCounter ¶
type MetricCounter uint32
MetricCounter represents a counter metric. Use DefineCounterMetric for initialization.
func DefineCounterMetric ¶
func DefineCounterMetric(name string) MetricCounter
DefineCounterMetric returns MetricCounter for a name.
func (MetricCounter) Increment ¶
func (m MetricCounter) Increment(offset uint64)
Increment increments the current value by an offset for this counter.
func (MetricCounter) Value ¶
func (m MetricCounter) Value() uint64
Value returns the current value for this counter.
type MetricGauge ¶
type MetricGauge uint32
MetricGauge represents a gauge metric. Use DefineGaugeMetric for initialization.
func DefineGaugeMetric ¶
func DefineGaugeMetric(name string) MetricGauge
DefineCounterMetric returns MetricGauge for a name.
func (MetricGauge) Add ¶
func (m MetricGauge) Add(offset int64)
Add adds an offset to the current value for this gauge.
func (MetricGauge) Value ¶
func (m MetricGauge) Value() int64
Value returns the current value for this gauge.
type MetricHistogram ¶
type MetricHistogram uint32
MetricHistogram represents a histogram metric. Use DefineHistogramMetric for initialization.
func DefineHistogramMetric ¶
func DefineHistogramMetric(name string) MetricHistogram
DefineHistogramMetric returns MetricHistogram for a name.
func (MetricHistogram) Record ¶
func (m MetricHistogram) Record(value uint64)
Record records a value for this histogram.
func (MetricHistogram) Value ¶
func (m MetricHistogram) Value() uint64
Value returns the current value for this histogram.