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

Synchronize observability settings during versions deploy #7091

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

taylorlee
Copy link
Contributor

@taylorlee taylorlee commented Oct 24, 2024

In addition to logpush and tail_consumers, patch observability settings
on version deploy. This still doesn't quite match the behavior of
"wrangler deploy", which will disable observability if it is not defined
in wrangler.toml (as of #6776), but at least this is more correct for now.

@taylorlee taylorlee requested a review from a team as a code owner October 24, 2024 20:53
Copy link

changeset-bot bot commented Oct 24, 2024

🦋 Changeset detected

Latest commit: 654ec04

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
wrangler Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@taylorlee taylorlee changed the title Syncrhonize observability settings during versions deploy Synchronize observability settings during versions deploy Oct 24, 2024
Copy link
Contributor

github-actions bot commented Oct 24, 2024

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11563725138/npm-package-wrangler-7091

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7091/npm-package-wrangler-7091

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11563725138/npm-package-wrangler-7091 dev path/to/script.js
Additional artifacts:
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11563725138/npm-package-create-cloudflare-7091 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11563725138/npm-package-cloudflare-kv-asset-handler-7091
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11563725138/npm-package-miniflare-7091
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11563725138/npm-package-cloudflare-pages-shared-7091
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11563725138/npm-package-cloudflare-vitest-pool-workers-7091
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11563725138/npm-package-cloudflare-workers-editor-shared-7091
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11563725138/npm-package-cloudflare-workers-shared-7091
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/11563725138/npm-package-cloudflare-workflows-shared-7091

Note that these links will no longer work once the GitHub Actions artifact expires.


[email protected] includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20241022.0
workerd 1.20241022.0 1.20241022.0
workerd --version 1.20241022.0 2024-10-22

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

) {
const maybeUndefinedSettings = {
logpush: config.logpush,
tail_consumers: config.tail_consumers,
observability: config.observability, // TODO reconcile with how regular deploy handles empty state
Copy link
Member

Choose a reason for hiding this comment

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

What's the desired end state here when it's empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure. When @RamIdeas added versions-deploy, any undefined settings are not synchronized. When @zebp added observability to regular deploy, it defaults to false when undefined.

It would be unfortunate to need to always patch settings to false for undefined observabililty, but that is the simplest way to reconcile them.

Copy link
Contributor

Choose a reason for hiding this comment

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

If the default is false then how about we remove the default (make it undefined, i.e. falsey) so this just works™️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@RamIdeas I'm not sure I follow. The default does seem to be undefined/falsey, but the difference between deploy and versions-deploy is that deploy always patches the full NonVersionedScriptSettings whereas versions-deploy only does so if at least one field is defined.

So deploy with undefined observability will disable it, whereas versions-deploy will leave it unchanged. Should we always patch during versions-deploy? Or conditionally patch during deploy? Or leave them slightly different?

Copy link
Member

@WalshyDev WalshyDev Oct 28, 2024

Choose a reason for hiding this comment

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

I don't think we should block on this. The behaviour here comes down to wrangler deploy doing something different for OBS compared to logpush/tail consumers, it will disable if it is not in the config. Meanwhile, logpush/tail will stay with their current values.

If we should do the explicit disable here or if deploy should not do that is a whole topic. The fact that OBS is already inconsistent isn't great, I'm happy with it at least being consistent here. I think there's a larger discussion that needs to happen (cc: @tanushree-sharma @nevikashah ) on what the behaviour should actually be in deploy & here.

I think part of this whole "user expectation" behaviour comes to the fact that Wrangler is already kinda inconsistent with these things. If you remove a binding from the config, it isn't inherited, it's removed. However, you need to explicitly disable workers.dev, it isn't disabled on not being there.

Imo, we need to figure out what the behaviour actually should be and be as consistent across the board as possible.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep no need to block on this. Sounds like there's a backend inconsistency re the observability field? Either way, I agree we need to decide the desired behaviour cc @tanushree-sharma @nevikashah

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 backend API is consistent, the inconsistency is whether it's called or not by wrangler. wrangler deploy always calls it, wrangler versions deploy only calls if if one of the 3 observability settings are defined in wrangler.toml

@taylorlee taylorlee force-pushed the tlee/sync-observability-in-versions-deploy branch from 1dfe8b0 to 2f56dcf Compare October 25, 2024 01:38
@taylorlee taylorlee added the e2e Run e2e tests on a PR label Oct 25, 2024
@taylorlee taylorlee force-pushed the tlee/sync-observability-in-versions-deploy branch from 2f56dcf to cab588b Compare October 25, 2024 17:01
│ Synced non-versioned settings:
│ logpush: <skipped>
│ observability: enabled: false
Copy link
Contributor

@RamIdeas RamIdeas Oct 25, 2024

Choose a reason for hiding this comment

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

should we display head_sampling_rate with <skipped> if it's not present? to avoid this single-entry nested value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm happy to go with whatever you suggest, but I would personally find that confusing. logpush: <skipped> means that wrangler left the remote state unchanged. Omitting head_sampling_rate does not skip synchronizing that field, but causes the default behavior of 100% sampling, which may be different from the prior setting.

In addition to logpush and tail_consumers, patch observability settings
on version deploy. This still doesn't quite match the behavior of
"wrangler deploy", which will disable observability if it is not defined
in wrangler.toml (as of #6776), but at least this is more correct for now.
@taylorlee taylorlee force-pushed the tlee/sync-observability-in-versions-deploy branch from cab588b to 654ec04 Compare October 28, 2024 22:31
@taylorlee
Copy link
Contributor Author

@RamIdeas any qualms with merging this? I think there is more to discuss on how wrangler deploy and wrangler versions deploy treat undefined settings differently, but I don't think that should block making observability handling more correct.

@emily-shen emily-shen added the skip-pr-description-validation Skip validation of the required PR description format label Oct 29, 2024
@taylorlee taylorlee merged commit 68a2a84 into main Oct 29, 2024
30 checks passed
@taylorlee taylorlee deleted the tlee/sync-observability-in-versions-deploy branch October 29, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e Run e2e tests on a PR skip-pr-description-validation Skip validation of the required PR description format
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants