Files
pytorch/cmake/Modules/FindOpenTelemetryApi.cmake
Chirag Pandya fd90991790 [rfc] opentelemetry in pytorch (#122999)
1. Add current latest version (opentelemetry-cpp version v1.14.2) to PyTorch library.
Steps:
```
$cd pytorch
$git submodule add https://github.com/open-telemetry/opentelemetry-cpp.git third_party/opentelemetry-cpp
$cd third_party/opentelemetry-cpp
$git checkout v1.14.2
$git add third_party/opentelemetry-cpp .gitmodules
$git commit
```
Expected change in checkout size:
```
(/home/cpio/local/a/pytorch-env) [cpio@devvm17556.vll0 ~/local/pytorch (gh/c-p-i-o/otel)]$ git count-objects -vH
count: 654
size: 3.59 MiB
in-pack: 1229701
packs: 17
size-pack: 1.17 GiB
prune-packable: 76
garbage: 0
size-garbage: 0 bytes
```

2.

TODO
- [x] Figure out how dynamic linking works. App builders will somehow need to `target_include` opentelemetry-cpp at runtime.
- [ ] Examples on how to use opentelemetry + pytorch
- [ ] Tests + documentation (e.g. using null opentelemetry implementation).

Pull Request resolved: https://github.com/pytorch/pytorch/pull/122999
Approved by: https://github.com/ezyang
2024-04-21 15:20:21 +00:00

20 lines
613 B
CMake

# Try to find the OpenTelemetry API headers
# OpenTelemetryApi_FOUND - system has OpenTelemetry API headers
# OpenTelemetryApi_INCLUDE_DIRS - the OpenTelemetry API headers dir
find_path(OpenTelemetryApi_INCLUDE_DIR
NAMES include/opentelemetry/version.h
DOC "The directory where Open Telemetry API headers reside"
)
set(OpenTelemetryApi_INCLUDE_DIRS ${OpenTelemetryApi_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenTelemetryApi
FOUND_VAR OpenTelemetryApi_FOUND
REQUIRED_VARS OpenTelemetryApi_INCLUDE_DIRS
)
mark_as_advanced(OpenTelemetryApi_FOUND)