mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Datasource/Cloudwatch: Adds support for Cloudwatch Logs (#23566)
* Datasource/Cloudwatch: Adds support for Cloudwatch Logs * Fix rebase leftover * Use jsurl for AWS url serialization * WIP: Temporary workaround for CLIQ metrics * Only allow up to 20 log groups to be selected * WIP additional changes * More changes based on feedback * More changes based on PR feedback * Fix strict null errors
This commit is contained in:
@@ -16,7 +16,6 @@ import {
|
||||
LogsMetaKind,
|
||||
LogsDedupStrategy,
|
||||
GraphSeriesXY,
|
||||
dateTime,
|
||||
toUtc,
|
||||
NullValueMode,
|
||||
toDataFrame,
|
||||
@@ -26,6 +25,7 @@ import {
|
||||
TimeZone,
|
||||
getDisplayProcessor,
|
||||
textUtil,
|
||||
dateTime,
|
||||
} from '@grafana/data';
|
||||
import { getThemeColor } from 'app/core/utils/colors';
|
||||
|
||||
@@ -232,17 +232,19 @@ export function dataFrameToLogsModel(
|
||||
};
|
||||
}
|
||||
|
||||
function separateLogsAndMetrics(dataFrame: DataFrame[]) {
|
||||
function separateLogsAndMetrics(dataFrames: DataFrame[]) {
|
||||
const metricSeries: DataFrame[] = [];
|
||||
const logSeries: DataFrame[] = [];
|
||||
|
||||
for (const series of dataFrame) {
|
||||
if (isLogsData(series)) {
|
||||
logSeries.push(series);
|
||||
for (const dataFrame of dataFrames) {
|
||||
if (isLogsData(dataFrame)) {
|
||||
logSeries.push(dataFrame);
|
||||
continue;
|
||||
}
|
||||
|
||||
metricSeries.push(series);
|
||||
if (dataFrame.length > 0) {
|
||||
metricSeries.push(dataFrame);
|
||||
}
|
||||
}
|
||||
|
||||
return { logSeries, metricSeries };
|
||||
@@ -273,9 +275,9 @@ export function logSeriesToLogsModel(logSeries: DataFrame[]): LogsModel | undefi
|
||||
const allSeries: LogFields[] = logSeries.map(series => {
|
||||
const fieldCache = new FieldCache(series);
|
||||
|
||||
// Assume the first string field in the dataFrame is the message. This was right so far but probably needs some
|
||||
// more explicit checks.
|
||||
const stringField = fieldCache.getFirstFieldOfType(FieldType.string);
|
||||
const stringField = fieldCache.hasFieldNamed('line')
|
||||
? fieldCache.getFieldByName('line')
|
||||
: fieldCache.getFirstFieldOfType(FieldType.string);
|
||||
if (stringField?.labels) {
|
||||
allLabels.push(stringField.labels);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user