Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add flag for disabling metrics #30

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
eriktaubeneck marked this conversation as resolved.
Show resolved Hide resolved

<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
Loading