Skip to content

Commit

Permalink
Merge main.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuereth committed Mar 10, 2021
2 parents 0647a4c + 3d71e5e commit 51a48d5
Show file tree
Hide file tree
Showing 42 changed files with 1,657 additions and 113 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@ Increment the:
## [Unreleased]

* Added TracerContext to so Tracer and TracerProvider share SDK configuration and
updates to exporters apply to all tracers #590
updates to exporters apply to all tracers [#590](https://github.com/open-telemetry/opentelemetry-cpp/pull/590)
* [EXPORTER] Added Zipkin Exporter. ([#471](https://github.com/open-telemetry/opentelemetry-cpp/pull/471))
* [PROPAGATOR] Added Composite Propagator ([#597](https://github.com/open-telemetry/opentelemetry-cpp/pull/597))

## [0.2.0] 2021-03-02

* [SDK] Added `ForceFlush` to `TracerProvider`. ([#588](https://github.com/open-telemetry/opentelemetry-cpp/pull/588)).
* [SDK] Added Resource API. ([#502](https://github.com/open-telemetry/opentelemetry-cpp/pull/502))
* [API] Modified TraceState support for w3c trace context as per specs.
([#551](https://github.com/open-telemetry/opentelemetry-cpp/pull/551))
* [API] Added B3 Propagator. ([#523](https://github.com/open-telemetry/opentelemetry-cpp/pull/523))
* [Exporter] Added ETW Exporter. ([#376](https://github.com/open-telemetry/opentelemetry-cpp/pull/376))
* [CI] Enable cache for Bazel for faster builds. ([#505](https://github.com/open-telemetry/opentelemetry-cpp/pull/505))

## [0.0.1] 2020-12-16

Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ if(WITH_STL)
endif()

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

option(WITH_PROMETHEUS "Whether to include the Prometheus Client in the SDK"
OFF)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ A PR is considered to be **ready to merge** when:
/
[Maintainer](https://github.com/open-telemetry/community/blob/main/community-membership.md#maintainer)
(at different company).
* A pull reqeust opened by an Approver / Maintainer can be merged with only one
* A pull request opened by an Approver / Maintainer can be merged with only one
approval from Approver / Maintainer (at different company).
* Major feedback items/points are resolved.
* It has been open for review for at least one working day. This gives people
Expand Down
15 changes: 8 additions & 7 deletions api/docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ PROJECT_NUMBER =
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.

PROJECT_BRIEF = "Version 0.1.0"
PROJECT_BRIEF = "Version 0.2.0"

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

INPUT = ./Overview.md \
../include/opentelemetry/common \
INPUT = ../include/opentelemetry/common \
../include/opentelemetry/core \
../include/opentelemetry/nostd/shared_ptr.h \
../include/opentelemetry/nostd/span.h \
Expand Down Expand Up @@ -839,6 +838,8 @@ RECURSIVE = YES
# run.

EXCLUDE = ../include/opentelemetry/common/spin_lock_mutex.h \
../include/opentelemetry/common/key_value_iterable_view.h \
../include/opentelemetry/trace/span_context_kv_iterable_view.h \
../include/opentelemetry/nostd/detail

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

GENERATE_HTML = YES
GENERATE_HTML = NO

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

GENERATE_TREEVIEW = NO
GENERATE_TREEVIEW = YES

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

GENERATE_XML = NO
GENERATE_XML = YES

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

XML_OUTPUT = xml
XML_OUTPUT = doxyoutput/xml

# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
# listings (including syntax highlighting and cross-referencing information) to
Expand Down
25 changes: 25 additions & 0 deletions api/docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile clean

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
mkdir -p doxyoutput
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

clean:
rm -rf doxyoutput
@$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
79 changes: 0 additions & 79 deletions api/docs/Overview.md

This file was deleted.

84 changes: 84 additions & 0 deletions api/docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- Project information -----------------------------------------------------

project = 'OpenTelemetry C++ API'
copyright = '2021, OpenTelemetry authors'
author = 'OpenTelemetry authors'

# Run doxygen
# -----------
# For the readthedocs builds, for some reason exhale doesn't find doxygen.
# So we run it manually here.
import subprocess
import os
if not os.path.isdir('doxyoutput'):
os.mkdir('doxyoutput')
subprocess.call(['doxygen'])


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"breathe",
"exhale",
]

breathe_projects = {
"OpenTelemetry C++ API": "./doxyoutput/xml"
}

breathe_default_project = "OpenTelemetry C++ API"

exhale_args = {
"containmentFolder": "otel_api",
"rootFileName": "otel_api.rst",
"rootFileTitle": "Reference documentation",
"doxygenStripFromPath": "..",
"exhaleUseDoxyfile": True,
"createTreeView": True,
}

primary_domain = "cpp"

higlight_language = "cpp"


# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
2 changes: 2 additions & 0 deletions api/docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
OpenTelemetry C++ API
=====================
83 changes: 83 additions & 0 deletions api/include/opentelemetry/trace/propagation/composite_propagator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#include <initializer_list>
#include <memory>
#include <vector>
#include "opentelemetry/trace/propagation/text_map_propagator.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace trace
{
namespace propagation
{

template <typename T>
class CompositePropagator : public TextMapPropagator<T>
{
public:
CompositePropagator(std::vector<std::unique_ptr<TextMapPropagator<T>>> propagators)
: propagators_(std::move(propagators))
{}
// Rules that manages how context will be extracted from carrier.
using Getter = nostd::string_view (*)(const T &carrier, nostd::string_view trace_type);

// Rules that manages how context will be injected to carrier.
using Setter = void (*)(T &carrier,
nostd::string_view trace_type,
nostd::string_view trace_description);

/**
* Run each of the configured propagators with the given context and carrier.
* Propagators are run in the order they are configured, so if multiple
* propagators write the same carrier key, the propagator later in the list
* will "win".
*
* @param setter Rules that manages how context will be injected to carrier.
* @param carrier Carrier into which context will be injected
* @param context Context to inject
*
*/

void Inject(Setter setter, T &carrier, const context::Context &context) noexcept override
{
for (auto &p : propagators_)
{
p->Inject(setter, carrier, context);
}
}

/**
* Run each of the configured propagators with the given context and carrier.
* Propagators are run in the order they are configured, so if multiple
* propagators write the same context key, the propagator later in the list
* will "win".
*
* @param setter Rules that manages how context will be extracte from carrier.
* @param context Context to add values to
* @param carrier Carrier from which to extract context
*/
context::Context Extract(Getter getter,
const T &carrier,
context::Context &context) noexcept override
{
auto first = true;
context::Context tmp_context;
for (auto &p : propagators_)
{
if (first)
{
tmp_context = p->Extract(getter, carrier, context);
first = false;
}
else
{
tmp_context = p->Extract(getter, carrier, tmp_context);
}
}
return propagators_.size() ? tmp_context : context;
}

private:
std::vector<std::unique_ptr<TextMapPropagator<T>>> propagators_;
};
} // namespace propagation
} // namespace trace
OPENTELEMETRY_END_NAMESPACE;
Loading

0 comments on commit 51a48d5

Please sign in to comment.