DataDog / kong-plugin-ddtrace

Datadog APM Plugin for Kong Gateway
Apache License 2.0
15 stars 7 forks source link

fix: ngx.re.match usage in w3c_propagation.lua #50

Closed dmehala closed 2 months ago

dmehala commented 2 months ago

Description

A customer spotted errors and warnings in their logs. Such as:

2024/04/03 04:06:31 [error] 2389#0: *773 [kong] handler.lua:379 [ddtrace] tracing error in DatadogTraceHandler:body_filter: ...l/share/lua/5.1/kong/plugins/ddtrace/w3c_propagation.lua:67: bad argument #1 to 'unpack' (table expected, got nil), client:

This PR fix ngx.re.match usage. I suspected ngx.re.match to return an error when there's no match but the err field is reserved for errors related to the regex engine. When there's no match, the first field is nil.

Contains:

dmehala commented 2 months ago

Looks like the test is not testing the faulty branch.

codecov-commenter commented 2 months ago

Codecov Report

Attention: Patch coverage is 41.66667% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 92.67%. Comparing base (00a5bd3) to head (7e58d5f).

Files Patch % Lines
kong/plugins/ddtrace/w3c_propagation.lua 41.66% 7 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #50 +/- ## ========================================== - Coverage 93.09% 92.67% -0.43% ========================================== Files 7 7 Lines 608 614 +6 ========================================== + Hits 566 569 +3 - Misses 42 45 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.