Skip to content

Support convertReqRes-style ECS field mapping where req/res data is unavailable as Node http objects #141

Open

Description

In my case I am running Node in an AWS Lambda environment where there is not a Node server running. Request data is available as APIGatewayProxyEvent or APIGatewayEventRequestContextV2 and responses as APIGatewayProxyResult or APIGatewayProxyStructuredResultV2.

Ideally this context would be gathered automatically by the apm-aws-lambda extension and accessible by ecs-logging-nodejs via the agent. But from what I can tell this isn't the case. This library doesn't log any HTTP request/response data as part of it's APM integration. And I don't see that this API Gateway data is collected by the extension today, assuming it is even available from the AWS Lambda Logs/Telemetry APIs.

As a stopgap for an indeterminate period of time I am using AsyncLocalStorage and a Pino mixin to gather this data from my function handlers and include it in my logs following ECS conventions.

If #68 resolves with a namespace-based solution and APM support remains lacking I would like to continue logging HTTP details on top-level ECS fields for consistency with non-Lambda services. This seems possible if I could create compatible instances of http.IncomingMessage and http.ServiceResponse but Node's HTTP API seems excessively complicated for this case.

Ideally I could explicitly provide the ECS fields, similar to what I do today and how existing req/res support works. Alternately support for Fetch API Request and Response objects.

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

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions