otelzerolog

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

README

otelzerolog

Description

This project aims to integrate OpenTelemetry, a set of APIs, libraries, agents, and collector services to capture distributed traces and metrics from your application, with Zerolog, a zero-allocation JSON logger in Go, for monitoring and managing your application's performance.

Features

  • Seamless integration of OpenTelemetry and Zerolog
  • Efficient tracing and logging of application activities
  • Easy debugging and monitoring

Prerequisites

  • Go (version 1.21)
  • Basic understanding of OpenTelemetry and Zerolog

Installation

go get -u github.com/hyperdxio/opentelemetry-go/otelzerolog

Usage

Configure open-telemetry provider. See example here

func main() {
  ctx := context.Background()

  // Setup opentelemetry provider
  loggerProvider := sdk.NewLoggerProvider()
  hook := otelzerolog.NewHook(loggerProvider)
  log := log.Hook(hook)

  log.Info().Ctx(ctx).Str("string", "string-value").Msg("Hello OpenTelemetry")
  time.Sleep(10 * time.Second)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Version

func Version() string

Version is the current release version of OpenTelemetry Zerolog in use.

Types

type Hook

type Hook struct {
	otel.Logger
}

func NewHook

func NewHook(loggerProvider otel.LoggerProvider) *Hook

func (Hook) Run

func (h Hook) Run(e *zerolog.Event, level zerolog.Level, msg string)

Jump to

Keyboard shortcuts

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