question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API change proposal: getting rid of the "create" method for observers

See original GitHub issue

This change is backward compatible (given that a user didn’t use the undocumented __init__ method of observers)

I would propose that the recommended way of calling an observer would be by calling the constructor __init__(), not the create() method. We can be backward compatible by forwarding the arguments of the create method to the __init__().

I understand from the codebase that __init__ was used internally, to recreate observers from existing metrics and other existing data (in the middle of the experiment). I propose that we move this functionality to a new method called create_from().

Calling the class constructor will feel natural and avoid documentation lookups. It would be better that the most convenient method (the constructor) is used externally than internally.

We can drop a warning in the create function and keep it around indefinitely.

If all lights are greens from the maintainers I can do the change and update the docs.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gabrieldemarmiessecommented, Aug 21, 2019

#601 Was created. I find it very clean. Do we all agree on this new API?

0reactions
gabrieldemarmiessecommented, Sep 11, 2019

This issue can be closed as all the observers have been done.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IntersectionObserver.unobserve() - Web APIs | MDN
This snippet shows an observer being created, an element being observed, and then being unobserved. const observer = new IntersectionObserver( ...
Read more >
Defining REST Observer jobs - IBM
The REST (or RESTful) Observer is installed as part of the core installation procedure. Use the REST Observer for obtaining topology data via...
Read more >
Observer APIs in JavaScript —Part I - InDepth.Dev
Observer APIs are very useful to detect changes in the applications. ... Remove unwanted DOM elements such as advertisements that are coming from ......
Read more >
Setting Up the Transaction Observer for the Payment Queue
To process transactions in your app, you must create and add an observer to the ... Create and build out a custom observer...
Read more >
LiveData remove Observer after first callback - Stack Overflow
The process is as follows, create a variable in your ViewModel where the LiveData is stored upon request, retrieve it in a create...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found