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
66b3e08a
Unverified
Commit
66b3e08a
authored
May 05, 2020
by
Andrej Ocenas
Committed by
GitHub
May 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Links: Filter data sources in derived link to tracing only (#23948)
parent
a8ba503b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
4 deletions
+43
-4
docs/sources/features/datasources/loki.md
+3
-2
public/app/plugins/datasource/loki/configuration/DerivedField.test.tsx
+38
-2
public/app/plugins/datasource/loki/configuration/DerivedField.tsx
+2
-0
No files found.
docs/sources/features/datasources/loki.md
View file @
66b3e08a
...
...
@@ -189,14 +189,15 @@ datasources:
jsonData
:
maxLines
:
1000
derivedFields
:
# Field with internal link pointing to datasource in Grafana
# Field with internal link pointing to data source in Grafana.
# Right now, Grafana supports only Jaeger and Zipkin data sources as link targets.
-
datasourceUid
:
my_jaeger_uid
matcherRegex
:
"
traceID=(
\\
w+)"
name
:
TraceID
# url will be interpreted as query for the datasource
url
:
"
$${__value.raw}"
# Field with external link
# Field with external link
.
-
matcherRegex
:
"
traceID=(
\\
w+)"
name
:
TraceID
url
:
"
http://localhost:16686/trace/$${__value.raw}"
...
...
public/app/plugins/datasource/loki/configuration/DerivedField.test.tsx
View file @
66b3e08a
...
...
@@ -2,12 +2,31 @@ import React from 'react';
import
{
shallow
}
from
'enzyme'
;
import
{
DerivedField
}
from
'./DerivedField'
;
import
DataSourcePicker
from
'../../../../core/components/Select/DataSourcePicker'
;
import
{
DataSourceInstanceSettings
}
from
'@grafana/data'
;
jest
.
mock
(
'app/features/plugins/datasource_srv'
,
()
=>
({
getDatasourceSrv
()
{
return
{
getExternal
():
any
[]
{
return
[];
getExternal
():
DataSourceInstanceSettings
[]
{
return
[
{
id
:
1
,
uid
:
'metrics'
,
name
:
'metrics_ds'
,
meta
:
{
tracing
:
false
,
}
as
any
,
}
as
any
,
{
id
:
2
,
uid
:
'tracing'
,
name
:
'tracing_ds'
,
meta
:
{
tracing
:
true
,
}
as
any
,
}
as
any
,
];
},
};
},
...
...
@@ -39,4 +58,21 @@ describe('DerivedField', () => {
const
wrapper
=
shallow
(<
DerivedField
value=
{
value
}
onChange=
{
()
=>
{}
}
onDelete=
{
()
=>
{}
}
suggestions=
{
[]
}
/>);
expect
(
wrapper
.
find
(
'DataSourceSection'
).
length
).
toBe
(
0
);
});
it
(
'shows only tracing datasources for internal link'
,
()
=>
{
const
value
=
{
matcherRegex
:
''
,
name
:
''
,
datasourceUid
:
'test'
,
};
const
wrapper
=
shallow
(<
DerivedField
value=
{
value
}
onChange=
{
()
=>
{}
}
onDelete=
{
()
=>
{}
}
suggestions=
{
[]
}
/>);
const
dsSection
=
wrapper
.
find
(
'DataSourceSection'
).
dive
();
expect
(
dsSection
.
find
(
DataSourcePicker
).
props
().
datasources
).
toEqual
([
{
meta
:
{
tracing
:
true
},
name
:
'tracing_ds'
,
value
:
'tracing'
,
},
]);
});
});
public/app/plugins/datasource/loki/configuration/DerivedField.tsx
View file @
66b3e08a
...
...
@@ -152,6 +152,8 @@ const DataSourceSection = (props: DataSourceSectionProps) => {
const
{
datasourceUid
,
onChange
}
=
props
;
const
datasources
:
DataSourceSelectItem
[]
=
getDatasourceSrv
()
.
getExternal
()
// At this moment only Jaeger and Zipkin datasource is supported as the link target.
.
filter
(
ds
=>
ds
.
meta
.
tracing
)
.
map
(
ds
=>
({
...
...
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