File tree Expand file tree Collapse file tree 14 files changed +108
-30
lines changed Expand file tree Collapse file tree 14 files changed +108
-30
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## [ Unreleased]
4
4
5
+ # 0.3.0
5
6
- [ chore] Upgrade several dependencies
6
7
- Update panel to support showing multiple graphs
8
+ - Update styling for single graph charts
9
+ - Use more of the vscode theme colors for graphs
7
10
- [ chore] We now use Yarn again instead of NPM. This is necessary to pull in
8
11
` fiberplane-charts ` directly from a workspace repository. The problem with
9
12
packaging has been solved with a Yarn plugin.
Original file line number Diff line number Diff line change 6
6
"displayName" : " Autometrics" ,
7
7
"license" : " MIT" ,
8
8
"description" : " Show enhanced autometrics information from your code" ,
9
- "version" : " 0.2.1 " ,
9
+ "version" : " 0.3.0 " ,
10
10
"repository" : {
11
11
"type" : " git" ,
12
12
"url" : " https://github.com/autometrics-dev/vscode-autometrics"
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { formatProviderError } from "./providerRuntime/errors";
4
4
import type { MessageFromWebview , MessageToWebview } from "./charts" ;
5
5
import { OPEN_PANEL_COMMAND } from "./constants" ;
6
6
import type { Prometheus } from "./prometheus" ;
7
- import { getNonce } from "./utils" ;
7
+ import { getNonce , getTitle } from "./utils" ;
8
8
9
9
/**
10
10
* Options for the kind of chart to display.
@@ -157,16 +157,3 @@ function getHtmlForWebview(
157
157
</body>
158
158
</html>` ;
159
159
}
160
-
161
- export function getTitle ( options : PanelOptions ) {
162
- switch ( options . type ) {
163
- case "called_by" :
164
- return `Called by ${ options . functionName } ` ;
165
- case "function" :
166
- return options . functionName ;
167
- case "metric" :
168
- return options . metricName ;
169
- case "function_graphs" :
170
- return options . functionName ;
171
- }
172
- }
Original file line number Diff line number Diff line change
1
+ import { Prism as SyntaxHighlighter } from "react-syntax-highlighter" ;
2
+ import { styles } from "./prismStyles" ;
3
+
4
+ export function CodeBlock ( { query } : { query : string } ) {
5
+ return (
6
+ < SyntaxHighlighter language = "promql" style = { styles } >
7
+ { query }
8
+ </ SyntaxHighlighter >
9
+ ) ;
10
+ }
Original file line number Diff line number Diff line change
1
+ export * from "./CodeBlock" ;
File renamed without changes.
Original file line number Diff line number Diff line change 8
8
Timeseries ,
9
9
} from "fiberplane-charts" ;
10
10
import styled from "styled-components" ;
11
- import { Prism as SyntaxHighlighter } from "react-syntax-highlighter " ;
12
- import { styles } from "./prismStyles " ;
11
+ import { CodeBlock } from "../CodeBlock " ;
12
+ import { colors } from "../../utils " ;
13
13
14
14
type Props = {
15
15
query : string ;
@@ -51,11 +51,10 @@ export function FunctionChart(props: Props) {
51
51
footerShown = { false }
52
52
gridBordersShown = { false }
53
53
gridDashArray = "2"
54
+ colors = { colors }
54
55
/>
55
56
</ div >
56
- < SyntaxHighlighter language = "promql" style = { styles } >
57
- { query }
58
- </ SyntaxHighlighter >
57
+ < CodeBlock query = { query } />
59
58
</ >
60
59
) ;
61
60
}
Original file line number Diff line number Diff line change 5
5
generateErrorRatioQuery ,
6
6
generateLatencyQuery ,
7
7
generateRequestRateQuery ,
8
+ getCalledByErrorRatio ,
9
+ getCalledByRequestRate ,
8
10
} from "../../../queries" ;
9
11
10
12
type Props = TimeRangeProps & {
@@ -19,6 +21,9 @@ export function FunctionCharts(props: Props) {
19
21
const errorRatioQuery = generateErrorRatioQuery ( functionName , moduleName ) ;
20
22
const latencyQuery = generateLatencyQuery ( functionName , moduleName ) ;
21
23
24
+ const calledByRequestQuery = getCalledByRequestRate ( functionName ) ;
25
+ const calledByErrorRatioQuery = getCalledByErrorRatio ( functionName ) ;
26
+
22
27
return (
23
28
< div >
24
29
< Title >
@@ -54,6 +59,29 @@ export function FunctionCharts(props: Props) {
54
59
/>
55
60
</ ChartContainer >
56
61
</ Container >
62
+ < hr />
63
+ < h5 > "Called by" metrics</ h5 >
64
+ < hr />
65
+ < Container >
66
+ < ChartContainer >
67
+ < FunctionChart
68
+ title = "Request Rate"
69
+ query = { calledByRequestQuery }
70
+ timeRange = { timeRange }
71
+ setTimeRange = { setTimeRange }
72
+ key = "request_rate"
73
+ />
74
+ </ ChartContainer >
75
+ < ChartContainer >
76
+ < FunctionChart
77
+ title = "Error Ratio"
78
+ query = { calledByErrorRatioQuery }
79
+ timeRange = { timeRange }
80
+ setTimeRange = { setTimeRange }
81
+ key = "error_ratio"
82
+ />
83
+ </ ChartContainer >
84
+ </ Container >
57
85
</ div >
58
86
) ;
59
87
}
Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ import {
14
14
} from "../../../queries" ;
15
15
import { useRequestData } from "../../hooks/useRequestData" ;
16
16
import { TimeRangeProps } from "../types" ;
17
+ import { getTitle } from "../../../utils" ;
18
+ import { CodeBlock } from "../CodeBlock" ;
19
+ import { colors } from "../../utils" ;
17
20
18
21
type Props = {
19
22
options : SingleChartOptions ;
@@ -41,9 +44,11 @@ export function SingleChart(props: Props) {
41
44
} ) ;
42
45
} , [ options , timeRange ] ) ;
43
46
47
+ const title = `${ options . type } chart for ${ getTitle ( options ) } ` ;
48
+
44
49
return (
45
50
< >
46
- < h1 > { query } </ h1 >
51
+ < h1 > { title } </ h1 >
47
52
< MetricsChart
48
53
graphType = { graphType }
49
54
stackingType = { stackingType }
@@ -52,7 +57,14 @@ export function SingleChart(props: Props) {
52
57
onChangeGraphType = { setGraphType }
53
58
onChangeStackingType = { setStackingType }
54
59
onChangeTimeRange = { setTimeRange }
60
+ chartControlsShown = { false }
61
+ gridColumnsShown = { false }
62
+ footerShown = { false }
63
+ gridBordersShown = { false }
64
+ gridDashArray = "2"
65
+ colors = { colors }
55
66
/>
67
+ < CodeBlock query = { query || "" } />
56
68
</ >
57
69
) ;
58
70
}
Original file line number Diff line number Diff line change @@ -6,3 +6,12 @@ export function getCurrentTimeRange(): TimeRange {
6
6
oneHourAgo . setHours ( oneHourAgo . getHours ( ) - 1 ) ;
7
7
return { from : oneHourAgo . toISOString ( ) , to : now . toISOString ( ) } ;
8
8
}
9
+
10
+ export const colors = [
11
+ "var(--vscode-charts-red)" ,
12
+ "var(--vscode-charts-blue)" ,
13
+ "var(--vscode-charts-yellow)" ,
14
+ "var(--vscode-charts-orange)" ,
15
+ "var(--vscode-charts-green)" ,
16
+ "var(--vscode-charts-purple)" ,
17
+ ] ;
You can’t perform that action at this time.
0 commit comments