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

Fix for ISO string modification during function metadata binding parsing #10735

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

satvu
Copy link
Member

@satvu satvu commented Jan 10, 2025

Issue describing the changes in this PR

resolves #10732 (and Azure/azure-functions-dotnet-worker#2882)

Pull request checklist

IMPORTANT: Currently, changes must be backported to the in-proc branch to be included in Core Tools and non-Flex deployments.

  • Backporting to the in-proc branch is not required
    • Otherwise: Link to backporting PR
  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • [] Otherwise: Backport tracked by issue/PR #issue_or_pr
  • My changes do not require diagnostic events changes
    • Otherwise: I have added/updated all related diagnostic events and their documentation (Documentation issue linked to PR)
  • I have added all required tests (Unit tests, E2E tests)

Additional information

Tested locally E2E the following scenarios:

  1. StartFromTime set to a past time started triggering and processing existing records immediately after startup (older records than start time untouched)
  2. StartFromTime set to a future date and will process any new changes following startup. Discussed with original engineers - this feature was only meant to go into the past, so there was never a design set for future dates. This setting will not ignore changes until that future date (note: need to test InProc to see if behavior is the same there).

@satvu satvu marked this pull request as ready for review January 11, 2025 00:29
@satvu satvu requested a review from a team as a code owner January 11, 2025 00:29
src/WebJobs.Script/Host/WorkerFunctionMetadataProvider.cs Outdated Show resolved Hide resolved
src/WebJobs.Script/Host/WorkerFunctionMetadataProvider.cs Outdated Show resolved Hide resolved
src/WebJobs.Script/Host/WorkerFunctionMetadataProvider.cs Outdated Show resolved Hide resolved
release_notes.md Outdated Show resolved Hide resolved
internal static FunctionMetadata ValidateBindings(IEnumerable<string> rawBindings, FunctionMetadata function)
{
HashSet<string> bindingNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);

foreach (string binding in rawBindings)
{
var functionBinding = BindingMetadata.Create(JObject.Parse(binding));
var functionBinding = GetBindingMetadata(binding);
Copy link
Member

Choose a reason for hiding this comment

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

Should this new behavior be an explicit opt-in for customers? With this change, all customers and bindings will experience the performance impact of the additional serialization for any bindings that pass through this flow or method.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know if we should have an explicit opt-in for a behavior that should've already been working. I believe that the use of ISO strings is only for the CosmosDB extension, so we could only check for the trigger or only for this property.

Copy link
Member Author

Choose a reason for hiding this comment

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

Note: we will benchmark the two approaches and compare the results to decide how to proceed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Benchmarking results here.

@satvu
Copy link
Member Author

satvu commented Jan 14, 2025

Discussed offline with @liliankasem - to incorporate suggestions we will need to refactor ValidateBindings (see here) and change it from a static method. Investigation shows that the only places where this method is called is in tests and within the same class. This should be a safe change.

@satvu satvu requested review from liliankasem and kshyju January 21, 2025 22:40
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.

Parsing bindings into a JObject modifies strings in ISO format
3 participants