-
Notifications
You must be signed in to change notification settings - Fork 320
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
Include send-data missing headers and organize telemetry config variables #3055
Conversation
Overall package sizeSelf size: 4.04 MB Dependency sizes
🤖 This report was automatically generated by heaviest-objects-in-the-universe |
808def9
to
85213de
Compare
Codecov Report
@@ Coverage Diff @@
## master #3055 +/- ##
==========================================
+ Coverage 86.84% 87.16% +0.32%
==========================================
Files 323 318 -5
Lines 11649 11614 -35
Branches 33 33
==========================================
+ Hits 10116 10123 +7
+ Misses 1533 1491 -42
... and 44 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
BenchmarksComparing candidate commit ced1feb in PR branch Found 0 performance improvements and 11 performance regressions! Performance is the same for 654 metrics, 43 unstable metrics. scenario:log-with-error-14
scenario:log-with-debug-14
scenario:log-skip-log-14
scenario:startup-with-tracer-14
scenario:log-with-debug-16
scenario:log-with-error-16
scenario:log-skip-log-16
scenario:log-without-log-16
scenario:startup-with-tracer-16
scenario:startup-with-tracer-18
|
2afea60
to
60ac59b
Compare
c950657
to
cb62f2d
Compare
cb62f2d
to
fd744c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but maybe get an approval from the tracing team too i guess ? 👍
@@ -6,10 +6,6 @@ const os = require('os') | |||
const dependencies = require('./dependencies') | |||
const { sendData } = require('./send-data') | |||
|
|||
const HEARTBEAT_INTERVAL = process.env.DD_TELEMETRY_HEARTBEAT_INTERVAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this moved? It doesn't seem to support programmatic config or be used anywhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved it to group all the telemetry properties reading in one place.
packages/dd-trace/src/config.js
Outdated
@@ -375,6 +378,10 @@ ken|consumer_?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?) | |||
process.env.DD_TELEMETRY_LOG_COLLECTION_ENABLED, | |||
DD_IAST_ENABLED | |||
) | |||
const DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED = coalesce( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this no longer enabled by default? How will we know if there is an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, using a different term here could be confusing. Why "diagnostic" instead of "debug" like what is used elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment DD_TELEMETRY_LOG_COLLECTION_ENABLED
is the property which enables log collection of traces with WARN or ERROR level. It is only used by iast.
And DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED
enables log collection of traces with DEBUG or INFO level. It is disabled by default. And really it doesn't have any effect yet as iast is not collecting that kind of traces.
There are more details here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This differs a lot from our current approach. Why not use DEBUG
and LOG_LEVEL
to be consistent? We'll probably want to normalize all of this properly across the library later on too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will discuss this with my team
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, we've decided to remove it until we are interested in collecting DEBUG or INFO traces.
But DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED
has other implications besides changing the log level. If true
:
- logs with stack traces sent via telemetry are not redacted and therefore no sensitive information is removed from them.
- and it is supposed to be valid for 4 hours (to make sure that customers don’t forget)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's super weird, and I agree with roch :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah let's make sure it makes sense before implementing it.
if (debug) { | ||
headers['dd-telemetry-debug-enabled'] = 'true' | ||
} | ||
if (application) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How could this be missing? These are 2 process-level information that should always be available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess they are added by the agent, so there is no need to add them in the tracer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure :S, let me check it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, they are not added by the agent.
And they are mandatory headers according to the spec
I know the application data is included among the request data but it seems that the headers help to identify the request even if the backend fails to parse the request payload. For example to identify a particular library version and language, sending requests that cannot be parsed.
So it is useful for the backend that the tracer includes them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine if they're needed, but in which case would the condition be false? There would always be an application
, and this it seems that this would always be true, so why the if
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because sendData
method doesn't guarantee that application
will always have a value and getHeaders
method accesses some application
properties.
I felt safer with the if
.
Removed
e9584af
to
fcfef2f
Compare
'content-type': 'application/json', | ||
'dd-telemetry-api-version': 'v1', | ||
'dd-telemetry-request-type': reqType, | ||
'dd-client-library-language': application.language_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we repeating this data that is always available as other headers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
application
object, which contains language and version, is included in the request payload but apparently dd-client-library-language
and dd-client-library-version
headers are mandatory according to the spec.
I gave you a reason in this comment
…bles (#3055) * Include send-data missing headers * Rename DD_TELEMETRY_DEBUG_ENABLED as DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED * Move DD_TELEMETRY_HEARTBEAT_INTERVAL to config.js * Remove DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED
…bles (#3055) * Include send-data missing headers * Rename DD_TELEMETRY_DEBUG_ENABLED as DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED * Move DD_TELEMETRY_HEARTBEAT_INTERVAL to config.js * Remove DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED
…bles (#3055) * Include send-data missing headers * Rename DD_TELEMETRY_DEBUG_ENABLED as DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED * Move DD_TELEMETRY_HEARTBEAT_INTERVAL to config.js * Remove DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED
…bles (#3055) * Include send-data missing headers * Rename DD_TELEMETRY_DEBUG_ENABLED as DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED * Move DD_TELEMETRY_HEARTBEAT_INTERVAL to config.js * Remove DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED
…bles (#3055) * Include send-data missing headers * Rename DD_TELEMETRY_DEBUG_ENABLED as DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED * Move DD_TELEMETRY_HEARTBEAT_INTERVAL to config.js * Remove DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED
…bles (#3055) * Include send-data missing headers * Rename DD_TELEMETRY_DEBUG_ENABLED as DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED * Move DD_TELEMETRY_HEARTBEAT_INTERVAL to config.js * Remove DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED
…bles (#3055) * Include send-data missing headers * Rename DD_TELEMETRY_DEBUG_ENABLED as DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED * Move DD_TELEMETRY_HEARTBEAT_INTERVAL to config.js * Remove DD_TELEMETRY_DIAGNOSTIC_LOG_COLLECTION_ENABLED
What does this PR do?
dd-client-library-language
anddd-client-library-version
headersDD_TELEMETRY_HEARTBEAT_INTERVAL
toconfig.js
Motivation
Some system-tests will check them
Plugin Checklist
Additional Notes