Git Product home page Git Product logo

Comments (4)

Lawouach avatar Lawouach commented on June 25, 2024 1

Python doesn't really have the concept of overloading functions. You do use default values indeed.

You could achieve this with singledispatch but I'm afraid this will make the code harder to read in this case.

I would stick with keeping a single function with default values.

Note also, from is a keyword in Python, you won't be able to call your variable that way.

Finally, might be worth using dateparser to allow users to say "2 minutes ago" which reads more fluently.

start_dt = dateparser.parse(start, settings={'TO_TIMEZONE': 'UTC'})

start is a string such as "2 minutes ago" or "now" that is translated into a datetime instance in UTC timezone. If you need to serialize it back to an ISO string:

isostr = start_dt.isoformat()

from chaostoolkit-instana.

russmiles avatar russmiles commented on June 25, 2024

The work will include updating the usage in the README, and also providing a short sample experiment with its usage incorporated in a samples directory.

from chaostoolkit-instana.

russmiles avatar russmiles commented on June 25, 2024

Parameters would be a window of time (start, end) and an optional delay parameter, defaulted to 5 seconds, as Instana's model can be up to 5 seconds behind the feeds from the target system.

from chaostoolkit-instana.

russmiles avatar russmiles commented on June 25, 2024

I'd like to refine this method so that it is called get_all_events_in_window as typically a window of time needs to be passed to retrieve a subset of all the events available. The signature would look like the following:

get_all_events_in_window(from, to)

I'd also like to propose that the from and to parameters could be defaulted to None, allowing for a default window of "last 5 minutes from time probe was called" to be employed.

Finally it would also be possible to support only from being specified, to defaulting to None, so that a window "from X ago to time probe was called" could be employed.

As tyo on its own doesn't seem too useful, it is suggested the above be achieved without default values and instead with function overloading?

from chaostoolkit-instana.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.