-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add google cloud logging #377
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
Conversation
cd2c81b to
bc5085a
Compare
bc5085a to
6277270
Compare
|
tested and possibly needs to go behind a flag for non-gce instances... scott will test later. |
|
I wonder if it would be worth adding a simple check to see if it's running in GCP like this: def is_running_on_gce():
try:
response = requests.get(
'http://metadata.google.internal/computeMetadata/v1/',
headers={'Metadata-Flavor': 'Google'},
timeout=1
)
return response.status_code == 200 and 'Metadata-Flavor' in response.headers and response.headers['Metadata-Flavor'] == 'Google'
except requests.exceptions.RequestException:
return Falserather than adding another cli flag. |
6277270 to
7f53f25
Compare
|
@steveoh This is ready for another look. I've tested this on my local VM and on mapserv and it behaved as expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds Google Cloud Logging integration to the forklift application. The implementation automatically detects when running on Google Compute Engine (GCE) and configures Google Cloud Logging accordingly.
- Adds Google Cloud Logging client setup that activates when running on GCE
- Implements GCE detection mechanism using metadata server endpoints
- Updates dependencies to include the google-cloud-logging package
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/forklift/main.py | Adds GCE detection function and integrates Google Cloud Logging setup into the existing logging configuration |
| setup.py | Adds google-cloud-logging dependency to the project requirements |
7f53f25 to
376b8dc
Compare

Description of Changes
This pull requests adds google cloud logging.
Warning
This is untested but should be trivial to test by installing and running a simple cli command.