AzureMonitor: Fix logs query multi-resource and timespan values (#67914)
* Update TimeGrain interface methods - Make them util functions because it's simpler * Update logs ds to appropiately set resources and timespan * Set timespan using RCF times * Update tests
This commit is contained in:
@@ -393,11 +393,15 @@ func appendErrorNotice(frame *data.Frame, err *AzureLogAnalyticsAPIError) *data.
|
||||
}
|
||||
|
||||
func (e *AzureLogAnalyticsDatasource) createRequest(ctx context.Context, logger log.Logger, queryURL string, query *AzureLogAnalyticsQuery) (*http.Request, error) {
|
||||
from := query.TimeRange.From.Format(time.RFC3339)
|
||||
to := query.TimeRange.To.Format(time.RFC3339)
|
||||
timespan := fmt.Sprintf("%s/%s", from, to)
|
||||
body := map[string]interface{}{
|
||||
"query": query.Query,
|
||||
"query": query.Query,
|
||||
"timespan": timespan,
|
||||
}
|
||||
if len(query.Resources) > 1 {
|
||||
body["resources"] = query.Resources
|
||||
body["workspaces"] = query.Resources
|
||||
}
|
||||
jsonValue, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user