echorelic

package module
v0.0.0-...-00bad8b Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2018 License: MIT Imports: 2 Imported by: 0

README

echo-relic

Echo middleware for New Relic

GoDoc Build Status

install

go get github.com/jessie-codes/echo-relic

Usage

Echo Relic starts a new transaction for each request and binds the transaction to the request context. See go-agent's documentation for how to use the transaction interface.


package main

import (
	"github.com/labstack/echo"
	"github.com/newrelic/go-agent"
	"github.com/jessie-codes/echo-relic"
)

func main() {
	e := echo.New()
	config := newrelic.NewConfig("__APP_NAME__", "__NEW_RELIC_LICENSE_KEY__")
	app, _ := newrelic.NewApplication(config)
	e.Use(echorelic.Middleware(app))

	e.GET("/", func(c echo.Context) error {
		txn := c.Get("newRelicTransaction")
		//route handle code
		return c.JSON(http.StatusOK, result)
	})
	e.Start(":8080")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(app newrelic.Application) echo.MiddlewareFunc

Middleware starts a newrelic.Transactions and adds it to the request's echo.Context

Types

This section is empty.

Jump to

Keyboard shortcuts

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