Skip to content

Commit f36c260

Browse files
authored
chore: add tool name to mcp metrics (#413)
- [x] I ran `make setup && make` to update the generated code after editing a `.atd` file (TODO: have a CI check) - [x] I made sure we're still backward compatible with old versions of the CLI. For example, the Semgrep backend need to still be able to _consume_ data generated by Semgrep 1.50.0. See https://atd.readthedocs.io/en/latest/atdgen-tutorial.html#smooth-protocol-upgrades Note that the types related to the semgrep-core JSON output or the semgrep-core RPC do not need to be backward compatible! - [ ] Any accompanying changes in `semgrep-proprietary` are approved and ready to merge once this PR is merged PR in `semgrep-proprietary`​: semgrep/semgrep-proprietary#4810
1 parent 8baadf6 commit f36c260

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

semgrep_metrics.atd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ type mcp = {
291291
?git_username <ocaml mutable>: string option;
292292
?git_repo <ocaml mutable>: string option;
293293
?git_branch <ocaml mutable>: string option;
294+
?tool_name <ocaml mutable>: string option;
294295
}
295296

296297
(*****************************************************************************)

semgrep_metrics.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,7 @@ class Mcp:
919919
git_username: Optional[str] = None
920920
git_repo: Optional[str] = None
921921
git_branch: Optional[str] = None
922+
tool_name: Optional[str] = None
922923

923924
@classmethod
924925
def from_json(cls, x: Any) -> 'Mcp':
@@ -935,6 +936,7 @@ def from_json(cls, x: Any) -> 'Mcp':
935936
git_username=_atd_read_string(x['git_username']) if 'git_username' in x else None,
936937
git_repo=_atd_read_string(x['git_repo']) if 'git_repo' in x else None,
937938
git_branch=_atd_read_string(x['git_branch']) if 'git_branch' in x else None,
939+
tool_name=_atd_read_string(x['tool_name']) if 'tool_name' in x else None,
938940
)
939941
else:
940942
_atd_bad_json('Mcp', x)
@@ -963,6 +965,8 @@ def to_json(self) -> Any:
963965
res['git_repo'] = _atd_write_string(self.git_repo)
964966
if self.git_branch is not None:
965967
res['git_branch'] = _atd_write_string(self.git_branch)
968+
if self.tool_name is not None:
969+
res['tool_name'] = _atd_write_string(self.tool_name)
966970
return res
967971

968972
@classmethod

0 commit comments

Comments
 (0)