userver: userver/tracing/component.hpp Source File
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
component.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/tracing/component.hpp
4/// @brief @copybrief components::Tracer
5
6#include <userver/components/component_fwd.hpp>
7#include <userver/components/impl/component_base.hpp>
8
9USERVER_NAMESPACE_BEGIN
10
11namespace components {
12
13// clang-format off
14
15/// @ingroup userver_components
16///
17/// @brief Component that initializes the request tracing facilities.
18///
19/// Finds the components::Logging component and requests an optional
20/// "opentracing" logger to use for Opentracing.
21///
22/// The component must be configured in service config.
23///
24/// ## Static options:
25/// Name | Description | Default value
26/// ---- | ----------- | -------------
27/// service-name | name of the service to write in traces | ''
28/// tracer | type of the tracer to trace, currently supported only 'native' | 'native'
29///
30/// ## Static configuration example:
31///
32/// @snippet components/common_component_list_test.cpp Sample tracer component config
33
34// clang-format on
35class Tracer final : public impl::ComponentBase {
36 public:
37 /// @ingroup userver_component_names
38 /// @brief The default name of components::Tracer
39 static constexpr std::string_view kName = "tracer";
40
41 Tracer(const ComponentConfig& config, const ComponentContext& context);
42
43 static yaml_config::Schema GetStaticConfigSchema();
44};
45
46template <>
47inline constexpr bool kHasValidate<Tracer> = true;
48
49template <>
50inline constexpr auto kConfigFileMode<Tracer> = ConfigFileMode::kNotRequired;
51
52} // namespace components
53
54USERVER_NAMESPACE_END