metering

package
v0.0.0-...-a6b9412 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DroppedEventCounter = MetricSet.NewCounter("metering_payment_gateway_dropped_event_counter", "Counter of drop metering events from the metering paymentGateway:// service")
View Source
var MeteringGRPCErrCounter = MetricSet.NewCounter("metering_payment_gateway_err_counter", "Counter of gRPC errors received reporting to the Payment Gateway service")
View Source
var MeteringGRPCRetryCounter = MetricSet.NewCounter("metering_payment_gateway_retry_counter", "Counter of gRPC retries and trying to report to the Payment Gateway service")
View Source
var MetricSet = dmetrics.NewSet()

Functions

func Register

func Register()

Register registers the payment gateway emitter inside dmetering package by calling dmetering.Register with the proper factory function. The emitter accepts a URL with the following format:

paymentGateway://<endpoint>?network=<network>&token=${SF_API_TOKEN}[&insecure=true|false][&plaintext=true|false][&delay=1s][&buffer_size=1000][&panic_on_drop=true|false]

The metering plugin will emit events to the payment gateway service pointed to by <endpoint> (required). The endpoint can contains a `:<port>` suffix to specify which port to use. If the port is not provided, 443 is assumed.

The connection is secured by TLS by default. If the `insecure` query parameter is set to `true`, the connection will be made with TLS but without verifying the certificate. The `plaintext` is reserved for development purposes and the connection is made without TLS, you cannot use that on production endpoints since they require a <token> and that a <token> can be sent onlt if the connection is secured with TLS.

Types

type CloseFunc

type CloseFunc func() error

type Config

type Config struct {
	Endpoint    string
	Insecure    bool
	Plaintext   bool
	Token       string
	Delay       time.Duration
	BufferSize  uint64
	PanicOnDrop bool
	Network     string
}

Jump to

Keyboard shortcuts

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