http

package
v2.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTracingToClient added in v2.8.0

func AddTracingToClient(client *http.Client, options ...Option) *http.Client

AddTracingToClient wraps the net/http.Client to automatically create child-spans, and append to HTTP Headers.

func WrapClient deprecated

func WrapClient(client *http.Client) *http.Client

WrapClient wraps the net/http.Client to automatically create child-spans, and append to HTTP Headers.

Deprecated: Use AddTracingToClient instead, and set a proper ResourceNamer. This function will be removed in a later version.

Types

type Option added in v2.8.0

type Option func(cfg *config)

Option allows for overriding our default-config.

func WithCustomTag added in v2.8.0

func WithCustomTag(key string, value any) Option

WithCustomTag will attach the value to the span tagged by the key.

func WithRequestIgnorer added in v2.8.0

func WithRequestIgnorer(requestIgnorer RequestIgnorer) Option

WithRequestIgnorer specifies a function that will be called to determined if the request should be traced or not.

func WithResourceNamer added in v2.8.0

func WithResourceNamer(resourceNamer ResourceNamer) Option

WithResourceNamer specifies a function that will be called to determine what the ResourceName of the span should be. For example, in the span "http.client https://coop.no/", the ResourceName is "https://coop.no/"

func WithServiceName added in v2.8.0

func WithServiceName(serviceName string) Option

WithServiceName overrides the service-name set in environment-variable "DD_SERVICE".

type RequestIgnorer added in v2.8.0

type RequestIgnorer func(req *http.Request) bool

RequestIgnorer is a function that will be called to determine if the request should be traced or not.

type ResourceNamer added in v2.8.0

type ResourceNamer func(req *http.Request) string

ResourceNamer is a function that will be called to determine what the ResourceName of the span should be.

func FullURLResourceNamer added in v2.8.0

func FullURLResourceNamer() ResourceNamer

FullURLResourceNamer will name the ResourceName to "GET https://www.coop.no/api/some-service/some-endpoint" NOTE! This might leak unintended user-ids, if they are part of the URL-path.

func FullURLWithParamsResourceNamer added in v2.8.0

func FullURLWithParamsResourceNamer() ResourceNamer

FullURLWithParamsResourceNamer will name the ResourceName to "GET https://www.coop.no/api/some-service/some-endpoint?foo=bar" NOTE! This might leak unintended user-ids, credentials, or other things that are part of a URL.

func HostResourceNamer added in v2.8.0

func HostResourceNamer() ResourceNamer

HostResourceNamer will name the ResourceName to "www.coop.no"

func StaticResourceNamer added in v2.8.0

func StaticResourceNamer(str string) ResourceNamer

StaticResourceNamer will set every span's ResourceName to str.

Jump to

Keyboard shortcuts

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