utils

package
v0.0.0-...-29137c7 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2025 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// WorkflowExecutionIDShortLen is the length of the short version of the WorkflowExecutionId (label)
	WorkflowExecutionIDShortLen = 3 // first 3 characters, 16^3 = 4.096 possibilities (mid-high cardinality)
)

Variables

This section is empty.

Functions

func ValOrUnknown

func ValOrUnknown(val string) string

This is needed to avoid issues during exporting OTel metrics to Prometheus For more details see https://smartcontract-it.atlassian.net/browse/INFOPLAT-1349 ValOrUnknown returns the value if it is not empty, otherwise it returns "unknown"

func ValShortOrUnknown

func ValShortOrUnknown(val string, _len int) string

ValShortOrUnknown returns the short len value if not empty or available, otherwise it returns "unknown"

Types

type ExecutionMetadata

type ExecutionMetadata struct {
	// Execution Context - Source
	SourceId string
	// Execution Context - Chain
	ChainFamilyName string
	ChainId         string
	NetworkName     string
	NetworkNameFull string
	// Execution Context - Workflow (capabilities.RequestMetadata)
	WorkflowId               string
	WorkflowOwner            string
	WorkflowExecutionId      string
	WorkflowName             string
	WorkflowDonId            uint32
	WorkflowDonConfigVersion uint32
	ReferenceId              string
	// Execution Context - Capability
	CapabilityType           string
	CapabilityId             string
	CapabilityTimestampStart uint32
	CapabilityTimestampEmit  uint32
}

TODO: Refactor as a proto referenced from the other proto files (telemetry messages)

func (ExecutionMetadata) Attributes

func (m ExecutionMetadata) Attributes() []attribute.KeyValue

Attributes returns common attributes used for metrics

type MetricInfo

type MetricInfo struct {
	Name        string
	Unit        string
	Description string
}

Define a new struct for metrics information

func (MetricInfo) NewFloat64Gauge

func (m MetricInfo) NewFloat64Gauge(meter metric.Meter) (metric.Float64Gauge, error)

NewFloat64Gauge creates a new Float64Gauge metric

func (MetricInfo) NewInt64Counter

func (m MetricInfo) NewInt64Counter(meter metric.Meter) (metric.Int64Counter, error)

NewInt64Counter creates a new Int64Counter metric

func (MetricInfo) NewInt64Gauge

func (m MetricInfo) NewInt64Gauge(meter metric.Meter) (metric.Int64Gauge, error)

NewInt64Gauge creates a new Int64Gauge metric

type MetricsCapBasic

type MetricsCapBasic struct {
	// contains filtered or unexported fields
}

MetricsCapBasic is a base struct for metrics related to a capability

func NewMetricsCapBasic

func NewMetricsCapBasic(info MetricsInfoCapBasic) (MetricsCapBasic, error)

NewMetricsCapBasic creates a new MetricsCapBasic using the provided MetricsInfoCapBasic

func (*MetricsCapBasic) RecordEmit

func (m *MetricsCapBasic) RecordEmit(ctx context.Context, start, emit uint64, attrKVs ...attribute.KeyValue)

type MetricsInfoCapBasic

type MetricsInfoCapBasic struct {
	// contains filtered or unexported fields
}

MetricInfo is a struct for metrics information

func NewMetricsInfoCapBasic

func NewMetricsInfoCapBasic(metricPrefix, eventRef string) MetricsInfoCapBasic

NewMetricsInfoCapBasic creates a new MetricsInfoCapBasic using the provided event/metric information

Jump to

Keyboard shortcuts

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