Skip to content

Conversation

@steveoh
Copy link
Member

@steveoh steveoh commented Jul 16, 2025

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.

@steveoh steveoh requested review from Copilot and stdavis July 16, 2025 01:29

This comment was marked as outdated.

@steveoh steveoh force-pushed the feat/cloud-logging branch from cd2c81b to bc5085a Compare July 16, 2025 01:32
@agrc-dev agrc-dev force-pushed the feat/cloud-logging branch from bc5085a to 6277270 Compare July 16, 2025 19:10
@steveoh
Copy link
Member Author

steveoh commented Jul 16, 2025

tested and possibly needs to go behind a flag for non-gce instances... scott will test later.

@stdavis
Copy link
Member

stdavis commented Jul 16, 2025

It works, but it's not ideal:
image

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 False

rather than adding another cli flag.

@stdavis stdavis force-pushed the feat/cloud-logging branch from 6277270 to 7f53f25 Compare July 17, 2025 22:12
@stdavis
Copy link
Member

stdavis commented Jul 17, 2025

@steveoh This is ready for another look. I've tested this on my local VM and on mapserv and it behaved as expected.

@stdavis stdavis requested a review from Copilot July 17, 2025 22:19
stdavis
stdavis previously approved these changes Jul 17, 2025
Copy link

Copilot AI left a 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

@steveoh steveoh merged commit 6e78662 into main Jul 17, 2025
2 checks passed
@steveoh steveoh deleted the feat/cloud-logging branch July 17, 2025 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants