Merge pull request #765 from prometheus/fabxc/cfg-tags

config: fix json/yaml tag inconsistencies.
This commit is contained in:
Fabian Reinartz 2015-06-02 20:19:36 +02:00
commit 4e65fdedfb

View file

@ -228,12 +228,12 @@ type BasicAuth struct {
type TargetGroup struct { type TargetGroup struct {
// Targets is a list of targets identified by a label set. Each target is // Targets is a list of targets identified by a label set. Each target is
// uniquely identifiable in the group by its address label. // uniquely identifiable in the group by its address label.
Targets []clientmodel.LabelSet `yaml:"targets,omitempty" json:"targets,omitempty"` Targets []clientmodel.LabelSet
// Labels is a set of labels that is common across all targets in the group. // Labels is a set of labels that is common across all targets in the group.
Labels clientmodel.LabelSet `yaml:"labels,omitempty" json:"labels,omitempty"` Labels clientmodel.LabelSet
// Source is an identifier that describes a group of targets. // Source is an identifier that describes a group of targets.
Source string `yaml:"-", json:"-"` Source string
} }
func (tg TargetGroup) String() string { func (tg TargetGroup) String() string {
@ -280,8 +280,8 @@ func (tg TargetGroup) MarshalYAML() (interface{}, error) {
// UnmarshalJSON implements the json.Unmarshaler interface. // UnmarshalJSON implements the json.Unmarshaler interface.
func (tg *TargetGroup) UnmarshalJSON(b []byte) error { func (tg *TargetGroup) UnmarshalJSON(b []byte) error {
g := struct { g := struct {
Targets []string `yaml:"targets"` Targets []string `json:"targets"`
Labels clientmodel.LabelSet `yaml:"labels"` Labels clientmodel.LabelSet `json:"labels"`
}{} }{}
if err := json.Unmarshal(b, &g); err != nil { if err := json.Unmarshal(b, &g); err != nil {
return err return err