Skip to content

Conversation

@satvu
Copy link
Member

@satvu satvu commented Jul 26, 2022

Issue describing the changes in this PR

#971

Pull request checklist

  • 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
  • I have added all required tests (Unit tests, E2E tests)

Additional information

  1. Add FixedDelayRetry and ExponentialBackoffRetry attributes to Worker.Extensions.Abstractions.
  2. Add example usage of attributes to the sample app.
  3. FunctionMetadataGenerator in the SDK has the ability to parse Retry Attributes and write them to functions.metadata JSON file.
  4. FunctionMetadataLoaderExtension is updated to use v1.0.3-preview of Microsoft.Azure.WebJobs.Script.Abstractions so that FunctionMetadata has the Retry property and the JSON Reader can deserialize JObjects from the functions.metadata file into FunctionMetadata as is without code changes.

@satvu satvu changed the title Add retry attributes to function level Define Retry Policy Attributes Jul 26, 2022
@satvu satvu marked this pull request as ready for review July 26, 2022 20:49
@satvu satvu requested review from brettsam, fabiocav and kshyju July 26, 2022 20:49
@satvu
Copy link
Member Author

satvu commented Jul 26, 2022

Additionally conducted manual verification by running this E2E with the host and inspecting loaded FunctionMetadata to check Retry information was populated correctly. Currently investigating to see what other tests we may need/want for this feature.

<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.25" />
<PackageReference Include="Microsoft.Azure.WebJobs.Script.Abstractions" Version="1.0.0-preview" />
<PackageReference Include="Microsoft.Azure.WebJobs.Script.Abstractions" Version="1.0.3-preview" />
Copy link
Member

Choose a reason for hiding this comment

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

Why 1.0.3 instead of 1.0.1?

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 just grabbed the latest available we had.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

The host uses 1.0.3-preview which is the latest (only published internally). RetryOptions do show up in 1.0.1-preview first, but there's also an update to the RetryOptions class in 1.0.2-preview. Don't know the progress on a public release for these, but I think we can match the host version without issues. If we only want to consume RetryOptions changes we can pick 1.0.2.

Copy link
Member

@kshyju kshyju left a comment

Choose a reason for hiding this comment

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

💰

<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.25" />
<PackageReference Include="Microsoft.Azure.WebJobs.Script.Abstractions" Version="1.0.0-preview" />
<PackageReference Include="Microsoft.Azure.WebJobs.Script.Abstractions" Version="1.0.3-preview" />
Copy link
Member

Choose a reason for hiding this comment

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


public Collection<ExpandoObject> Bindings { get; set; } = new Collection<ExpandoObject>();

public SdkRetryOptions? Retry { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

We need to update the source gen version of metadata generation with this prop as well. Correct? Perhaps a follow up PR later.

Copy link
Member

@kshyju kshyju left a comment

Choose a reason for hiding this comment

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

LGTM.


private static void ValidateIntervals(TimeSpan minimumInterval, TimeSpan maximumInterval)
{
if (minimumInterval.Ticks < 0)
Copy link
Member

Choose a reason for hiding this comment

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

What string input(for minimumInterval) will produce a TimeSpan instance with negative value for Ticks 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.

"-00:00:10" passes the TimeSpan.Parse check and fails this check.

[AttributeUsage(AttributeTargets.Method)]
public abstract class RetryAttribute : Attribute
{
public RetryAttribute()
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this public constructor?

Copy link
Member Author

Choose a reason for hiding this comment

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

Intent was to stylistically match the other attribute classes (binding attribute, input binding attribute, etc).

@satvu
Copy link
Member Author

satvu commented Aug 17, 2022

/check-enforcer evaluate

@satvu
Copy link
Member Author

satvu commented Aug 17, 2022

/check-enforcer evaluate

@satvu
Copy link
Member Author

satvu commented Aug 17, 2022

/check-enforcer override

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