StackExchange / StackExchange/StackExchange.Redis
Allow to register global profiler
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 6.2k
- Forks
- 1.6k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 43
Description
Allowing to specify global profiler for all connections will help simplify enablement of profiling auto-magically. Ideally registering of a global profiler should work retroactively for the already created connections. So there will be no application startup race between the connection creation and profiler registration.
Minimum API may be like this:
public static void RegisterDefaultProfiler(Func<ProfilingSession> defaultProfilerSessionsFactory);
It will work, however to discourage calling connection.RegisterProfiler(() => null); for every new connection to make sure default profiler will be cleaned up. For this some multiplexing of profilers needs to be implemented. One solution may be have a static method that will register the factory of creating ProfilerSession factories. It will create a session factory based on profiler registered for the specific connection using RegisterProfiler method.
public static void RegisterDefaultProfiler(Func<Func<ProfilingSession>, Func<ProfilingSession>> profilingSessionProviderFactory);
Than there may be a FinishSession() callback or delegate that will allow to proxy requested results from one profiler session to another.
Even minimum implementation will be enough to make profiling of Redis easier.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the existing connection-level RegisterProfiler API and the profiling session lifecycle. Define how RegisterDefaultProfiler should affect both existing and newly created connections, including per-connection profiler overrides and the proposed profiler multiplexing. Done means the minimum global registration works without an application startup race and supports Redis profiling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, redis
- Domain
- backend, observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100