Skip to content

Allow to register global profiler #1044

Description

@SergeyKanzhelev

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions