Skip to content

Conversation

@cee-dub
Copy link
Collaborator

@cee-dub cee-dub commented Nov 11, 2025

This makes accessing the RequestID and SandboxID from fsthttp.Request consistent, and enables a move away from reading the FASTLY_TRACE_ID environment variable for SandboxID which is confusing now that we have RequestID.

Users are encouraged to use RequestID() to uniquely identify individual requests being served.

Fixes #183

The RequestID value comes from this host call:

// witx;
//
//	(@interface func (export "downstream_client_request_id")
//	    (param $req $request_handle)
//	    (param $reqid_out (@witx pointer (@witx char8)))
//	    (param $reqid_max_len (@witx usize))
//	    (param $nwritten_out (@witx pointer (@witx usize)))
//	    (result $err (expected (error $fastly_status)))
//	)
//
//go:wasmimport fastly_http_downstream downstream_client_request_id
func fastlyHTTPDownstreamRequestID(...) FastlyStatus

@cee-dub cee-dub changed the title Use FastlyMeta for RequestID and SessionID Use FastlyMeta for RequestID and SandboxID Nov 14, 2025
Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

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

LGTM

@dgryski
Copy link
Member

dgryski commented Nov 14, 2025

Merge conflict to be resolved.


func main() {
var requests int
var requestCount int
Copy link
Member

Choose a reason for hiding this comment

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

Could we add request count to FastlyMeta? It's something I would really like to have in my usage.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Have to fix conflicts. Seems like a safe add?

Copy link
Member

Choose a reason for hiding this comment

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

Opened #215 as a PR onto this branch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just rebased this. You should be able to merge on top once this goes green again.

@cee-dub cee-dub force-pushed the cee-dub/request-meta branch from 705faad to 5124f51 Compare November 14, 2025 22:05
@cee-dub cee-dub merged commit 9f38fd1 into main Nov 14, 2025
9 checks passed
@cee-dub cee-dub deleted the cee-dub/request-meta branch November 14, 2025 22:22
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.

Replace environment variables witih accessor methods

5 participants