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

How to check if debug mode is enabled in bidding logic? #363

Open
profgrammer opened this issue May 25, 2024 · 1 comment
Open

How to check if debug mode is enabled in bidding logic? #363

profgrammer opened this issue May 25, 2024 · 1 comment

Comments

@profgrammer
Copy link

Hi,
There are a couple of places where we call contributeToHistogram and contributeToHistogramOnEvent in our bidding logic. These calls are guarded by some experiments and we want to have debug mode enabled in all of the calls. In case more than one experiment is enabled we end up calling enableDebugMode more than once which crashes the script.

  • Is there any way to know if debug mode is enabled in the privateAggregation object?
  • Is this a best practice to follow? If not how can we best implement this case?

Thanks in advance!

@alexmturner
Copy link

alexmturner commented Jul 3, 2024

Hi!

While there isn't a built in way to check debug mode, callers should be able to define a variable within their code to detect when it is available.

For example:

// At the start of generateBid()
let isDebugModeEnabled = false;

// Later, maybe multiple times:
if (!isDebugModeEnabled) {
  privateAggregation.enableDebugMode();
  isDebugModeEnabled = true;
}

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

No branches or pull requests

2 participants