newrelic

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: MIT Imports: 6 Imported by: 0

README


DeepSource

newrelic middleware

Supported Go versions & installation

⚙ gearbox requires version 1.14 or higher of Go (Download Go)

Just use go get to download and install gearbox

go get -u github.com/gogearbox/gearbox
go get u- github.com/gogearbox/newrelic

Examples

package main

import (
	  "github.com/newrelic/go-agent/v3/newrelic"
	  "github.com/gogearbox/gearbox"
    newrelicmiddleware "github.com/gogearbox/newrelic"
)

func main() {
	// Setup gearbox
	gb := gearbox.New()

	// Initialize newrelic
	nr, _ := newrelic.NewApplication(
		newrelic.ConfigAppName(APP_NAME),
		newrelic.ConfigLicense(LICENSE),
	)

	// Register the newrelic middleware for all requests
	gb.Use(newrelicmiddleware.New(nr))

	// Define your handler
	gb.Post("/hello", func(ctx gearbox.Context) {
		panic("There is an issue")
	})

	// Start service
	gb.Start(":3000")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(app *newrelic.Application, options ...Options) func(ctx gearbox.Context)

New returns middleware handler

Types

type Options

type Options struct {
	// Repanic configures whether newrelic should repanic after recovery
	Repanic bool
}

Options struct holds newrelic middleware settings

Jump to

Keyboard shortcuts

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