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

vdk-control-cli: allow cli users to explicitly set the user agent tag #1403

Merged
merged 9 commits into from
Dec 5, 2022

Conversation

murphp15
Copy link
Collaborator

@murphp15 murphp15 commented Dec 5, 2022

Why

Users are looking to be able to determine where requests originated from when browsing the data.

How

We are going to let cli users explicitly set the user-agent header.

How has this been tested

sent requests to vdk aas and made sure they have the correct user agent in super collider.
The results of this test can only be validated by VMware employees which isn't ideal for an open source project. https://sql.supercollider.vmware.com/stg/history/index.html?sql=select%20*%20from%20history_staging.taurus_httptrace%20where%20request_headers_user_agent%20like%20%27%25paul%25%27%20limit%2010&ddlOutputType=table&version=1#

Closes: #1404

Signed-off-by: murphp15 murphp15@tcd.ie

@murphp15 murphp15 marked this pull request as draft December 5, 2022 10:06
@antoniivanov antoniivanov linked an issue Dec 5, 2022 that may be closed by this pull request
@antoniivanov
Copy link
Collaborator

I've created corresponding issue in Github for the work explaining the problem and the solution - #1404

@murphp15 murphp15 marked this pull request as ready for review December 5, 2022 14:25
@antoniivanov
Copy link
Collaborator

For the purposes of this change, you can use a local server with telemetry endpoint like https://webhook.site/ or https://requestbin.com/

Thought it is a good point. Our CICD deployment uses vcsa.vmware.com currently for telemetry - https://github.com/vmware/versatile-data-kit/blob/main/projects/control-service/cicd/deploy-testing-pipelines-service.sh#L97
It might be nice to extend vdk-heartbeat to check telemetry as well also

@mivanov1988
Copy link
Contributor

LGTM

@@ -18,6 +19,11 @@ class VDKConfig:

_op_id = os.environ.get("VDK_OP_ID_OVERRIDE", f"{uuid.uuid4().hex}"[:16])

_user_agent = os.environ.get(
"VDK_CONTROL_SERVICE_USER_AGENT",
f"vdk-control-cli/1.2 ({os.name}; {sys.platform})" + sys.version.split(" ")[0],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can get version from projects/vdk-control-cli/src/vdk/internal/control/command_groups/version_group/version.py

But how about this

Suggested change
f"vdk-control-cli/1.2 ({os.name}; {sys.platform})" + sys.version.split(" ")[0],
f"vdk-control-cli/{version.__version__} ({sys.platform}; {platform.platform()}; ) Python {platform.python_version()} Node {platform.node()} User {getpass.getuser()}",

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that revealing too much info?
I'm not sure I want my username being sent in a user-agent tag?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with adding {version.__version__}.

I also don't think we want to include the node name.
my node id is paulmxxxxxx.vmware.com'.
Seems like too much info to include in my opinion.

@tozka Please let me know what you think.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this 'vdk-control-cli/1.3.0 (darwin; macOS-12.6.1-arm64-arm-64bit; ) Python 3.10.8'

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I am OK with this.

AWS allows hostname though it contains user information. assuming it's used by admin team of the control service, it might be ok to have host name ... But I understand the having user data could be a bad precedent and lead to incidental PII violation. So I am ok to default without node and user info

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something seems wrong. Did it auto-merge? This was not supposed to be the change to be merged ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad.
Here is the fix #1412.
Can you please take a look at it.

@murphp15 murphp15 enabled auto-merge (squash) December 5, 2022 16:23
@murphp15 murphp15 merged commit e18fdf2 into main Dec 5, 2022
@murphp15 murphp15 deleted the person/murphp15/vdk_client_requests branch December 5, 2022 17:44
murphp15 added a commit that referenced this pull request Dec 6, 2022
# Why?
This PR is including a small fix that was supposed to be in this(#1403) PR. 
It's tested as described in the linked PR. 

# What?
Corrections to the tag format

# How has this been tested?
Tested as part of the previous ticket. 

# What type of change are you making?
Bug fix

Signed-off-by: murphp15 <murphp15@tcd.ie>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Detect application type issuing http requests to Control Servicea
4 participants