Skip to content

fix: disable Client Side Stats by default#756

Merged
ojproductions merged 6 commits intomainfrom
onzia/disable-css-by-default
Mar 23, 2026
Merged

fix: disable Client Side Stats by default#756
ojproductions merged 6 commits intomainfrom
onzia/disable-css-by-default

Conversation

@ojproductions
Copy link
Contributor

@ojproductions ojproductions commented Mar 23, 2026

What does this PR do?

Disables CSS by default to prevent double counting by the agent.

Testing Guidelines

With css disabled in lambda:
generated by this pipeline

Screenshot 2026-03-23 at 12 55 58 AM

With css enabled in lambda:
Generated by this pipeline

Screenshot 2026-03-23 at 12 57 19 AM

as shown, css is corrected when disabled in lambda and almost doubled when enabled

Motivation

APMSVLS-435

Additional Notes

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

@ojproductions ojproductions requested review from a team as code owners March 23, 2026 17:15
@ojproductions ojproductions changed the title Onzia/disable css by default disable Client Side Stats by default Mar 23, 2026
@ojproductions ojproductions changed the title disable Client Side Stats by default fix: disable Client Side Stats by default Mar 23, 2026
)

# disable css by default to prevent double counting in lambda
if "DD_TRACE_COMPUTE_STATS" not in os.environ:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we ignore this ENV even it's set ? we can generate a warning if we found it's set to true and tell the customer this should always be off?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning is a good idea though I dont think we should block the option completely. If the user sees the warning they can choose whether or not to ignore it. I think @happynancee had the same idea

"DD_TRACE_COMPUTE_STATS" not in os.environ
and "DD_TRACE_STATS_COMPUTATION_ENABLED" not in os.environ
):
os.environ["DD_TRACE_COMPUTE_STATS"] = "false"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do both DD_TRACE_COMPUTE_STATS and DD_TRACE_STATS_COMPUTATION_ENABLED work in Python? If so, I would consider setting DD_TRACE_STATS_COMPUTATION_ENABLED=false since that's the more standard one across all the tracers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. Theyre essentially used as aliases in the python tracer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason we'd want to allow users to enable client-side stats? If not, we should just set this env var always.

Copy link
Contributor

@joeyzhao2018 joeyzhao2018 Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

following up on whether we should or should not allow customers to set it.
This actually makes a difference. ENVs or configurations are not created for all environments and platforms. It is a common practice to always turn specific ENVs off in specific environments. This is one of those cases. We literally don't want to grant customers the freedom to choose here... because it doesn't work...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very good points. I'll just invariably set the env then

@ojproductions ojproductions merged commit 52bcf21 into main Mar 23, 2026
105 checks passed
@ojproductions ojproductions deleted the onzia/disable-css-by-default branch March 23, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants