-
Notifications
You must be signed in to change notification settings - Fork 558
Opentracing shim #1909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Opentracing shim #1909
Changes from all commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
45e0c4b
First attempt
chusitoo 321a801
Tracer unit tests wip
chusitoo 36cca42
Add more comments from compatibility section
chusitoo 81b8557
More tracer unit tests
chusitoo 1fc7f33
Unit tests for shim utils
chusitoo 4d99b85
Unit tests for span context shim
chusitoo 22949e2
Unit tests for span shim
chusitoo f62eb78
Cleanup and more unit tests
chusitoo 25aeac8
Reduce copying for StartSpan
chusitoo 8f10779
Implement span context shim trace_id and span_id
chusitoo 697c402
Update CMakeFile build and install
chusitoo 2d2adf3
Add Bazel build, fix failing test
chusitoo 5d15422
Add README
chusitoo 32ba915
Additional tests and cleanup
chusitoo ddd71ab
Merge remote-tracking branch 'remotes/origin/main' into opentracing-shim
chusitoo 4d91681
Disable by default
chusitoo cf5c93e
Merge branch 'main' into opentracing-shim
lalitb 0c55471
Fixes for markdownlint
chusitoo 43114f5
Exclude shim from bazel.noexcept and bazel.nortti
chusitoo fd03fcc
Value string conversion to Attribute is unsupported
chusitoo a0a5366
Fix format
chusitoo 9df7351
Minor UT tuning
chusitoo 96da882
Enable Opentracing shim in cmake.maintainer.test job
chusitoo b9178ef
Link with Opentracing lib
chusitoo 20c99ec
Cannot compile shim for Windows because Opentracing Bazel build suppo…
chusitoo ba50b4d
Merge remote-tracking branch 'remotes/origin/main' into opentracing-shim
chusitoo 7a0ca8d
Comments on why shim is ignored in some tests
chusitoo 0708bb1
Move comments block inside function body
chusitoo 32a291b
Merge remote-tracking branch 'remotes/origin/main' into opentracing-shim
chusitoo f6bc7de
Cleanup
chusitoo 6636cc5
Fix error in package exclusion
chusitoo 7b3d99a
Fix clang/gcc compilation warnings/errors
chusitoo 18ff609
Move to own ci job
chusitoo 0457d0b
Fix copy-paste error
chusitoo 43ddff2
Format...
chusitoo d141674
Ignore CXXFLAGS for Opentracing
chusitoo 3276cc0
Not sure why CI fails to exclude shim in Windows Bazel...
chusitoo 07113bc
Fix typo in CXX flags
chusitoo a278709
Attempt removing shim via deleted_packages
chusitoo f74f67f
Disable redundant-move
chusitoo 7c0a4df
Merge remote-tracking branch 'remotes/origin/main' into opentracing-shim
chusitoo 20a0d9c
Merge remote-tracking branch 'remotes/origin/main' into opentracing-shim
chusitoo 9d66d21
Merge remote-tracking branch 'remotes/origin/main' into opentracing-shim
chusitoo c4a38c1
Merge branch 'main' into opentracing-shim
chusitoo 57b3051
Update references to OpenTracing
chusitoo cc360d7
Use static_cast when RTTI is disabled
chusitoo ecff298
Micro-optimizations
chusitoo 4cf746f
Unit test for start span with error tag
chusitoo d500915
Remove exclusion of shim in bazel no-rtti test
chusitoo 72ea0fb
Run opentracing-shim test job on latest Ubuntu
chusitoo 1877e2d
Fix problems with UTs reported by Valgrind
chusitoo 0f967df
Merge remote-tracking branch 'remotes/origin/main' into opentracing-shim
chusitoo 241ff46
Put back string => string_view mapping
chusitoo f90d480
Merge branch 'main' into opentracing-shim
chusitoo afd1b4d
Add copyright and license
chusitoo f24c4cf
Merge branch 'main' into opentracing-shim
chusitoo 60b880b
Merge branch 'main' into opentracing-shim
chusitoo 2eadaf8
Merge branch 'main' into opentracing-shim
chusitoo 36ead65
Merge branch 'main' into opentracing-shim
chusitoo 55ae68e
Merge branch 'main' into opentracing-shim
chusitoo 7a46efa
Merge branch 'main' into opentracing-shim
chusitoo 52ecc0b
Merge branch 'main' into opentracing-shim
lalitb 64edf81
Merge branch 'main' into opentracing-shim
marcalff a4cd537
Fix prometheus commit
chusitoo 59108e4
Merge branch 'main' into opentracing-shim
lalitb ac8dc8f
Merge branch 'main' into opentracing-shim
esigo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| # Copyright The OpenTelemetry Authors | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package(default_visibility = ["//visibility:public"]) | ||
|
|
||
| cc_library( | ||
| name = "opentracing_shim", | ||
| srcs = [ | ||
| "src/shim_utils.cc", | ||
| "src/span_context_shim.cc", | ||
| "src/span_shim.cc", | ||
| "src/tracer_shim.cc", | ||
| ], | ||
| hdrs = [ | ||
| "include/opentelemetry/opentracingshim/propagation.h", | ||
| "include/opentelemetry/opentracingshim/shim_utils.h", | ||
| "include/opentelemetry/opentracingshim/span_context_shim.h", | ||
| "include/opentelemetry/opentracingshim/span_shim.h", | ||
| "include/opentelemetry/opentracingshim/tracer_shim.h", | ||
| ], | ||
| strip_include_prefix = "include", | ||
| tags = ["opentracing"], | ||
| deps = [ | ||
| "//api", | ||
| "@com_github_opentracing//:opentracing", | ||
| ], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "propagation_test", | ||
| srcs = [ | ||
| "test/propagation_test.cc", | ||
| "test/shim_mocks.h", | ||
| ], | ||
| tags = [ | ||
| "opentracing_shim", | ||
| "test", | ||
| ], | ||
| deps = [ | ||
| ":opentracing_shim", | ||
| "@com_google_googletest//:gtest_main", | ||
| ], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "shim_utils_test", | ||
| srcs = [ | ||
| "test/shim_mocks.h", | ||
| "test/shim_utils_test.cc", | ||
| ], | ||
| tags = [ | ||
| "opentracing_shim", | ||
| "test", | ||
| ], | ||
| deps = [ | ||
| ":opentracing_shim", | ||
| "@com_google_googletest//:gtest_main", | ||
| ], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "span_shim_test", | ||
| srcs = [ | ||
| "test/shim_mocks.h", | ||
| "test/span_shim_test.cc", | ||
| ], | ||
| tags = [ | ||
| "opentracing_shim", | ||
| "test", | ||
| ], | ||
| deps = [ | ||
| ":opentracing_shim", | ||
| "@com_google_googletest//:gtest_main", | ||
| ], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "span_context_shim_test", | ||
| srcs = [ | ||
| "test/span_context_shim_test.cc", | ||
| ], | ||
| tags = [ | ||
| "opentracing_shim", | ||
| "test", | ||
| ], | ||
| deps = [ | ||
| ":opentracing_shim", | ||
| "@com_google_googletest//:gtest_main", | ||
| ], | ||
| ) | ||
|
|
||
| cc_test( | ||
| name = "tracer_shim_test", | ||
| srcs = [ | ||
| "test/shim_mocks.h", | ||
| "test/tracer_shim_test.cc", | ||
| ], | ||
| tags = [ | ||
| "opentracing_shim", | ||
| "test", | ||
| ], | ||
| deps = [ | ||
| ":opentracing_shim", | ||
| "@com_google_googletest//:gtest_main", | ||
| ], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # Copyright The OpenTelemetry Authors | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set(this_target opentelemetry_opentracing_shim) | ||
|
|
||
| add_library(${this_target} src/shim_utils.cc src/span_shim.cc | ||
| src/span_context_shim.cc src/tracer_shim.cc) | ||
|
|
||
| set_target_properties(${this_target} PROPERTIES EXPORT_NAME opentracing_shim) | ||
|
|
||
| target_include_directories( | ||
| ${this_target} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>" | ||
| "$<INSTALL_INTERFACE:include>") | ||
|
|
||
| if(OPENTRACING_DIR) | ||
| include_directories( | ||
| "${CMAKE_BINARY_DIR}/${OPENTRACING_DIR}/include" | ||
| "${CMAKE_SOURCE_DIR}/${OPENTRACING_DIR}/include" | ||
| "${CMAKE_SOURCE_DIR}/${OPENTRACING_DIR}/3rd_party/include") | ||
| target_link_libraries(${this_target} opentelemetry_api opentracing) | ||
| else() | ||
| target_link_libraries(${this_target} opentelemetry_api | ||
| OpenTracing::opentracing) | ||
| endif() | ||
|
|
||
| install( | ||
| TARGETS ${this_target} | ||
| EXPORT "${PROJECT_NAME}-target" | ||
| RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
| LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
|
|
||
| install( | ||
| DIRECTORY include/opentelemetry/opentracingshim | ||
| DESTINATION include/opentelemetry | ||
| FILES_MATCHING | ||
| PATTERN "*.h") | ||
|
|
||
| if(BUILD_TESTING) | ||
| foreach(testname propagation_test shim_utils_test span_shim_test | ||
| span_context_shim_test tracer_shim_test) | ||
|
|
||
| add_executable(${testname} "test/${testname}.cc") | ||
|
|
||
| if(OPENTRACING_DIR) | ||
| target_link_libraries( | ||
| ${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} | ||
| opentelemetry_api opentelemetry_opentracing_shim opentracing) | ||
| else() | ||
| target_link_libraries( | ||
| ${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} | ||
| opentelemetry_api opentelemetry_opentracing_shim | ||
| OpenTracing::opentracing) | ||
| endif() | ||
|
|
||
| gtest_add_tests( | ||
| TARGET ${testname} | ||
| TEST_PREFIX opentracing_shim. | ||
| TEST_LIST ${testname}) | ||
| endforeach() | ||
| endif() # BUILD_TESTING |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # OpenTracing Shim | ||
|
|
||
| [![Apache License][license-image]][license-image] | ||
|
|
||
| The OpenTracing shim is a bridge layer from OpenTelemetry to the OpenTracing API. | ||
| It takes an OpenTelemetry Tracer and exposes it as an implementation compatible with | ||
| that of an OpenTracing Tracer. | ||
|
|
||
| ## Usage | ||
|
|
||
| Use the TracerShim wherever you initialize your OpenTracing tracers. | ||
| There are 2 ways to expose an OpenTracing Tracer: | ||
|
|
||
| 1. From the global OpenTelemetry configuration: | ||
|
|
||
| ```cpp | ||
| auto tracer_shim = TracerShim::createTracerShim(); | ||
| ``` | ||
|
|
||
| 1. From a provided OpenTelemetry Tracer instance: | ||
|
|
||
| ```cpp | ||
| auto tracer_shim = TracerShim::createTracerShim(tracer); | ||
| ``` | ||
|
|
||
| Optionally, one can also specify the propagators to be used for the OpenTracing `TextMap` | ||
| and `HttpHeaders` formats: | ||
|
|
||
| ```cpp | ||
| OpenTracingPropagators propagators{ | ||
| .text_map = nostd::shared_ptr<TextMapPropagator>(new CustomTextMap()), | ||
| .http_headers = nostd::shared_ptr<TextMapPropagator>(new trace::propagation::HttpTraceContext()) | ||
| }; | ||
|
|
||
| auto tracer_shim = TracerShim::createTracerShim(tracer, propagators); | ||
| ``` | ||
|
|
||
| If propagators are not specified, OpenTelemetry's global propagator will be used. | ||
|
|
||
| ## License | ||
|
|
||
| Apache 2.0 - See [LICENSE][license-url] for more information. | ||
|
|
||
| ## Useful links | ||
|
|
||
| - For more information on OpenTelemetry, visit: <https://opentelemetry.io/> | ||
| - For help or feedback on this project, join us in [GitHub Discussions][discussions-url] | ||
|
|
||
| [discussions-url]: https://github.com/open-telemetry/opentelemetry-cpp/discussions | ||
| [license-url]: https://github.com/open-telemetry/opentelemetry-cpp/blob/main/LICENSE | ||
| [license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.