Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
SigNoz
Commits
25803e66
Commit
25803e66
authored
4 years ago
by
dhrubesh
Browse files
Options
Download
Email Patches
Plain Diff
integrated API, populates graph data
parent
39012d86
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
frontend/src/modules/Metrics/ExternalApi/graphConfig.ts
+1
-1
frontend/src/modules/Metrics/ExternalApi/graphConfig.ts
frontend/src/modules/Metrics/ServiceMetrics.tsx
+12
-8
frontend/src/modules/Metrics/ServiceMetrics.tsx
frontend/src/store/actions/metrics.ts
+14
-7
frontend/src/store/actions/metrics.ts
frontend/src/store/reducers/metrics.ts
+3
-2
frontend/src/store/reducers/metrics.ts
with
30 additions
and
18 deletions
+30
-18
frontend/src/modules/Metrics/ExternalApi/graphConfig.ts
+
1
-
1
View file @
25803e66
...
@@ -91,6 +91,7 @@ export const getOptions = (theme: string): ChartOptions => {
...
@@ -91,6 +91,7 @@ export const getOptions = (theme: string): ChartOptions => {
};
};
export
const
borderColors
=
[
export
const
borderColors
=
[
"
#00feff
"
,
"
rgba(227, 74, 51, 1.0)
"
,
"
rgba(227, 74, 51, 1.0)
"
,
"
rgba(250,174,50,1)
"
,
"
rgba(250,174,50,1)
"
,
"
#058b00
"
,
"
#058b00
"
,
...
@@ -99,7 +100,6 @@ export const borderColors = [
...
@@ -99,7 +100,6 @@ export const borderColors = [
"
#45a1ff
"
,
"
#45a1ff
"
,
"
#ffe900
"
,
"
#ffe900
"
,
"
#30e60b
"
,
"
#30e60b
"
,
"
#00feff
"
,
"
#8000d7
"
,
"
#8000d7
"
,
"
#ededf0
"
"
#ededf0
"
];
];
This diff is collapsed.
Click to expand it.
frontend/src/modules/Metrics/ServiceMetrics.tsx
+
12
-
8
View file @
25803e66
...
@@ -13,6 +13,7 @@ import {
...
@@ -13,6 +13,7 @@ import {
externalMetricsAvgDurationItem
,
externalMetricsAvgDurationItem
,
externalErrCodeMetricsItem
,
externalErrCodeMetricsItem
,
externalMetricsItem
,
externalMetricsItem
,
dbOverviewMetricsItem
,
getExternalAvgDurationMetrics
,
getExternalAvgDurationMetrics
,
getExternalErrCodeMetrics
,
getExternalErrCodeMetrics
,
topEndpointListItem
,
topEndpointListItem
,
...
@@ -30,6 +31,7 @@ const { TabPane } = Tabs;
...
@@ -30,6 +31,7 @@ const { TabPane } = Tabs;
interface
ServicesMetricsProps
extends
RouteComponentProps
<
any
>
{
interface
ServicesMetricsProps
extends
RouteComponentProps
<
any
>
{
serviceMetrics
:
metricItem
[];
serviceMetrics
:
metricItem
[];
dbOverviewMetrics
:
dbOverviewMetricsItem
[];
getServicesMetrics
:
Function
;
getServicesMetrics
:
Function
;
getExternalMetrics
:
Function
;
getExternalMetrics
:
Function
;
getExternalErrCodeMetrics
:
Function
;
getExternalErrCodeMetrics
:
Function
;
...
@@ -132,7 +134,7 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => {
...
@@ -132,7 +134,7 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => {
</
Col
>
</
Col
>
</
Row
>
</
Row
>
<
Row
gutter
=
{
32
}
style
=
{
{
margin
:
20
}
}
>
<
Row
gutter
=
{
32
}
style
=
{
{
margin
:
20
}
}
>
<
Col
span
=
{
12
}
>
<
Col
span
=
{
12
}
>
<
Card
bodyStyle
=
{
{
padding
:
10
}
}
>
<
Card
bodyStyle
=
{
{
padding
:
10
}
}
>
<
ExternalApiGraph
<
ExternalApiGraph
...
@@ -163,10 +165,10 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => {
...
@@ -163,10 +165,10 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => {
<
Col
span
=
{
12
}
>
<
Col
span
=
{
12
}
>
<
Card
bodyStyle
=
{
{
padding
:
10
}
}
>
<
Card
bodyStyle
=
{
{
padding
:
10
}
}
>
<
ExternalApiGraph
<
ExternalApiGraph
title
=
"
External Call Error Rate
"
title
=
"
Database Calls RPS
"
keyIdentifier
=
"
externalHttpUrl
"
keyIdentifier
=
"
dbSystem
"
dataIdentifier
=
"
numCalls
"
dataIdentifier
=
"
callRate
"
data
=
{
props
.
externalErrCode
Metrics
}
data
=
{
props
.
dbOverview
Metrics
}
/>
/>
</
Card
>
</
Card
>
</
Col
>
</
Col
>
...
@@ -175,10 +177,10 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => {
...
@@ -175,10 +177,10 @@ const _ServiceMetrics = (props: ServicesMetricsProps) => {
<
Card
bodyStyle
=
{
{
padding
:
10
}
}
>
<
Card
bodyStyle
=
{
{
padding
:
10
}
}
>
<
ExternalApiGraph
<
ExternalApiGraph
label
=
"Average Duration"
label
=
"Average Duration"
title
=
"
External Call d
uration"
title
=
"
DataBase Calls Avg D
uration"
dataIdentifier
=
"avgDuration"
dataIdentifier
=
"avgDuration"
fnDataIdentifier
=
{
(
s
)
=>
Number
(
s
)
/
1000000
}
fnDataIdentifier
=
{
(
s
)
=>
Number
(
s
)
/
1000000
}
data
=
{
props
.
externalAvgDuration
Metrics
}
data
=
{
props
.
dbOverview
Metrics
}
/>
/>
</
Card
>
</
Card
>
</
Col
>
</
Col
>
...
@@ -196,6 +198,7 @@ const mapStateToProps = (
...
@@ -196,6 +198,7 @@ const mapStateToProps = (
externalAvgDurationMetrics
:
externalMetricsAvgDurationItem
[];
externalAvgDurationMetrics
:
externalMetricsAvgDurationItem
[];
externalErrCodeMetrics
:
externalErrCodeMetricsItem
[];
externalErrCodeMetrics
:
externalErrCodeMetricsItem
[];
externalMetrics
:
externalMetricsItem
[];
externalMetrics
:
externalMetricsItem
[];
dbOverviewMetrics
:
dbOverviewMetricsItem
[];
globalTime
:
GlobalTime
;
globalTime
:
GlobalTime
;
}
=>
{
}
=>
{
return
{
return
{
...
@@ -204,6 +207,7 @@ const mapStateToProps = (
...
@@ -204,6 +207,7 @@ const mapStateToProps = (
topEndpointsList
:
state
.
topEndpointsList
,
topEndpointsList
:
state
.
topEndpointsList
,
externalMetrics
:
state
.
externalMetrics
,
externalMetrics
:
state
.
externalMetrics
,
globalTime
:
state
.
globalTime
,
globalTime
:
state
.
globalTime
,
dbOverviewMetrics
:
state
.
dbOverviewMetrics
,
externalAvgDurationMetrics
:
state
.
externalAvgDurationMetrics
,
externalAvgDurationMetrics
:
state
.
externalAvgDurationMetrics
,
};
};
};
};
...
@@ -216,6 +220,6 @@ export const ServiceMetrics = withRouter(
...
@@ -216,6 +220,6 @@ export const ServiceMetrics = withRouter(
getExternalAvgDurationMetrics
:
getExternalAvgDurationMetrics
,
getExternalAvgDurationMetrics
:
getExternalAvgDurationMetrics
,
getTopEndpoints
:
getTopEndpoints
,
getTopEndpoints
:
getTopEndpoints
,
updateTimeInterval
:
updateTimeInterval
,
updateTimeInterval
:
updateTimeInterval
,
getDbOverViewMetrics
:
getDbOverViewMetrics
,
getDbOverViewMetrics
:
getDbOverViewMetrics
,
})(
_ServiceMetrics
),
})(
_ServiceMetrics
),
);
);
This diff is collapsed.
Click to expand it.
frontend/src/store/actions/metrics.ts
+
14
-
7
View file @
25803e66
...
@@ -54,6 +54,14 @@ export interface externalMetricsItem {
...
@@ -54,6 +54,14 @@ export interface externalMetricsItem {
timestamp
:
number
;
timestamp
:
number
;
}
}
export
interface
dbOverviewMetricsItem
{
avgDuration
:
number
;
callRate
:
number
;
dbSystem
:
string
;
numCalls
:
number
;
timestamp
:
number
;
}
export
interface
customMetricsItem
{
export
interface
customMetricsItem
{
timestamp
:
number
;
timestamp
:
number
;
value
:
number
;
value
:
number
;
...
@@ -83,7 +91,7 @@ export interface getExternalMetricsAction {
...
@@ -83,7 +91,7 @@ export interface getExternalMetricsAction {
export
interface
getDbOverViewMetricsAction
{
export
interface
getDbOverViewMetricsAction
{
type
:
ActionTypes
.
getDbOverviewMetrics
;
type
:
ActionTypes
.
getDbOverviewMetrics
;
payload
:
external
MetricsItem
[];
payload
:
dbOverview
MetricsItem
[];
}
}
export
interface
getTopEndpointsAction
{
export
interface
getTopEndpointsAction
{
type
:
ActionTypes
.
getTopEndpoints
;
type
:
ActionTypes
.
getTopEndpoints
;
...
@@ -123,12 +131,11 @@ export const getDbOverViewMetrics = (
...
@@ -123,12 +131,11 @@ export const getDbOverViewMetrics = (
"
&end=
"
+
"
&end=
"
+
globalTime
.
maxTime
+
globalTime
.
maxTime
+
"
&step=60
"
;
"
&step=60
"
;
const
response
=
await
api
.
get
<
any
>
(
apiV1
+
request_string
);
const
response
=
await
api
.
get
<
dbOverviewMetricsItem
[]
>
(
apiV1
+
request_string
);
console
.
log
(
"
response
"
,
response
);
dispatch
<
getDbOverViewMetricsAction
>
({
// dispatch<getExternalMetricsAction>({
type
:
ActionTypes
.
getDbOverviewMetrics
,
// type: ActionTypes.getExternalMetrics,
payload
:
response
.
data
,
// payload: response.data,
});
// });
};
};
};
};
...
...
This diff is collapsed.
Click to expand it.
frontend/src/store/reducers/metrics.ts
+
3
-
2
View file @
25803e66
...
@@ -7,6 +7,7 @@ import {
...
@@ -7,6 +7,7 @@ import {
externalErrCodeMetricsItem
,
externalErrCodeMetricsItem
,
customMetricsItem
,
customMetricsItem
,
externalMetricsItem
,
externalMetricsItem
,
dbOverviewMetricsItem
,
externalMetricsAvgDurationItem
,
externalMetricsAvgDurationItem
,
}
from
"
../actions
"
;
}
from
"
../actions
"
;
...
@@ -126,11 +127,11 @@ export const externalMetricsReducer = (
...
@@ -126,11 +127,11 @@ export const externalMetricsReducer = (
};
};
export
const
dbOverviewMetricsReducer
=
(
export
const
dbOverviewMetricsReducer
=
(
state
:
external
MetricsItem
[]
=
[
state
:
dbOverview
MetricsItem
[]
=
[
{
{
avgDuration
:
0
,
avgDuration
:
0
,
callRate
:
0
,
callRate
:
0
,
externalHttpUrl
:
""
,
dbSystem
:
""
,
numCalls
:
0
,
numCalls
:
0
,
timestamp
:
0
,
timestamp
:
0
,
},
},
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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