Comments (4)
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.
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.
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.
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)
- Establish default structure and files for a Chaos Toolkit extension
- Create anyWarningOrCriticalEvents probe
- Optional delay
- Move existing implementation over to using the Instana Python API HOT 4
- events subpackage isn't exported
- Fix typo in setup.py to correct typo when released to PyPi
- error status code handling on instana api HOT 4
- README contains a typo
- Add probes for infrastructure individual host level metric inspection.
- Update extensions page on Chaos Toolkit site for this extension's drivers/control when ready HOT 2
- Hook up to Travis for CI/CD
- Create getEventContents probe HOT 1
- Create anyCriticalEvents probe
- Create anyWarningEvents probe
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chaostoolkit-instana.