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

add /_localstack/info endpoint for basic infos about the instance #9290

Merged
merged 4 commits into from Oct 5, 2023

Conversation

thrau
Copy link
Member

@thrau thrau commented Oct 4, 2023

Motivation

Several other localstack systems need access to basic information about the running instance beyond the health status. Much like docker info, this new endpoint aims to provide this information.

Example:

{
  "version": "2.3.3.dev:c77b830",
  "edition": "pro",
  "is_license_activated": true,
  "session_id": "1830110c-6e4d-4256-9bc0-9008b8c5b6b9",
  "machine_id": "4256a311839b",
  "system": "linux",
  "is_docker": true,
  "server_time_utc": "2023-10-04T14:59:40",
  "uptime": 120
}

Changes

  • Add a /_localstack/info endpoint
  • Add two new metadata methods: getting the edition (from files we create in the Dockerfiles), and checking whether license activation has been successful
  • Add the edition key also to the health endpoint, since that has long since been requested
  • Add the output of info also to the diagnose endpoint

Testing

  • You can use the dev run script and call curl -s https://localhost.localstack.cloud:4566/_localstack/info | jq .

@thrau thrau added the semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases label Oct 4, 2023
@thrau thrau requested a review from lukqw October 4, 2023 14:59
@github-actions
Copy link

github-actions bot commented Oct 4, 2023

LocalStack Community integration with Pro

       2 files  ±0         2 suites  ±0   1h 18m 7s ⏱️ + 8m 0s
2 242 tests ±0  1 740 ✔️ ±0  502 💤 ±0  0 ±0 
2 243 runs  ±0  1 740 ✔️ ±0  503 💤 ±0  0 ±0 

Results for commit 58f835d. ± Comparison against base commit f5adc8f.

♻️ This comment has been updated with latest results.

@coveralls
Copy link

coveralls commented Oct 4, 2023

Coverage Status

coverage: 82.919% (-0.2%) from 83.12% when pulling db3c6f2 on info-endpoint into f5adc8f on master.

Copy link
Member

@alexrashed alexrashed left a comment

Choose a reason for hiding this comment

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

Nice! This is going to be super-useful when trying to help our users! 🚀



def is_license_activated() -> bool:
try:
Copy link
Member

Choose a reason for hiding this comment

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

nit: Maybe it would make sense to separate the imports here:

  • First try to import anything super-stable from ext.
    • return false if it's not possible
  • Then try to import the specific method.
    • list a prominent error in this case, because that would mean that this code stopped working because of a refactoring, not because the package is missing

@thrau thrau merged commit ebb26be into master Oct 5, 2023
18 of 22 checks passed
@thrau thrau deleted the info-endpoint branch October 5, 2023 15:48
@lukqw
Copy link
Member

lukqw commented Oct 6, 2023

This is great! Thanks for the addition 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants