Class ScopeConfigurator::Builder

Nested Relationships

This class is a nested type of Template Class ScopeConfigurator.

Nested Types

Class Documentation

class Builder

A builder class for the ScopeConfigurator that facilitates the creation of ScopeConfigurators.

Public Functions

inline explicit Builder(T default_scope_config) noexcept

Constructor for a builder object that cam be used to create a scope configurator. A minimally configured builder would build a ScopeConfigurator that applies the default_scope_config to every instrumentation scope.

Parameters:

default_scope_config – The default scope config that the built configurator should fall back on.

inline Builder &AddCondition(std::function<bool(const InstrumentationScope&)> scope_matcher, T scope_config)

Allows the user to pass a generic function that evaluates an instrumentation scope through a boolean check. If the check passes, the provided config is applied. Conditions are evaluated in order.

Parameters:
  • scope_matcher – a function that returns true if the scope being evaluated matches the criteria defined by the function.

  • scope_config – the scope configuration to return for the matched scope.

Returns:

this

inline Builder &AddConditionNameEquals(nostd::string_view scope_name, T scope_config)

A convenience condition that specifically matches the scope name of the scope being evaluated. If the scope name matches to the provided string, then the provided scope configuration is applied to the scope.

Parameters:
  • scope_name – The scope name to which the config needs to be applied.

  • scope_config – The scope config for the matching scopes.

Returns:

this

inline ScopeConfigurator<T> Build() const

Constructs the scope configurator object that can be used to retrieve scope config depending on the instrumentation scope.

Returns:

a configured scope configurator.