Skip to content

evolve hook tracing by providing the concept of hook exec/call tracers #588

Open
@RonnyPfannschmidt

Description

@RonnyPfannschmidt

with the evolution attempts in the claude pr #584 i arrived at an idea to help better trace what hooks get called

instead of adding before/after function

we will have internal hook wrappers following a spec of

@hookspec(wrapper=True)
def pluggy_trace_hookexec(hook_name: str,
            hooks: Sequence[HookImpl],
            wrappers: Sequence[WrapperImpl],
            kwargs: Mapping[str, object],
            firstresult: bool):...


   code before any hook gets called
   result = yield
   after all hooks have executed
   # no result mod allowed


@hookspec(wrapper=True)
def pluggy_trace_hook_wrapper(wrapper: WrapperImpl): ...
   before wrapper is active
   result = yield
   after wrapper is donr



@hookspec(wrapper=True)
def pluggy_trace_hook_wrapper(hook: HookImpl): ...
   before hook was called
   result = yield
   after hook was called

note - we may choose to add additional arguments to ensure a good developer experience

i just added the minium needed to get started

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions