metrics

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Chain = "chain"
	TRC   = "trc"
)

Trust material

View Source
const (
	TRCReq    = "trc_request"
	ChainReq  = "chain_request"
	NotifyTRC = "trc_notify"
	LatestTRC = "latest_trc_number"
)

Request types

View Source
const (
	SigVerification = "signature_verification"
	ASInspector     = "trc_inspection"
	App             = "application"
)

Triggers

View Source
const (
	Success    = prom.Success
	OkExists   = "ok_exists"
	OkInserted = "ok_inserted"
	OkIgnored  = "ok_ignored"

	ErrMismatch   = "err_content_mismatch"
	ErrDB         = prom.ErrDB
	ErrInactive   = "err_inactive"
	ErrInternal   = prom.ErrInternal
	ErrKey        = "err_key"
	ErrNotAllowed = "err_not_allowed"
	ErrNotFound   = "err_not_found"
	ErrParse      = prom.ErrParse
	ErrTransmit   = "err_transmit"
	ErrValidate   = prom.ErrValidate
	ErrVerify     = prom.ErrVerify
)

Result types

View Source
const Namespace = "trustengine"

Namespace is the prometheus namespace.

Variables

View Source
var (
	// Provider exposes the provider metrics.
	Provider = newProvider()
	// RPC exposes the RPC metrics.
	RPC = newRPC()
	// Signer exposes the signer metrics.
	Signer = newSigner()
	// Verifier exposes the verifier metrics.
	Verifier = newVerifier()
)

Functions

func CtxWith

func CtxWith(ctx context.Context, trigger string) context.Context

CtxWith returns a new context, based on ctx, that embeds argument trigger.

func FromCtx

func FromCtx(ctx context.Context) string

FromCtx returns the trigger embedded in ctx if one exists, or "application" otherwise.

func PeerToLabel

func PeerToLabel(peer net.Addr, local addr.IA) string

PeerToLabel converts the peer address to a peer metric label.

func Timestamp

func Timestamp(ts time.Time) float64

Timestamp return the prometheus value for gauge.

Types

type ProviderLabels

type ProviderLabels struct {
	Type    string
	Trigger string
	Result  string
}

ProviderLabels defines the trust material provider labels.

func (ProviderLabels) Labels

func (l ProviderLabels) Labels() []string

Labels returns the list of labels.

func (ProviderLabels) Values

func (l ProviderLabels) Values() []string

Values returns the label values in the order defined by Labels.

func (ProviderLabels) WithResult

func (l ProviderLabels) WithResult(result string) ProviderLabels

WithResult returns the lookup labels with the modified result.

type RPCLabels

type RPCLabels struct {
	Type    string
	Trigger string
	Peer    string
	Result  string
}

RPCLabels defines the trust material RPC labels.

func (RPCLabels) Labels

func (l RPCLabels) Labels() []string

Labels returns the list of labels.

func (RPCLabels) Values

func (l RPCLabels) Values() []string

Values returns the label values in the order defined by Labels.

func (RPCLabels) WithResult

func (l RPCLabels) WithResult(result string) RPCLabels

WithResult returns the lookup labels with the modified result.

type SignerLabels

type SignerLabels struct {
	Result string
}

SignerLabels defines the trust material signer labels.

func (SignerLabels) Labels

func (l SignerLabels) Labels() []string

Labels returns the list of labels.

func (SignerLabels) Values

func (l SignerLabels) Values() []string

Values returns the label values in the order defined by Labels.

func (SignerLabels) WithResult

func (l SignerLabels) WithResult(result string) SignerLabels

WithResult returns the lookup labels with the modified result.

type VerifierLabels

type VerifierLabels struct {
	Result string
}

VerifierLabels defines the trust material resolver labels.

func (VerifierLabels) Labels

func (l VerifierLabels) Labels() []string

Labels returns the list of labels.

func (VerifierLabels) Values

func (l VerifierLabels) Values() []string

Values returns the label values in the order defined by Labels.

func (VerifierLabels) WithResult

func (l VerifierLabels) WithResult(result string) VerifierLabels

WithResult returns the lookup labels with the modified result.

Jump to

Keyboard shortcuts

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