-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from mcarbonne/feat_monitor_disk_space_increase
Feat monitor disk space increase
- Loading branch information
Showing
14 changed files
with
394 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
### unreleased | ||
- `threshold_percent` replaced by `threshold` in `filesystemusage` provider ([details](README.md#filesystemusage)). | ||
|
||
### 2.0.0 | ||
- `config.json` is now `config.yml` | ||
- `scrape_interval` (for scrapers) is now a string with unit. Before, it was an integer (seconds). Example: `scrape_interval: 120` is now `scrape_interval: 120s` (or even `scrape_interval: 2m`). | ||
- `filesystemusage` provider has been reworked to allow automatic mountpoints detection. See [here](#filesystemusage) for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package configmapper | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"reflect" | ||
) | ||
|
||
type CustomParserFunction func(string) (reflect.Value, error) | ||
|
||
type Context struct { | ||
customParsers map[string]CustomParserFunction | ||
} | ||
|
||
func MakeContext() Context { | ||
return Context{ | ||
customParsers: make(map[string]CustomParserFunction), | ||
} | ||
} | ||
|
||
func (c *Context) RegisterCustomParser(name string, lambda CustomParserFunction) error { | ||
_, ok := c.customParsers[name] | ||
if ok { | ||
return errors.New("Custom parser " + name + " already registered") | ||
} else { | ||
c.customParsers[name] = lambda | ||
return nil | ||
} | ||
} | ||
|
||
func (ctx *Context) getCustomParserIfAny(structField *reflect.StructField) (*CustomParserFunction, error) { | ||
if tag, ok := structField.Tag.Lookup("custom"); ok { | ||
parser, ok := ctx.customParsers[tag] | ||
if ok { | ||
return &parser, nil | ||
} else { | ||
return nil, fmt.Errorf("custom parser missing for '%v'", tag) | ||
} | ||
} | ||
return nil, nil | ||
} |
Oops, something went wrong.