Skip to content

Enhance Kapacitor module and state. - #46294

Merged
rallytime merged 9 commits into
saltstack:developfrom
aabouzaid:kapacitor_enhancements
Mar 8, 2018
Merged

rallytime merged 9 commits into
saltstack:developfrom
aabouzaid:kapacitor_enhancements

Conversation

@aabouzaid

@aabouzaid aabouzaid commented Mar 2, 2018 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Current Kapacitor module and state are missing some functionality.

This PR has following:

  • TICK script could be defined to access more than 1 database/retention policy.
  • Set Kapacitor URL (in case kapacitord doesn't listen to localhost).
  • Support for URL using https and use http by default.
  • Support for -skipVerify option to allow "Unsafe SSL".

Tests written?

Yes

Commits signed with GPG?

Yes

@rallytime rallytime left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @aabouzaid - I have a couple of requests and one question on this change. Thanks!

Comment thread salt/modules/kapacitor.py Outdated
def define_task(name,
tick_script,
task_type='stream',
dbrps=None,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this new kwarg to the end of the list? We don't want to change the API unnecessarily here.

Comment thread salt/states/kapacitor.py Outdated
def task_present(name,
tick_script,
task_type='stream',
dbrps=None,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here as above.

Comment thread salt/states/kapacitor.py
A list of databases and retention policies in "dbname"."rpname" format
to fetch data from. For backward compatibility, the value of
'database' and 'retention_policy' will be merged as part of dbrps.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a .. versionadded:: Fluorine tag to these docs (and do the same for the docs in the module)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but how I can add it for mixed sections like this:

'''
Kapacitor state module.

:configuration: This module accepts connection configuration details either as
    parameters or as configuration settings in /etc/salt/minion on the relevant
    minions::

        kapacitor.unsafe_ssl: 'false'
        kapacitor.protocol: 'http'
        kapacitor.host: 'localhost'
        kapacitor.port: 9092

    This data can also be passed into pillar. Options passed into opts will
    overwrite options passed into pillar.

.. versionadded:: 2016.11.0
'''

Since kapacitor.unsafe_ssl and kapacitor.protocol are new, but rest are old (2016.11.0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I think you can put that in the configuration block, indented. But I am not sure on what the formatting will look like. It might just be prudent to add a comment in that configuration block stating that those options are new to Fluorine.

Comment thread salt/states/kapacitor.py

task = __salt__['kapacitor.get_task'](name)
old_script = task['script'] if task else ''
task_dbrps = [{'db': dbrp[0], 'rp': dbrp[1]} for dbrp in (dbrp.split('.') for dbrp in dbrps)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this change things for people specifying database and retention_policy and not dbrps? It seems like this would change the default behavior.

@rallytime
rallytime merged commit 65cee66 into saltstack:develop Mar 8, 2018
Comment thread salt/modules/kapacitor.py
.. versionadded:: Fluorine

database
Which database to fetch data from. Defaults to None, which will use the

@aabouzaid aabouzaid Mar 9, 2018 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

database
Which database to fetch data from. Defaults to None, which will use the
default database in InfluxDB.

@rallytime btw, I believe this (allow empty database) has never been "really" true, it has been changed on 28.10.2015 which means that happened even before the major change in v0.13.

Therefore, I will change this too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok sounds good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants