Skip to content

Commit

Permalink
Merge pull request #17211 from lidavidm/opentelemetry-cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusvniekerk committed Dec 10, 2021
2 parents 12c8f5f + 777e443 commit 6a21350
Show file tree
Hide file tree
Showing 9 changed files with 260 additions and 0 deletions.
18 changes: 18 additions & 0 deletions recipes/cpp-opentelemetry-api/bld.bat
@@ -0,0 +1,18 @@
@echo on

mkdir build-cpp
if errorlevel 1 exit 1

cd build-cpp
cmake .. ^
-GNinja ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_PREFIX_PATH=%CONDA_PREFIX% ^
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
-DBUILD_TESTING=OFF ^
-DWITH_API_ONLY=ON ^
-DWITH_ETW=OFF ^
-DWITH_EXAMPLES=OFF

cmake --build . --config Release --target install
if errorlevel 1 exit 1
21 changes: 21 additions & 0 deletions recipes/cpp-opentelemetry-api/build.sh
@@ -0,0 +1,21 @@
#!/bin/bash

set -ex

export CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_CXX_STANDARD=11"

mkdir -p build-cpp
pushd build-cpp

cmake ${CMAKE_ARGS} .. \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_PREFIX_PATH=$PREFIX \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DBUILD_TESTING=OFF \
-DWITH_API_ONLY=ON \
-DWITH_EXAMPLES=OFF

ninja install
popd
42 changes: 42 additions & 0 deletions recipes/cpp-opentelemetry-api/meta.yaml
@@ -0,0 +1,42 @@
{% set name = "cpp-opentelemetry-api" %}
{% set version = "1.1.0" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://github.com/open-telemetry/opentelemetry-cpp/archive/refs/tags/v{{ version }}.tar.gz
sha256: f8fd3adddd47be382dc79c19d7e7efcf86a0dfbb5a237db6e0618dbb7eb8e058

build:
number: 0

requirements:
build:
- {{ compiler('cxx') }}
- cmake >=3.1
- ninja

test:
commands:
- test -d $PREFIX/include/opentelemetry/ # [unix]
- if not exist %LIBRARY_INC%\opentelemetry exit 1 # [win]

about:
home: https://github.com/open-telemetry/opentelemetry-cpp
license: Apache-2.0
license_family: APACHE
license_file: LICENSE
summary: 'The OpenTelemetry C++ Client'
description: |
OpenTelemetry is a collection of tools, APIs, and SDKs. Use it to
instrument, generate, collect, and export telemetry data (metrics,
logs, and traces) to help you analyze your software’s performance
and behavior.
doc_url: https://opentelemetry.io/docs/instrumentation/cpp/
dev_url: https://github.com/open-telemetry/opentelemetry-cpp

extra:
recipe-maintainers:
- lidavidm
25 changes: 25 additions & 0 deletions recipes/cpp-opentelemetry-sdk/bld.bat
@@ -0,0 +1,25 @@
@echo on

mkdir build-cpp
if errorlevel 1 exit 1

REM Release tarballs do not contain the required Protobuf definitions.
robocopy /S /E %LIBRARY_PREFIX%\share\opentelemetry\opentelemetry-proto\opentelemetry .\third_party\opentelemetry-proto\opentelemetry
REM Stop CMake from trying to git clone the Protobuf definitions.
mkdir .\third_party\opentelemetry-proto\.git

cd build-cpp
cmake .. ^
-GNinja ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_PREFIX_PATH=%CONDA_PREFIX% ^
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
-DBUILD_TESTING=OFF ^
-DWITH_API_ONLY=OFF ^
-DWITH_ETW=OFF ^
-DWITH_EXAMPLES=OFF ^
-DWITH_OTLP=ON ^
-DWITH_OTLP_GRPC=ON

cmake --build . --config Release --target install
if errorlevel 1 exit 1
28 changes: 28 additions & 0 deletions recipes/cpp-opentelemetry-sdk/build.sh
@@ -0,0 +1,28 @@
#!/bin/bash

set -ex

export CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_CXX_STANDARD=11"

# Release tarballs do not contain the required Protobuf definitions.
cp -r $PREFIX/share/opentelemetry/opentelemetry-proto/opentelemetry ./third_party/opentelemetry-proto/
# Stop CMake from trying to git clone the Protobuf definitions.
mkdir ./third_party/opentelemetry-proto/.git

mkdir -p build-cpp
pushd build-cpp

cmake ${CMAKE_ARGS} .. \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_PREFIX_PATH=$PREFIX \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DBUILD_TESTING=OFF \
-DWITH_API_ONLY=OFF \
-DWITH_EXAMPLES=OFF \
-DWITH_OTLP=ON \
-DWITH_OTLP_GRPC=ON

ninja install
popd
58 changes: 58 additions & 0 deletions recipes/cpp-opentelemetry-sdk/meta.yaml
@@ -0,0 +1,58 @@
{% set name = "cpp-opentelemetry-sdk" %}
{% set version = "1.1.0" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://github.com/open-telemetry/opentelemetry-cpp/archive/refs/tags/v{{ version }}.tar.gz
sha256: f8fd3adddd47be382dc79c19d7e7efcf86a0dfbb5a237db6e0618dbb7eb8e058

build:
number: 0

requirements:
build:
- {{ compiler('cxx') }}
- cmake >=3.1
- ninja
host:
- cpp-opentelemetry-api
- grpc-cpp
- nlohmann_json
- proto-opentelemetry-proto
- libprotobuf >=3.18
- zlib
run:
- grpc-cpp
- libprotobuf >=3.18

test:
commands:
- test -d $PREFIX/include/opentelemetry/sdk/ # [unix]
- test -d $PREFIX/lib/cmake/opentelemetry-cpp/ # [unix]
- test -f $PREFIX/lib/libopentelemetry_common.a # [unix]
- test -f $PREFIX/lib/libopentelemetry_exporter_otlp_grpc.a # [unix]
- if not exist %LIBRARY_INC%\opentelemetry\sdk exit 1 # [win]
- if not exist %LIBRARY_LIB%\cmake\opentelemetry-cpp exit 1 # [win]
- if not exist %LIBRARY_LIB%\opentelemetry_common.lib exit 1 # [win]
- if not exist %LIBRARY_LIB%\opentelemetry_exporter_otlp_grpc.lib exit 1 # [win]

about:
home: https://github.com/open-telemetry/opentelemetry-cpp
license: Apache-2.0
license_family: APACHE
license_file: LICENSE
summary: 'The OpenTelemetry C++ Client'
description: |
OpenTelemetry is a collection of tools, APIs, and SDKs. Use it to
instrument, generate, collect, and export telemetry data (metrics,
logs, and traces) to help you analyze your software’s performance
and behavior.
doc_url: https://opentelemetry.io/docs/instrumentation/cpp/
dev_url: https://github.com/open-telemetry/opentelemetry-cpp

extra:
recipe-maintainers:
- lidavidm
12 changes: 12 additions & 0 deletions recipes/proto-opentelemetry-proto/bld.bat
@@ -0,0 +1,12 @@
@echo on

set DEST_DIR=%LIBRARY_PREFIX%\share\opentelemetry\opentelemetry-proto
mkdir %DEST_DIR%
if %ERRORLEVEL% NEQ 0 exit 1

copy LICENSE %DEST_DIR%
if %ERRORLEVEL% NEQ 0 exit 1

REM robocopy returns non-zero exit codes on success
robocopy /S /E opentelemetry\ %DEST_DIR%\opentelemetry
if %ERRORLEVEL% GEQ 8 exit 1
12 changes: 12 additions & 0 deletions recipes/proto-opentelemetry-proto/build.sh
@@ -0,0 +1,12 @@
#!/bin/bash

set -ex

main() {
local -r dest_dir="$PREFIX/share/opentelemetry/opentelemetry-proto"
mkdir -p "$dest_dir"
cp LICENSE "$dest_dir"
cp -r opentelemetry "$dest_dir/opentelemetry"
}

main
44 changes: 44 additions & 0 deletions recipes/proto-opentelemetry-proto/meta.yaml
@@ -0,0 +1,44 @@
{% set name = "proto-opentelemetry-proto" %}
{% set version = "0.11.0" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://github.com/open-telemetry/opentelemetry-proto/archive/refs/tags/v{{ version }}.tar.gz
sha256: 985367f8905e91018e636cbf0d83ab3f834b665c4f5899a27d10cae9657710e2

build:
noarch: generic
number: 0

requirements:
build:
host:
run:

test:
commands:
- test -f $PREFIX/share/opentelemetry/opentelemetry-proto/LICENSE # [unix]
- test -f $PREFIX/share/opentelemetry/opentelemetry-proto/opentelemetry/proto/common/v1/common.proto # [unix]
- if not exist %PREFIX%\Library\share\opentelemetry\opentelemetry-proto\LICENSE exit 1 # [win]
- if not exist %PREFIX%\Library\share\opentelemetry\opentelemetry-proto\opentelemetry\proto\common\v1\common.proto exit 1 # [win]

about:
home: https://github.com/open-telemetry/opentelemetry-proto
license: Apache-2.0
license_family: APACHE
license_file: LICENSE
summary: 'Protobuf definitions for the OpenTelemetry protocol (OTLP)'
description: |
OpenTelemetry is a collection of tools, APIs, and SDKs. Use it to
instrument, generate, collect, and export telemetry data (metrics,
logs, and traces) to help you analyze your software’s performance
and behavior.
doc_url: https://github.com/open-telemetry/opentelemetry-proto
dev_url: https://opentelemetry.io/docs/reference/specification/

extra:
recipe-maintainers:
- lidavidm

0 comments on commit 6a21350

Please sign in to comment.