Skip to content

Commit

Permalink
Added client ID env var
Browse files Browse the repository at this point in the history
  • Loading branch information
surge119 committed Jul 31, 2024
1 parent 06c0a92 commit 04a0df9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/fixit/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# LICENSE file in the root directory of this source tree.

import logging
import os
import time
from collections import defaultdict
from contextlib import contextmanager
Expand Down Expand Up @@ -65,9 +66,17 @@ def collect_violations(
The optional `metrics_hook` parameter will be called (if provided) after all
lint rules have finished running, passing in a dictionary of
``RuleName.visit_function_name`` -> ``duration in microseconds``.
{
CLIENT_ID: an optional client id set by environment variable,
Duration.RuleName.visit_function_name: duration in microseconds,
ViolationCount.RuleName: number of violations,
ViolationCountReplacement.RuleName: number of violations with replacements,
ViolationCount.Total: total number of violations,
}
"""

self.metrics["CLIENT_ID"] = os.environ.get("FIXIT_CLIENT_ID", "default")

@contextmanager
def visit_hook(name: str) -> Iterator[None]:
start = time.perf_counter()
Expand Down

0 comments on commit 04a0df9

Please sign in to comment.