Hash YAML instead of JSON

But it doesn't work either because of secret fields.

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
Simon Pasquier 2020-02-05 15:01:28 +01:00 committed by Chris Marchbanks
parent 8cc84660fa
commit 317e73de79

View file

@ -17,12 +17,12 @@ import (
"context" "context"
"crypto/md5" "crypto/md5"
"encoding/hex" "encoding/hex"
"encoding/json"
"fmt" "fmt"
"sync" "sync"
"time" "time"
"github.com/go-kit/kit/log" "github.com/go-kit/kit/log"
"gopkg.in/yaml.v2"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model" "github.com/prometheus/common/model"
@ -174,7 +174,7 @@ func labelsToEqualityMatchers(ls model.LabelSet) []*labels.Matcher {
// Used for hashing configs and diff'ing hashes in ApplyConfig. // Used for hashing configs and diff'ing hashes in ApplyConfig.
func toHash(data interface{}) (string, error) { func toHash(data interface{}) (string, error) {
bytes, err := json.Marshal(data) bytes, err := yaml.Marshal(data)
if err != nil { if err != nil {
return "", err return "", err
} }