nomad-temporal-jobs

shared

import "munchbox/temporal-workers/shared"

Index

func InitTracer

func InitTracer(ctx context.Context, serviceName string) func(context.Context) error

InitTracer configures the global OpenTelemetry tracer provider with OTLP gRPC export. The serviceName determines the node identity in the Tempo service graph. Returns a shutdown function that should be deferred.

func NewLogger

func NewLogger(serviceName string) (tlog.Logger, *slog.Logger)

NewLogger creates a JSON slog logger wrapped for Temporal SDK compatibility. Returns both the Temporal-compatible logger (for client/worker options) and the underlying slog logger (for use outside Temporal contexts).

func NewMetricsHandler

func NewMetricsHandler(listenAddr string) tclient.MetricsHandler

NewMetricsHandler creates a Temporal MetricsHandler backed by Prometheus. Starts an HTTP server on listenAddr exposing /metrics. Returns nil if listenAddr is empty (metrics disabled).

func NewNomadClient

func NewNomadClient() (*api.Client, error)

NewNomadClient creates a configured Nomad API client with OTel-instrumented HTTP transport so calls appear as edges in the service graph.

func PeerServiceAttr

func PeerServiceAttr(name string) attribute.KeyValue

PeerServiceAttr returns a peer.service attribute for service graph edges.

func StartClientSpan

func StartClientSpan(ctx context.Context, name string, attrs ...attribute.KeyValue) (context.Context, trace.Span)

StartClientSpan creates a SpanKindClient span for outbound service calls. Client spans with peer.service attributes produce edges in the Tempo service graph.

func StartSpan

func StartSpan(ctx context.Context, name string, attrs ...attribute.KeyValue) (context.Context, trace.Span)

StartSpan creates a new span with the given name and attributes.

func Tracer

func Tracer() trace.Tracer

Tracer returns the global tracer instance.

Generated by gomarkdoc