epsagonhttp

package
v1.39.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

View Source
const AMAZON_REQUEST_ID = "x-amzn-requestid"
View Source
const API_GATEWAY_RESOURCE_TYPE = "api_gateway"
View Source
const APPSYNC_API_SUBDOMAIN = ".appsync-api."
View Source
const EPSAGON_DOMAIN = "epsagon.com"
View Source
const EPSAGON_TRACEID_HEADER_KEY = "epsagon-trace-id"

Variables

This section is empty.

Functions

func CreateHTTPTriggerEvent added in v1.19.0

func CreateHTTPTriggerEvent(wrapperTracer tracer.Tracer, request *http.Request, resourceName string) *protocol.Event

CreateHTTPTriggerEvent creates an HTTP trigger event

Types

type ClientWrapper

type ClientWrapper struct {
	http.Client

	// MetadataOnly flag overriding the configuration
	MetadataOnly bool
	// contains filtered or unexported fields
}

ClientWrapper is Epsagon's wrapper for http.Client

func Wrap

func Wrap(c http.Client, args ...context.Context) ClientWrapper

Wrap wraps an http.Client to Epsagon's ClientWrapper

func (*ClientWrapper) Do

func (c *ClientWrapper) Do(req *http.Request) (resp *http.Response, err error)

Do wraps http.Client's Do

func (*ClientWrapper) Get

func (c *ClientWrapper) Get(rawUrl string) (resp *http.Response, err error)

Get wraps http.Client.Get

func (*ClientWrapper) Head

func (c *ClientWrapper) Head(rawUrl string) (resp *http.Response, err error)

Head wraps http.Client.Head

func (*ClientWrapper) Post

func (c *ClientWrapper) Post(
	rawUrl string, contentType string, body io.Reader) (resp *http.Response, err error)

Post wraps http.Client.Post

func (*ClientWrapper) PostForm

func (c *ClientWrapper) PostForm(
	rawUrl string, data url.Values) (resp *http.Response, err error)

PostForm wraps http.Client.PostForm

type HandlerFunction added in v1.19.0

type HandlerFunction func(http.ResponseWriter, *http.Request)

HandlerFunction is a generic http handler function

func WrapHandleFunc added in v1.19.0

func WrapHandleFunc(
	config *epsagon.Config, handler HandlerFunction, names ...string) HandlerFunction

WrapHandleFunc wraps a generic http.HandleFunc handler function with Epsagon Last two optional paramerts are the name of the handler (will be the resource name of the events) and an optional hardcoded hostname

type TracingTransport added in v1.7.0

type TracingTransport struct {
	// MetadataOnly flag overriding the configuration
	MetadataOnly bool
	// contains filtered or unexported fields
}

TracingTransport is the RoundTripper implementation that traces HTTP calls

func NewTracingTransport added in v1.7.0

func NewTracingTransport(args ...context.Context) *TracingTransport

func NewWrappedTracingTransport added in v1.8.0

func NewWrappedTracingTransport(rt http.RoundTripper, args ...context.Context) *TracingTransport

func (*TracingTransport) RoundTrip added in v1.7.0

func (t *TracingTransport) RoundTrip(req *http.Request) (resp *http.Response, err error)

RoundTrip implements the RoundTripper interface to trace HTTP calls

type ValidationFunction added in v1.5.0

type ValidationFunction func(string, string) bool

type WrappedResponseWriter added in v1.19.0

type WrappedResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

WrappedResponseWriter is wrapping Resposne writer with Epsagon to enrich the trace with data from the response

func CreateWrappedResponseWriter added in v1.19.0

func CreateWrappedResponseWriter(rw http.ResponseWriter, resource *protocol.Resource) *WrappedResponseWriter

CreateWrappedResponseWriter creates a newWrappedResponseWriter

func (*WrappedResponseWriter) Header added in v1.19.0

func (w *WrappedResponseWriter) Header() http.Header

Header wrapper

func (*WrappedResponseWriter) UpdateResource added in v1.19.0

func (w *WrappedResponseWriter) UpdateResource()

UpdateResource updates the connected resource with the response headers and body

func (*WrappedResponseWriter) Write added in v1.19.0

func (w *WrappedResponseWriter) Write(data []byte) (int, error)

Write wrapper

func (*WrappedResponseWriter) WriteHeader added in v1.19.0

func (w *WrappedResponseWriter) WriteHeader(statusCode int)

WriteHeader wrapper, will set status_code immediately

Jump to

Keyboard shortcuts

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