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

chore: proper fallback value for boolean "bogus" options #3765

Open
david-luna opened this issue Nov 30, 2023 · 0 comments
Open

chore: proper fallback value for boolean "bogus" options #3765

david-luna opened this issue Nov 30, 2023 · 0 comments
Assignees
Labels
agent-nodejs Make available for APM Agents project planning.

Comments

@david-luna
Copy link
Member

david-luna commented Nov 30, 2023

Description

When refactoring our configuration tests to run them in separate processes (#3762) an unwanted behaviour was discovered when a "bogus" boolean value is set in the configuration. This is when the value is not any of true, false, "true" or "false".

Regarding bogus values the spec says

If an invalid value for a configuration option is provided (for example: breakdown_metrics="yes" or apiRequestTime="1h") then the agent MUST ignore the value (falling back to a config source with lower precedence) and SHOULD emit a log warning about the ignored value.

The node agent logs the warning but instead of falling back to a config source with lower precedence the value gets resolved to undefined ignoring sources of lower precedence like the defaults. As an example this behaviour with defaults would be okay for the options with false value as default (contextPropagationOnly, disableSend, errorOnAbortedRequests, opentelemetryBridgeEnabled, useElasticTraceparentHeader, usePathAsTransactionName) but not for options with dafault value set to true (active, breakdownMetrics, captureExceptions, captureHeaders, centralConfig, instrument, instrumentIncomingHTTPRequests, spanCompressionEnabled, verifyServerCert).

As a example we have this test that sets a bogus value for ELASTIC_APM_ACTIVE env var. this value wins over the other sources and when resolved we get undefined resulting in the agent being inactive.

// XXX: normalization turns this value to `undefined` because "bogus"

Possible approach

The agent should keep reference of the options provided from all sources instead of squashing them into a single object. then the normalization process should be aware of these sources to do the proper fallback if one option has a bogus value.

NOTE: as discussed internally this will be actioned when the test refactoring is done

@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Nov 30, 2023
@david-luna david-luna self-assigned this Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-nodejs Make available for APM Agents project planning.
Projects
None yet
Development

No branches or pull requests

1 participant