go_dcp_tracing_otel

package module
v0.0.0-...-ecc9325 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 13 Imported by: 0

README

go-dcp-tracing-otel

go-dcp-tracing-otel provides OpenTelemetry-based tracing implementations for the go-dcp package. This allows users to leverage OpenTelemetry for distributed tracing in their go-dcp applications.

Features

  • Integrates OpenTelemetry with go-dcp for enhanced observability.
  • Automatically registers the OpenTelemetry tracer with the go-dcp tracing system.
  • Supports Jaeger exporter for tracing data.

Installation

To install the package, use the following command:

go get github.com/emrygun/go-dcp-tracing-otel

Usage

To use this package in your project, import it anonymously (with the blank identifier _), similar to how you import database/sql driver packages. This ensures the init function is executed and the OpenTelemetry tracer is registered.

Example:

import (
    _ "github.com/emrygun/go-dcp-tracing-otel"
)

By registering the OpenTelemetry tracer, this package helps integrate OpenTelemetry's powerful tracing capabilities with go-dcp, facilitating enhanced observability and monitoring for your distributed applications.

Environment Variables

The following environment variables can be set to configure the tracing behavior:

  • GO-DCP_COLLECTOR_SERVICE_NAME: The service name to be used by the Jaeger exporter. Defaults to go-dcp if not set.
  • OTEL_EXPORTER_JAEGER_ENDPOINT: The Jaeger collector endpoint. Defaults to http://localhost:14268/api/traces if not set.
  • OTEL_EXPORTER_JAEGER_USER: The username to be used for authentication with the Jaeger collector.
  • OTEL_EXPORTER_JAEGER_PASSWORD: The password to be used for authentication with the Jaeger collector.

Example:

export GO-DCP_COLLECTOR_SERVICE_NAME=my-service
export OTEL_EXPORTER_JAEGER_ENDPOINT=http://localhost:14268/api/traces
export OTEL_EXPORTER_JAEGER_USER=my-username
export OTEL_EXPORTER_JAEGER_PASSWORD=my-password

Example:

export GO-DCP_COLLECTOR_SERVICE_NAME=my-service

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Documentation

Overview

Package go_dcp_tracing_otel provides OpenTelemetry-based tracing implementations for the go-dcp package. This allows users to leverage OpenTelemetry for distributed tracing in their go-dcp applications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OpenTelemetryRequestSpan

type OpenTelemetryRequestSpan struct {
	// contains filtered or unexported fields
}

func NewOpenTelemetryRequestSpan

func NewOpenTelemetryRequestSpan(ctx tracing.RequestSpanContext, span trace.Span) *OpenTelemetryRequestSpan

func (*OpenTelemetryRequestSpan) AddEvent

func (span *OpenTelemetryRequestSpan) AddEvent(key string, timestamp time.Time)

func (*OpenTelemetryRequestSpan) Context

func (*OpenTelemetryRequestSpan) End

func (span *OpenTelemetryRequestSpan) End()

func (*OpenTelemetryRequestSpan) SetAttribute

func (span *OpenTelemetryRequestSpan) SetAttribute(key string, value interface{})

type OpenTelemetryRequestTracer

type OpenTelemetryRequestTracer struct {
	// contains filtered or unexported fields
}

func NewOpenTelemetryRequestTracer

func NewOpenTelemetryRequestTracer(provider trace.TracerProvider) *OpenTelemetryRequestTracer

func (*OpenTelemetryRequestTracer) RequestSpan

func (tracer *OpenTelemetryRequestTracer) RequestSpan(parentContext tracing.RequestSpanContext, operationName string) tracing.RequestSpan

Jump to

Keyboard shortcuts

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