Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SYB-019 - Implement experimental API to trace functions without decorators #35

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vereis
Copy link
Collaborator

@vereis vereis commented Jan 22, 2024

This PR implements a new Sibyl.Experimental module which aims to replace the usage of the decorator library we're currently using to avoid some of the pitfalls of said library.

See the module docs in Sibyl.Experimental for more info.

Linked to #29

import Sibyl.Events, only: [define_event: 1]
import Sibyl.Experimental

import Kernel, except: [def: 2]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: do we want to support tracing private functions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it would be cool for it to be configurable to wrap any function-like definitions in traces, e.g. I might want to trace tests for them to appear later in my observability stack:

use Sibyl.Experimental, trace_all: [def: 2, defp: 2, test: 3]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a really fun idea actually, I'll look into how easily we can do that!

Comment on lines +20 to +21
1) In order to trace functions, you must annotate functions with `@sibyl trace: true`. In future, we may be able to
capture extra metadata to attach to traces via additional keyword parameters.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main reason we're doing this is not to conflict with anyone actually using the decorator library in their application.

Happy to take any opinions on what this annotation could be? I suppose if we want to extend this out as a generic decorator library alternative, we could go forward with @annotate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants