Skip to content

Commit 7bba715

Browse files
authored
Merge pull request #323 from open-telemetry/main
[pull] main from open-telemetry:main
2 parents 95baed7 + 031307b commit 7bba715

File tree

54 files changed

+1876
-143
lines changed

Some content is hidden

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

54 files changed

+1876
-143
lines changed

.devcontainer/Dockerfile.dev

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
FROM otel/cpp_format_tools
5+
6+
ARG GRPC_VERSION=v1.55.0
7+
ARG PROTOBUF_VERSION=23.4
8+
ARG ABSEIL_CPP_VERSION=20240116.1
9+
10+
ENV PROTOBUF_VERSION=${PROTOBUF_VERSION}
11+
ENV ABSEIL_CPP_VERSION=${ABSEIL_CPP_VERSION}
12+
13+
COPY ci /opt/ci
14+
15+
RUN apt update && apt install -y wget \
16+
ninja-build \
17+
libcurl4-openssl-dev \
18+
markdownlint
19+
20+
RUN cd /opt/ci && bash setup_cmake.sh
21+
RUN cd /opt/ci && bash setup_ci_environment.sh
22+
RUN cd /opt && bash ci/setup_googletest.sh \
23+
&& bash ci/setup_grpc.sh -r ${GRPC_VERSION}
24+
25+
ADD https://github.com/bazelbuild/bazelisk/releases/download/v1.22.1/bazelisk-linux-amd64 /usr/local/bin
26+
27+
RUN git config --global core.autocrlf input \
28+
&& chmod +x /usr/local/bin/bazelisk-linux-amd64

.devcontainer/devcontainer.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright The OpenTelemetry Authors
2+
// SPDX-License-Identifier: Apache-2.0
3+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
4+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.162.0/containers/javascript-node
5+
{
6+
"name": "opentelemetry-cpp",
7+
"build": {
8+
"context": "..",
9+
"dockerfile": "Dockerfile.dev",
10+
"args": {
11+
"GRPC_VERSION": "v1.55.0",
12+
"PROTOBUF_VERSION": "23.4",
13+
"ABSEIL_CPP_VERSION":"20240116.1"
14+
}
15+
},
16+
"settings": {
17+
"terminal.integrated.shell.linux": "/bin/sh"
18+
},
19+
"extensions": [
20+
"ms-vscode.cpptools",
21+
"ms-azuretools.vscode-docker",
22+
"ms-vscode.cpptools-extension-pack"
23+
],
24+
25+
"remoteUser": "root"
26+
}

.github/dependabot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@ updates:
66
interval: "daily"
77
labels:
88
- "GHA"
9+
10+
- package-ecosystem: "devcontainers"
11+
directory: "/"
12+
schedule:
13+
interval: daily

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ jobs:
7878
sudo -E ./ci/setup_googletest.sh
7979
sudo -E ./ci/setup_ci_environment.sh
8080
sudo -E ./ci/install_protobuf.sh
81+
- name: setup grpc
82+
run: |
83+
sudo ./ci/setup_grpc.sh
8184
- name: run cmake gcc (maintainer mode, sync)
8285
env:
8386
CC: /usr/bin/gcc-14
@@ -111,6 +114,9 @@ jobs:
111114
sudo -E ./ci/setup_googletest.sh
112115
sudo -E ./ci/setup_ci_environment.sh
113116
sudo -E ./ci/install_protobuf.sh
117+
- name: setup grpc
118+
run: |
119+
sudo ./ci/setup_grpc.sh
114120
- name: run cmake gcc (maintainer mode, async)
115121
env:
116122
CC: /usr/bin/gcc-14
@@ -144,6 +150,9 @@ jobs:
144150
sudo -E ./ci/setup_googletest.sh
145151
sudo -E ./ci/setup_ci_environment.sh
146152
sudo -E ./ci/install_protobuf.sh
153+
- name: setup grpc
154+
run: |
155+
sudo ./ci/setup_grpc.sh
147156
- name: run cmake clang (maintainer mode, sync)
148157
env:
149158
CC: /usr/bin/clang-18
@@ -177,6 +186,9 @@ jobs:
177186
sudo -E ./ci/setup_googletest.sh
178187
sudo -E ./ci/setup_ci_environment.sh
179188
sudo -E ./ci/install_protobuf.sh
189+
- name: setup grpc
190+
run: |
191+
sudo ./ci/setup_grpc.sh
180192
- name: run cmake clang (maintainer mode, async)
181193
env:
182194
CC: /usr/bin/clang-18
@@ -210,6 +222,9 @@ jobs:
210222
sudo -E ./ci/setup_googletest.sh
211223
sudo -E ./ci/setup_ci_environment.sh
212224
sudo -E ./ci/install_protobuf.sh
225+
- name: setup grpc
226+
run: |
227+
sudo ./ci/setup_grpc.sh
213228
- name: run cmake clang (maintainer mode, abiv2)
214229
env:
215230
CC: /usr/bin/clang-18

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ Increment the:
3030
* [SDK] Better control of threads executed by opentelemetry-cpp
3131
[#3175](https://github.com/open-telemetry/opentelemetry-cpp/pull/3175)
3232

33+
* [SDK] Enable deriving from ResourceDetector to create a Resource
34+
[#3247](https://github.com/open-telemetry/opentelemetry-cpp/pull/3247)
35+
36+
* [EXPORTER] Support handling retry-able errors for OTLP/HTTP
37+
[#3223](https://github.com/open-telemetry/opentelemetry-cpp/pull/3223)
38+
39+
* [EXPORTER] Support handling retry-able errors for OTLP/gRPC
40+
[#3219](https://github.com/open-telemetry/opentelemetry-cpp/pull/3219)
41+
3342
New features:
3443

3544
* [SDK] Better control of threads executed by opentelemetry-cpp

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ if(NOT WITH_STL STREQUAL "OFF")
212212
endif()
213213
endif()
214214

215+
option(WITH_OTLP_RETRY_PREVIEW
216+
"Whether to enable experimental retry functionality" OFF)
217+
215218
option(WITH_OTLP_GRPC_SSL_MTLS_PREVIEW
216219
"Whether to enable mTLS support fro gRPC" OFF)
217220

CONTRIBUTING.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,91 @@ bazel build //examples/simple:example_simple
6060
bazel-bin/examples/simple/example_simple
6161
```
6262

63+
### DevContainer Setup for Project
64+
65+
This guide provides instructions on how to set up and use the development
66+
container (`devcontainer`) environment to streamline testing and development
67+
for this project. With the DevContainer, you can work in a consistent environment
68+
configured with all the necessary dependencies and tools.
69+
70+
#### Prerequisites
71+
72+
Before getting started, ensure you have the following installed:
73+
74+
* **Docker**: DevContainers require Docker for containerization.
75+
* **Visual Studio Code (VSCode)** with the **Remote - Containers** extension.
76+
77+
#### Getting Started
78+
79+
* **Open the Project in DevContainer**:
80+
81+
Open the project in VSCode. When prompted to "Reopen in Container," select
82+
this option. If you’re not prompted, you can manually open the container by
83+
selecting **Remote-Containers: Reopen in Container** from the command palette
84+
(`F1` or `Ctrl+Shift+P`).
85+
86+
* **Container Setup**:
87+
88+
The DevContainer environment will automatically build based on the configuration
89+
files provided (e.g., `.devcontainer/devcontainer.json`). This setup will install
90+
required dependencies, tools, and environment variables needed for the project.
91+
92+
#### Available Commands
93+
94+
Once inside the DevContainer, you can use the following commands to run tests
95+
and CI workflows.
96+
97+
##### 1. Run Tests with Bazelisk
98+
99+
To run tests with Bazelisk using specific compilation options, use:
100+
101+
```bash
102+
bazelisk-linux-amd64 test --copt=-DENABLE_LOGS_PREVIEW
103+
--test_output=errors --cache_test_results=no --copt=-DENABLE_TEST //exporters/otlp/...
104+
```
105+
106+
###### Command Breakdown
107+
108+
* `--copt=-DENABLE_LOGS_PREVIEW`: Enables preview logs.
109+
* `--test_output=errors`: Shows only the errors in the test output.
110+
* `--cache_test_results=no`: Forces Bazel to re-run tests without caching.
111+
* `--copt=-DENABLE_TEST`: Enables testing capabilities for the target code.
112+
* `//exporters/otlp/...`: Specifies the test target path.
113+
114+
##### 2. Run CI Script
115+
116+
You can also run the CI script provided to perform testing with the
117+
following command as an
118+
example:
119+
120+
```bash
121+
bash ci/do_ci.sh cmake.exporter.otprotocol.test
122+
```
123+
124+
This command initiates the CI pipeline, executing tests specifically for the
125+
**cmake.exporter.otprotocol** module.
126+
127+
#### Troubleshooting
128+
129+
If you encounter issues:
130+
131+
* **Rebuild the DevContainer**: From the command palette, run
132+
**Remote-Containers: Rebuild Container** to reinitialize the environment.
133+
* **Check Bazelisk and CI Script Logs**: Inspect logs for any configuration or
134+
dependency issues.
135+
136+
#### Additional Notes
137+
138+
* You can adjust compiler options (`--copt`) as needed to test additional flags
139+
or enable/disable specific features.
140+
* The test results will be displayed in the terminal within the DevContainer for
141+
easy debugging.
142+
143+
#### Resources
144+
145+
* **Bazelisk Documentation**: [https://github.com/bazelbuild/bazelisk](https://github.com/bazelbuild/bazelisk)
146+
* **VSCode DevContainer Documentation**: [https://code.visualstudio.com/docs/remote/containers](https://code.visualstudio.com/docs/remote/containers)
147+
63148
## Pull Requests
64149

65150
### How to Send Pull Requests

api/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ target_compile_definitions(
116116
opentelemetry_api
117117
INTERFACE OPENTELEMETRY_ABI_VERSION_NO=${OPENTELEMETRY_ABI_VERSION_NO})
118118

119+
if(WITH_OTLP_RETRY_PREVIEW)
120+
target_compile_definitions(opentelemetry_api
121+
INTERFACE ENABLE_OTLP_RETRY_PREVIEW)
122+
endif()
123+
119124
if(WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
120125
target_compile_definitions(opentelemetry_api
121126
INTERFACE ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW)

ci/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# Building and running tests as a developer
22

33
CI tests can be run on docker by invoking the script `./ci/run_docker.sh
4-
./ci/do_ci.sh {TARGET}` where the targets are:
4+
./ci/do_ci.sh {TARGET}`or inside
5+
[devcontainer](../CONTRIBUTING.md#devcontainer-setup-for-project)
6+
by invoking the script
7+
`./ci/do_ci.sh {TARGET}` where the targets are:
58

69
* `cmake.test`: build cmake targets and run tests.
710
* `cmake.maintainer.test`: build with cmake and test, in maintainer mode.

ci/do_ci.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ elif [[ "$1" == "cmake.maintainer.sync.test" ]]; then
108108
rm -rf *
109109
cmake "${CMAKE_OPTIONS[@]}" \
110110
-DWITH_OTLP_HTTP=ON \
111+
-DWITH_OTLP_GRPC=ON \
111112
-DWITH_OTLP_FILE=ON \
112113
-DWITH_PROMETHEUS=ON \
113114
-DWITH_EXAMPLES=ON \
@@ -120,6 +121,7 @@ elif [[ "$1" == "cmake.maintainer.sync.test" ]]; then
120121
-DOTELCPP_MAINTAINER_MODE=ON \
121122
-DWITH_NO_DEPRECATED_CODE=ON \
122123
-DWITH_OTLP_HTTP_COMPRESSION=ON \
124+
-DWITH_OTLP_RETRY_PREVIEW=ON \
123125
-DWITH_THREAD_INSTRUMENTATION_PREVIEW=ON \
124126
"${SRC_DIR}"
125127
eval "$MAKE_COMMAND"
@@ -130,6 +132,7 @@ elif [[ "$1" == "cmake.maintainer.async.test" ]]; then
130132
rm -rf *
131133
cmake "${CMAKE_OPTIONS[@]}" \
132134
-DWITH_OTLP_HTTP=ON \
135+
-DWITH_OTLP_GRPC=ON \
133136
-DWITH_OTLP_FILE=ON \
134137
-DWITH_PROMETHEUS=ON \
135138
-DWITH_EXAMPLES=ON \
@@ -142,6 +145,7 @@ elif [[ "$1" == "cmake.maintainer.async.test" ]]; then
142145
-DOTELCPP_MAINTAINER_MODE=ON \
143146
-DWITH_NO_DEPRECATED_CODE=ON \
144147
-DWITH_OTLP_HTTP_COMPRESSION=ON \
148+
-DWITH_OTLP_RETRY_PREVIEW=ON \
145149
-DWITH_THREAD_INSTRUMENTATION_PREVIEW=ON \
146150
"${SRC_DIR}"
147151
eval "$MAKE_COMMAND"
@@ -165,6 +169,7 @@ elif [[ "$1" == "cmake.maintainer.cpp11.async.test" ]]; then
165169
-DOTELCPP_MAINTAINER_MODE=ON \
166170
-DWITH_NO_DEPRECATED_CODE=ON \
167171
-DWITH_OTLP_HTTP_COMPRESSION=ON \
172+
-DWITH_OTLP_RETRY_PREVIEW=ON \
168173
-DWITH_THREAD_INSTRUMENTATION_PREVIEW=ON \
169174
"${SRC_DIR}"
170175
make -k -j $(nproc)
@@ -175,6 +180,7 @@ elif [[ "$1" == "cmake.maintainer.abiv2.test" ]]; then
175180
rm -rf *
176181
cmake "${CMAKE_OPTIONS[@]}" \
177182
-DWITH_OTLP_HTTP=ON \
183+
-DWITH_OTLP_GRPC=ON \
178184
-DWITH_OTLP_FILE=ON \
179185
-DWITH_PROMETHEUS=ON \
180186
-DWITH_EXAMPLES=ON \
@@ -189,6 +195,7 @@ elif [[ "$1" == "cmake.maintainer.abiv2.test" ]]; then
189195
-DWITH_ABI_VERSION_1=OFF \
190196
-DWITH_ABI_VERSION_2=ON \
191197
-DWITH_OTLP_HTTP_COMPRESSION=ON \
198+
-DWITH_OTLP_RETRY_PREVIEW=ON \
192199
-DWITH_THREAD_INSTRUMENTATION_PREVIEW=ON \
193200
"${SRC_DIR}"
194201
eval "$MAKE_COMMAND"
@@ -340,6 +347,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.test" ]]; then
340347
-DWITH_OTLP_HTTP=ON \
341348
-DWITH_OTLP_FILE=ON \
342349
-DWITH_OTLP_GRPC_SSL_MTLS_PREVIEW=ON \
350+
-DWITH_OTLP_RETRY_PREVIEW=ON \
343351
"${SRC_DIR}"
344352
grpc_cpp_plugin=`which grpc_cpp_plugin`
345353
proto_make_file="CMakeFiles/opentelemetry_proto.dir/build.make"

0 commit comments

Comments
 (0)