upstreamwarn

package
v1.156.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package upstreamwarn hands what an API connection's upstream answered to whatever records upstream warnings (#2486): a Deprecation or Sunset header, and a 404 or 410 from an operation that answered before. The outbound chain calls Observe for every answer an API connection receives, the way it feeds internal/connstate; the API gateway marks the request with the catalog operation it addresses, and an answer to a request with no operation is not observed. The operation is the catalog's operation id or "METHOD template", never the concrete path, which can carry a filled secret.

It holds no recorder of its own: the platform installs one with SetObserver once its database is open, and until then every answer is passed over.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Observe

func Observe(ctx context.Context, connection string, status int, header http.Header)

Observe hands one answer to the installed recorder when the request named an operation. A transport failure (status 0) says nothing about the operation and is passed over.

func Operation

func Operation(ctx context.Context) string

Operation is the operation ctx marks, or "".

func SetObserver

func SetObserver(o Observer)

SetObserver installs the recorder every answer is handed to; nil removes it.

func WithOperation

func WithOperation(ctx context.Context, operation string) context.Context

WithOperation marks the requests made under ctx as addressing operation.

Types

type Observer

type Observer interface {
	Observe(ctx context.Context, connection, operation string, status int, header http.Header)
}

Observer records what an upstream said about an operation.

Jump to

Keyboard shortcuts

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