Categorygithub.com/poly-gun/go-telemetry
modulepackage
0.0.13
Repository: https://github.com/poly-gun/go-telemetry.git
Documentation: pkg.go.dev

# README

go-telemetry - OTEL HTTP Telemetry

Documentation

Official godoc documentation (with examples) can be found at the Package Registry.

Usage

Add Package Dependency
go get -u github.com/poly-gun/go-telemetry
Import and Implement

main.go

package main

import (
    "context"
    "os"
    "io"

    "github.com/poly-gun/go-telemetry"
)

// ctx, cancel represent the server's runtime context and cancellation handler.
var ctx, cancel = context.WithCancel(context.Background())

func main() {
    return
}

func init() {
    // Setup the telemetry pipeline and cancellation handler.
    shutdown := telemetry.Setup(ctx, func(o *telemetry.Settings) {
        if os.Getenv("CI") == "" { // Example of running the program in a local, development environment.
            o.Zipkin.Enabled = false

            o.Tracer.Local = true
            o.Tracer.Options = nil
            o.Tracer.Writer = io.Discard

            o.Metrics.Local = true
            o.Metrics.Options = nil
            o.Metrics.Writer = io.Discard

            o.Logs.Local = true
            o.Logs.Options = nil
            o.Logs.Writer = io.Discard
        } else {
            o.Zipkin.URL = "http://zipkin.istio-system.svc.cluster.local:9411"
        }
    })

    // Initialize the telemetry interrupt handler.
    telemetry.Interrupt(ctx, cancel, shutdown)
}

Contributions

See the Contributing Guide for additional details on getting started.

Task-Board

  • Create a Resource Detector for Kubernetes Telemetry.

# Packages

No description provided by the author
No description provided by the author

# Functions

Interrupt is a graceful interrupt + signal handler for the telemetry pipeline.
No description provided by the author
Setup bootstraps the OpenTelemetry pipeline.

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
Tracer represents a tracer configuration for OpenTelemetry.
Zipkin represents the configuration for a Zipkin collector.

# Type aliases

No description provided by the author