Skip to content

Commit f1afdd0

Browse files
committed
feat: Add tracing hook.
1 parent 03e2a59 commit f1afdd0

File tree

22 files changed

+1829
-3
lines changed

22 files changed

+1829
-3
lines changed

.github/workflows/manual-publish-doc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- libs/client-sdk
1111
- libs/server-sdk
1212
- libs/server-sdk-redis-source
13+
- libs/server-sdk-otel
1314
name: Publish Documentation
1415
jobs:
1516
build-publish:

.github/workflows/manual-sdk-release-artifacts.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
- libs/client-sdk:launchdarkly-cpp-client
1717
- libs/server-sdk:launchdarkly-cpp-server
1818
- libs/server-sdk-redis-source:launchdarkly-cpp-server-redis-source
19+
- libs/server-sdk-otel:launchdarkly-cpp-server-otel
1920

2021
name: Publish SDK Artifacts
2122

.github/workflows/release-please.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
package-server-tag: ${{ steps.release.outputs['libs/server-sdk--tag_name'] }}
1515
package-server-redis-released: ${{ steps.release.outputs['libs/server-sdk-redis-source--release_created'] }}
1616
package-server-redis-tag: ${{ steps.release.outputs['libs/server-sdk-redis-source--tag_name'] }}
17+
package-server-otel-released: ${{ steps.release.outputs['libs/server-sdk-otel--release_created'] }}
18+
package-server-otel-tag: ${{ steps.release.outputs['libs/server-sdk-otel--tag_name'] }}
1719
steps:
1820
- uses: googleapis/release-please-action@v4
1921
id: release
@@ -142,3 +144,44 @@ jobs:
142144
upload-assets: true
143145
upload-tag-name: ${{ needs.release-please.outputs.package-server-redis-tag }}
144146
provenance-name: ${{ format('{0}-server-redis-multiple-provenance.intoto.jsonl', matrix.os) }}
147+
148+
release-server-otel:
149+
strategy:
150+
matrix:
151+
# Each of the platforms for which release-artifacts need generated.
152+
os: [ ubuntu-22.04, windows-2022, macos-13 ]
153+
runs-on: ${{ matrix.os }}
154+
needs: [ 'release-please' ]
155+
if: ${{ needs.release-please.outputs.package-server-otel-released == 'true'}}
156+
outputs:
157+
hashes-linux: ${{ steps.release-server-otel.outputs.hashes-linux }}
158+
hashes-windows: ${{ steps.release-server-otel.outputs.hashes-windows }}
159+
hashes-macos: ${{ steps.release-server-otel.outputs.hashes-macos }}
160+
steps:
161+
- uses: actions/checkout@v4
162+
- id: release-server-otel
163+
name: Full release of libs/server-sdk-otel
164+
uses: ./.github/actions/sdk-release
165+
with:
166+
# The tag of the release to upload artifacts to.
167+
tag_name: ${{ needs.release-please.outputs.package-server-otel-tag }}
168+
github_token: ${{secrets.GITHUB_TOKEN}}
169+
sdk_path: 'libs/server-sdk-otel'
170+
sdk_cmake_target: 'launchdarkly-cpp-server-otel'
171+
172+
release-server-otel-provenance:
173+
needs: [ 'release-please', 'release-server-otel' ]
174+
strategy:
175+
matrix:
176+
# Generates a combined attestation for each platform
177+
os: [ linux, windows, macos ]
178+
permissions:
179+
actions: read
180+
id-token: write
181+
contents: write
182+
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
183+
with:
184+
base64-subjects: "${{ needs.release-server-otel.outputs[format('hashes-{0}', matrix.os)] }}"
185+
upload-assets: true
186+
upload-tag-name: ${{ needs.release-please.outputs.package-server-otel-tag }}
187+
provenance-name: ${{ format('{0}-server-otel-multiple-provenance.intoto.jsonl', matrix.os) }}

.github/workflows/server-otel.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: libs/server-sdk-otel
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths-ignore:
7+
- '**.md' # Do not need to run CI for markdown changes.
8+
pull_request:
9+
branches: [ "main", "feat/**" ]
10+
paths-ignore:
11+
- '**.md'
12+
schedule:
13+
# Run daily at midnight PST
14+
- cron: '0 8 * * *'
15+
16+
jobs:
17+
build-test-otel:
18+
runs-on: ubuntu-22.04
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: ./.github/actions/ci
22+
with:
23+
cmake_target: launchdarkly-cpp-server-otel
24+
cmake_extra_options: '-DLD_BUILD_OTEL_SUPPORT=ON'
25+
simulate_release: true
26+
build-otel-mac:
27+
runs-on: macos-13
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: ./.github/actions/ci
31+
with:
32+
cmake_target: launchdarkly-cpp-server-otel
33+
cmake_extra_options: '-DLD_BUILD_OTEL_SUPPORT=ON'
34+
platform_version: 12
35+
simulate_release: true
36+
build-test-otel-windows:
37+
runs-on: windows-2022
38+
steps:
39+
- uses: actions/checkout@v4
40+
- uses: ilammy/msvc-dev-cmd@v1
41+
- uses: ./.github/actions/ci
42+
env:
43+
BOOST_LIBRARY_DIR: 'C:\local\boost_1_87_0\lib64-msvc-14.3'
44+
BOOST_LIBRARYDIR: 'C:\local\boost_1_87_0\lib64-msvc-14.3'
45+
Boost_DIR: 'C:\local\boost_1_87_0\lib64-msvc-14.3\cmake\Boost-1.87.0'
46+
with:
47+
cmake_target: launchdarkly-cpp-server-otel
48+
cmake_extra_options: '-DLD_BUILD_OTEL_SUPPORT=ON'
49+
platform_version: 2022
50+
toolset: msvc
51+
simulate_windows_release: true

.release-please-manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"libs/common": "1.10.0",
55
"libs/internal": "0.12.1",
66
"libs/server-sdk": "3.9.1",
7-
"libs/server-sdk-redis-source": "2.2.0"
7+
"libs/server-sdk-redis-source": "2.2.0",
8+
"libs/server-sdk-otel": "0.0.0"
89
}

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ option(LD_BUILD_EXAMPLES "Build hello-world examples." ON)
101101

102102
option(LD_BUILD_REDIS_SUPPORT "Build redis support." OFF)
103103

104+
option(LD_BUILD_OTEL_SUPPORT "Build OpenTelemetry integration." OFF)
105+
104106
# If using 'make' as the build system, CMake causes the 'install' target to have a dependency on 'all', meaning
105107
# it will cause a full build. This disables that, allowing us to build piecemeal instead. This is useful
106108
# so that we only need to build the client or server for a given release (if only the client or server were affected.)
@@ -195,6 +197,11 @@ if (LD_BUILD_REDIS_SUPPORT)
195197
add_subdirectory(libs/server-sdk-redis-source)
196198
endif ()
197199

200+
if (LD_BUILD_OTEL_SUPPORT)
201+
message("LaunchDarkly: building OpenTelemetry integration")
202+
add_subdirectory(libs/server-sdk-otel)
203+
endif ()
204+
198205
# Built as static or shared depending on LD_BUILD_SHARED_LIBS variable.
199206
# This target "links" in common, internal, and sse as object libraries.
200207
add_subdirectory(libs/client-sdk)

examples/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ if (LD_BUILD_REDIS_SUPPORT)
88
add_subdirectory(hello-cpp-server-redis)
99
add_subdirectory(hello-c-server-redis)
1010
endif ()
11+
12+
if (LD_BUILD_OTEL_SUPPORT)
13+
add_subdirectory(hello-cpp-server-otel)
14+
endif ()
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Required for Apple Silicon support.
2+
cmake_minimum_required(VERSION 3.19)
3+
4+
project(
5+
LaunchDarklyHelloCPPServerOTel
6+
VERSION 0.1
7+
DESCRIPTION "LaunchDarkly Hello CPP Server-side SDK with OpenTelemetry Integration"
8+
LANGUAGES CXX
9+
)
10+
11+
set(THREADS_PREFER_PTHREAD_FLAG ON)
12+
find_package(Threads REQUIRED)
13+
14+
# Find Boost
15+
find_package(Boost 1.81 REQUIRED COMPONENTS system)
16+
17+
add_executable(hello-cpp-server-otel main.cpp)
18+
19+
target_link_libraries(hello-cpp-server-otel
20+
PRIVATE
21+
launchdarkly::server
22+
launchdarkly::server_otel
23+
Threads::Threads
24+
${Boost_LIBRARIES}
25+
opentelemetry_trace
26+
opentelemetry_exporter_otlp_http
27+
)

0 commit comments

Comments
 (0)