instafiber

package module
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 10 Imported by: 0

README

Instana instrumentation for fiber

This module provides Instana instrumentation for fiber library.

GoDoc

Installation

To add the module to your go.mod file run the following command in your project directory:

$ go get github.com/instana/go-sensor/instrumentation/instafiber

Usage

// Create a sensor for instana instrumentation
sensor := instana.NewSensor("my-web-server")

app := fiber.New()

// Use the instafiber.TraceHandler for instrumenting the handler
app.Get("/greet", instafiber.TraceHandler(sensor, "greet", "/greet", func(c *fiber.Ctx) error {
return c.SendString("Hello world!")
}))

Refer to instafiber package documentation for more details.

Documentation

Overview

Package instafiber provides Instana instrumentation for Fiber package.

Example
// (c) Copyright IBM Corp. 2023

//go:build go1.17
// +build go1.17

package main

import (
	"log"

	"github.com/gofiber/fiber/v2"
	instana "github.com/instana/go-sensor"
	"github.com/instana/go-sensor/instrumentation/instafiber"
)

func main() {

	// Create a sensor for instana instrumentation
	sensor := instana.NewSensor("my-service")

	app := fiber.New()

	// Use the instafiber.TraceHandler for instrumenting the handler
	app.Get("/greet", instafiber.TraceHandler(sensor, "greet", "/greet", hello))

	// Start server
	log.Fatal(app.Listen(":3000"))
}

func hello(c *fiber.Ctx) error {
	return c.SendString("Hello world!")
}
Output:

Index

Examples

Constants

View Source
const Version = "0.17.0"

Version is the instrumentation module semantic version

Variables

This section is empty.

Functions

func TraceHandler

func TraceHandler(sensor instana.TracerLogger, routeID, pathTemplate string, handler fiber.Handler) fiber.Handler

TraceHandler adds Instana instrumentation to the route handler

Types

This section is empty.

Jump to

Keyboard shortcuts

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