Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
55533d12
Unverified
Commit
55533d12
authored
May 11, 2020
by
Andrej Ocenas
Committed by
GitHub
May 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CloudWatch/Logs: Fix fields not being refetched when log group changed (#24529)
parent
cb74bc68
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
3 deletions
+27
-3
public/app/plugins/datasource/cloudwatch/language_provider.ts
+27
-3
No files found.
public/app/plugins/datasource/cloudwatch/language_provider.ts
View file @
55533d12
...
...
@@ -117,17 +117,41 @@ export class CloudWatchLanguageProvider extends LanguageProvider {
};
}
private
fetchFields
=
_
.
throttle
(
async
(
logGroups
:
string
[])
=>
{
private
fetchedFieldsCache
:
|
{
time
:
number
;
logGroups
:
string
[];
fields
:
string
[];
}
|
undefined
;
private
fetchFields
=
async
(
logGroups
:
string
[]):
Promise
<
string
[]
>
=>
{
if
(
this
.
fetchedFieldsCache
&&
Date
.
now
()
-
this
.
fetchedFieldsCache
.
time
<
30
*
1000
&&
_
.
sortedUniq
(
this
.
fetchedFieldsCache
.
logGroups
).
join
(
'|'
)
===
_
.
sortedUniq
(
logGroups
).
join
(
'|'
)
)
{
return
this
.
fetchedFieldsCache
.
fields
;
}
const
results
=
await
Promise
.
all
(
logGroups
.
map
(
logGroup
=>
this
.
datasource
.
getLogGroupFields
({
logGroupName
:
logGroup
}))
);
return
[
const
fields
=
[
...
new
Set
<
string
>
(
results
.
reduce
((
acc
:
string
[],
cur
)
=>
acc
.
concat
(
cur
.
logGroupFields
?.
map
(
f
=>
f
.
name
)
as
string
[]),
[])
).
values
(),
];
},
30
*
1000
);
this
.
fetchedFieldsCache
=
{
time
:
Date
.
now
(),
logGroups
,
fields
,
};
return
fields
;
};
private
handleKeyword
=
async
(
context
?:
TypeaheadContext
):
Promise
<
TypeaheadOutput
|
null
>
=>
{
const
suggs
=
await
this
.
getFieldCompletionItems
(
context
?.
logGroupNames
??
[]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment