Couchbase C++ SDK
1.4.0 (rev. 59aa900)
Toggle main menu visibility
Loading...
Searching...
No Matches
request_span.hxx
Go to the documentation of this file.
1
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
/*
3
* Copyright 2021 Couchbase, Inc.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*/
17
18
#pragma once
19
20
#include <cinttypes>
21
#include <memory>
22
#include <string>
23
24
namespace
couchbase::tracing
25
{
26
class
request_span
27
{
28
public
:
29
request_span
() =
default
;
30
request_span
(
const
request_span
& other) =
default
;
31
request_span
(
request_span
&& other) =
default
;
32
auto
operator=
(
const
request_span
& other) ->
request_span
& =
default
;
33
auto
operator=
(
request_span
&& other) ->
request_span
& =
default
;
34
virtual
~request_span
() =
default
;
35
36
explicit
request_span
(std::string
name
)
37
: name_(std::move(
name
))
38
{
39
}
40
request_span
(std::string
name
, std::shared_ptr<request_span>
parent
)
41
: name_(std::move(
name
))
42
, parent_(std::move(
parent
))
43
{
44
}
45
virtual
void
add_tag
(
const
std::string&
name
, std::uint64_t value) = 0;
46
virtual
void
add_tag
(
const
std::string&
name
,
const
std::string& value) = 0;
47
virtual
void
end
() = 0;
48
49
[[nodiscard]]
auto
name
() const -> const std::
string
&
50
{
51
return
name_;
52
}
53
54
[[nodiscard]]
virtual
auto
parent
() const -> std::shared_ptr<
request_span
>
55
{
56
return
parent_;
57
}
58
59
[[nodiscard]]
virtual
auto
uses_tags
() const ->
bool
60
{
61
return
true
;
62
}
63
75
[[nodiscard]]
virtual
auto
try_set_dispatch_operation_id
(std::uint32_t
/* opaque */
) ->
bool
76
{
77
return
false
;
78
}
79
89
[[nodiscard]]
virtual
auto
try_set_dispatch_local_id
(
const
std::string&
/* local_id */
) ->
bool
90
{
91
return
false
;
92
}
93
103
[[nodiscard]]
virtual
auto
try_set_dispatch_result
(std::uint64_t
/* server_duration_us */
,
104
const
std::string&
/* peer_address */
,
105
std::uint16_t
/* peer_port */
) ->
bool
106
{
107
return
false
;
108
}
109
110
private
:
111
std::string name_{};
112
std::shared_ptr<request_span> parent_{
nullptr
};
113
};
114
}
// namespace couchbase::tracing
couchbase::tracing::request_span::try_set_dispatch_result
virtual auto try_set_dispatch_result(std::uint64_t, const std::string &, std::uint16_t) -> bool
Efficiently record the result metadata of a dispatch span (server processing time and the peer socket...
Definition
request_span.hxx:103
couchbase::tracing::request_span::try_set_dispatch_operation_id
virtual auto try_set_dispatch_operation_id(std::uint32_t) -> bool
Efficiently record the dispatch operation identifier (the request opaque) without formatting it to a ...
Definition
request_span.hxx:75
couchbase::tracing::request_span::request_span
request_span(std::string name)
Definition
request_span.hxx:36
couchbase::tracing::request_span::~request_span
virtual ~request_span()=default
couchbase::tracing::request_span::request_span
request_span(request_span &&other)=default
couchbase::tracing::request_span::try_set_dispatch_local_id
virtual auto try_set_dispatch_local_id(const std::string &) -> bool
Efficiently record the local connection identifier of a dispatch span without materializing a tag-nam...
Definition
request_span.hxx:89
couchbase::tracing::request_span::request_span
request_span()=default
couchbase::tracing::request_span::uses_tags
virtual auto uses_tags() const -> bool
Definition
request_span.hxx:59
couchbase::tracing::request_span::parent
virtual auto parent() const -> std::shared_ptr< request_span >
Definition
request_span.hxx:54
couchbase::tracing::request_span::request_span
request_span(std::string name, std::shared_ptr< request_span > parent)
Definition
request_span.hxx:40
couchbase::tracing::request_span::operator=
auto operator=(request_span &&other) -> request_span &=default
couchbase::tracing::request_span::name
auto name() const -> const std::string &
Definition
request_span.hxx:49
couchbase::tracing::request_span::end
virtual void end()=0
couchbase::tracing::request_span::request_span
request_span(const request_span &other)=default
couchbase::tracing::request_span::add_tag
virtual void add_tag(const std::string &name, const std::string &value)=0
couchbase::tracing::request_span::operator=
auto operator=(const request_span &other) -> request_span &=default
couchbase::tracing::request_span::add_tag
virtual void add_tag(const std::string &name, std::uint64_t value)=0
couchbase::tracing
Definition
otel_tracer.hxx:25
couchbase
tracing
request_span.hxx
Generated by
1.17.0