Skip to content

Commit

Permalink
add flag for disabling metrics (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
eriktaubeneck authored May 28, 2024
1 parent 5e2d24f commit 3051e42
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
23 changes: 23 additions & 0 deletions server/app/query/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ function IPAForm({
);
const [stallDetectionEnabled, setStallDetectionEnabled] = useState(true);
const [multiThreadingEnabled, setMultiThreadingEnabled] = useState(true);
const [disableMetricsEnabled, setDisableMetricsEnabled] = useState(false);
const disableBranch = commitSpecifier != CommitSpecifier.BRANCH;
const disableCommitHash = commitSpecifier != CommitSpecifier.COMMIT_HASH;
const filteredCommitHashes =
Expand Down Expand Up @@ -378,6 +379,28 @@ function IPAForm({
</div>
</div>

<div className="items-center pt-4">
<div className="block text-sm font-medium leading-6 text-gray-900">
Disable metrics
</div>
<div className="block pt-1 text-sm font-medium leading-6 text-gray-900">
<Switch
checked={disableMetricsEnabled}
onChange={setDisableMetricsEnabled}
name="disable_metrics"
className={`${
disableMetricsEnabled ? "bg-blue-600" : "bg-gray-200"
} relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2`}
>
<span
className={`${
disableMetricsEnabled ? "translate-x-6" : "translate-x-1"
} inline-block h-4 w-4 transform rounded-full bg-white transition-transform`}
/>
</Switch>
</div>
</div>

<button
type="submit"
className={clsx(
Expand Down
7 changes: 6 additions & 1 deletion sidecar/app/query/ipa.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class IPAHelperCompileStep(LoggerOutputCommandStep):
gate_type: GateType
stall_detection: bool
multi_threading: bool
disable_metrics: bool
logger: loguru.Logger = field(repr=False)
status: ClassVar[Status] = Status.COMPILING

Expand All @@ -173,12 +174,14 @@ def build_from_query(cls, query: IPAHelperQuery):
gate_type = query.gate_type
stall_detection = query.stall_detection
multi_threading = query.multi_threading
disable_metrics = query.disable_metrics
return cls(
manifest_path=manifest_path,
target_path=query.paths.target_path,
gate_type=gate_type,
stall_detection=stall_detection,
multi_threading=multi_threading,
disable_metrics=disable_metrics,
logger=query.logger,
)

Expand All @@ -187,7 +190,8 @@ def build_command(self) -> LoggerOutputCommand:
cmd=f"cargo build --bin helper --manifest-path={self.manifest_path} "
f'--features="web-app real-world-infra {self.gate_type}'
f"{' stall-detection' if self.stall_detection else ''}"
f"{' multi-threading' if self.multi_threading else ''}\" "
f"{' multi-threading' if self.multi_threading else ''}"
f"{' disable-metrics' if self.disable_metrics else ''}\" "
f"--no-default-features --target-dir={self.target_path} "
f"--release",
logger=self.logger,
Expand Down Expand Up @@ -402,6 +406,7 @@ class IPAHelperQuery(IPAQuery):
gate_type: GateType
stall_detection: bool
multi_threading: bool
disable_metrics: bool

step_classes: ClassVar[list[type[Step]]] = [
IPACloneStep,
Expand Down
3 changes: 3 additions & 0 deletions sidecar/app/routes/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def start_ipa_helper(
gate_type: Annotated[str, Form()],
stall_detection: Annotated[bool, Form()],
multi_threading: Annotated[bool, Form()],
disable_metrics: Annotated[bool, Form()],
background_tasks: BackgroundTasks,
):
# pylint: disable=too-many-arguments
Expand All @@ -53,6 +54,7 @@ def start_ipa_helper(
f"{commit_hash}_{gate_type}"
f"{'_stall-detection' if stall_detection else ''}"
f"{'_multi-threading' if multi_threading else ''}"
f"{'_disable-metrics' if disable_metrics else ''}"
)

paths = Paths(
Expand All @@ -67,6 +69,7 @@ def start_ipa_helper(
gate_type=GateType[gate_type.upper()],
stall_detection=stall_detection,
multi_threading=multi_threading,
disable_metrics=disable_metrics,
port=settings.helper_port,
)
background_tasks.add_task(query.start)
Expand Down

0 comments on commit 3051e42

Please sign in to comment.