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

feat: Add retry delay as span attribute in retry handler #180

Merged
merged 3 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading