package
0.4.8
Repository: https://github.com/stratumn/go-core.git
Documentation: pkg.go.dev

# README

Configuring Monitoring

Our packages export metrics, logs and traces depending on your configuration. To activate monitoring, set the monitoring.active flag to true.

Logs

Logs are written to the standard output using logrus.

Metrics

We support two ways of exposing metrics:

Prometheus

If you want to pull Prometheus metrics, set monitoring.exporter to prometheus. When using Prometheus, you should also set monitoring.metrics.port. Your metrics can then be pulled at {baseURL}:{port}/metrics.

Elastic APM

If you want to use Elastic APM, set monitoring.exporter to elastic.

All the Elastic APM configuration options should be passed as environment variables. Please see the Elastic APM documentation for reference.

The following configuration options are mandatory:

  • ELASTIC_APM_SERVICE_NAME
  • ELASTIC_APM_SERVER_URL
  • ELASTIC_APM_SECRET_TOKEN

We recommend setting the following configuration options too:

  • ELASTIC_APM_ENVIRONMENT (staging/production)
  • ELASTIC_APM_METRICS_INTERVAL if the default 30 seconds doesn't suit you

Traces

Distributed traces are only available when choosing the elastic exporter.

If you use distributed tracing, don't forget to set ELASTIC_APM_TRANSACTION_SAMPLE_RATE to less than 1.0 in production. Distributed tracing is expensive, if you have a lot of requests you can't afford to trace them all.

# Packages

No description provided by the author

# Functions

ConfigurationFromFlags builds configuration from user-provided command-line flags.
Configure configures metrics and trace monitoring.
LogEntry creates a new log entry with some default fields set.
NewFossilizerAdapter decorates an existing fossilizer.
RegisterFlags registers the command-line monitoring flags.
SetSpanStatus sets the status of the span depending on the error.
SetSpanStatusAndEnd sets the status of the span depending on the error and ends it.
SetVersion sets the current code's version and commit.
SpanLogEntry creates a new log entry with the transaction ID set.
StartSpanIncomingRequest starts a new span for an incoming request and fills some common flags.
StartSpanOutgoingRequest starts a new span for an outgoing request and fills some common flags.
StartSpanProcessing starts a new span for an internal processing task and fills some common flags.
TxLogEntry creates a new log entry with the transaction ID set.
WrapKeyValueStore wraps an existing key value store adapter to add monitoring.
WrapStore wraps an existing store adapter to add monitoring.

# Constants

Available exporters.
Metrics and labels available to all packages.
Metrics and labels available to all packages.
Metrics and labels available to all packages.
Available exporters.
Span types.
Span types.
Span types.
Metrics and labels available to all packages.

# Variables

Default buckets used by histograms.
Errors used by the configuration module.

# Structs

Config contains options for monitoring.
FossilizerAdapter is a decorator for the Fossilizer interface.
KeyValueStoreAdapter is a decorator for the store.KeyValueStore interface.
StoreAdapter is a decorator for the store.Adapter interface.