Documentation
¶
Index ¶
- Constants
- func CommonLogAttrs(runID, symbol, mic, endpoint string) []any
- func Init(ctx context.Context, config *Config) error
- func LogWithTrace(ctx context.Context, attrs ...any) []any
- func Logger() *slog.Logger
- func RecordBackoff(endpoint, reason string)
- func RecordBackoffSleep(endpoint string, duration time.Duration)
- func RecordBatchBytes(batchType string, bytes int64)
- func RecordCBOpen(scope string)
- func RecordDecodeFail(reason string)
- func RecordPublish(publishType, outcome string)
- func RecordPublishLatency(publishType string, duration time.Duration)
- func RecordRequest(endpoint, outcome, code string)
- func RecordRequestLatency(endpoint string, duration time.Duration)
- func RecordRetry(endpoint, reason string)
- func RecordSessionEject()
- func RecordSpanError(span trace.Span, err error)
- func Reset()
- func SetCBState(scope string, state int)
- func SetInflightRequests(endpoint string, count int)
- func Shutdown(ctx context.Context) error
- func StartEmitProtoSpan(ctx context.Context, messageType, symbol string) (context.Context, trace.Span)
- func StartFXRatesSpan(ctx context.Context, fromCurrency, toCurrency string) (context.Context, trace.Span)
- func StartIngestDecodeSpan(ctx context.Context, endpoint, symbol string) (context.Context, trace.Span)
- func StartIngestFetchSpan(ctx context.Context, endpoint, symbol, mic, url string, attempt int) (context.Context, trace.Span)
- func StartIngestNormalizeSpan(ctx context.Context, endpoint, symbol, mic string) (context.Context, trace.Span)
- func StartPublishBusSpan(ctx context.Context, topic, partitionKey string, chunkIndex int, bytes int64) (context.Context, trace.Span)
- func StartRunSpan(ctx context.Context, runID, env string, args []string) (context.Context, trace.Span)
- func StartSpan(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- func Tracer() trace.Tracer
- func UpdateIngestFetchSpan(span trace.Span, status int, bytes int64, elapsed time.Duration)
- type Config
- type Observability
- type PrometheusConfig
Constants ¶
const ( SpanNameRun = "yfin.run" SpanNameIngestFetch = "ingest.fetch" SpanNameIngestDecode = "ingest.decode" SpanNameIngestNormalize = "ingest.normalize" SpanNameEmitProto = "emit.proto" SpanNamePublishBus = "publish.bus" SpanNameFXRates = "fx.rates" )
Span names for different operations
Variables ¶
This section is empty.
Functions ¶
func CommonLogAttrs ¶
Common log attributes for yfinance-go
func LogWithTrace ¶
LogWithTrace adds trace context to log attributes
func RecordBackoff ¶
func RecordBackoff(endpoint, reason string)
func RecordBackoffSleep ¶
func RecordBatchBytes ¶
func RecordCBOpen ¶
func RecordCBOpen(scope string)
func RecordDecodeFail ¶
func RecordDecodeFail(reason string)
func RecordPublish ¶
func RecordPublish(publishType, outcome string)
func RecordPublishLatency ¶
func RecordRequest ¶
func RecordRequest(endpoint, outcome, code string)
func RecordRequestLatency ¶
func RecordRetry ¶
func RecordRetry(endpoint, reason string)
func RecordSessionEject ¶
func RecordSessionEject()
func RecordSpanError ¶
RecordSpanError records an error in a span
func SetCBState ¶
func SetInflightRequests ¶
func StartEmitProtoSpan ¶
func StartEmitProtoSpan(ctx context.Context, messageType, symbol string) (context.Context, trace.Span)
StartEmitProtoSpan creates a span for protobuf emission
func StartFXRatesSpan ¶
func StartFXRatesSpan(ctx context.Context, fromCurrency, toCurrency string) (context.Context, trace.Span)
StartFXRatesSpan creates a span for FX rate operations
func StartIngestDecodeSpan ¶
func StartIngestDecodeSpan(ctx context.Context, endpoint, symbol string) (context.Context, trace.Span)
StartIngestDecodeSpan creates a span for decode operations
func StartIngestFetchSpan ¶
func StartIngestFetchSpan(ctx context.Context, endpoint, symbol, mic, url string, attempt int) (context.Context, trace.Span)
StartIngestFetchSpan creates a span for HTTP fetch operations
func StartIngestNormalizeSpan ¶
func StartIngestNormalizeSpan(ctx context.Context, endpoint, symbol, mic string) (context.Context, trace.Span)
StartIngestNormalizeSpan creates a span for normalization operations
func StartPublishBusSpan ¶
func StartPublishBusSpan(ctx context.Context, topic, partitionKey string, chunkIndex int, bytes int64) (context.Context, trace.Span)
StartPublishBusSpan creates a span for bus publishing
func StartRunSpan ¶
func StartRunSpan(ctx context.Context, runID, env string, args []string) (context.Context, trace.Span)
StartRunSpan creates the root span for a yfin run
Types ¶
type Config ¶
type Config struct {
ServiceName string
ServiceVersion string
Environment string
CollectorEndpoint string
TraceProtocol string
SampleRatio float64
LogLevel string
MetricsAddr string
MetricsEnabled bool
TracingEnabled bool
}
Config represents observability configuration
type Observability ¶
type Observability struct {
// contains filtered or unexported fields
}
Observability represents the main observability interface
type PrometheusConfig ¶
PrometheusConfig for Prometheus exporter