elastic / elastic/apm

If client closes socket prematurely, mark transaction in a special way

Open
#154 4 comments 0 reactions 0 assignees View on GitHub
apm-agents poll
Dominant language
Gherkin
Stars
427
Forks
125
PR merge metrics
No merged PRs in 30d

Description

## Description of the issue

It came up in elastic/apm-agent-nodejs#1411 that the Node.js agent doesn't record the fact that a client closes the socket to the app being monitored. Most (if not all?) agents just happily record the transaction as successful - which, from the point of view of the service it also kind of is.

It would, therefore, be a nice feature if, when we're tracing an incoming HTTP request and the client closes the socket prematurely, that the agent can detect this and mark the transaction. Today the transaction just looks like it was successful even though the client never received the response.

Possible ways to mark the transaction:

1. Change the transaction `result` from the regular result (e.g. `HTTP 2xx`) to for example `aborted`
1. Add a "mark" to the transaction when the socket was closed similar to how the RUM agent marks "time to first byte" etc.
1. Invent a new field, e.g. `socket.status: "aborted"`

I don't think I'm a big fan of option 3 as not all transactions have a socket associated with them. I really like option 2 as it allows us to record exactly when it happened. Option 1 is nice as well as it allows us to easily filter by this and display it in the UI - though maybe that's not actually a use case?

## What we are voting on

@elastic/apm-agent-devs Should the agents who can implement something like this?

Please also share your thoughts in the comments on which way you think this could best be implemented or if you think it shouldn't be something that is recorded.

## Vote

| Agent | Yes | No | Indifferent | N/A | Link to agent issue
| --------|:----:|:---:|:-----------:|:----:|:-------------------:|
| .NET |

  • [ ]
|
  • [ ]
|
  • [ ]
|
  • [ ]
|
| Go |
  • [ ]
|
  • [ ]
|
  • [ ]
|
  • [ ]
|
| Java |
  • [ ]
|
  • [ ]
|
  • [ ]
|
  • [ ]
|
| Node.js |
  • [ ]
|
  • [ ]
|
  • [ ]
|
  • [ ]
|
| Python |
  • [ ]
|
  • [ ]
|
  • [ ]
|
  • [ ]
|
| Ruby |
  • [ ]
|
  • [ ]
|
  • [ ]
|
  • [ ]
|
| RUM |
  • [ ]
|
  • [ ]
|
  • [ ]
|
  • [x]
|

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.