userver: userver/tracing/manager_component.hpp Source File
Loading...
Searching...
No Matches
manager_component.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/tracing/manager_component.hpp
4/// @brief TracingManager base and default components
5
6#include <string>
7
8#include <userver/components/loggable_component_base.hpp>
9#include <userver/tracing/manager.hpp>
10#include <userver/tracing/span.hpp>
11
12USERVER_NAMESPACE_BEGIN
13
14namespace tracing {
15
16/// @brief Base component for implementing TracingManager component
17// NOLINTNEXTLINE(fuchsia-multiple-inheritance)
19 public TracingManagerBase {
20 public:
21 TracingManagerComponentBase(const components::ComponentConfig&,
22 const components::ComponentContext&);
23};
24
25// clang-format off
26
27/// @ingroup userver_components
28///
29/// @brief Locator component that provides access to the actual TracingManager
30/// that will be used in handlers and clients unless specified otherwise
31///
32/// The component can be configured in service config.
33/// If the config is not provided, then tracing::kDefaultTracingManager will be used
34///
35/// ## Static options:
36/// Name | Description | Default value
37/// ---- | ----------- | -------------
38/// component-name | name of the component, that implements TracingManagerComponentBase | <use kDefaultTracingManager>
39///
40// clang-format on
41class DefaultTracingManagerLocator final
43 public:
44 /// @ingroup userver_component_names
45 /// @brief The default name of tracing::DefaultTracingManagerLocator
46 static constexpr std::string_view kName = "tracing-manager-locator";
47
48 DefaultTracingManagerLocator(const components::ComponentConfig&,
49 const components::ComponentContext&);
50
51 const TracingManagerBase& GetTracingManager() const;
52
53 static yaml_config::Schema GetStaticConfigSchema();
54
55 private:
56 const TracingManagerBase& tracing_manager_;
57};
58
59} // namespace tracing
60
61template <>
62inline constexpr bool
63 components::kHasValidate<tracing::DefaultTracingManagerLocator> = true;
64
65template <>
66inline constexpr auto
67 components::kConfigFileMode<tracing::DefaultTracingManagerLocator> =
69
70USERVER_NAMESPACE_END