Skip to content

Add OpenTelemetry support #7642

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

Open
wants to merge 53 commits into
base: main
Choose a base branch
from
Open

Add OpenTelemetry support #7642

wants to merge 53 commits into from

Conversation

haywoodsh
Copy link
Contributor

@haywoodsh haywoodsh commented Apr 14, 2025

Proposed changes

Add otel support for NGINX Ingress Controller OSS and Plus
Added config map keys:

  otel-exporter-endpoint: "[(http|https)://]host:port" # Required
  otel-exporter-header-name: "name" # Optional
  otel-exporter-header-value: "value" # Optional
  otel-service-name: "unknown_service:nginx" # Optional
  otel-global-trace-enabled: "false" # Optional, enables otel tracing at the http context

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

@github-actions github-actions bot added enhancement Pull requests for new features/feature enhancements go Pull requests that update Go code docker Pull requests that update Docker code labels Apr 14, 2025
@haywoodsh haywoodsh linked an issue Apr 23, 2025 that may be closed by this pull request
7 tasks
@pdabelf5 pdabelf5 force-pushed the feat/add-otel-support branch from 3f111b2 to 8c598c6 Compare April 29, 2025 16:47
Copy link

codecov bot commented Apr 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 52.47%. Comparing base (2f0cb58) to head (73798d5).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7642      +/-   ##
==========================================
+ Coverage   52.29%   52.47%   +0.18%     
==========================================
  Files          90       90              
  Lines       21472    21550      +78     
==========================================
+ Hits        11228    11308      +80     
+ Misses       9774     9772       -2     
  Partials      470      470              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions bot added the chore Pull requests for routine tasks label Apr 30, 2025
@haywoodsh haywoodsh force-pushed the feat/add-otel-support branch from 22e590f to 4cf0f62 Compare May 2, 2025 15:05
@github-actions github-actions bot removed the chore Pull requests for routine tasks label May 2, 2025
@haywoodsh haywoodsh force-pushed the feat/add-otel-support branch from 25f53b4 to bee7750 Compare May 6, 2025 15:27
@github-actions github-actions bot added the documentation Pull requests/issues for documentation label May 6, 2025
@haywoodsh haywoodsh force-pushed the feat/add-otel-support branch from 8ad0ac7 to bee7750 Compare May 6, 2025 16:32
@github-actions github-actions bot removed the documentation Pull requests/issues for documentation label May 6, 2025
Copy link

github-actions bot commented May 6, 2025

Deploy Preview will be available once build job completes!

Name Link
😎 Deploy Preview https://frontdoor-test-docs.nginx.com/previews/nginx-ingress-controller/7642/

@github-actions github-actions bot added documentation Pull requests/issues for documentation dependencies Pull requests that update a dependency file python Pull requests that update Python code github_actions Pull requests that update Github_actions code helm_chart Pull requests that update the Helm Chart labels May 15, 2025
@haywoodsh haywoodsh force-pushed the feat/add-otel-support branch from 01535d0 to 1d581b5 Compare May 15, 2025 15:15
@github-actions github-actions bot removed documentation Pull requests/issues for documentation dependencies Pull requests that update a dependency file python Pull requests that update Python code github_actions Pull requests that update Github_actions code helm_chart Pull requests that update the Helm Chart labels May 15, 2025
@haywoodsh haywoodsh force-pushed the feat/add-otel-support branch from 714a273 to 406b1b8 Compare May 16, 2025 08:51
@github-actions github-actions bot added python Pull requests that update Python code tests Pull requests that update tests github_actions Pull requests that update Github_actions code chore Pull requests for routine tasks labels May 16, 2025
@pdabelf5 pdabelf5 force-pushed the feat/add-otel-support branch from 2aade5c to 93b48df Compare May 22, 2025 10:53
@github-actions github-actions bot added chore Pull requests for routine tasks tests Pull requests that update tests and removed dependencies Pull requests that update a dependency file helm_chart Pull requests that update the Helm Chart labels May 22, 2025
@@ -230,6 +230,11 @@ If you encounter the error `error [emerg] 13#13: "zone_sync" directive is duplic
{{<bootstrap-table "table table-striped table-bordered table-responsive">}}
|ConfigMap Key | Description | Default | Example |
| ---| ---| ---| --- |
|*otel-exporter-endpoint* | OTLP/gRPC endpoint that will accept [OpenTelemetry](https://opentelemetry.io) data. Set `otel-trace-in-http` to *True* to enable OpenTelemetry at global level. Example: *"https://otel-collector:4317"*. Note: requires the Ingress Controller image with OpenTelemetry module. | | |
Copy link
Contributor

@vepatel vepatel May 27, 2025

Choose a reason for hiding this comment

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

we can specify N/A as defaults for the ones without

|*otel-exporter-header-name* | The name of a custom HTTP header to add to telemetry export request. Example: *"X-custom-header"*. `otel-exporter-endpoint` and `otel-exporter-header-value` required. | | |
|*otel-exporter-header-value* | The value of a custom HTTP header to add to telemetry export request.Example: *"custom-value"*. `otel-exporter-endpoint` and `otel-exporter-header-name` required. | | |
|*otel-service-name* | Sets the `service.name` attribute of the OTel resource. Example: *"nginx-ingress-controller:nginx"*. `otel-exporter-endpoint` required. | | |
| *otel-trace-in-http* | Enables [OpenTelemetry](https://opentelemetry.io) globally (for all Ingress, VirtualServer and VirtualServerRoute resources). Set this to *False* to enable OpenTelemetry for individual routes with snippets. `otel-exporter-endpoint` required. | *False* | |
|*opentracing* | Removed in v5.0.0. Enables [OpenTracing](https://opentracing.io) globally (for all Ingress, VirtualServer and VirtualServerRoute resources). Note: requires the Ingress Controller image with OpenTracing module and a tracer. See the [docs]({{< relref "/installation/integrations/opentracing.md" >}}) for more information. | *False* | |
Copy link
Contributor

@vepatel vepatel May 27, 2025

Choose a reason for hiding this comment

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

since this is more of a replacement, should we remove opentracing entries now? @shaun-nx

@@ -5,7 +5,7 @@
"image": "ubi-8-plus-nap",
"type": "plus",
"nap_modules": "waf",
"marker": "appprotect_waf_policies_allow",
"marker": "'appprotect_waf_policies_allow or otel'",
Copy link
Contributor

Choose a reason for hiding this comment

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

Imo we should create a new entry for Otel like OIDC, mixing it with other unrelated markers is a bit confusing especially since the configuration is controlled using configmap only

@@ -1022,7 +1022,7 @@ def get_nginx_template_conf(v1: CoreV1Api, ingress_namespace, ic_pod_name=None)
if ic_pod_name is None:
ic_pod_name = get_first_pod_name(v1, ingress_namespace)
file_path = "/etc/nginx/nginx.conf"
return get_file_contents(v1, file_path, ic_pod_name, ingress_namespace)
return get_file_contents(v1, file_path, ic_pod_name, ingress_namespace, print_log)
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to pass print_log as default is true?

@@ -0,0 +1,10 @@
# syntax=docker/dockerfile:1.8
Copy link
Contributor

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Pull requests for routine tasks docker Pull requests that update Docker code documentation Pull requests/issues for documentation enhancement Pull requests for new features/feature enhancements github_actions Pull requests that update Github_actions code go Pull requests that update Go code python Pull requests that update Python code tests Pull requests that update tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement basic support for Otel
4 participants