splunkchi

package module
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

README

Splunk instrumentation for github.com/go-chi/chi

This package provides OpenTelemetry instrumentation for the github.com/go-chi/chi package.

Getting Started

This package is designed to be used as middleware for the github.com/go-chi/chi package. See example_test.go for more information.

Documentation

Overview

Package splunkchi provides OpenTelemetry instrumentation for the github.com/go-chi/chi package.

Example
package main

import (
	"net/http"

	"github.com/go-chi/chi"

	"github.com/signalfx/splunk-otel-go/instrumentation/github.com/go-chi/chi/splunkchi"
)

func main() {
	router := chi.NewRouter()
	router.Use(splunkchi.Middleware())
	router.Get("/hello", func(w http.ResponseWriter, _ *http.Request) {
		_, err := w.Write([]byte("Hello World!\n"))
		if err != nil {
			w.WriteHeader(http.StatusInternalServerError)
		}
	})
	if err := http.ListenAndServe(":8080", router); err != nil {
		panic(err)
	}
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(options ...Option) func(http.Handler) http.Handler

Middleware returns github.com/go-chi/chi middleware that traces served requests.

func Version added in v1.6.0

func Version() string

Version returns the version of splunkchi.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option applies options to a configuration.

func WithAttributes

func WithAttributes(attr []attribute.KeyValue) Option

WithAttributes returns an Option that appends attr to the attributes set for every span created.

func WithPropagator

func WithPropagator(p propagation.TextMapPropagator) Option

WithPropagator returns an Option that sets p as the TextMapPropagator used when propagating a span context.

func WithTracerProvider

func WithTracerProvider(tp trace.TracerProvider) Option

WithTracerProvider returns an Option that sets the TracerProvider used for a configuration.

Jump to

Keyboard shortcuts

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