From fada156ca23e2518860b8cf51dfbc31baa1b8793 Mon Sep 17 00:00:00 2001 From: Ohad Abarbanel Date: Mon, 12 Aug 2024 17:50:58 +0300 Subject: [PATCH 1/3] feat: Add retry delay as span attribute in retry handler --- retry_handler.go | 1 + 1 file changed, 1 insertion(+) diff --git a/retry_handler.go b/retry_handler.go index 141a8c0..459a951 100644 --- a/retry_handler.go +++ b/retry_handler.go @@ -144,6 +144,7 @@ func (middleware RetryHandler) retryRequest(ctx context.Context, pipeline Pipeli ctx, span := otel.GetTracerProvider().Tracer(observabilityName).Start(ctx, "RetryHandler_Intercept - attempt "+fmt.Sprint(executionCount)) span.SetAttributes(attribute.Int("http.retry_count", executionCount), attribute.Int("http.status_code", resp.StatusCode), + attribute.Float64("http.retry_delay", delay.Seconds()), ) defer span.End() req = req.WithContext(ctx) From 4e73166f7a058f8e5aa30a93879ee7440d23dd4f Mon Sep 17 00:00:00 2001 From: Ohad Abarbanel Date: Tue, 13 Aug 2024 13:20:44 +0300 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Vincent Biret --- retry_handler.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/retry_handler.go b/retry_handler.go index 459a951..f366396 100644 --- a/retry_handler.go +++ b/retry_handler.go @@ -142,9 +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.retry_delay", delay.Seconds()), + attribute.Float64("http.request.resend_delay", delay.Seconds()), + ) defer span.End() req = req.WithContext(ctx) From 7573e834c6e671dfa023ddb45c2d3f5eb70fd6d4 Mon Sep 17 00:00:00 2001 From: Ohad Abarbanel Date: Tue, 13 Aug 2024 13:21:27 +0300 Subject: [PATCH 3/3] chore: Change user agent version and add changelog entry --- CHANGELOG.md | 7 +++++++ user_agent_handler.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 422e94f..b2ef7e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/user_agent_handler.go b/user_agent_handler.go index 2b11cd4..a310851 100644 --- a/user_agent_handler.go +++ b/user_agent_handler.go @@ -42,7 +42,7 @@ func NewUserAgentHandlerOptions() *UserAgentHandlerOptions { return &UserAgentHandlerOptions{ Enabled: true, ProductName: "kiota-go", - ProductVersion: "1.4.3", + ProductVersion: "1.4.4", } }