resend

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package resend carries the number of times an outgoing HTTP request has been resent through a context.Context, from a retrying round tripper (arkoren.dev/core/http/client) to the instrumented one it wraps (arkoren.dev/core/service/telemetry), which records it as http.request.resend_count. The original request is attempt zero; callers attach a new count per retry.

ctx := resend.NewContext(ctx, 1)
fmt.Println(resend.FromContext(ctx)) // 1

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) int

FromContext returns the resend count stored by NewContext, zero for the first attempt of a request. Contexts without an attached count also return zero and are not mutated.

Example: count := resend.FromContext(resend.NewContext(ctx, 2)); fmt.Println(count)

func NewContext

func NewContext(ctx context.Context, count int) context.Context

NewContext returns a copy of ctx that records count resends: 1 for the first resend of a request, 2 for the second, and so on. It performs no I/O or range validation; the retrying client owns the count. A nil parent follows context.WithValue's panic rule.

Example: ctx := resend.NewContext(ctx, 1)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL