baseplate

baseplate.metrics_client_from_config(raw_config)

Configure and return a metrics client.

This expects two configuration options:

metrics.namespace
The root key to prefix all metrics in this application with.
metrics.endpoint
A host:port pair, e.g. localhost:2014. If an empty string, a client that discards all metrics will be returned.
Parameters:raw_config (dict) – The application configuration which should have settings for the metrics client.
Returns:A configured client.
Return type:baseplate.metrics.Client
baseplate.tracing_client_from_config(raw_config, log_if_unconfigured=True)

Configure and return a tracing client.

This expects one configuration option and can take many optional ones:

tracing.service_name
The name for the service this observer is registered to.
tracing.endpoint (optional)
(Deprecated in favor of the sidecar model.) Destination to record span data.
tracing.queue_name (optional)
Name of POSIX queue where spans are recorded
tracing.max_span_queue_size (optional)
Span processing queue limit.
tracing.num_span_workers (optional)
Number of worker threads for span processing.
tracing.span_batch_interval (optional)
Wait time for span processing in seconds.
tracing.num_conns (optional)
Pool size for remote recorder connection pool.
tracing.sample_rate (optional)
Percentage of unsampled requests to record traces for (e.g. “37%”)
Parameters:
  • raw_config (dict) – The application configuration which should have settings for the tracing client.
  • log_if_unconfigured (bool) – When the client is not configured, should trace spans be logged or discarded silently?
Returns:

A configured client.

Return type:

baseplate.diagnostics.tracing.TracingClient

baseplate.error_reporter_from_config(raw_config, module_name)

Configure and return a error reporter.

This expects one configuration option and can take many optional ones:

sentry.dsn
The DSN provided by Sentry. If blank, the reporter will discard events.
sentry.site (optional)
An arbitrary string to identify this client installation.
sentry.environment (optional)
The environment your application is running in.
sentry.exclude_paths (optional)
Comma-delimited list of module prefixes to ignore when discovering where an error came from.
sentry.include_paths (optional)
Comma-delimited list of paths to include for consideration when drilling down to an exception.
sentry.ignore_exceptions (optional)
Comma-delimited list of fully qualified names of exception classes (potentially with * globs) to not report.
sentry.sample_rate (optional)
Percentage of errors to report. (e.g. “37%”)
sentry.processors (optional)
Comma-delimited list of fully qualified names of processor classes to apply to events before sending to Sentry.

Example usage:

error_reporter_from_config(app_config, __name__)
Parameters:
  • raw_config (dict) – The application configuration which should have settings for the error reporter.
  • module_name (str) – __name__ of the root module of the application.
Return type:

raven.Client