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

Feat/new metric handler #1872

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat: new metric handler.
  • Loading branch information
Bidaya0 committed Oct 16, 2023
commit 93303249c9b90f43be325294c7fe18fc8ec87d81
9 changes: 7 additions & 2 deletions dongtai_protocol/views/agent_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class AgentRegisterEndPoint(OpenApiEndPoint):
description = "引擎注册"

@staticmethod
def register_agent(token, version, language, project_name, user, project_version):
def register_agent(token, version, language, project_name, user, project_version, jvm_user_dir=""):
project = IastProject.objects.values("id").filter(name=project_name).first()
is_audit = AgentRegisterEndPoint.get_is_audit()
project_id = -1
Expand Down Expand Up @@ -76,6 +76,7 @@ def register_agent(token, version, language, project_name, user, project_version
language=language,
is_audit=is_audit,
allow_report=allow_report,
jvm_user_dir=jvm_user_dir,
)
else:
IastAgent.objects.filter(pk=agent_id).update(
Expand Down Expand Up @@ -252,7 +253,7 @@ def post(self, request: Request):
version_name = param.get("projectVersion", "V1.0")
version_name = version_name if version_name else "V1.0"
template_id = param.get("projectTemplateId", None)
param.get("jvmUserDirectory", "")
jvm_user_dir = param.get("jvmUserDirectory", "")
if template_id is not None:
template = IastProjectTemplate.objects.filter(pk=template_id).first()
if not template:
Expand Down Expand Up @@ -294,6 +295,7 @@ def post(self, request: Request):
version=version,
project_version=project_version,
user=user,
jvm_user_dir=jvm_user_dir,
)
else:
agent_id = self.register_agent(
Expand All @@ -303,6 +305,7 @@ def post(self, request: Request):
version=version,
user=user,
project_version=None,
jvm_user_dir=jvm_user_dir,
)

self.register_server(
Expand Down Expand Up @@ -367,6 +370,7 @@ def __register_agent(
language,
is_audit,
allow_report,
jvm_user_dir="",
):
if exist_project:
IastAgent.objects.filter(
Expand All @@ -390,6 +394,7 @@ def __register_agent(
is_audit=is_audit,
allow_report=allow_report,
department_id=1,
jvm_user_dir=jvm_user_dir,
)
return agent.id

Expand Down
Loading