-
Notifications
You must be signed in to change notification settings - Fork 490
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial scraping of prometheus targets
Add discovery and scraping services Update discoverers to use ID be Initers Remove ApplyConditionalDefaults from all discoverers Update scraper service config to dash names and Initer Update scraper service to not block on configuration update Add service tests for all discoverers Add redacting to marathon discovery and scraper config Add validation to scraper service configuration Add DB/RP to scrape targets data Add blacklisting to scraper Update name of file discovery to files Fix deadlock for scraper service on update before open Update prom discovery logging to use prom log interface Update server tests to have discovery/scraper expectations Add basic configuration for scrapers/discovers to kapacitor.conf Remove debug output from circle testing Update locking for scraper service add support for k8s to be a list or a single entry
- Loading branch information
1 parent
6eb087a
commit dc98421
Showing
59 changed files
with
3,954 additions
and
137 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,58 @@ | ||
package listmap | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"reflect" | ||
|
||
"github.com/BurntSushi/toml" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
// DoUnmarshalTOML unmarshals either a list of maps or just a single map into dst. | ||
// The argument dst must be a pointer to a slice. | ||
func DoUnmarshalTOML(dst, src interface{}) error { | ||
dstV := reflect.Indirect(reflect.ValueOf(dst)) | ||
if !dstV.CanSet() { | ||
return errors.New("dst must be settable") | ||
} | ||
dstK := dstV.Kind() | ||
if dstK != reflect.Slice { | ||
return errors.New("dst must be a slice") | ||
} | ||
|
||
srcV := reflect.ValueOf(src) | ||
srcK := srcV.Kind() | ||
|
||
var srvValues []reflect.Value | ||
switch srcK { | ||
case reflect.Slice: | ||
l := srcV.Len() | ||
srvValues = make([]reflect.Value, l) | ||
for i := 0; i < l; i++ { | ||
srvValues[i] = srcV.Index(i) | ||
} | ||
case reflect.Map: | ||
srvValues = []reflect.Value{srcV} | ||
default: | ||
return fmt.Errorf("src must be a slice or map, got %v", srcK) | ||
} | ||
|
||
// We want to preserve the TOML decoding behavior exactly, | ||
// so we first re-encode the src data and then decode again, | ||
// only this time directly into the element of the slice. | ||
var buf bytes.Buffer | ||
dstV.Set(reflect.MakeSlice(dstV.Type(), len(srvValues), len(srvValues))) | ||
for i, v := range srvValues { | ||
if err := toml.NewEncoder(&buf).Encode(v.Interface()); err != nil { | ||
return errors.Wrap(err, "failed to reencode toml data") | ||
} | ||
newValue := reflect.New(dstV.Type().Elem()) | ||
if _, err := toml.Decode(buf.String(), newValue.Interface()); err != nil { | ||
return err | ||
} | ||
dstV.Index(i).Set(reflect.Indirect(newValue)) | ||
buf.Reset() | ||
} | ||
return nil | ||
} |
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
Oops, something went wrong.