Skip to content

Commit

Permalink
Merge branch 'main' into wip-thrift
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb authored Oct 20, 2021
2 parents bbc4b8f + cc065f7 commit c50fed7
Show file tree
Hide file tree
Showing 17 changed files with 142 additions and 127 deletions.
54 changes: 35 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,16 @@ option(WITH_PROMETHEUS "Whether to include the Prometheus Client in the SDK"
option(WITH_ELASTICSEARCH
"Whether to include the Elasticsearch Client in the SDK" OFF)

option(WITH_ZPAGES "Whether to include the Zpages Server in the SDK" OFF)

option(WITH_JAEGER "Whether to include the Jaeger exporter" OFF)

option(WITH_NO_GETENV "Whether the platform supports environment variables" OFF)

option(BUILD_TESTING "Whether to enable tests" ON)

option(BUILD_W3CTRACECONTEXT_TEST "Whether to build w3c trace context" OFF)

if(WITH_NO_GENENV)
add_definitions(-DNO_GETENV)
endif()
Expand Down Expand Up @@ -251,29 +255,41 @@ endif()
# GNUInstallDirs.
include(GNUInstallDirs)

if(NOT WITH_API_ONLY)
if((NOT WITH_API_ONLY)
OR WITH_ELASTICSEARCH
OR WITH_ZIPKIN
OR WITH_OTLP
OR WITH_OTLP_HTTP
OR WITH_ZPAGES
OR BUILD_W3CTRACECONTEXT_TEST
OR WITH_ETW)
# nlohmann_json package is required for most SDK build configurations
find_package(nlohmann_json QUIET)
if(NOT nlohmann_json_FOUND)
message("Using local nlohmann::json from submodule")
set(JSON_BuildTests
OFF
CACHE INTERNAL "")
set(JSON_Install
ON
CACHE INTERNAL "")
if(EXISTS ${PROJECT_SOURCE_DIR}/third_party/nlohmann-json)
# This option allows to link nlohmann_json::nlohmann_json target
add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/nlohmann-json)
# This option allows to add header to include directories
include_directories(
${PROJECT_SOURCE_DIR}/third_party/nlohmann-json/single_include)
if(EXISTS ${PROJECT_SOURCE_DIR}/.git)
message("Trying to use local nlohmann::json from submodule")
set(JSON_BuildTests
OFF
CACHE INTERNAL "")
set(JSON_Install
ON
CACHE INTERNAL "")
if(EXISTS ${PROJECT_SOURCE_DIR}/third_party/nlohmann-json/CMakeLists.txt)
# This option allows to link nlohmann_json::nlohmann_json target
add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/nlohmann-json)
# This option allows to add header to include directories
include_directories(
${PROJECT_SOURCE_DIR}/third_party/nlohmann-json/single_include)
else()
message(
FATAL_ERROR
"\nnlohmann_json package was not found. Please either provide it manually or clone with submodules. "
"To initialize, fetch and checkout any nested submodules, you can use the following command:\n"
"git submodule update --init --recursive")
endif()
else()
message(
FATAL_ERROR
"\nnlohmann_json package was not found. Please either provide it manually or clone with submodules. "
"To initialize, fetch and checkout any nested submodules, you can use the following command:\n"
"git submodule update --init --recursive")
# Let's fail with default find_package error
find_package(nlohmann_json REQUIRED)
endif()
else()
message("Using external nlohmann::json")
Expand Down
53 changes: 19 additions & 34 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ git commit
git push fork feature
```

If you made changes to the Markdown documents (`*.md` files), install the latest
[`markdownlint-cli`](https://github.com/igorshubovych/markdownlint-cli) and run:

```sh
markdownlint .
```

Open a pull request against the main `opentelemetry-cpp` repo.

To run tests locally, please read the [CI instructions](ci/README.md).
Expand Down Expand Up @@ -144,6 +151,14 @@ If none of the above worked and the PR has been stuck for more than 2 weeks, the
owner should bring it to the OpenTelemetry C++ SIG meeting. See
[README.md](README.md#contributing) for the meeting link.

## Design Choices

As with other OpenTelemetry clients, opentelemetry-cpp follows the
[opentelemetry-specification](https://github.com/open-telemetry/opentelemetry-specification).

It's especially valuable to read through the [library
guidelines](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/library-guidelines.md).

## Useful Resources

Hi! If you’re looking at this document, these resources will provide you the
Expand All @@ -168,43 +183,13 @@ the C++ repository.
* The OpenTelemetry Specification describes the requirements and expectations
of for all OpenTelemetry implementations.

* Read through the [OpenTelemetry
Collector](https://github.com/open-telemetry/opentelemetry-collector) GitHub
repository.
* This repository has a lot of good information surrounding the OpenTelemetry
ecosystem. At the top of the
**[readme](https://github.com/open-telemetry/opentelemetry-collector/blob/main/README.md)**,
there are multiple links that give newcomers a good idea of what the project
is about and how to get involved in it.
* Read through the OpenTelemetry Python documentation
* Read through the OpenTelemetry C++ documentation
* The
[API](https://opentelemetry-python.readthedocs.io/en/stable/api/api.html)
[API](https://opentelemetry-cpp.readthedocs.io/en/latest/api/api.html)
and
[SDK](https://opentelemetry-python.readthedocs.io/en/stable/sdk/sdk.html)
[SDK](https://opentelemetry-cpp.readthedocs.io/en/latest/sdk/sdk.html)
documentation provides a lot of information on what the classes and their
functions are used for. Since there is currently minimal documentation for
C++, use the Python repository’s extensive documentation to learn more about
how the API and SDK work.

### Code Examples

* Follow the [simple trace
example](https://github.com/open-telemetry/opentelemetry-cpp/pull/92) for an
introduction to basic OpenTelemetry functionality in C++. Currently the
example can be found in [PR
#94](https://github.com/open-telemetry/opentelemetry-cpp/pull/94).

* Read through the [Java Quick-Start
Guide](https://github.com/open-telemetry/opentelemetry-java/blob/main/QUICKSTART.md).
This shows you how the classes and functions will interact in simple and easy
to digest examples.
* Take a look at this [Java SDK
example](https://github.com/open-telemetry/opentelemetry-java/tree/main/examples/sdk-usage).
This shows a good use case of the SDK using stdout exporter.
* Take a look at the [Java Jaeger
example](https://github.com/open-telemetry/opentelemetry-java/tree/main/examples/jaeger).
This provides a brief introduction to the Jaeger exporter, its interface, and
how to interact with the service.
functions are used for.

Please contribute! You’re welcome to add more information if you come across any
helpful resources.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ of the current project.

| Platform | Build type |
|---------------------------------------------------------------------|---------------|
| ubuntu-18.04 (Default GCC Compiler - 7.5.0) | CMake, Bazel |
| ubuntu-20.04 (Default GCC Compiler - 9.3.0) | CMake, Bazel |
| ubuntu-18.04 (GCC 4.8 with -std=c++11 flag) | CMake [1] |
| ubuntu-20.04 (Default GCC Compiler - 9.3.0 with -std=c++20 flags) | CMake, Bazel |
| macOS 10.15 (Xcode 12.2) | Bazel |
Expand Down
2 changes: 1 addition & 1 deletion docs/public/sdk/GettingStarted.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ OpenTelemetry offers six tracing exporters out of the box:
// otlp http exporter
opentelemetry::exporter::otlp::OtlpHttpExporterOptions opts;
opts.url = "http://localhost:4317/v1/traces";
opts.url = "http://localhost:4318/v1/traces";
auto otlp_http_exporter =
std::unique_ptr<sdktrace::SpanExporter>(new opentelemetry::exporter::otlp::OtlpHttpExporter(opts));
Expand Down
9 changes: 4 additions & 5 deletions examples/otlp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,18 @@ OpenTelemetry Collector with an OTLP receiver by running:
- On Unix based systems use:

```console
docker run --rm -it -p 4317:4317 -p 55681:55681 -v $(pwd)/examples/otlp:/cfg otel/opentelemetry-collector:0.19.0 --config=/cfg/opentelemetry-collector-config/config.dev.yaml
docker run --rm -it -p 4317:4317 -p 4318:4318 -v $(pwd)/examples/otlp:/cfg otel/opentelemetry-collector:0.19.0 --config=/cfg/opentelemetry-collector-config/config.dev.yaml
```

- On Windows use:

```console
docker run --rm -it -p 4317:4317 -p 55681:55681 -v "%cd%/examples/otlp":/cfg otel/opentelemetry-collector:0.19.0 --config=/cfg/opentelemetry-collector-config/config.dev.yaml
docker run --rm -it -p 4317:4317 -p 4318:4318 -v "%cd%/examples/otlp":/cfg otel/opentelemetry-collector:0.19.0 --config=/cfg/opentelemetry-collector-config/config.dev.yaml
```

Note that the OTLP exporter connects to the Collector at `localhost:4317` by
default. This can be changed with first argument from command-line, for example:
Note that the OTLP gRPC and HTTP exporters connects to the Collector at `localhost:4317` and `localhost:4318:/v1/traces` respectively. This can be changed with first argument from command-line, for example:
`./example_otlp_grpc gateway.docker.internal:4317` and
`./example_otlp_http gateway.docker.internal:55681/v1/traces`.
`./example_otlp_http gateway.docker.internal:4318/v1/traces`.

Once you have the Collector running, see
[CONTRIBUTING.md](../../CONTRIBUTING.md) for instructions on building and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ receivers:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: "0.0.0.0:55681"
endpoint: "0.0.0.0:4318"
cors_allowed_origins:
- '*'
service:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Logger : public logs::Logger
{
static ETWProvider instance; // C++11 magic static
return instance;
};
}

/**
* @brief Init a reference to etw::ProviderHandle
Expand Down
Loading

0 comments on commit c50fed7

Please sign in to comment.