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

tracing: upgrade to dd-opentracing-cpp v1.3.7 #10031

Conversation

dgoffredo
Copy link
Contributor

@dgoffredo dgoffredo commented Jun 2, 2023

What this PR does / why we need it:

Upgrades the Datadog tracing plugin to new release v1.3.7: https://github.com/DataDog/dd-opentracing-cpp/releases/tag/v1.3.7

This most recent release adds logging for uncommon error scenarios that can occur between nginx and the Datadog Agent.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation only
  • Upgrade tracing plugin

How Has This Been Tested?

The nginx base image builds and runs and produces traces using the Datadog tracing plugin.

docker build --tag ingress-nginx-nginx . in images/nginx/rootfs.

Use the following configuration files:

/tmp/nginx.conf

load_module /etc/nginx/modules/ngx_http_opentracing_module.so;

events {
    worker_connections  1024;
}

http {
    opentracing_load_tracer /usr/local/lib/libdd_opentracing.so /etc/nginx/dd-config.json;

    opentracing on;
    opentracing_tag http_user_agent $http_user_agent;
    opentracing_trace_locations off;
    opentracing_operation_name "$request_method $uri";

    log_format with_trace_id '$remote_addr - $http_x_forwarded_user [$time_local] "$request" '
        '$status $body_bytes_sent "$http_referer" '
        '"$http_user_agent" "$http_x_forwarded_for" '
        '"$opentracing_context_x_datadog_trace_id" "$opentracing_context_x_datadog_parent_id"';

    access_log /dev/stderr with_trace_id;

    server {
        listen       80;

        location / {
            opentracing_tag "custom-tag" "special value";
            opentracing_propagate_context;
            proxy_pass http://localhost/upstream;
        }

        location /upstream {
            return 200;
        }
    }
}

/tmp/dd-config.json

{
  "service": "nginx-test"
}

Run nginx.

$ docker run -it --mount type=bind,source=/tmp/nginx.conf,target=/etc/nginx/nginx.conf,readonly --mount type=bind,source=/tmp/dd-config.json,target=/etc/nginx/dd-config.json,readonly --publish 127.0.0.1:8000:80 ingress-nginx-nginx

Send a request.

$ curl '127.0.0.1:8000'

Note the tracing in the nginx log:

info: DATADOG TRACER CONFIGURATION - {"agent_url":"http://localhost:8126","analytics_enabled":false,"analytics_sample_rate":null,"date":"2023-06-02T19:20:36+0000","enabled":true,"env":"","lang":"cpp","lang_version":"201402","report_hostname":false,"sampling_rules":"[]","service":"nginx-test","version":"v1.3.7"}
127.0.0.1 - - [02/Jun/2023:19:20:44 +0000] "GET /upstream HTTP/1.0" 200 0 "-" "curl/7.81.0" "-" "3293968931881126918" "8622360542771705867"
172.17.0.1 - - [02/Jun/2023:19:20:44 +0000] "GET / HTTP/1.1" 200 0 "-" "curl/7.81.0" "-" "3293968931881126918" "3293968931881126918"

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 2, 2023
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Jun 2, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @dgoffredo. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-priority size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 2, 2023
@rikatz
Copy link
Contributor

rikatz commented Jun 4, 2023

/cc @esigo

@k8s-ci-robot k8s-ci-robot requested a review from esigo June 4, 2023 19:44
@esigo
Copy link
Member

esigo commented Jun 5, 2023

/lgtm
Thanks for your contribution.
Please note that we are going to deprecate and remove datadog and other tracings in favor of OpenTelemetry.
Migration info can be found here.
Still it makes sense to have the latest version in the ingress-nginx releases that still has datadog.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 5, 2023
@esigo
Copy link
Member

esigo commented Jun 5, 2023

/assign @tao12345666333

1 similar comment
@esigo
Copy link
Member

esigo commented Jun 5, 2023

/assign @tao12345666333

@esigo esigo removed their assignment Jun 5, 2023
@rikatz
Copy link
Contributor

rikatz commented Jun 11, 2023

/lgtm
/approve
Thanks!

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dgoffredo, esigo, rikatz

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rikatz
Copy link
Contributor

rikatz commented Jun 11, 2023

/ok-to-test

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 11, 2023
@k8s-ci-robot k8s-ci-robot merged commit 05e5956 into kubernetes:main Jun 11, 2023
@dgoffredo
Copy link
Contributor Author

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants