From b89cc7ac11a81ecf294cca9ea2d0f68876b3f77b Mon Sep 17 00:00:00 2001 From: Alex Buchanan Date: Fri, 25 Oct 2024 14:00:25 -0700 Subject: [PATCH] docs: note about segment context handling in http request (#140) --- internal/telemetry/segment.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/telemetry/segment.go b/internal/telemetry/segment.go index 6ca0e39..589e725 100644 --- a/internal/telemetry/segment.go +++ b/internal/telemetry/segment.go @@ -150,6 +150,8 @@ func (s *SegmentClient) send(ctx context.Context, es EventState, et EventType, e return fmt.Errorf("unable to create request body: %w", err) } + // We don't include the parent context in the http request, + // because we want to send telemetry even if the parent context is canceled. req, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(data)) if err != nil { return fmt.Errorf("unable to create request: %w", err)