elastic / elastic/apm-agent-nodejs

`parsers.getContextFromRequest` is missing `context.request.url.*` fields for HTTP/2

Open
#2,497 0 comments 0 reactions 0 assignees View on GitHub
agent-nodejs
Dominant language
JavaScript
Stars
594
Forks
244
Avg merge
1d 8h
Merged PRs (30d)
16

Description

`parsers.getContextFromRequest()` is used to gather data for `{transaction,error}.context.request` from an incoming request object. Here is an example `context.request` object it gets for an HTTP/1.1 request:

```
"request": {
"http_version": "1.1",
"method": "GET",
"url": {
"raw": "/",
"protocol": "https:",
"hostname": "localhost",
"port": "58851",
"pathname": "/",
"full": "https://localhost:58851/"
},
"headers": {
"host": "localhost:58851",
"connection": "close"
},
"socket": {
"remote_address": "::ffff:127.0.0.1"
}
},
```

and from a HTTP/2 request:

```
"request": {
"http_version": "2.0",
"method": "GET",
"url": {
"raw": "/",
"protocol": "http:",
"pathname": "/"
},
"headers": {
":scheme": "https",
":authority": "localhost:58848",
":method": "GET",
":path": "/"
},
"socket": {
"remote_address": "::ffff:127.0.0.1"
}
},
```

The "url" data gathering is using https://github.com/watson/original-url
There is a PR there to add HTTP/2 support: https://github.com/watson/original-url/pull/8
We should help get that merged and update our original-url.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.