Skip to content

feat(metrics): collect the DOCKER_HOST environment variable path #8007

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

pendo324
Copy link

@pendo324 pendo324 commented May 2, 2025

Which issue(s) does this change fix?

Why is this change necessary?

It allows SAM CLI to have a proxy measurement on which tools users are using as its backend. This allows the SAM CLI team to prioritize testing and features from various tools which users may be using to provide their DOCKER_HOST.

How does it address the issue?

This change collects the last part of URIs/paths, in hope that these last parts shed light on which tool the user is using with SAM CLI. For example, if a user is using a local version of docker, this new metric would collect docker.sock. This is only checking the last part of paths in an effort to not needlessly collect what may be private URLs to remote docker hosts which user's might be using.

What side effects does this change have?

None?

Mandatory Checklist

PRs will only be reviewed after checklist is complete

  • [N/A] Add input/output type hints to new functions/methods
  • [N/A] Write design document if needed (Do I need to write a design document?)
  • [N/A] Write/update unit tests
  • [N/A] Write/update integration tests
  • [N.A] Write/update functional tests if needed
  • make pr passes
  • [N/A] make update-reproducible-reqs if dependencies were changed
  • [N/A] Write documentation

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@pendo324 pendo324 requested a review from a team as a code owner May 2, 2025 23:45
@github-actions github-actions bot added pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels May 2, 2025
@valerena
Copy link
Contributor

valerena commented May 3, 2025

Thanks for the contribution! There are a few errors on make pr (and in other tests), if you can take a look.

At least in make pr

samcli/lib/telemetry/metric.py:495: error: Missing positional argument "path" in call to "exists"  [call-arg]
samcli/lib/telemetry/metric.py:497: error: Returning Any from function declared to return "str"  [no-any-return]
samcli/lib/telemetry/metric.py:500: error: Returning Any from function declared to return "str"  [no-any-return]

The first one is because of if os.path.exists(): (I imagine there's a variable missing there, probably parsed.path)

The other ones might be just errors on typing with os.path.basepath 🤔. You might be able to just do str(..) to fix those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants