Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Global Config Spec #386

Closed
jcooklin opened this issue Oct 6, 2015 · 11 comments
Closed

Global Config Spec #386

jcooklin opened this issue Oct 6, 2015 · 11 comments

Comments

@jcooklin
Copy link
Collaborator

jcooklin commented Oct 6, 2015

NOTE by @mjbrender: snap was originally nicknamed pulse, which is why you'll see the Pulse used below

Global Config

This spec describes adding global configuration to pulse. We will describe two types of config below. The first is the top level configuration and will be referred to as Global Config while the second is specific to providing plugin configuration at load time and will be referred to going forward as Global Plugin Config. The pulse agent can be provided these configurations through a switch and configuration file at startup or through the API (pulsectl) after starting.

Example usage

pulsed -config ~/pulsed.cfg

~/pulsed.cfg

{
    "control": {
        "cache_ttl": "5s"
    },
    "scheduler": {
        "default_deadline": "5s",
        "worker_pool_size": 5
    },
    "plugin": {
        "all": {
            "password": "p@ssw0rd"
        },
        "collector": {
            "pcm": {
                "path": "/usr/local/pcm/bin",
                "versions": {
                    "1": {
                        "user": "john"
                    }
                }
            }
        }, 
        "publisher": {
            "influxdb": {
                "server": "xyz.local",
                "password": "$password"
            }
        }
    }
}

API/client usage

pulsectl config --control cache_ttl 5s
pulsectl config --scheduler cache_deadline 5s
pulsectl config --collector pcm.path /usr/local/bin
pulsectl config --control --unset cache_ttl 

Global Config provides runtime configuration and the ability to define a variable once and reference it in multiple plugins.

A ConfigPolicy derived from the Global Config (and Global Plugin Config) will be passed to the method GetMetricTypes. The Publish, Collect or Process methods will continue to receive ConfigPolicy but it will now be a merge between the tasks configuration and the Global Configuration.

@sandlbn
Copy link
Contributor

sandlbn commented Oct 8, 2015

@jcooklin Do you know when this will be implemented ? For one of my plugins I need to pass list with hypervisor URIs. Right now I have my own code but I will be happy to use global configuration module.

@lynxbat
Copy link
Contributor

lynxbat commented Oct 8, 2015

I don't think switch elements for pulsed should mix into globals.

instead:

{
    "global": {
        "password": "p@ssw0rd"
    },
    "cache_ttl": "5s",
    "default_deadline": "5s",
    "plugin": {
        "collector": {
            "pcm": {
                "path": "/usr/local/pcm/bin",
                "versions": {
                    "1": {
                        "user": "john"
                    }
                }
            }
        }, 
        "publisher": {
            "influxdb": {
                "server": "xyz.local",
                "password": "$password"
            }
        }
    }
}

@pittma
Copy link
Contributor

pittma commented Oct 8, 2015

what about

{
    "control": {
        "cache_ttl": "5s"
    },
    "scheduler": {
        "default_deadline": "5s",
        "worker_pool_size": 5
    },
    "plugin": {
        "all": {
            "password": "p@ssw0rd"
        },
        "collector": {
            "pcm": {
                "path": "/usr/local/pcm/bin",
                "versions": {
                    "1": {
                        "user": "john"
                    }
                }
            }
        },
        "publisher": {
            "influxdb": {
                "server": "xyz.local",
                "password": "$password"
            }
        }
    }
}

@lynxbat
Copy link
Contributor

lynxbat commented Oct 8, 2015

I like but why "global"?

@lynxbat
Copy link
Contributor

lynxbat commented Oct 8, 2015

Config is config for the pulsed

@lynxbat
Copy link
Contributor

lynxbat commented Oct 8, 2015

Or at least put under roles for each role config:

  1. scheduler
  2. control

@pittma
Copy link
Contributor

pittma commented Oct 8, 2015

word, agreed. +1 on:

Or at least put under roles for each role config:

  1. scheduler
  2. control

@jcooklin
Copy link
Collaborator Author

jcooklin commented Oct 8, 2015

@sandlbn I'm working on it this sprint.

@jcooklin
Copy link
Collaborator Author

jcooklin commented Oct 8, 2015

@lynxbat, @danielscottt: I updated ~/pulsed.cfg above based on the feedback. Additional thoughts?

@pittma
Copy link
Contributor

pittma commented Dec 30, 2015

Reopening this, the ability to configure the daemon is not yet implemented.

@pittma pittma reopened this Dec 30, 2015
geauxvirtual pushed a commit to tjmcs/snap that referenced this issue Mar 11, 2016
geauxvirtual pushed a commit to tjmcs/snap that referenced this issue Mar 11, 2016
geauxvirtual pushed a commit to tjmcs/snap that referenced this issue Mar 12, 2016
geauxvirtual pushed a commit to tjmcs/snap that referenced this issue Mar 15, 2016
tjmcs pushed a commit to tjmcs/snap that referenced this issue Mar 16, 2016
tjmcs pushed a commit to tjmcs/snap that referenced this issue Mar 16, 2016
tjmcs pushed a commit to tjmcs/snap that referenced this issue Mar 16, 2016
geauxvirtual added a commit that referenced this issue Mar 21, 2016
@geauxvirtual
Copy link
Contributor

Closing with the merge of #763.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants