Documentation ¶
Overview ¶
Package metrics implements a metrics dashboard with either datadog or prometheus (coming soon)
Index ¶
- Constants
- Variables
- func EndSpan(span trace.Span)
- func EndSpanWithErr(span trace.Span, err error)
- func PyroscopeWrapTracerProvider(provider trace.TracerProvider, buildInfo config.BuildInfo, ...) trace.TracerProvider
- func RPCClient(ctx context.Context, metrics Handler, url string, client *http.Client, ...) (*rpc.Client, error)
- func Setup(ctx context.Context, buildInfo config.BuildInfo) error
- func StartPyroscope(info config.BuildInfo) *pyroscope.Profiler
- type Handler
- func Get() Handler
- func NewByType(ctx context.Context, buildInfo config.BuildInfo, ht HandlerType) (handler Handler, err error)
- func NewDatadogMetricsHandler(buildInfo config.BuildInfo) Handler
- func NewFromEnv(ctx context.Context, buildInfo config.BuildInfo) (handler Handler, err error)
- func NewJaegerHandler(buildInfo config.BuildInfo) Handler
- func NewNullHandler() Handler
- func NewRelicMetricsHandler(buildInfo config.BuildInfo) Handler
- type HandlerType
- type TestHandler
Constants ¶
const ( // ChainID is the metric name for the chain ID. ChainID = "chain_id" // ContractAddress is the metric name for the contract address. ContractAddress = "contract_address" // Origin is the metric name for the origin chain ID. Origin = "origin_chain_id" // Destination is the metric name for the destination chain ID. Destination = "destination_chain_id" // Nonce is the metric name for the nonce. Nonce = "nonce" // TxHash is the metric name for the transaction hash. TxHash = "tx_hash" // Page is the metric name for the page. Page = "page" )
const DDProfileEnv = "DD_PROFILES"
DDProfileEnv is the data daog profile neviornment variable.
const HandlerEnv = "METRICS_HANDLER"
HandlerEnv is the driver to use for metrics.
Variables ¶
var AllHandlerTypes []HandlerType
AllHandlerTypes is a list of all contract types. Since we use stringer and this is a testing library, instead of manually copying all these out we pull the names out of stringer. In order to make sure stringer is updated, we panic on any method called where the index is higher than the stringer array length.
Functions ¶
func EndSpanWithErr ¶ added in v0.0.43
EndSpanWithErr ends a span and records an error if one is present.
func PyroscopeWrapTracerProvider ¶ added in v0.0.43
func PyroscopeWrapTracerProvider(provider trace.TracerProvider, buildInfo config.BuildInfo, extraOpts ...otelpyroscope.Option) trace.TracerProvider
PyroscopeWrapTracerProvider wraps the tracer provider with pyroscope. The traceProvider is not affected if the pyroscope endpoint is not set.
func RPCClient ¶ added in v0.0.43
func RPCClient(ctx context.Context, metrics Handler, url string, client *http.Client, opts ...otelhttp.Option) (*rpc.Client, error)
RPCClient is a wrapper around rpc.Client that adds metrics/tracing.
Types ¶
type Handler ¶ added in v0.0.19
type Handler interface { Start(ctx context.Context) error // Gin gets a gin middleware for tracing. Gin() gin.HandlerFunc // ConfigureHTTPClient configures tracing on an http client ConfigureHTTPClient(client *http.Client, opts ...otelhttp.Option) // AddGormCallbacks adds gorm callbacks for tracing. AddGormCallbacks(db *gorm.DB) // GetTracerProvider returns the tracer provider. GetTracerProvider() trace.TracerProvider // Tracer returns the tracer provider. Tracer() trace.Tracer // Propagator returns the propagator. Propagator() propagation.TextMapPropagator // Type returns the handler type. Type() HandlerType }
Handler collects metrics.
func NewByType ¶ added in v0.0.43
func NewByType(ctx context.Context, buildInfo config.BuildInfo, ht HandlerType) (handler Handler, err error)
NewByType sets up a metrics handler by type.
func NewDatadogMetricsHandler ¶ added in v0.0.19
NewDatadogMetricsHandler creates a new datadog metrics handler.
func NewFromEnv ¶ added in v0.0.19
NewFromEnv sets up a metrics handler from environment variable. this will not set the global and generally, SetupFromEnv should be used instead.
func NewJaegerHandler ¶ added in v0.0.43
NewJaegerHandler creates a new jaeger handler for handling jaeger traces. the JAEGER_ENDPOINT environment variable must be set for this to work. Note: currently, this is only suitable for local runs, because of default options we've put in place This can be fixed in a future version through an option builder.
func NewNullHandler ¶ added in v0.0.19
func NewNullHandler() Handler
NewNullHandler creates a new null transaction handler.
func NewRelicMetricsHandler ¶ added in v0.0.19
NewRelicMetricsHandler creates a new newrelic metrics handler.
type HandlerType ¶ added in v0.0.19
type HandlerType uint8
HandlerType is the handler type to use
const ( // DataDog is the datadog driver. DataDog HandlerType = iota + 1 // Datadog // NewRelic is the new relic driver.t. NewRelic // NewRelic // Jaeger is the jaeger driver. Jaeger // Jaeger // Null is a null data type handler. Null // Null )
func (HandlerType) Lower ¶ added in v0.0.19
func (i HandlerType) Lower() string
Lower gets the lowercase version of the handler type. Useful for comparison in switch.
func (HandlerType) String ¶ added in v0.0.19
func (i HandlerType) String() string
type TestHandler ¶ added in v0.0.43
type TestHandler interface { Handler // GetSpansByName returns all spans with the given name. GetSpansByName(name string) (spans []tracetest.SpanStub) }
TestHandler is a handler that can be used for testing traces.
func NewTestTracer ¶ added in v0.0.43
func NewTestTracer(ctx context.Context, tb testing.TB) TestHandler
NewTestTracer returns a new test tracer.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package internal contains internal constants for metrics package this is done in a separate package to avoid circular dependencies
|
Package internal contains internal constants for metrics package this is done in a separate package to avoid circular dependencies |
Package localmetrics provides a local server for metrics.
|
Package localmetrics provides a local server for metrics. |
Package newrelic provides custom wrpapers for newrelic.
|
Package newrelic provides custom wrpapers for newrelic. |
Package pyroscope implements pyroscope.io client.
|
Package pyroscope implements pyroscope.io client. |