userver: userver/tracing/component.hpp Source File
Loading...
Searching...
No Matches
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/raw_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.
20///
21/// The component must be configured in service config.
22///
23/// ## Static options:
24/// Name | Description | Default value
25/// ---- | ----------- | -------------
26/// service-name | name of the service to write in traces | ''
27/// tracer | type of the tracer to trace, currently supported only 'native' | 'native'
28///
29/// ## Static configuration example:
30///
31/// @snippet components/common_component_list_test.cpp Sample tracer component config
32
33// clang-format on
34class Tracer final : public RawComponentBase {
35public:
36 /// @ingroup userver_component_names
37 /// @brief The default name of components::Tracer
38 static constexpr std::string_view kName = "tracer";
39
40 Tracer(const ComponentConfig& config, const ComponentContext& context);
41
42 static yaml_config::Schema GetStaticConfigSchema();
43};
44
45template <>
46inline constexpr bool kHasValidate<Tracer> = true;
47
48template <>
49inline constexpr auto kConfigFileMode<Tracer> = ConfigFileMode::kNotRequired;
50
51} // namespace components
52
53USERVER_NAMESPACE_END