diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index b842bc8..ba24a3d 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -1,109 +1,100 @@ -============ -Contributing -============ +=========================================== +Contributing to the Netuitive Python Client +=========================================== -Contributions are welcome, and they are greatly appreciated! Every -little bit helps, and credit will always be given. - -You can contribute in many ways: +Contributions are welcome and can be represented in many different ways as noted below. Help is greatly appreciated and credit will always be given. Types of Contributions ---------------------- -Report Bugs -~~~~~~~~~~~ - -Report bugs at https://github.com/netuitive/netuitive-client-python/issues. +Reporting Bugs +~~~~~~~~~~~~~~ +Report bugs on `the issues page `_. With your bug report, please include: -If you are reporting a bug, please include: +- Your operating system name and version. +- Any details about your local setup that might be helpful in troubleshooting the issue. +- Detailed steps to reproduce the bug. -* Your operating system name and version. -* Any details about your local setup that might be helpful in troubleshooting. -* Detailed steps to reproduce the bug. +Fixing Bugs +~~~~~~~~~~~~ +Find bugs at `the issues page `_. Anything tagged with "bug" is open to be fixed. With your fix, please include: -Fix Bugs -~~~~~~~~ +- The issue number +- A detailed commit message -Look through the GitHub issues for bugs. Anything tagged with "bug" -is open to whoever wants to implement it. +Implementing Features +~~~~~~~~~~~~~~~~~~~~~~ +Find features at `the issues page `_. Anything tagged with "feature" is open to be implemented. With your feature, please include: -Implement Features -~~~~~~~~~~~~~~~~~~ - -Look through the GitHub issues for features. Anything tagged with "feature" -is open to whoever wants to implement it. +- The issue number +- A detailed commit message Write Documentation ~~~~~~~~~~~~~~~~~~~ - -Netuitive Python Client could always use more documentation, whether as part of the -official Netuitive Python Client docs, in docstrings, or even on the web in blog posts, -articles, and such. +The Netuitive Python Client can always use documentation (more documentation is always better!). Please document your features or usage as part of the official docs, in docstrings, in blog posts, articles, or wherever you see fit. Submit Feedback ~~~~~~~~~~~~~~~ +File an issue at `the issues page `_. If you are proposing a feature: -The best way to send feedback is to file an issue at https://github.com/netuitive/netuitive-client-python/issues. +- Explain how it would work in detail +- Keep the scope as narrow as possible to make it easier to implement -If you are proposing a feature: - -* Explain in detail how it would work. -* Keep the scope as narrow as possible, to make it easier to implement. -* Remember that this is a volunteer-driven project, and that contributions - are welcome :) - -Get Started! +Workflow ------------ -Ready to contribute? Here's how to set up `netuitive` for local development. +#. Create a branch directly in this repo or a fork (if you don't have push access). Please name branches within this repository ``feature/`` or ``fix/description``. For example, something like ``feature/upgrade_agent_0.2.3-70``. + +#. Create an issue or open a pull request (PR). If you aren't sure your PR will solve the issue or may be controversial, we're okay with you opening an issue separately and linking to it in your PR. That way, if the PR is not accepted, the issue will remain and be tracked. -1. Fork the `netuitive` repo on GitHub. -2. Clone your fork locally:: +#. Clone your fork locally:: $ git clone git@github.com:your_name_here/netuitive.git -3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:: +#. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:: $ mkvirtualenv netuitive $ cd netuitive/ $ python setup.py develop -4. Create a branch for local development:: +#. Create a branch for local development:: $ git checkout -b name-of-your-bugfix-or-feature - Now you can make your changes locally. - -5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:: +#. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:: $ flake8 netuitive tests $ python setup.py test $ tox To get flake8 and tox, just pip install them into your virtualenv. + +#. Close (and reference) issues by the ``closes #XXX`` or ``fixes #XXX`` notation in the commit message. Please use a descriptive, useful commit message that could be used to understand why a particular change was made. -6. Commit your changes and push your branch to GitHub:: +#. Commit your changes and push your branch to GitHub:: $ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature -7. Submit a pull request through the GitHub website. +#. Keep pushing commits to the initial branch using ``--amend``/``--rebase`` as necessary. Don't mix unrelated issues in a single branch. -Pull Request Guidelines ------------------------ +#. Clean up the branch (rebase with master to synchronize, squash, edit commits, test, etc.) to prepare for it to be merged. -Before you submit a pull request, check that it meets these guidelines: +#. If you didn't open a pull request already, do so now. Ensure it meets the following guidelines: + #. The pull request should include tests. + #. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst. + #. The pull request should work for Python 2.6, 2.7, 3.3, and 3.4, and for PyPy. -1. The pull request should include tests. -2. If the pull request adds functionality, the docs should be updated. Put - your new functionality into a function with a docstring, and add the - feature to the list in README.rst. -3. The pull request should work for Python 2.6, 2.7, 3.3, and 3.4, and for PyPy. +#. After reviewing your commits for documentation, passed continuous integration (CI) tests, version bumps, changelogs, and good, descriptive commit messages, a project maintainer can merge your request. -Tips ----- +#. Create/update the changelog if necessary. +Additional Information +----------------------- + +Tips +~~~~~ To run a subset of tests:: $ python -m unittest tests.test_netuitive diff --git a/README.rst b/README.rst index 5b7e832..3ad233a 100644 --- a/README.rst +++ b/README.rst @@ -4,20 +4,17 @@ Netuitive Python Client |BuildStatus|_ -.. |BuildStatus| image:: https://travis-ci.org/Netuitive/netuitive-client-python.svg?branch=master +.. |BuildStatus| image:: https://travis-ci.org/Netuitive/netuitive-client-python.svg?branch=master .. _BuildStatus: https://travis-ci.org/Netuitive/netuitive-client-python .. image:: https://coveralls.io/repos/github/Netuitive/netuitive-client-python/badge.svg?branch=master :target: https://coveralls.io/github/Netuitive/netuitive-client-python?branch=master -What is Netuitive monitoring? ------------------------------ -Netuitive provides an adaptive monitoring and analytics platform for cloud infrastructure and web applications. -Netuitive learns behaviors and utilizes pre-set dynamic policies that reduce the manual effort and human-guesswork typically required to monitor systems and applications. -This unique technology enables IT operations and developers to automate performance analysis, detect relevant anomalies, and determine efficient capacity utilization. +| The Netuitive Python Client allows you to push data to `Netuitive `_ using Python. Netuitive provides an adaptive monitoring and analytics platform for cloud infrastructure and web applications. -Features --------- +| For more information, check out the `help docs `_ or contact `support `_. -* Create a Netuitive Element with the following data: +The Netuitive Python Client can... + +* ...create an `element `_ in Netuitive with the following data: * Element Name * Attributes * Tags @@ -26,7 +23,7 @@ Features * Location * Metric Tags -* Create a Netuitive Event with the following data +* ...create an `event `_ in Netuitive with the following data: * Element Name * Event Type * Title @@ -35,75 +32,88 @@ Features * Tags * Source +Using the Python Netuitive Client +---------------------------------- -Usage ------ - -###### Setup the Client +Setup the Client +~~~~~~~~~~~~~~~~~ ``ApiClient = netuitive.Client(api_key='')`` -###### Setup the Element +Setup the Element +~~~~~~~~~~~~~~~~~~ ``MyElement = netuitive.Element()`` -###### Add an Attribute +Add an Attribute +~~~~~~~~~~~~~~~~~ ``MyElement.add_attribute('Language', 'Python')`` -###### Add an Element relation +Add an Element relation +~~~~~~~~~~~~~~~~~~~~~~~~ ``MyElement.add_relation('my_child_element')`` -###### Add a Tag +Add a Tag +~~~~~~~~~~ ``MyElement.add_tag('Production', 'True')`` -###### Add a Metric Sample +Add a Metric Sample +~~~~~~~~~~~~~~~~~~~~ ``MyElement.add_sample('cpu.idle', 1432832135, 1, host='my_hostname')`` -###### Add a Metric Sample with a Sparse Data Strategy +Add a Metric Sample with a Sparse Data Strategy +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``MyElement.add_sample('app.zero', 1432832135, 1, host='my_hostname', sparseDataStrategy='ReplaceWithZero')`` -###### Add a Metric Sample with unit type - +Add a Metric Sample with unit type +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``MyElement.add_sample('app.requests', 1432832135, 1, host='my_hostname', unit='requests/s')`` -###### Add a Metric Sample with utilization tag +Add a Metric Sample with utilization tag +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``MyElement.add_sample('app.requests', 1432832135, 1, host='my_hostname', tags=[{'utilization': 'true'}])`` -###### Add a Metric Sample with min/max values +Add a Metric Sample with min/max values +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``MyElement.add_sample('app.percent_used', 1432832135, 50, host='my_hostname', unit='percent', min=0, max=100)`` -###### Send the Samples +Send the Samples +~~~~~~~~~~~~~~~~~ ``ApiClient.post(MyElement)`` -###### Remove the samples already sent +Remove the samples already sent +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``MyElement.clear_samples()`` - -###### Create an Event +Create an Event +~~~~~~~~~~~~~~~~ ``MyEvent = netuitive.Event(hst, 'INFO', 'test event','big old test message', 'INFO')`` -###### Send the Event +Send the Event +~~~~~~~~~~~~~~~ ``ApiClient.post_event(MyEvent)`` -###### Check that our local time is set correctly (returns True/False) +Check that our local time is set correctly (returns True/False) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``ApiClient.time_insync()`` Example -------- - +---------- +The below example sets up the Netuitive Python client, creates an element ("MyElement") with attributes, a relationship, and tags and then passes in some samples. After the element is posted, the samples are cleared, an event is created and posted. +:: import netuitive