[FEATURE] add trace heatmap chart plugin - #724
Conversation
c40e966 to
139f2ea
Compare
b33097f to
cad2d04
Compare
e90da96 to
30c30f1
Compare
30c30f1 to
69d4258
Compare
|
FINAL TEST IN PROGRESS ... IMPORTANT: By changing the query type the rest of query spec lags and sometimes does not even load! This not coming from my change. Sounds like an old issue. Checking what could be the issue... |
Signed-off-by: Mahmoud Shahrokni <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Mahmoud Shahrokni <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Mahmoud Shahrokni <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Mahmoud Shahrokni <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Mahmoud Shahrokni <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Mahmoud Shahrokni <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Mahmoud Shahrokni <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Mahmoud Shahrokni <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Mahmoud Shahrokni <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Mahmoud Shahrokni <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud Shahrokni <39291137+shahrokni@users.noreply.github.com> Signed-off-by: Seyed Mahmoud Shahrokni <39291137+shahrokni@users.noreply.github.com> Signed-off-by: Seyed Mahmoud Shahrokni <39291137+shahrokni@users.noreply.github.com> Signed-off-by: Seyed Mahmoud Shahrokni <39291137+shahrokni@users.noreply.github.com> Signed-off-by: Seyed Mahmoud Shahrokni <39291137+shahrokni@users.noreply.github.com> Signed-off-by: Seyed Mahmoud Shahrokni <39291137+shahrokni@users.noreply.github.com> Signed-off-by: Seyed Mahmoud Shahrokni <39291137+shahrokni@users.noreply.github.com> Signed-off-by: Seyed Mahmoud Shahrokni <39291137+shahrokni@users.noreply.github.com> Signed-off-by: Seyed Mahmoud Shahrokni <39291137+shahrokni@users.noreply.github.com> Signed-off-by: Seyed Mahmoud Shahrokni <39291137+shahrokni@users.noreply.github.com>
69d4258 to
ec0a324
Compare
|
|
||
| func MustGetWorkspaces(dirPath string) []string { | ||
| excludedWorkspaces := []string{"e2e"} | ||
| excludedWorkspaces := []string{"e2e", "traceheatmapchart"} |
There was a problem hiding this comment.
At the moment this plugin does not include any Go files. Therefore, the pipeline throws an exception. For now, we can exclude the plugin from this part of the pipeline.
There was a problem hiding this comment.
not sure why the plugin should not include go files. At least the sdk related files should exist.
There was a problem hiding this comment.
we don't need these files as they are included in the repo root.
There was a problem hiding this comment.
we don't need these files as they are included in the repo root.
There was a problem hiding this comment.
we don't need these files as they are included in the repo root.
There was a problem hiding this comment.
we don't need these files as they are included in the repo root.
There was a problem hiding this comment.
we don't need these files as they are included in the repo root.
| @@ -0,0 +1,30 @@ | |||
| module github.com/perses/plugins/prometheus | |||
There was a problem hiding this comment.
| module github.com/perses/plugins/prometheus | |
| module github.com/perses/plugins/traceheatmapchart |
| @@ -0,0 +1,17 @@ | |||
| module: "github.com/perses/traceheatmapchart@v0" | |||
There was a problem hiding this comment.
| module: "github.com/perses/traceheatmapchart@v0" | |
| module: "github.com/perses/plugins/traceheatmapchart@v0" |
| @@ -0,0 +1,63 @@ | |||
| { | |||
| "name": "@perses/traceheatmap-chart-plugin", | |||
There was a problem hiding this comment.
| "name": "@perses/traceheatmap-chart-plugin", | |
| "name": "@perses-dev/traceheatmap-chart-plugin", |
| })(), | ||
| }); | ||
|
|
||
| return `<div style=" |
There was a problem hiding this comment.
this HTML is invalid, was this ran to check?
| scale: 'hourly', | ||
| getBuckets: (start, end, local) => { | ||
| const generateHourlyLabels = (ts: number) => { | ||
| const formatter = new Intl.DateTimeFormat('en-US', { hour: 'numeric' }); |
There was a problem hiding this comment.
can we avoid to hardcode the en-US locale?
| elementId: generateId(column, row, 'min'), | ||
| value: ((): string | undefined => { | ||
| const indexes = bucketToFlatResultsMap[column]?.[row]; | ||
| if (!indexes) return undefined; |
There was a problem hiding this comment.
since this does not guard against empty arrays, what would be displayed?
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| export { getPluginModule } from './getPluginModule'; |
There was a problem hiding this comment.
We are missing component exports here.
| "dev": "rsbuild dev", | ||
| "build": "npm run build-mf && concurrently \"npm:build:*\"", | ||
| "build-mf": "rsbuild build", | ||
| "build:cjs": "swc ./src -d dist/lib/cjs --strip-leading-paths --config-file .cjs.swcrc", |
There was a problem hiding this comment.
not sure why are we re defining the cjs.swcrc if there is one at the root that can be re used, like other plugins already do.
| resultsStartTimes: Array<Pick<TraceSearchResult, 'startTimeUnixMs' | 'durationMs'>>, | ||
| local?: string | ||
| ): TraceHeatMapTimeBucket => { | ||
| const startTimeStamp = min(...resultsStartTimes.map((i) => i.startTimeUnixMs)); |
There was a problem hiding this comment.
This could create a stack overflow with many traces, the min and max functions don't take arrays, they are expanded as variadic parameters, but the V8's has limits on how many parameters you can add. It will be better to use a plain loop and calculate the max and min at the same time.
Relates to perses/perses#3942
This is the bare minimum
trace heat map chart. All it needs is traces and the exponential base (default 2) to bucketize the traces according to their time and duration.The x-axis and y-axis represent the time and duration buckets respectively. Both buckets are generated dynamically.
The following picture shows a base 2 bucketing.
It also supports base 10. Choosing a proper base may vary by different cases.
Demo
Same queries and traces, different bases
Next Steps?
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes