Skip to content

formatter: add access log formatters for tracking upstream hosts and connection IDs attempted#43215

Merged
yanavlasov merged 7 commits into
envoyproxy:mainfrom
IssaAbuKalbein:upstream_formatters
Mar 1, 2026
Merged

formatter: add access log formatters for tracking upstream hosts and connection IDs attempted#43215
yanavlasov merged 7 commits into
envoyproxy:mainfrom
IssaAbuKalbein:upstream_formatters

Conversation

@IssaAbuKalbein
Copy link
Copy Markdown
Contributor

Commit Message: formatter: add access log formatters for tracking upstream hosts and connection IDs attempted

Additional Description: Adds new access log formatters to track all upstream hosts and connection IDs attempted during request processing:

  • %UPSTREAM_HOSTS_ATTEMPTED% - Comma-separated list of upstream host addresses (ip:port)
  • %UPSTREAM_HOSTS_ATTEMPTED_WITHOUT_PORT% - Upstream host addresses without port
  • %UPSTREAM_HOST_NAMES_ATTEMPTED% - Upstream host names
  • %UPSTREAM_HOST_NAMES_ATTEMPTED_WITHOUT_PORT% - Upstream host names without port
  • %UPSTREAM_CONNECTION_IDS_ATTEMPTED% - Connection IDs used during request processing

Extended StreamInfo::UpstreamInfo interface with methods to track attempted hosts and connection IDs. Implemented tracking in HTTP router, TCP proxy, and UDP proxy.

Risk Level: Low

Testing: Unit tests added for all new formatters. Mocks updated for new interface methods.

Docs Changes: Updated docs/root/configuration/advanced/substitution_formatter.rst with documentation for all new formatters.

Release Notes: Added entry in changelogs/current.yaml.

Platform Specific Features: N/A

…connection IDs attempted

Signed-off-by: Issa Abu Kalbein <iabukalbein@microsoft.com>
@IssaAbuKalbein
Copy link
Copy Markdown
Contributor Author

/retest

Signed-off-by: Issa Abu Kalbein <86603440+IssaAbuKalbein@users.noreply.github.com>
@IssaAbuKalbein
Copy link
Copy Markdown
Contributor Author

/retest

Copy link
Copy Markdown
Contributor

@yanavlasov yanavlasov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/wait-any

* This is useful for tracking retry behavior in access logs.
* @param host the host description that was attempted.
*/
virtual void addUpstreamHostAttempted(Upstream::HostDescriptionConstSharedPtr host) PURE;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can add this behavior to the existing setUpstreamHost and setUpstreamConnectionId since they are always called together now. Let me know what you think.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've merged addUpstreamConnectionIdAttempted into setUpstreamConnectionId — all 4 call sites were always paired together, so setUpstreamConnectionId now automatically pushes to the attempted list and the separate addUpstreamConnectionIdAttempted API has been removed.

For setUpstreamHost / addUpstreamHostAttempted however, these can't be safely merged. setUpstreamHost has 12 call sites but only 3 are paired with addUpstreamHostAttempted. The other 9 include health checkers, ext_proc, ext_authz, pool success/failure callbacks, and low-level connection creation — these set the host for informational purposes but don't represent routing attempts. Merging would pollute UPSTREAM_HOST_NAMES_ATTEMPTED with non-routing entries (e.g., health check hosts).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yanavlasov WDYT?

…e usage

Signed-off-by: Issa Abu Kalbein <iabukalbein@microsoft.com>
Issa Abu Kalbein and others added 2 commits February 11, 2026 18:47
Signed-off-by: Issa Abu Kalbein <iabukalbein@microsoft.com>
Signed-off-by: Issa Abu Kalbein <86603440+IssaAbuKalbein@users.noreply.github.com>
@IssaAbuKalbein
Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@IssaAbuKalbein
Copy link
Copy Markdown
Contributor Author

/retest

Signed-off-by: Issa Abu Kalbein <86603440+IssaAbuKalbein@users.noreply.github.com>
@IssaAbuKalbein IssaAbuKalbein temporarily deployed to external-contributors February 12, 2026 14:22 — with GitHub Actions Inactive
@IssaAbuKalbein
Copy link
Copy Markdown
Contributor Author

/retest

Signed-off-by: Issa Abu Kalbein <86603440+IssaAbuKalbein@users.noreply.github.com>
@mattklein123 mattklein123 removed their assignment Feb 21, 2026
@yanavlasov yanavlasov merged commit 99ddbc2 into envoyproxy:main Mar 1, 2026
28 checks passed
bmjask pushed a commit to bmjask/envoy that referenced this pull request Mar 14, 2026
…connection IDs attempted (envoyproxy#43215)

Adds new access log formatters to track all
upstream hosts and connection IDs attempted during request processing:

- `%UPSTREAM_HOSTS_ATTEMPTED%` - Comma-separated list of upstream host
addresses (ip:port)
- `%UPSTREAM_HOSTS_ATTEMPTED_WITHOUT_PORT%` - Upstream host addresses
without port
- `%UPSTREAM_HOST_NAMES_ATTEMPTED%` - Upstream host names
- `%UPSTREAM_HOST_NAMES_ATTEMPTED_WITHOUT_PORT%` - Upstream host names
without port
- `%UPSTREAM_CONNECTION_IDS_ATTEMPTED%` - Connection IDs used during
request processing

Extended `StreamInfo::UpstreamInfo` interface with methods to track
attempted hosts and connection IDs. Implemented tracking in HTTP router,
TCP proxy, and UDP proxy.

__Risk Level:__ Low

__Testing:__ Unit tests added for all new formatters. Mocks updated for
new interface methods.

__Docs Changes:__ Updated
`docs/root/configuration/advanced/substitution_formatter.rst` with
documentation for all new formatters.

__Release Notes:__ Added entry in `changelogs/current.yaml`.

__Platform Specific Features:__ N/A

---------

Signed-off-by: Issa Abu Kalbein <iabukalbein@microsoft.com>
Signed-off-by: Issa Abu Kalbein <86603440+IssaAbuKalbein@users.noreply.github.com>
Co-authored-by: Issa Abu Kalbein <iabukalbein@microsoft.com>
Signed-off-by: bjmask <11672696+bjmask@users.noreply.github.com>
bvandewalle pushed a commit to bvandewalle/envoy that referenced this pull request Mar 17, 2026
…connection IDs attempted (envoyproxy#43215)

Adds new access log formatters to track all
upstream hosts and connection IDs attempted during request processing:

- `%UPSTREAM_HOSTS_ATTEMPTED%` - Comma-separated list of upstream host
addresses (ip:port)
- `%UPSTREAM_HOSTS_ATTEMPTED_WITHOUT_PORT%` - Upstream host addresses
without port
- `%UPSTREAM_HOST_NAMES_ATTEMPTED%` - Upstream host names
- `%UPSTREAM_HOST_NAMES_ATTEMPTED_WITHOUT_PORT%` - Upstream host names
without port
- `%UPSTREAM_CONNECTION_IDS_ATTEMPTED%` - Connection IDs used during
request processing

Extended `StreamInfo::UpstreamInfo` interface with methods to track
attempted hosts and connection IDs. Implemented tracking in HTTP router,
TCP proxy, and UDP proxy.

__Risk Level:__ Low

__Testing:__ Unit tests added for all new formatters. Mocks updated for
new interface methods.

__Docs Changes:__ Updated
`docs/root/configuration/advanced/substitution_formatter.rst` with
documentation for all new formatters.

__Release Notes:__ Added entry in `changelogs/current.yaml`.

__Platform Specific Features:__ N/A

---------

Signed-off-by: Issa Abu Kalbein <iabukalbein@microsoft.com>
Signed-off-by: Issa Abu Kalbein <86603440+IssaAbuKalbein@users.noreply.github.com>
Co-authored-by: Issa Abu Kalbein <iabukalbein@microsoft.com>
fishcakez pushed a commit to fishcakez/envoy that referenced this pull request Mar 25, 2026
…connection IDs attempted (envoyproxy#43215)

Adds new access log formatters to track all
upstream hosts and connection IDs attempted during request processing:

- `%UPSTREAM_HOSTS_ATTEMPTED%` - Comma-separated list of upstream host
addresses (ip:port)
- `%UPSTREAM_HOSTS_ATTEMPTED_WITHOUT_PORT%` - Upstream host addresses
without port
- `%UPSTREAM_HOST_NAMES_ATTEMPTED%` - Upstream host names
- `%UPSTREAM_HOST_NAMES_ATTEMPTED_WITHOUT_PORT%` - Upstream host names
without port
- `%UPSTREAM_CONNECTION_IDS_ATTEMPTED%` - Connection IDs used during
request processing

Extended `StreamInfo::UpstreamInfo` interface with methods to track
attempted hosts and connection IDs. Implemented tracking in HTTP router,
TCP proxy, and UDP proxy.

__Risk Level:__ Low

__Testing:__ Unit tests added for all new formatters. Mocks updated for
new interface methods.

__Docs Changes:__ Updated
`docs/root/configuration/advanced/substitution_formatter.rst` with
documentation for all new formatters.

__Release Notes:__ Added entry in `changelogs/current.yaml`.

__Platform Specific Features:__ N/A

---------

Signed-off-by: Issa Abu Kalbein <iabukalbein@microsoft.com>
Signed-off-by: Issa Abu Kalbein <86603440+IssaAbuKalbein@users.noreply.github.com>
Co-authored-by: Issa Abu Kalbein <iabukalbein@microsoft.com>
krinkinmu pushed a commit to grnmeira/envoy that referenced this pull request Apr 20, 2026
…connection IDs attempted (envoyproxy#43215)

Adds new access log formatters to track all
upstream hosts and connection IDs attempted during request processing:

- `%UPSTREAM_HOSTS_ATTEMPTED%` - Comma-separated list of upstream host
addresses (ip:port)
- `%UPSTREAM_HOSTS_ATTEMPTED_WITHOUT_PORT%` - Upstream host addresses
without port
- `%UPSTREAM_HOST_NAMES_ATTEMPTED%` - Upstream host names
- `%UPSTREAM_HOST_NAMES_ATTEMPTED_WITHOUT_PORT%` - Upstream host names
without port
- `%UPSTREAM_CONNECTION_IDS_ATTEMPTED%` - Connection IDs used during
request processing

Extended `StreamInfo::UpstreamInfo` interface with methods to track
attempted hosts and connection IDs. Implemented tracking in HTTP router,
TCP proxy, and UDP proxy.

__Risk Level:__ Low

__Testing:__ Unit tests added for all new formatters. Mocks updated for
new interface methods.

__Docs Changes:__ Updated
`docs/root/configuration/advanced/substitution_formatter.rst` with
documentation for all new formatters.

__Release Notes:__ Added entry in `changelogs/current.yaml`.

__Platform Specific Features:__ N/A

---------

Signed-off-by: Issa Abu Kalbein <iabukalbein@microsoft.com>
Signed-off-by: Issa Abu Kalbein <86603440+IssaAbuKalbein@users.noreply.github.com>
Co-authored-by: Issa Abu Kalbein <iabukalbein@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants