Skip to content

Commit

Permalink
Convert storm to wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
nmuesch authored and therve committed Mar 25, 2019
1 parent 79374ae commit 12f148e
Show file tree
Hide file tree
Showing 26 changed files with 1,498 additions and 1,500 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
__pycache__/
*.py[cod]
*$py.class
*.jar*

# C extensions
*.so
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ jobs:
env: CHECK=sortdb PYTHON3=true
- stage: test
env: CHECK=riak_repl PYTHON3=true
- stage: test
env: CHECK=storm PYTHON3=true
- stage: test
env: CHECK=traefik PYTHON3=true
- stage: test
Expand Down
10 changes: 10 additions & 0 deletions storm/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
graft datadog_checks
graft tests

include MANIFEST.in
include README.md
include requirements.in
include requirements-dev.txt
include manifest.json

global-exclude *.py[cod] __pycache__
12 changes: 7 additions & 5 deletions storm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ The Storm check is **NOT** included in the [Datadog Agent][1] package.

To install the Storm check on your host:

1. [Download the Datadog Agent][1].
2. Download the [`check.py` file][2] for Storm.
3. Place it in the Agent's `checks.d` directory.
4. Rename it to `storm.py`.
1. Install the [developer toolkit][7] on any machine.
2. Run `ddev release build storm` to build the package.
3. [Download the Datadog Agent][1].
4. Upload the build artifact to any host with an Agent and run `datadog-agent integration install -w path/to/storm/dist/<ARTIFACT_NAME>.whl`.


### Configuration

Expand Down Expand Up @@ -53,8 +54,9 @@ The check returns:
Need help? Contact [Datadog support][6].

[1]: https://app.datadoghq.com/account/settings#agent
[2]: https://github.com/DataDog/integrations-extras/blob/master/storm/conf.yaml.example
[2]: https://github.com/DataDog/integrations-extras/blob/master/storm/datadog_checks/storm/data/conf.yaml.example
[3]: https://docs.datadoghq.com/agent/faq/agent-commands/#start-stop-restart-the-agent
[4]: https://docs.datadoghq.com/agent/faq/agent-commands/#agent-status-and-information
[5]: https://github.com/DataDog/integrations-extras/blob/master/storm/metadata.csv
[6]: http://docs.datadoghq.com/help/
[7]: https://github.com/DataDog/integrations-core/blob/master/docs/dev/new_check_howto.md#developer-toolkit
1 change: 0 additions & 1 deletion storm/ci/.gitignore

This file was deleted.

86 changes: 0 additions & 86 deletions storm/ci/storm.rake

This file was deleted.

25 changes: 0 additions & 25 deletions storm/conf.yaml.example

This file was deleted.

1 change: 1 addition & 0 deletions storm/datadog_checks/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
1 change: 1 addition & 0 deletions storm/datadog_checks/storm/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.0.1'
7 changes: 7 additions & 0 deletions storm/datadog_checks/storm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from .__about__ import __version__
from .storm import StormCheck

__all__ = [
'__version__',
'StormCheck'
]
25 changes: 25 additions & 0 deletions storm/datadog_checks/storm/data/conf.yaml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
init_config:
# Default environment to use for all instances
# environment: production
#
# Intervals (in seconds): Default is 1 min
# intervals:
# - 60

instances:
- server: http://localhost:8080
# Always specify the server with the default storm REST api port.
# Default is 8080
#
# Specify the environment
# environment: preproduction
#
# Specify additional tags
# tags:
# - mytag:myvalue
# - mytag2:myvalue2
#
# Specify metric intervals in seconds (note this overrides the defaults).
# intervals:
# - 60
#
23 changes: 14 additions & 9 deletions storm/check.py → storm/datadog_checks/storm/storm.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)

# stdlib

# 3rd party
import requests
import json

# project
from checks import AgentCheck
from datadog_checks.base import AgentCheck

from six import PY3

if PY3:
long = int

EVENT_TYPE = SOURCE_TYPE_NAME = 'storm'

Expand Down Expand Up @@ -138,6 +138,7 @@ def _get_float(stat_map, default, *components):
"""
return _g(stat_map, default, _float, *components)


def _get_string(stat_map, default, *components):
""" Helper Function to safely get the string value from the map.
Expand All @@ -149,6 +150,7 @@ def _get_string(stat_map, default, *components):
"""
return _g(stat_map, default, str, *components)


def _get_bool(stat_map, default, *components):
""" Helper Function to safely get the boolean value from the map.
Expand All @@ -160,20 +162,23 @@ def _get_bool(stat_map, default, *components):
"""
return _g(stat_map, default, _bool, *components)


def _get_list(stat_map, *components):
""" Helper Function to safely get the list value from the map.
:param stat_map: stat map
:param components: components in order to traverse.
:return: list of component
:rtype: list
val = _g(s, [], None, 'acked')
"""
val = _g(stat_map, [], None, *components)
if not val or not isinstance(val, list):
return []

return val


def _get_dict(stat_map, *components):
""" Helper Function to safely get the list value from the map.
Expand Down Expand Up @@ -209,8 +214,7 @@ def from_string(cls, version_string):
:return: Storm Version
:rtype: StormCheck.StormVersion
"""
parts = version_string.split(".")

version_string.split(".")

def __init__(self, major, minor, patch, classifier=None):
self.major = major
Expand Down Expand Up @@ -329,9 +333,10 @@ def get_topology_metrics(self, topology_id, interval=60, storm_version=None):
endpoint = "/api/v1/topology/{}"

params = {'window': interval}
return self.get_request_json(endpoint.format(topology_id),
r = self.get_request_json(endpoint.format(topology_id),
"Error retrieving Storm Topology Metrics for topology:{}".format(topology_id),
params=params)
return r

def process_cluster_stats(self, cluster_stats):
""" Process Cluster Stats Response
Expand Down
19 changes: 19 additions & 0 deletions storm/logos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Logos

The logos folder should contain three images with filenames and sizes that exactly match the following specifications. Underneath each specification is a list of places where the images may appear in the web app.

#### `saas_logos-bot.png` (200 × 128)

- Integration tile images at `/account/settings`
- Description heading at `/account/settings#integrations/storm`
- Integration monitor tiles and search bar results images at `/monitors#create/integration`

#### `saas_logos-small.png` (120 × 60)

- Integration dashboards list images at `/dash/list`
- Some integration dashboards/screenboards at `/dash/integration/storm`

#### `avatars-bot.png` (128 × 128)

- Event stream at `/event/stream`
- Notification icons at `/report/monitor`
3 changes: 2 additions & 1 deletion storm/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"creates_events": false,
"type": "check",
"is_public": true,
"metric_prefix": "storm."
"metric_prefix": "storm.",
"integration_id": "storm"
}
2 changes: 2 additions & 0 deletions storm/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
datadog-checks-dev
responses
Empty file added storm/requirements.in
Empty file.
1 change: 0 additions & 1 deletion storm/requirements.txt

This file was deleted.

59 changes: 59 additions & 0 deletions storm/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from codecs import open # To use a consistent encoding
from os import path

from setuptools import setup

HERE = path.dirname(path.abspath(__file__))

# Get version info
ABOUT = {}
with open(path.join(HERE, 'datadog_checks', 'storm', '__about__.py')) as f:
exec(f.read(), ABOUT)

# Get the long description from the README file
with open(path.join(HERE, 'README.md'), encoding='utf-8') as f:
long_description = f.read()


CHECKS_BASE_REQ = 'datadog-checks-base>=4.2.0'


setup(
name='datadog-storm',
version=ABOUT['__version__'],
description='The Storm check',
long_description=long_description,
long_description_content_type='text/markdown',
keywords='datadog agent storm check',

# The project's main homepage.
url='https://github.com/DataDog/integrations-extras',

# Author details
author='@platinummonkey',
author_email='@platinummonkey',

# License
license='BSD-3-Clause',

# See https://pypi.org/classifiers
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Topic :: System :: Monitoring',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],

# The package we're going to ship
packages=['datadog_checks.storm'],

# Run-time dependencies
install_requires=[CHECKS_BASE_REQ],

# Extra files to ship with the wheel package
include_package_data=True,
)
Loading

0 comments on commit 12f148e

Please sign in to comment.