Skip to content

Commit

Permalink
Add filter to selectors for Compare Modes
Browse files Browse the repository at this point in the history
Limit the fetching to 1 month
  • Loading branch information
MaXal committed Dec 16, 2024
1 parent cdb8593 commit 1c76a49
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
<div class="flex flex-col gap-5">
<StickyToolbar>
<template #start>
<div class="flex items-center">
<MachineSelect :machine-configurator="machineConfigurator" />
</div>
<BranchSelect
:branch-configurator="branchConfigurator"
:triggered-by-configurator="triggeredByConfigurator"
/>
<MachineSelect :machine-configurator="machineConfigurator" />
<DimensionSelect
label="Mode"
:dimension="testModeConfigurator1"
Expand Down Expand Up @@ -124,6 +122,7 @@ import DimensionSelect from "../../charts/DimensionSelect.vue"
import { modeSelectLabelFormat } from "../../../shared/labels"
import { createTestModeConfigurator } from "../../../configurators/TestModeConfigurator"
import BranchSelect from "../BranchSelect.vue"
import { TimeRangeConfigurator } from "../../../configurators/TimeRangeConfigurator"
interface CompareBranchesProps {
dbName: string
Expand Down Expand Up @@ -158,22 +157,34 @@ const persistentStateManager = new PersistentStateManager(
},
router
)
const machineConfigurator = new MachineConfigurator(serverConfigurator, persistentStateManager)
const branchConfigurator = createBranchConfigurator(serverConfigurator, persistentStateManager, [])
const triggeredByConfigurator = privateBuildConfigurator(serverConfigurator, persistentStateManager, [])
const timeRangeConfigurator = new TimeRangeConfigurator(persistentStateManager)
const branchConfigurator = createBranchConfigurator(serverConfigurator, persistentStateManager, [timeRangeConfigurator])
const triggeredByConfigurator = privateBuildConfigurator(serverConfigurator, persistentStateManager, [timeRangeConfigurator, branchConfigurator])
const machineConfigurator = new MachineConfigurator(serverConfigurator, persistentStateManager, [timeRangeConfigurator, branchConfigurator])
const measureConfigurator = new SimpleMeasureConfigurator("metrics", persistentStateManager)
measureConfigurator.initData(metricsNames)
const testConfigurator = new SimpleMeasureConfigurator("tests", persistentStateManager)
const testModeConfigurator1 = createTestModeConfigurator(serverConfigurator, persistentStateManager, [branchConfigurator], "mode1", false)
const testModeConfigurator2 = createTestModeConfigurator(serverConfigurator, persistentStateManager, [branchConfigurator], "mode2", false)
const testModeConfigurator1 = createTestModeConfigurator(
serverConfigurator,
persistentStateManager,
[timeRangeConfigurator, branchConfigurator, machineConfigurator, triggeredByConfigurator],
"mode1",
false
)
const testModeConfigurator2 = createTestModeConfigurator(
serverConfigurator,
persistentStateManager,
[timeRangeConfigurator, branchConfigurator, machineConfigurator, triggeredByConfigurator],
"mode2",
false
)
const mode1 = ref<string | null>(null)
const mode2 = ref<string | null>(null)
const tableData = ref<TableRow[]>()
const fetchedData = ref<TableRow[]>()
combineLatest([testModeConfigurator1.createObservable(), testModeConfigurator2.createObservable(), serverConfigurator.createObservable(), machineConfigurator.createObservable()])
Expand Down Expand Up @@ -251,7 +262,7 @@ function getColorForBuild(build1: number, build2: number) {
}
function getAllMetricsFromMode(machineConfigurator: MachineConfigurator, mode: string | null, metricNames: string[]): Observable<Result[]> {
if(mode == "default") {
if (mode == "default") {
mode = ""
}
const params = {
Expand Down Expand Up @@ -287,6 +298,7 @@ function handleNavigateToTest(project: string, metric: string) {
.p-button-icon-only.p-button-rounded {
@apply text-black;
}
.lower {
font-weight: 700;
color: #ff5252;
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (t *StatsServer) getModeComparison(request *http.Request) (*bytebufferpool.
}
measureNamesString := strings.Join(quotedMeasureNames, ",")

sql := fmt.Sprintf("SELECT project as Project, measure_name as MeasureName, arraySlice(groupArray(measure_value), 1, 50) AS MeasureValues FROM (SELECT project, measures.name as measure_name, measures.value as measure_value FROM %s ARRAY JOIN measures WHERE mode = '%s' AND branch = '%s' AND measure_name in (%s) AND machine like '%s' ORDER BY generated_time DESC)GROUP BY project, measure_name;", params.Table, params.Mode, params.Branch, measureNamesString, params.Machine)
sql := fmt.Sprintf("SELECT project as Project, measure_name as MeasureName, arraySlice(groupArray(measure_value), 1, 50) AS MeasureValues FROM (SELECT project, measures.name as measure_name, measures.value as measure_value FROM %s ARRAY JOIN measures WHERE mode = '%s' AND branch = '%s' AND measure_name in (%s) AND machine like '%s' AND generated_time >subtractMonths(now(),1) ORDER BY generated_time DESC)GROUP BY project, measure_name;", params.Table, params.Mode, params.Branch, measureNamesString, params.Machine)
db, err := t.openDatabaseConnection()
defer func(db driver.Conn) {
_ = db.Close()
Expand Down

0 comments on commit 1c76a49

Please sign in to comment.