[v11.0.x] Loki: Support custom X-Query-Tags header (#86189)
Loki: Support custom `X-Query-Tags` header (#85123)
* Loki: Support custom `X-Query-Tags` header
* add comment
(cherry picked from commit 9a8ae3c932)
Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
This commit is contained in:
co-authored by
Sven Grossmann
parent
232798e0d0
commit
98417a579f
@@ -100,23 +100,26 @@ func parseDirection(jsonPointerValue *string) (Direction, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func parseSupportingQueryType(jsonPointerValue *string) (SupportingQueryType, error) {
|
||||
func parseSupportingQueryType(jsonPointerValue *string) SupportingQueryType {
|
||||
if jsonPointerValue == nil {
|
||||
return SupportingQueryNone, nil
|
||||
} else {
|
||||
jsonValue := *jsonPointerValue
|
||||
switch jsonValue {
|
||||
case "logsVolume":
|
||||
return SupportingQueryLogsVolume, nil
|
||||
case "logsSample":
|
||||
return SupportingQueryLogsSample, nil
|
||||
case "dataSample":
|
||||
return SupportingQueryDataSample, nil
|
||||
case "infiniteScroll":
|
||||
return SupportingQueryInfiniteScroll, nil
|
||||
default:
|
||||
return SupportingQueryNone, fmt.Errorf("invalid supportingQueryType: %s", jsonValue)
|
||||
}
|
||||
return SupportingQueryNone
|
||||
}
|
||||
|
||||
jsonValue := *jsonPointerValue
|
||||
switch jsonValue {
|
||||
case "logsVolume":
|
||||
return SupportingQueryLogsVolume
|
||||
case "logsSample":
|
||||
return SupportingQueryLogsSample
|
||||
case "dataSample":
|
||||
return SupportingQueryDataSample
|
||||
case "infiniteScroll":
|
||||
return SupportingQueryInfiniteScroll
|
||||
case "":
|
||||
return SupportingQueryNone
|
||||
default:
|
||||
// `SupportingQueryType` is just a `string` in the schema, so we can just parse this as a string
|
||||
return SupportingQueryType(jsonValue)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,10 +169,7 @@ func parseQuery(queryContext *backend.QueryDataRequest) ([]*lokiQuery, error) {
|
||||
legendFormat = *model.LegendFormat
|
||||
}
|
||||
|
||||
supportingQueryType, err := parseSupportingQueryType(model.SupportingQueryType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
supportingQueryType := parseSupportingQueryType(model.SupportingQueryType)
|
||||
|
||||
qs = append(qs, &lokiQuery{
|
||||
Expr: expr,
|
||||
|
||||
Reference in New Issue
Block a user