Skip to content

Conversation

@martintmk
Copy link
Contributor

@martintmk martintmk commented Jul 4, 2023

Details on the issue fix or feature implementation

This comment:
martincostello/polly-sandbox#1 (comment)

Made me realize that not every adopter wants to consume native Polly telemetry. This PR adds a simple way to hook into Polly telemetry and inspect TelemetryEventArguments that contain all necessary information to report custom events from it.

Usage:

var builder = new ResilienceStrategyBuilder()
    .AddTimeout(TimeSpan.FromSeconds(1))
    .ConfigureTelemetry(new TelemetryOptions
    {
        OnTelemetryEvent = args =>
        {
            // do whatever you want with args
        }
    });

Contributes to #1365

Confirm the following

  • I started this PR by branching from the head of the default branch
  • I have targeted the PR to merge into the default branch
  • I have included unit tests for the issue/feature
  • I have successfully run a local build

@martintmk martintmk added the v8 Issues related to the new version 8 of the Polly library. label Jul 4, 2023
@martintmk martintmk added this to the v8.0.0 milestone Jul 4, 2023
@martintmk martintmk requested a review from martincostello July 4, 2023 08:40
@codecov
Copy link

codecov bot commented Jul 4, 2023

Codecov Report

Merging #1387 (8cd00cc) into main (ed4c480) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1387   +/-   ##
=======================================
  Coverage   83.68%   83.68%           
=======================================
  Files         269      269           
  Lines        6429     6431    +2     
  Branches     1003     1004    +1     
=======================================
+ Hits         5380     5382    +2     
  Misses        840      840           
  Partials      209      209           
Flag Coverage Δ
linux ?
macos 83.68% <100.00%> (+<0.01%) ⬆️
windows 83.68% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../Polly.Core/Telemetry/ResilienceTelemetrySource.cs 100.00% <ø> (ø)
...rc/Polly.Core/Telemetry/TelemetryEventArguments.cs 100.00% <ø> (ø)
...s/Telemetry/ResilienceTelemetryDiagnosticSource.cs 100.00% <100.00%> (ø)
src/Polly.Extensions/Telemetry/TelemetryOptions.cs 100.00% <100.00%> (ø)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v8 Issues related to the new version 8 of the Polly library.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants