add support for additional prometheus labels for query (#1936)

This commit is contained in:
Harshavardhana
2022-05-05 13:44:10 -07:00
committed by GitHub
parent 9103ea9d70
commit 3bfdbb5ec7
109 changed files with 606 additions and 841 deletions

View File

@@ -56,7 +56,7 @@ var isValidSetSize = func(count uint64) bool {
// input argument patterns, the symmetry calculation is to ensure that
// we also use uniform number of drives common across all ellipses patterns.
func possibleSetCountsWithSymmetry(setCounts []uint64, argPatterns []ellipses.ArgPattern) []uint64 {
var newSetCounts = make(map[uint64]struct{})
newSetCounts := make(map[uint64]struct{})
for _, ss := range setCounts {
var symmetry bool
for _, argPattern := range argPatterns {
@@ -177,7 +177,7 @@ func getTotalSizes(argPatterns []ellipses.ArgPattern) []uint64 {
for _, argPattern := range argPatterns {
var totalSize uint64 = 1
for _, p := range argPattern {
totalSize = totalSize * uint64(len(p.Seq))
totalSize *= uint64(len(p.Seq))
}
totalSizes = append(totalSizes, totalSize)
}
@@ -206,7 +206,7 @@ func PossibleParityValues(args ...string) ([]string, error) {
// of endpoints following the ellipses pattern, this is what is used
// by the object layer for initializing itself.
func parseEndpointSet(args ...string) (setIndexes [][]uint64, err error) {
var argPatterns = make([]ellipses.ArgPattern, len(args))
argPatterns := make([]ellipses.ArgPattern, len(args))
for i, arg := range args {
patterns, err := ellipses.FindEllipsesPatterns(arg)
if err != nil {

View File

@@ -27,7 +27,8 @@ func TestGetDivisibleSize(t *testing.T) {
testCases := []struct {
totalSizes []uint64
result uint64
}{{[]uint64{24, 32, 16}, 8},
}{
{[]uint64{24, 32, 16}, 8},
{[]uint64{32, 8, 4}, 4},
{[]uint64{8, 8, 8}, 8},
{[]uint64{24}, 24},
@@ -143,7 +144,7 @@ func TestGetSetIndexes(t *testing.T) {
for _, testCase := range testCases {
testCase := testCase
t.Run("", func(t *testing.T) {
var argPatterns = make([]ellipses.ArgPattern, len(testCase.args))
argPatterns := make([]ellipses.ArgPattern, len(testCase.args))
for i, arg := range testCase.args {
patterns, err := ellipses.FindEllipsesPatterns(arg)
if err != nil {

View File

@@ -30,10 +30,12 @@ func NewUUID() (string, error) {
// Key used for Get/SetReqInfo
type key string
const ContextLogKey = key("console-log")
const ContextRequestID = key("request-id")
const ContextRequestUserID = key("request-user-id")
const ContextRequestUserAgent = key("request-user-agent")
const ContextRequestHost = key("request-host")
const ContextRequestRemoteAddr = key("request-remote-addr")
const ContextAuditKey = key("request-audit-entry")
const (
ContextLogKey = key("console-log")
ContextRequestID = key("request-id")
ContextRequestUserID = key("request-user-id")
ContextRequestUserAgent = key("request-user-agent")
ContextRequestHost = key("request-host")
ContextRequestRemoteAddr = key("request-remote-addr")
ContextAuditKey = key("request-audit-entry")
)

View File

@@ -25,9 +25,7 @@ import (
"github.com/minio/console/pkg/http"
)
var (
ErrCantDetermineMinIOImage = errors.New("can't determine MinIO Image")
)
var ErrCantDetermineMinIOImage = errors.New("can't determine MinIO Image")
// getLatestMinIOImage returns the latest docker image for MinIO if found on the internet
func GetLatestMinIOImage(client http.ClientI) (*string, error) {
@@ -41,7 +39,7 @@ func GetLatestMinIOImage(client http.ClientI) (*string, error) {
if err != nil {
return nil, err
}
var re = regexp.MustCompile(`minio\.(RELEASE.*?Z)"`)
re := regexp.MustCompile(`minio\.(RELEASE.*?Z)"`)
// look for a single match
matches := re.FindAllStringSubmatch(string(body), 1)
for i := range matches {