Skip to content
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

Add otel-plugin-nginx, otel-cpp #30305

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions opentelemetry-cpp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package:
name: opentelemetry-cpp
version: 1.17.0
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: fa0a5200ddbe9ae6f487a228e658aedc102dab56
- uses: cmake/configure
with:
opts: -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON -DWITH_OTLP_GRPC=ON -DWITH_ABSEIL=ON
- uses: cmake/build
- uses: cmake/install

- uses: strip

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any docs/infodirs we can split into subpackages, development files. etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was wondering about this - I didn't see any documentation about this in the wiki. What are the common subpackage breakdowns we aim for, what kinds of files go in them, and what naming conventions should each subpackage have?

Here's the file extension breakdown for files in the package:

   4 cmake
   7 pc
  18 so
 334 h

I can probably break out the headers, but what about cmake/pc? Are those considered development files, or should they go in a separate package?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have pipelines in melange that can be used to split things away: https://github.com/chainguard-dev/melange/tree/main/pkg/build/pipelines/split

Typically, we split whatever we can. I.E., those headers (the .h files) would be split away with split/dev and docs would be split with split/manpages and split/info if an info directory exists. It looks like in your case, you just need to create a -dev subpackage that uses the split/dev pipeline

update:
enabled: true
github:
identifier: open-telemetry/opentelemetry-cpp
strip-prefix: v
123 changes: 123 additions & 0 deletions opentelemetry-plugin-nginx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#nolint:valid-pipeline-git-checkout-tag
package:
name: opentelemetry-plugin-nginx
version: 0_git20241009
epoch: 0
description: Adds OpenTelemetry distributed tracing support to nginx. This is the otel community plugin for nginx, not the official nginx plugin for otel.
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

- uses: cmake/configure
working-directory: instrumentation/nginx
- uses: cmake/build
working-directory: instrumentation/nginx
- runs: |
mkdir -p ${{targets.contextdir}}/usr/share/nginx/modules
cp -p otel_ngx_module.so ${{targets.contextdir}}/usr/share/nginx/modules/
working-directory: instrumentation/nginx/output

- uses: strip

wlynch marked this conversation as resolved.
Show resolved Hide resolved
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
Loading