shannon

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package shannon provides functionality for exporting Shannon protocol metrics to Prometheus.

Index

Constants

View Source
const (

	// The default value for a domain if it cannot be extracted from an endpoint URL
	ErrDomain = "error_extracting_domain"
)

Variables

This section is empty.

Functions

func ExtractDomainOrHost

func ExtractDomainOrHost(rawURL string) (string, error)

ExtractDomainOrHost extracts the effective TLD+1 from a URL. It falls back to a reasonable domain extraction for localhost, IP addresses, and other non-standard hosts.

func ExtractTLDFromEndpointAddr

func ExtractTLDFromEndpointAddr(addr string) string

ExtractTLDFromEndpointAddr extracts effective TLD+1 from endpoint address. Returns an empty string if the TLD cannot be determined.

func GetEndpointTLDs

func GetEndpointTLDs(endpoints protocol.EndpointAddrList) map[protocol.EndpointAddr]string

GetEndpointTLDs extracts TLD information from endpoint addresses

func LogEndpointTLDDiversity

func LogEndpointTLDDiversity(logger polylog.Logger, endpoints protocol.EndpointAddrList)

func PublishMetrics

func PublishMetrics(
	logger polylog.Logger,
	observations *protocolobservations.ShannonObservationsList,
)

PublishMetrics exports all Shannon-related Prometheus metrics using observations reported by the Shannon protocol.

func SetActiveHTTPRelays

func SetActiveHTTPRelays(activeCount int64)

SetActiveHTTPRelays updates the gauge metric with the current number of active HTTP relays. This should be called whenever the active HTTP relay count changes in the concurrency limiter. TODO_TECHDEBT: the metrics package should use the passed observation to report metrics: it should not expose any methods for external usage (other than PublishMetrics)

func SetActiveWebsocketConnections

func SetActiveWebsocketConnections(activeCount int64)

SetActiveWebsocketConnections updates the gauge metric with the current number of active Websocket connections. This should be called whenever the Websocket connection count changes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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