Skip to content

Commit

Permalink
Merge pull request #180 from ohad83/feat/retry-handler-delay-attribute
Browse files Browse the repository at this point in the history
feat: Add retry delay as span attribute in retry handler
  • Loading branch information
baywet authored Aug 13, 2024
2 parents 9bf80c7 + 7573e83 commit 3f27fff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

## [1.4.4] - 2024-08-13

### Changed

- Added `http.request.resend_delay` as a span attribute for the retry handler
- Changed the `http.retry_count` span attribute to `http.request.resend_count` to conform to OpenTelemetry specs.

## [1.4.3] - 2024-07-22

### Changed
Expand Down
5 changes: 4 additions & 1 deletion retry_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,11 @@ func (middleware RetryHandler) retryRequest(ctx context.Context, pipeline Pipeli
}
if observabilityName != "" {
ctx, span := otel.GetTracerProvider().Tracer(observabilityName).Start(ctx, "RetryHandler_Intercept - attempt "+fmt.Sprint(executionCount))
span.SetAttributes(attribute.Int("http.retry_count", executionCount),
span.SetAttributes(attribute.Int("http.request.resend_count", executionCount),

attribute.Int("http.status_code", resp.StatusCode),
attribute.Float64("http.request.resend_delay", delay.Seconds()),

)
defer span.End()
req = req.WithContext(ctx)
Expand Down
2 changes: 1 addition & 1 deletion user_agent_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func NewUserAgentHandlerOptions() *UserAgentHandlerOptions {
return &UserAgentHandlerOptions{
Enabled: true,
ProductName: "kiota-go",
ProductVersion: "1.4.3",
ProductVersion: "1.4.4",
}
}

Expand Down

0 comments on commit 3f27fff

Please sign in to comment.