Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a Parent-Request-Id header #1365

Merged
merged 3 commits into from
Feb 18, 2025
Merged

Conversation

bjlaub
Copy link
Contributor

@bjlaub bjlaub commented Feb 18, 2025

Before this PR

Traces created with a span type of SERVER_INCOMING generate a requestId, which is useful for observing operations on a service related to handling a particular inbound request. However, that requestId is local to the service itself, and doesn't allow for easily following RPC call chains in observability data. While the traceId does allow for this, it can sometimes be overly noisy and doesn't allow for easily tracing through RPC calls themselves.

After this PR

add a Parent-Request-Id header

This provides better observability for RPC call chains by having callers include their own generated requestId (if one exists) on new outbound requests. Receivers can log the Parent-Request-Id header value. This should allow for observing the operations that generated a request to an endpoint by following Parent-Request-Id pointers backwards, without needing to view observability data for the entire traceId, which may be very large.

==COMMIT_MSG==
add a Parent-Request-Id header
==COMMIT_MSG==

Possible downsides?

Extra header means more bytes on the wire, but should be small.

This provides better observability for RPC call chains by having callers
include their own generated requestId (if one exists) on new outbound
requests. Receivers can log the `Parent-Request-Id` header value. This
should allow for observing the operations that generated a request to an
endpoint by following `Parent-Request-Id` pointers backwards, without
needing to view observability data for the entire traceId, which may be
very large.
@changelog-app
Copy link

changelog-app bot commented Feb 18, 2025

Generate changelog in changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services
    and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the
    operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration,
    performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

add a Parent-Request-Id header

Check the box to generate changelog(s)

  • Generate changelog entry

Comment on lines 44 to 45
* For traces initiated with span type {@link SpanType#SERVER_INCOMING},
* this header will be set to the requestId generated for that trace.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm having trouble parsing this sentence. Perhaps something like:

The {@code Parent-Request-Id} header represents the requestId of the caller, if present. This provides a direct causal connection between requests up a call stack. This can be an advantage over traceId which provides a broad set of data without information to understand the call pathing unless spans are sampled.

"defaultTraceId",
Optional.of("forUserAgent"),
"rootOperation",
SpanType.SERVER_INCOMING);
Copy link
Contributor

Choose a reason for hiding this comment

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

We can capture the requestId value here, and assert equality below rather than isNotBlank()

Copy link
Contributor

@carterkozak carterkozak left a comment

Choose a reason for hiding this comment

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

thanks!

@bulldozer-bot bulldozer-bot bot merged commit 3eec808 into develop Feb 18, 2025
5 checks passed
@bulldozer-bot bulldozer-bot bot deleted the blaub/parent-request-id branch February 18, 2025 21:37
@autorelease3
Copy link

autorelease3 bot commented Feb 18, 2025

Released 6.21.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants