forked from grafana/loki
-
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.
Validate labels in the distributor. (grafana#251)
Also, make ErrOutOfOrder a HTTP 4xx error and continue to append even when we encourter an out of order entry. Signed-off-by: Tom Wilkie <[email protected]>
- Loading branch information
Showing
7 changed files
with
84 additions
and
37 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
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,24 @@ | ||
package util | ||
|
||
import ( | ||
"github.com/cortexproject/cortex/pkg/ingester/client" | ||
"github.com/cortexproject/cortex/pkg/util/wire" | ||
"github.com/grafana/loki/pkg/parser" | ||
) | ||
|
||
// ToClientLabels parses the labels and converts them to the Cortex type. | ||
func ToClientLabels(labels string) ([]client.LabelPair, error) { | ||
ls, err := parser.Labels(labels) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
pairs := make([]client.LabelPair, 0, len(ls)) | ||
for i := 0; i < len(ls); i++ { | ||
pairs = append(pairs, client.LabelPair{ | ||
Name: wire.Bytes(ls[i].Name), | ||
Value: wire.Bytes(ls[i].Value), | ||
}) | ||
} | ||
return pairs, nil | ||
} |