ppecho

package module
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ppecho

This package instruments the labstack/echo package.

Installation

$ go get github.com/pinpoint-apm/pinpoint-go-agent/plugin/echo
import "github.com/pinpoint-apm/pinpoint-go-agent/plugin/echo"

Usage

PkgGoDev

This package instruments inbound requests handled by an echo.Router. Register the Middleware as the middleware of the router to trace all handlers:

e := echo.New()
e.Use(ppecho.Middleware())

Use WrapHandler to select the handlers you want to track:

e.GET("/hello", ppecho.WrapHandler(hello))

For each request, a pinpoint.Tracer is stored in the request context. By using the pinpoint.FromContext function, this tracer can be obtained in your handler. Alternatively, the context of the request may be propagated where the context that contains the pinpoint.Tracer is required.

package main

import (
    "github.com/labstack/echo"
    "github.com/pinpoint-apm/pinpoint-go-agent"
    "github.com/pinpoint-apm/pinpoint-go-agent/plugin/echo"
)

func hello(c echo.Context) error {
    return c.String(200, "Hello World!!")
}

func main() {
    ... //setup agent
	
    e := echo.New()
    e.Use(ppecho.Middleware())

    e.GET("/hello", hello)
    e.Start(":9000")
}

Full Example Source

This package supports URL Statistics feature. It aggregates response times, successes and failures for each router pattern.

Config Options

Documentation

Overview

Package ppecho instruments the labstack/echo package (https://github.com/labstack/echo).

This package instruments inbound requests handled by a echo.Router. Register the Middleware as the middleware of the router to trace all handlers:

e := echo.New()
e.Use(ppecho.Middleware())

Use WrapHandler to select the handlers you want to track:

e.GET("/hello", ppecho.WrapHandler(hello))

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware() echo.MiddlewareFunc

Middleware returns an echo middleware that creates a pinpoint.Tracer that instruments the echo handler function.

func WrapHandler

func WrapHandler(handler echo.HandlerFunc) echo.HandlerFunc

WrapHandler wraps the given echo handler and adds the pinpoint.Tracer to the request's context. By using the pinpoint.FromContext function, this tracer can be obtained.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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