Skip to content

Commit 51a48d5

Browse files
committed
Merge main.
2 parents 0647a4c + 3d71e5e commit 51a48d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1657
-113
lines changed

CHANGELOG.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,19 @@ Increment the:
1616
## [Unreleased]
1717

1818
* Added TracerContext to so Tracer and TracerProvider share SDK configuration and
19-
updates to exporters apply to all tracers #590
19+
updates to exporters apply to all tracers [#590](https://github.com/open-telemetry/opentelemetry-cpp/pull/590)
20+
* [EXPORTER] Added Zipkin Exporter. ([#471](https://github.com/open-telemetry/opentelemetry-cpp/pull/471))
21+
* [PROPAGATOR] Added Composite Propagator ([#597](https://github.com/open-telemetry/opentelemetry-cpp/pull/597))
22+
23+
## [0.2.0] 2021-03-02
24+
25+
* [SDK] Added `ForceFlush` to `TracerProvider`. ([#588](https://github.com/open-telemetry/opentelemetry-cpp/pull/588)).
26+
* [SDK] Added Resource API. ([#502](https://github.com/open-telemetry/opentelemetry-cpp/pull/502))
27+
* [API] Modified TraceState support for w3c trace context as per specs.
28+
([#551](https://github.com/open-telemetry/opentelemetry-cpp/pull/551))
29+
* [API] Added B3 Propagator. ([#523](https://github.com/open-telemetry/opentelemetry-cpp/pull/523))
30+
* [Exporter] Added ETW Exporter. ([#376](https://github.com/open-telemetry/opentelemetry-cpp/pull/376))
31+
* [CI] Enable cache for Bazel for faster builds. ([#505](https://github.com/open-telemetry/opentelemetry-cpp/pull/505))
2032

2133
## [0.0.1] 2020-12-16
2234

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ if(WITH_STL)
7474
endif()
7575

7676
option(WITH_OTLP "Whether to include the OpenTelemetry Protocol in the SDK" OFF)
77+
option(WITH_ZIPKIN "Whether to include the Zipkin exporter in the SDK" OFF)
7778

7879
option(WITH_PROMETHEUS "Whether to include the Prometheus Client in the SDK"
7980
OFF)

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ A PR is considered to be **ready to merge** when:
119119
/
120120
[Maintainer](https://github.com/open-telemetry/community/blob/main/community-membership.md#maintainer)
121121
(at different company).
122-
* A pull reqeust opened by an Approver / Maintainer can be merged with only one
122+
* A pull request opened by an Approver / Maintainer can be merged with only one
123123
approval from Approver / Maintainer (at different company).
124124
* Major feedback items/points are resolved.
125125
* It has been open for review for at least one working day. This gives people

api/docs/Doxyfile

+8-7
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ PROJECT_NUMBER =
4444
# for a project that appears at the top of each page and should give viewer a
4545
# quick idea about the purpose of the project. Keep the description short.
4646

47-
PROJECT_BRIEF = "Version 0.1.0"
47+
PROJECT_BRIEF = "Version 0.2.0"
4848

4949
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
5050
# in the documentation. The maximum height of the logo should not exceed 55
@@ -790,8 +790,7 @@ WARN_LOGFILE =
790790
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
791791
# Note: If this tag is empty the current directory is searched.
792792

793-
INPUT = ./Overview.md \
794-
../include/opentelemetry/common \
793+
INPUT = ../include/opentelemetry/common \
795794
../include/opentelemetry/core \
796795
../include/opentelemetry/nostd/shared_ptr.h \
797796
../include/opentelemetry/nostd/span.h \
@@ -839,6 +838,8 @@ RECURSIVE = YES
839838
# run.
840839

841840
EXCLUDE = ../include/opentelemetry/common/spin_lock_mutex.h \
841+
../include/opentelemetry/common/key_value_iterable_view.h \
842+
../include/opentelemetry/trace/span_context_kv_iterable_view.h \
842843
../include/opentelemetry/nostd/detail
843844

844845
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
@@ -1088,7 +1089,7 @@ IGNORE_PREFIX =
10881089
# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
10891090
# The default value is: YES.
10901091

1091-
GENERATE_HTML = YES
1092+
GENERATE_HTML = NO
10921093

10931094
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
10941095
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
@@ -1444,7 +1445,7 @@ DISABLE_INDEX = NO
14441445
# The default value is: NO.
14451446
# This tag requires that the tag GENERATE_HTML is set to YES.
14461447

1447-
GENERATE_TREEVIEW = NO
1448+
GENERATE_TREEVIEW = YES
14481449

14491450
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
14501451
# doxygen will group on one line in the generated HTML documentation.
@@ -1912,15 +1913,15 @@ MAN_LINKS = NO
19121913
# captures the structure of the code including all documentation.
19131914
# The default value is: NO.
19141915

1915-
GENERATE_XML = NO
1916+
GENERATE_XML = YES
19161917

19171918
# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
19181919
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
19191920
# it.
19201921
# The default directory is: xml.
19211922
# This tag requires that the tag GENERATE_XML is set to YES.
19221923

1923-
XML_OUTPUT = xml
1924+
XML_OUTPUT = doxyoutput/xml
19241925

19251926
# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
19261927
# listings (including syntax highlighting and cross-referencing information) to

api/docs/Makefile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile clean
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
mkdir -p doxyoutput
21+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
22+
23+
clean:
24+
rm -rf doxyoutput
25+
@$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

api/docs/Overview.md

-79
This file was deleted.

api/docs/conf.py

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
# import os
14+
# import sys
15+
# sys.path.insert(0, os.path.abspath('.'))
16+
17+
18+
# -- Project information -----------------------------------------------------
19+
20+
project = 'OpenTelemetry C++ API'
21+
copyright = '2021, OpenTelemetry authors'
22+
author = 'OpenTelemetry authors'
23+
24+
# Run doxygen
25+
# -----------
26+
# For the readthedocs builds, for some reason exhale doesn't find doxygen.
27+
# So we run it manually here.
28+
import subprocess
29+
import os
30+
if not os.path.isdir('doxyoutput'):
31+
os.mkdir('doxyoutput')
32+
subprocess.call(['doxygen'])
33+
34+
35+
# -- General configuration ---------------------------------------------------
36+
37+
# Add any Sphinx extension module names here, as strings. They can be
38+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
39+
# ones.
40+
extensions = [
41+
"breathe",
42+
"exhale",
43+
]
44+
45+
breathe_projects = {
46+
"OpenTelemetry C++ API": "./doxyoutput/xml"
47+
}
48+
49+
breathe_default_project = "OpenTelemetry C++ API"
50+
51+
exhale_args = {
52+
"containmentFolder": "otel_api",
53+
"rootFileName": "otel_api.rst",
54+
"rootFileTitle": "Reference documentation",
55+
"doxygenStripFromPath": "..",
56+
"exhaleUseDoxyfile": True,
57+
"createTreeView": True,
58+
}
59+
60+
primary_domain = "cpp"
61+
62+
higlight_language = "cpp"
63+
64+
65+
# Add any paths that contain templates here, relative to this directory.
66+
templates_path = ['_templates']
67+
68+
# List of patterns, relative to source directory, that match files and
69+
# directories to ignore when looking for source files.
70+
# This pattern also affects html_static_path and html_extra_path.
71+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
72+
73+
74+
# -- Options for HTML output -------------------------------------------------
75+
76+
# The theme to use for HTML and HTML Help pages. See the documentation for
77+
# a list of builtin themes.
78+
#
79+
html_theme = "sphinx_rtd_theme"
80+
81+
# Add any paths that contain custom static files (such as style sheets) here,
82+
# relative to this directory. They are copied after the builtin static files,
83+
# so a file named "default.css" will overwrite the builtin "default.css".
84+
html_static_path = ['_static']

api/docs/index.rst

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
OpenTelemetry C++ API
2+
=====================
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#include <initializer_list>
2+
#include <memory>
3+
#include <vector>
4+
#include "opentelemetry/trace/propagation/text_map_propagator.h"
5+
6+
OPENTELEMETRY_BEGIN_NAMESPACE
7+
namespace trace
8+
{
9+
namespace propagation
10+
{
11+
12+
template <typename T>
13+
class CompositePropagator : public TextMapPropagator<T>
14+
{
15+
public:
16+
CompositePropagator(std::vector<std::unique_ptr<TextMapPropagator<T>>> propagators)
17+
: propagators_(std::move(propagators))
18+
{}
19+
// Rules that manages how context will be extracted from carrier.
20+
using Getter = nostd::string_view (*)(const T &carrier, nostd::string_view trace_type);
21+
22+
// Rules that manages how context will be injected to carrier.
23+
using Setter = void (*)(T &carrier,
24+
nostd::string_view trace_type,
25+
nostd::string_view trace_description);
26+
27+
/**
28+
* Run each of the configured propagators with the given context and carrier.
29+
* Propagators are run in the order they are configured, so if multiple
30+
* propagators write the same carrier key, the propagator later in the list
31+
* will "win".
32+
*
33+
* @param setter Rules that manages how context will be injected to carrier.
34+
* @param carrier Carrier into which context will be injected
35+
* @param context Context to inject
36+
*
37+
*/
38+
39+
void Inject(Setter setter, T &carrier, const context::Context &context) noexcept override
40+
{
41+
for (auto &p : propagators_)
42+
{
43+
p->Inject(setter, carrier, context);
44+
}
45+
}
46+
47+
/**
48+
* Run each of the configured propagators with the given context and carrier.
49+
* Propagators are run in the order they are configured, so if multiple
50+
* propagators write the same context key, the propagator later in the list
51+
* will "win".
52+
*
53+
* @param setter Rules that manages how context will be extracte from carrier.
54+
* @param context Context to add values to
55+
* @param carrier Carrier from which to extract context
56+
*/
57+
context::Context Extract(Getter getter,
58+
const T &carrier,
59+
context::Context &context) noexcept override
60+
{
61+
auto first = true;
62+
context::Context tmp_context;
63+
for (auto &p : propagators_)
64+
{
65+
if (first)
66+
{
67+
tmp_context = p->Extract(getter, carrier, context);
68+
first = false;
69+
}
70+
else
71+
{
72+
tmp_context = p->Extract(getter, carrier, tmp_context);
73+
}
74+
}
75+
return propagators_.size() ? tmp_context : context;
76+
}
77+
78+
private:
79+
std::vector<std::unique_ptr<TextMapPropagator<T>>> propagators_;
80+
};
81+
} // namespace propagation
82+
} // namespace trace
83+
OPENTELEMETRY_END_NAMESPACE;

0 commit comments

Comments
 (0)