Skip to content

Commit

Permalink
Add otel-plugin-nginx, otel-cpp
Browse files Browse the repository at this point in the history
- Adds opentelemetry-cpp: c++ client for otel (dependency for
  otel-plugin-nginx).
- Adds otel-plugin-nginx
- Modifies protobuf to disable generation of libupb. This is a static
  internal dependency of protobuf. If this ends up being load bearing
  for php and python protobuf packages, we should repackage this into a
  subpackage.
  • Loading branch information
wlynch committed Oct 8, 2024
1 parent 20ca9a0 commit 872ae7f
Show file tree
Hide file tree
Showing 3 changed files with 194 additions and 14 deletions.
56 changes: 56 additions & 0 deletions opentelemetry-cpp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package:
name: opentelemetry-cpp
version: 1.16.1
epoch: 0
description: The OpenTelemetry C++ Client
copyright:
- license: Apache-2.0

environment:
contents:
packages:
- abseil-cpp-dev
- benchmark-dev
- busybox
- c-ares-dev
- cmake
- gcc
- glibc-dev
- grpc-dev
- gtest-dev
- icu-dev
- make
- openssl-dev
- pkgconf
- protobuf-dev
- re2-dev
- systemd-dev

pipeline:
- uses: git-checkout
with:
repository: https://github.com/open-telemetry/opentelemetry-cpp
tag: v${{package.version}}
expected-commit: baecbb95bd63df53e0af16e87bc683967962c5f8

- runs: |
mkdir build
cd build
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON -DWITH_OTLP_GRPC=ON -DWITH_ABSEIL=ON ..
cmake --build . --target all
cmake --install . --prefix ${{targets.contextdir}}/usr
- uses: strip

update:
enabled: true
github:
identifier: open-telemetry/opentelemetry-cpp
strip-prefix: v

test:
pipeline:
# AUTOGENERATED
- runs: |
otelcol --version
otelcol --help
125 changes: 125 additions & 0 deletions opentelemetry-plugin-nginx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
#nolint:valid-pipeline-git-checkout-tag
package:
name: opentelemetry-plugin-nginx
version: 0_git20241008
epoch: 0
description: Adds OpenTelemetry distributed tracing support to nginx.
copyright:
- license: Apache-2.0
dependencies:
runtime:
- opentelemetry-cpp

environment:
contents:
packages:
- abseil-cpp-dev
- busybox
- c-ares-dev
- cmake
- curl-dev
- gcc
- glibc-dev
- grpc-dev
- icu-dev
- make
- nginx
- opentelemetry-cpp
- pcre-dev
- protobuf-c-dev
- protobuf-dev
- re2-dev
- systemd-dev

pipeline:
- uses: git-checkout
with:
repository: https://github.com/open-telemetry/opentelemetry-cpp-contrib
branch: main
expected-commit: f6d29426ee9b4d6b476c09ca3cb9bed3cf23906f

- runs: |
cd instrumentation/nginx
mkdir build
cd build
cmake ..
make
mkdir -p ${{targets.contextdir}}/usr/share/nginx/modules
cp -p otel_ngx_module.so ${{targets.contextdir}}/usr/share/nginx/modules/
- uses: strip

update:
enabled: true
git: {}
schedule:
period: weekly
reason: shared contrib repo that doesn't maintain tags for this component

test:
environment:
contents:
packages:
- nginx
pipeline:
- uses: git-checkout
with:
repository: https://github.com/open-telemetry/opentelemetry-cpp-contrib
branch: main
expected-commit: f6d29426ee9b4d6b476c09ca3cb9bed3cf23906f
- runs: |
cat <<EOF > /etc/nginx/nginx.conf
load_module /usr/share/nginx/modules/otel_ngx_module.so;
user nobody;
http {
opentelemetry_config /etc/nginx/otel-nginx.toml;
server {
listen 80;
server_name otel_example;
root /var/www/html;
location = / {
opentelemetry_operation_name my_example_backend;
opentelemetry_propagate;
proxy_pass http://localhost:3500/;
}
}
}
events {}
EOF
cat <<EOF > /etc/nginx/otel-nginx.toml
exporter = "otlp"
processor = "batch"
[exporters.otlp]
# Alternatively the OTEL_EXPORTER_OTLP_ENDPOINT environment variable can also be used.
host = "localhost"
port = 4317
[processors.batch]
max_queue_size = 2048
schedule_delay_millis = 5000
max_export_batch_size = 512
[service]
# Can also be set by the OTEL_SERVICE_NAME environment variable.
name = "nginx-proxy" # Opentelemetry resource name
[sampler]
name = "AlwaysOn" # Also: AlwaysOff, TraceIdRatioBased
ratio = 0.1
parent_based = false
EOF
# Not sure why this isn't included in main package.
mkdir -p /var/lib/nginx/tmp/
# -T: test the configuration file: nginx checks the configuration for correct syntax, and then tries to open files referred in the configuration.
# additionally dump configuration files to standard output (1.9.2).
- runs: nginx -T
27 changes: 13 additions & 14 deletions protobuf.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package:
name: protobuf
version: 3.27.4
epoch: 0
epoch: 1
description: Library for extensible, efficient structure packing
copyright:
- license: BSD-3-Clause
Expand Down Expand Up @@ -47,7 +47,8 @@ pipeline:
-DBUILD_SHARED_LIBS=True \
-DCMAKE_BUILD_TYPE=Release \
-Dprotobuf_ABSL_PROVIDER=package \
-Dprotobuf_BUILD_TESTS=OFF
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_BUILD_LIBUPB=OFF
ninja -C build
DESTDIR=${{targets.destdir}} ninja -C build install
Expand Down Expand Up @@ -107,6 +108,16 @@ subpackages:
mkdir -p "${{targets.subpkgdir}}"/usr/lib
mv ${{targets.destdir}}/usr/lib/libprotobuf-lite.so.* ${{targets.subpkgdir}}/usr/lib/
- name: protobuf-upb
description: Protocol Buffers upb library
dependencies:
runtime:
- protobuf
pipeline:
- runs: |
cd upb
mkdir -p "${{targets.subpkgdir}}"/usr/lib
update:
enabled: true
github:
Expand All @@ -127,15 +138,3 @@ test:
pipeline:
- runs: |
protoc --help
protoc-gen-upb --version
protoc-gen-upb --help
protoc-gen-upb-27.4.0 --version
protoc-gen-upb-27.4.0 --help
protoc-gen-upb_minitable --version
protoc-gen-upb_minitable --help
protoc-gen-upb_minitable-27.4.0 --version
protoc-gen-upb_minitable-27.4.0 --help
protoc-gen-upbdefs --version
protoc-gen-upbdefs --help
protoc-gen-upbdefs-27.4.0 --version
protoc-gen-upbdefs-27.4.0 --help

0 comments on commit 872ae7f

Please sign in to comment.