You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Your sample code for both Asp.Net and Asp.Net MVC you register the analytics client as scoped which effectively makes them per request but from what I am gathering it seems like it should be registered as a singleton, why are they registered as scoped?
Can you update somewhere in your documentation explicitly stating that the analytics client is thread safe and can be registered as a singleton (if that is the case) and then change your sample code to register them as singletons?
hi @dzins thanks for reporting this. whether to make it scoped or singleton depends on your use case. we do have customers prefer to do it purely stateless. you could also define your own flush behavior with scoped instance. the example only showcases one of the use cases. but you're right, I do feel the docs should be more elaborated on the options and their implications. will get the docs updated.
and yes, the client is thread safe. we built a thread management SDK to supervise all thread usages. they are disposed when the client is disposed. if you've observed any memory leak or thread issues, please let us know. thanks!
Describe the bug
Your sample code for both Asp.Net and Asp.Net MVC you register the analytics client as scoped which effectively makes them per request but from what I am gathering it seems like it should be registered as a singleton, why are they registered as scoped?
Can you update somewhere in your documentation explicitly stating that the analytics client is thread safe and can be registered as a singleton (if that is the case) and then change your sample code to register them as singletons?
To Reproduce
Steps to reproduce the behavior:
This sample code:
https://github.com/segmentio/Analytics-CSharp/blob/main/Samples/AspNetMvcSample/Startup.cs
https://github.com/segmentio/Analytics-CSharp/blob/main/Samples/AspNetSample/Startup.cs
Expected behavior
They should be registering the analytics client as a singleton.
The text was updated successfully, but these errors were encountered: