Skip to content

Support for Pre-Request AWS Span in Laravel Vapor #1019

@mortenhauberg

Description

@mortenhauberg

Problem Statement

I’m using Laravel Vapor, and I’d like to capture the time spent in AWS (API Gateway + Lambda cold start, etc.) before the request reaches the Laravel application.

Now that laravel/vapor-core#192 is merged, it’s possible to access the AWS_API_GATEWAY_REQUEST_TIME server variable. I’d love to use this to automatically instrument a span that represents the AWS overhead as a sibling to the existing http.server span, not a child of it.

Would you be open to accepting a PR for this, or is there a recommended way to hook into span creation earlier in the lifecycle?

Solution Brainstorm

I’ve tried hacking this in from the application side, but I’m starting to question my sanity. I can’t find a clean way to do this outside of the Sentry SDK itself and I imagine other Vapor users would benefit from this out-of-the-box.

Essentially, this would involve:

  • Using $request->server('AWS_API_GATEWAY_REQUEST_TIME') as the start time
  • Using $requestStartTime as the end time
  • Creating a span that either replaces or supplements the existing bootstrap span

This is as far as I got right now, but the span is nested under http.server, which isn't correct.

Image

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions