-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Activity.Events is new in .NET 5. Is there any concern that a long running activity, with many events, could create a memory leak cause memory exhaustion in an app?
The specific scenario I'm thinking of is a long running gRPC streaming call. There is an activity on the client and server that lasts for the duration of the call. In OpenTelemetry each sent and received message is an event. See https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/rpc.md#events. Message activities would be added to the call activity as events.
If a call sends and receives hundreds of thousands of messages over the lifetime of a call, and each time adds a new ActivityEvent + attributes to the current activity, I believe those events will stay in-memory until the call is complete. Memory usage over the lifetime of a long running call will continuously increase.
Is my theory correct? What is the guidance here?