Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,11 @@ it('sends a streamed span envelope with correct spans for a manually started spa
},
'network.protocol.name': {
type: 'string',
value: 'HTTP/1.1',
value: 'http',
},
'network.protocol.version': {
type: 'string',
value: '1.1',
},
},
is_segment: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ test('sends spans for MCP 2026-07-28 tool calls', async ({ baseURL }) => {
expect(requestTrace?.data?.['http.request.body.size']).toBe(341);
expect(requestTrace?.data?.['user_agent.original']).toBe('node');
expect(requestTrace?.data?.['http.request.header.content_type']).toBe('application/json');
expect(requestTrace?.data?.['network.protocol.name']).toBe('HTTP/1.1');
expect(requestTrace?.data?.['network.protocol.name']).toBe('http');
expect(requestTrace?.data?.['network.protocol.version']).toBe('1.1');
expect(requestTrace?.data?.['http.response.status_code']).toBe(200);
expect(requestTrace?.data?.['mcp.server.extra']).toBe(' /|\ ^._.^ /|\ ');
expect(mcpTrace?.trace_id).toBe(requestTrace?.trace_id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ const SEGMENT_SPAN = {
type: 'integer',
value: expect.any(Number),
},
'network.protocol.name': {
type: 'string',
value: 'http',
},
'os.name': {
type: 'string',
value: expect.any(String),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export type Runtime = 'cloudflare' | 'node' | 'bun' | 'deno';

export const RUNTIME = (process.env.RUNTIME || 'deno') as Runtime;
export const RUNTIME = (process.env.RUNTIME || 'node') as Runtime;

export const APP_NAME = 'hono-4';
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ test('attaches HTTP connection info to the server transaction', async ({ baseURL
// Regression guard against connection info attributes.
// The conninfo middleware must only *add* attributes, never replace or clear existing ones.
// These are the baseline attributes the server transaction carries *without* the conninfo feature
test("preserves the baseline client.* and network.* server span attributes that the SDK sends without Hono's conninfo", async ({
test("preserves the baseline server.*, client.* and network.* server span attributes that the SDK sends without Hono's conninfo", async ({
baseURL,
}) => {
const transactionPromise = waitForTransaction(APP_NAME, event => {
Expand All @@ -88,18 +88,38 @@ test("preserves the baseline client.* and network.* server span attributes that
const data = transaction.contexts?.trace?.data ?? {};

if (RUNTIME === 'node') {
expect(data['net.host.name']).toBe('localhost');
expect(data['net.transport']).toBe('ip_tcp');
expect(data['net.host.ip']).toEqual(expect.any(String));
expect(data['net.peer.ip']).toEqual(expect.any(String));
expect(data['net.peer.port']).toEqual(expect.any(Number));
expect(data['server.address']).toBe('localhost');
expect(data['server.port']).toBe(Number(new URL(baseURL!).port));
expect(data['client.address']).toEqual(expect.any(String));
expect(data['client.port']).toEqual(expect.any(Number));
expect(data['network.type']).toMatch(/^ipv[46]$/);
expect(data['network.protocol.name']).toBe('http');
expect(data['network.protocol.version']).toBe('1.1');
expect(data['network.transport']).toBeUndefined();
expect(data['network.local.port']).toBe(data['server.port']);
expect(data['network.local.address']).toEqual(expect.any(String));
expect(data['network.peer.address']).toBe(data['client.address']);
expect(data['network.peer.port']).toBe(data['client.port']);
} else if (RUNTIME === 'bun') {
// Doesn't set net.*, network.*, or client.* attributes
expect(data['client.address']).toEqual(expect.any(String));
expect(data['client.port']).toEqual(expect.any(Number));
expect(data['network.peer.address']).toBe(data['client.address']);
expect(data['network.peer.port']).toBe(data['client.port']);
expect(data['network.type']).toMatch(/^ipv[46]$/);
} else if (RUNTIME === 'cloudflare') {
expect(data['network.protocol.name']).toBe('HTTP/1.1');
expect(data['server.address']).toBe('localhost');
expect(data['client.address']).toBe('::1');
expect(data['network.peer.address']).toBe(data['client.address']);
expect(data['network.protocol.name']).toBe('http');
expect(data['network.protocol.version']).toBe('1.1');
} else if (RUNTIME === 'deno') {
expect(data['server.address']).toBe('localhost');
expect(data['client.address']).toEqual(expect.any(String));
expect(data['client.port']).toEqual(expect.any(Number));
expect(data['network.peer.address']).toBe(data['client.address']);
expect(data['network.peer.port']).toBe(data['client.port']);
expect(data['network.transport']).toBe('tcp');
expect(data['network.protocol.name']).toBe('http');
} else {
throw new Error(`No tests for runtime: ${RUNTIME}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,22 @@ test('Sends an API route transaction', async ({ baseURL }) => {
'url.full': 'http://localhost:3030/test-transaction',
'url.path': '/test-transaction',
'http.host': 'localhost:3030',
'net.host.name': 'localhost',
'server.address': 'localhost',
'http.method': 'GET',
'http.scheme': 'http',
'http.target': '/test-transaction',
'http.user_agent': 'node',
'http.flavor': '1.1',
'net.transport': 'ip_tcp',
'net.host.ip': expect.any(String),
'net.host.port': expect.any(Number),
'net.peer.ip': expect.any(String),
'net.peer.port': expect.any(Number),
'client.address': '::1',
'client.port': expect.any(Number),
'network.transport': 'tcp',
'network.local.address': expect.any(String),
'network.local.port': expect.any(Number),
'network.peer.address': expect.any(String),
'network.peer.port': expect.any(Number),
'network.protocol.name': 'http',
'network.protocol.version': '1.1',
'server.port': 3030,
'http.status_code': 200,
'http.status_text': 'OK',
'http.route': '/test-transaction',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,22 @@ test('Sends an API route transaction', async ({ baseURL }) => {
'url.full': 'http://localhost:3030/test-transaction',
'url.path': '/test-transaction',
'http.host': 'localhost:3030',
'net.host.name': 'localhost',
'server.address': 'localhost',
'http.method': 'GET',
'http.scheme': 'http',
'http.target': '/test-transaction',
'http.user_agent': 'node',
'http.flavor': '1.1',
'net.transport': 'ip_tcp',
'net.host.ip': expect.any(String),
'net.host.port': expect.any(Number),
'net.peer.ip': expect.any(String),
'net.peer.port': expect.any(Number),
'client.address': '::1',
'client.port': expect.any(Number),
'network.transport': 'tcp',
'network.local.address': expect.any(String),
'network.local.port': expect.any(Number),
'network.peer.address': expect.any(String),
'network.peer.port': expect.any(Number),
'network.protocol.name': 'http',
'network.protocol.version': '1.1',
'server.port': 3030,
'http.status_code': 200,
'http.status_text': 'OK',
'http.route': '/test-transaction',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,22 @@ test('Sends an API route transaction', async ({ baseURL }) => {
'url.full': 'http://localhost:3030/test-transaction',
'url.path': '/test-transaction',
'http.host': 'localhost:3030',
'net.host.name': 'localhost',
'server.address': 'localhost',
'http.method': 'GET',
'http.scheme': 'http',
'http.target': '/test-transaction',
'http.user_agent': 'node',
'http.flavor': '1.1',
'net.transport': 'ip_tcp',
'net.host.ip': expect.any(String),
'net.host.port': expect.any(Number),
'net.peer.ip': expect.any(String),
'net.peer.port': expect.any(Number),
'client.address': '::1',
'client.port': expect.any(Number),
'network.transport': 'tcp',
'network.local.address': expect.any(String),
'network.local.port': expect.any(Number),
'network.peer.address': expect.any(String),
'network.peer.port': expect.any(Number),
'network.protocol.name': 'http',
'network.protocol.version': '1.1',
'server.port': 3030,
'http.status_code': 200,
'http.status_text': 'OK',
'http.route': '/test-transaction',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,22 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => {
'url.full': `http://localhost:3030/test-outgoing-http/${id}`,
'url.path': `/test-outgoing-http/${id}`,
'http.host': 'localhost:3030',
'net.host.name': 'localhost',
'server.address': 'localhost',
'http.method': 'GET',
'http.scheme': 'http',
'http.target': `/test-outgoing-http/${id}`,
'http.user_agent': expect.any(String),
'http.flavor': '1.1',
'net.transport': 'ip_tcp',
'net.host.ip': expect.any(String),
'net.host.port': expect.any(Number),
'net.peer.ip': expect.any(String),
'net.peer.port': expect.any(Number),
'client.address': '::1',
'client.port': expect.any(Number),
'network.transport': 'tcp',
'network.local.address': expect.any(String),
'network.local.port': expect.any(Number),
'network.peer.address': expect.any(String),
'network.peer.port': expect.any(Number),
'network.protocol.name': 'http',
'network.protocol.version': '1.1',
'server.port': 3030,
'http.status_code': 200,
'http.status_text': 'OK',
'http.route': '/test-outgoing-http/:id',
Expand Down Expand Up @@ -104,16 +109,21 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => {
'url.full': `http://localhost:3030/test-inbound-headers/${id}`,
'url.path': `/test-inbound-headers/${id}`,
'http.host': 'localhost:3030',
'net.host.name': 'localhost',
'server.address': 'localhost',
'http.method': 'GET',
'http.scheme': 'http',
'http.target': `/test-inbound-headers/${id}`,
'http.flavor': '1.1',
'net.transport': 'ip_tcp',
'net.host.ip': expect.any(String),
'net.host.port': expect.any(Number),
'net.peer.ip': expect.any(String),
'net.peer.port': expect.any(Number),
'client.address': '::1',
'client.port': expect.any(Number),
'network.transport': 'tcp',
'network.local.address': expect.any(String),
'network.local.port': expect.any(Number),
'network.peer.address': expect.any(String),
'network.peer.port': expect.any(Number),
'network.protocol.name': 'http',
'network.protocol.version': '1.1',
'server.port': 3030,
'http.status_code': 200,
'http.status_text': 'OK',
'http.route': '/test-inbound-headers/:id',
Expand Down Expand Up @@ -194,17 +204,22 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => {
'url.full': `http://localhost:3030/test-outgoing-fetch/${id}`,
'url.path': `/test-outgoing-fetch/${id}`,
'http.host': 'localhost:3030',
'net.host.name': 'localhost',
'server.address': 'localhost',
'http.method': 'GET',
'http.scheme': 'http',
'http.target': `/test-outgoing-fetch/${id}`,
'http.user_agent': expect.any(String),
'http.flavor': '1.1',
'net.transport': 'ip_tcp',
'net.host.ip': expect.any(String),
'net.host.port': expect.any(Number),
'net.peer.ip': expect.any(String),
'net.peer.port': expect.any(Number),
'client.address': '::1',
'client.port': expect.any(Number),
'network.transport': 'tcp',
'network.local.address': expect.any(String),
'network.local.port': expect.any(Number),
'network.peer.address': expect.any(String),
'network.peer.port': expect.any(Number),
'network.protocol.name': 'http',
'network.protocol.version': '1.1',
'server.port': 3030,
'http.status_code': 200,
'http.status_text': 'OK',
'http.route': '/test-outgoing-fetch/:id',
Expand Down Expand Up @@ -233,16 +248,21 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => {
'url.full': `http://localhost:3030/test-inbound-headers/${id}`,
'url.path': `/test-inbound-headers/${id}`,
'http.host': 'localhost:3030',
'net.host.name': 'localhost',
'server.address': 'localhost',
'http.method': 'GET',
'http.scheme': 'http',
'http.target': `/test-inbound-headers/${id}`,
'http.flavor': '1.1',
'net.transport': 'ip_tcp',
'net.host.ip': expect.any(String),
'net.host.port': expect.any(Number),
'net.peer.ip': expect.any(String),
'net.peer.port': expect.any(Number),
'client.address': '::1',
'client.port': expect.any(Number),
'network.transport': 'tcp',
'network.local.address': expect.any(String),
'network.local.port': expect.any(Number),
'network.peer.address': expect.any(String),
'network.peer.port': expect.any(Number),
'network.protocol.name': 'http',
'network.protocol.version': '1.1',
'server.port': 3030,
'http.status_code': 200,
'http.status_text': 'OK',
'http.route': '/test-inbound-headers/:id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,22 @@ test.skip('Sends an API route transaction', async ({ baseURL }) => {
'http.response.status_code': 200,
'url.full': 'http://localhost:3030/test-transaction',
'http.host': 'localhost:3030',
'net.host.name': 'localhost',
'server.address': 'localhost',
'http.method': 'GET',
'http.scheme': 'http',
'http.target': '/test-transaction',
'http.user_agent': 'node',
'http.flavor': '1.1',
'net.transport': 'ip_tcp',
'net.host.ip': expect.any(String),
'net.host.port': expect.any(Number),
'net.peer.ip': expect.any(String),
'net.peer.port': expect.any(Number),
'client.address': '::1',
'client.port': expect.any(Number),
'network.transport': 'tcp',
'network.local.address': expect.any(String),
'network.local.port': expect.any(Number),
'network.peer.address': expect.any(String),
'network.peer.port': expect.any(Number),
'network.protocol.name': 'http',
'network.protocol.version': '1.1',
'server.port': 3030,
'http.status_code': 200,
'http.status_text': 'OK',
'http.route': '/test-transaction',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,22 @@ test('Sends an API route transaction from module', async ({ baseURL }) => {
'url.full': 'http://localhost:3030/example-module/transaction',
'url.path': '/example-module/transaction',
'http.host': 'localhost:3030',
'net.host.name': 'localhost',
'server.address': 'localhost',
'http.method': 'GET',
'http.scheme': 'http',
'http.target': '/example-module/transaction',
'http.user_agent': 'node',
'http.flavor': '1.1',
'net.transport': 'ip_tcp',
'net.host.ip': expect.any(String),
'net.host.port': expect.any(Number),
'net.peer.ip': expect.any(String),
'net.peer.port': expect.any(Number),
'client.address': '::1',
'client.port': expect.any(Number),
'network.transport': 'tcp',
'network.local.address': expect.any(String),
'network.local.port': expect.any(Number),
'network.peer.address': expect.any(String),
'network.peer.port': expect.any(Number),
'network.protocol.name': 'http',
'network.protocol.version': '1.1',
'server.port': 3030,
'http.status_code': 200,
'http.status_text': 'OK',
'http.route': '/example-module/transaction',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,22 @@ test('Sends an API route transaction from module', async ({ baseURL }) => {
'url.full': 'http://localhost:3030/example-module/transaction',
'url.path': '/example-module/transaction',
'http.host': 'localhost:3030',
'net.host.name': 'localhost',
'server.address': 'localhost',
'http.method': 'GET',
'http.scheme': 'http',
'http.target': '/example-module/transaction',
'http.user_agent': 'node',
'http.flavor': '1.1',
'net.transport': 'ip_tcp',
'net.host.ip': expect.any(String),
'net.host.port': expect.any(Number),
'net.peer.ip': expect.any(String),
'net.peer.port': expect.any(Number),
'client.address': '::1',
'client.port': expect.any(Number),
'network.transport': 'tcp',
'network.local.address': expect.any(String),
'network.local.port': expect.any(Number),
'network.peer.address': expect.any(String),
'network.peer.port': expect.any(Number),
'network.protocol.name': 'http',
'network.protocol.version': '1.1',
'server.port': 3030,
'http.status_code': 200,
'http.status_text': 'OK',
'http.route': '/example-module/transaction',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ test('Should trace outgoing fetch requests inside middleware and create breadcru
'http.response.status_code': 200,
type: 'fetch',
'url.full': 'http://localhost:3030/',
'server.address': 'localhost:3030',
'server.address': 'localhost',
'server.port': 3030,
'sentry.op': 'http.client',
'sentry.origin': 'auto.http.wintercg_fetch',
},
Expand Down
Loading
Loading