Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Attributes set on HTTP/2 server spans:
| `url.path` | Request URL path (without query) | Always |
| `url.query` | Query string (without `?`) | When query string is present |
| `url.scheme` | `http` or `https` | Always |
| `server.address` | `:authority` pseudo-header value | When present |
| `server.address` | Requested host, without the port | When `:authority` is present |
| `network.protocol.version` | `2.0` | Always |
| `http.response.status_code` | Response status code | When the response is sent |
| `error.type` | HTTP status code as string | On 5xx responses |
Expand Down
3 changes: 2 additions & 1 deletion lib/instrumentations.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ function onHttp2ServerStreamStart({ stream, headers }) {
span.setAttribute('network.protocol.version', '2.0');

const authority = headers?.[':authority'];
if (authority) span.setAttribute('server.address', authority);
if (authority)
span.setAttribute('server.address', splitAuthority(authority)[0]);

// The span is stashed on the stream so the finish and close handlers do
// not need a second AsyncLocalStorage lookup.
Expand Down
2 changes: 1 addition & 1 deletion test/test-http2.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe('otel HTTP/2 server spans', () => {
'url.scheme': 'http',
'network.protocol.version': '2.0',
'http.response.status_code': '200',
'server.address': `127.0.0.1:${target.port}`,
'server.address': '127.0.0.1',
});
});

Expand Down
Loading