Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for probes in configuration #123

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AlbertoSH
Copy link

Sample of how the configuration could look like

    {
        "cert": "/some/path/file.crt",
        "token": {
            "type": "env",
            "key": "MY_TOKEN"
        },
        "date": {
          "type": "probe",
          "name": "Current date",
          "provider": {
            "type": "process",
            "path": "date"
          }
        },
        "words": {
          "type": "probe",
          "name": "Some capped words",
          "provider": {
              "type": "python",
              "module": "string",
              "func": "capwords",
              "arguments": {
                "s": "some words"
              }
          }
        },
        "valueFromServer": {
          "type": "probe",
          "name": "Some value taken from the network",
          "provider": {
            "type": "http",
            "url": "http://my.config.server.com/value"
         }
        }
    }

@codecov-io
Copy link

codecov-io commented Jun 24, 2019

Codecov Report

Merging #123 into master will decrease coverage by 0.02%.
The diff coverage is 72.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #123      +/-   ##
==========================================
- Coverage   83.24%   83.22%   -0.03%     
==========================================
  Files          23       23              
  Lines        1570     1580      +10     
==========================================
+ Hits         1307     1315       +8     
- Misses        263      265       +2
Impacted Files Coverage Δ
chaoslib/configuration.py 89.65% <72.72%> (-10.35%) ⬇️
chaoslib/provider/process.py 95.55% <0%> (+2.22%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ccc52cf...2dfd86e. Read the comment docs.

@Lawouach
Copy link
Contributor

Thanks a lot for the kicking the discussion on this one.

I'm going to take some time to think about it because it's not a small change nor a small thing to support. So, I will have to ask patience if you don't mind as I'm always quite careful about changing the core :)

@AlbertoSH
Copy link
Author

Sure! Implementation-wise, it's not a big deal but a change of this nature could introduce some problems at the specification level
So yes, take your time ;)
In the meantime and for my purposes, I can use my version

Potentially, a new kind of probe (configuration-probe) could be added just for configuration purposes. That would allow us to define what we need the way we need without the issues of using something that's already there (and compatibility needs to be maintained). Something like

{
        "cert": "/some/path/file.crt",
        "token": {
            "type": "env",
            "key": "MY_TOKEN"
        },
        "date": {
          "type": "configuration-probe",
          "provider": {
            "type": "process",
            "path": "date"
          }
        },
        "words": {
          "type": "configuration-probe",
          "provider": {
              "type": "python",
              "module": "string",
              "func": "capwords",
              "arguments": {
                "s": "some words"
              }
          }
        },
        "valueFromServer": {
          "type": "configuration-probe",
          "provider": {
            "type": "http",
            "url": "http://my.config.server.com/value"
         }
        }
    }

In the end, whatever allows us to compute a value at runtime would be enough

@Lawouach
Copy link
Contributor

Hi there,

I haven't forgotten about this PR. Just was busy elsewhere unfortunately :(

@Lawouach Lawouach marked this pull request as draft July 6, 2020 12:23
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.

4 participants