DataDog / nginx-datadog

Enhance NGINX Observability and Security with Datadog's Module
https://www.datadoghq.com
Apache License 2.0
25 stars 10 forks source link

fix: datadog script execution #95

Closed dmehala closed 4 months ago

dmehala commented 5 months ago

Description

This commit fixes a regression likely introduced in PR #79. The module attempts to resolve an uninitialized configuration variable, resulting in an error log.

Resolves #94.

What is happening?

The sampling delegation feature introduced two directives: datadog_delegate_sampling and datadog_allow_sampling_delegation_in_subrequests.

These directives can accept variables and requires NGINX to resolve these variables while processing the request to determine if sampling should be delegated. Since #79, the default values for these directives have not been set, resulting in a malformed NgxScript.

The solution

I removed the ability to extend variables for sampling delegation directives and ensured the underlygin variables are initialized.

For later

Refactor NgxScript to handle compilation error and assert if there is an error.

codecov-commenter commented 5 months ago

Codecov Report

Attention: Patch coverage is 57.14286% with 3 lines in your changes missing coverage. Please review.

Project coverage is 67.41%. Comparing base (ee79534) to head (9b8b17b).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/DataDog/nginx-datadog/pull/95/graphs/tree.svg?width=650&height=150&src=pr&token=SZCZI1FAYU&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog)](https://app.codecov.io/gh/DataDog/nginx-datadog/pull/95?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) ```diff @@ Coverage Diff @@ ## master #95 +/- ## ========================================== + Coverage 66.66% 67.41% +0.74% ========================================== Files 37 37 Lines 3573 3529 -44 Branches 612 607 -5 ========================================== - Hits 2382 2379 -3 + Misses 875 833 -42 - Partials 316 317 +1 ``` | [Files](https://app.codecov.io/gh/DataDog/nginx-datadog/pull/95?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | Coverage Δ | | |---|---|---| | [src/datadog\_directive.cpp](https://app.codecov.io/gh/DataDog/nginx-datadog/pull/95?src=pr&el=tree&filepath=src%2Fdatadog_directive.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-c3JjL2RhdGFkb2dfZGlyZWN0aXZlLmNwcA==) | `50.78% <ø> (+3.79%)` | :arrow_up: | | [src/ngx\_http\_datadog\_module.cpp](https://app.codecov.io/gh/DataDog/nginx-datadog/pull/95?src=pr&el=tree&filepath=src%2Fngx_http_datadog_module.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-c3JjL25neF9odHRwX2RhdGFkb2dfbW9kdWxlLmNwcA==) | `63.38% <100.00%> (+0.70%)` | :arrow_up: | | [src/request\_tracing.cpp](https://app.codecov.io/gh/DataDog/nginx-datadog/pull/95?src=pr&el=tree&filepath=src%2Frequest_tracing.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-c3JjL3JlcXVlc3RfdHJhY2luZy5jcHA=) | `68.30% <0.00%> (+4.30%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/DataDog/nginx-datadog/pull/95/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog)