Skip to content

Logging overhaul#137

Merged
jonaraphael merged 47 commits into
mainfrom
feat/logging-overhaul
Jan 28, 2025
Merged

Logging overhaul#137
jonaraphael merged 47 commits into
mainfrom
feat/logging-overhaul

Conversation

@sstill88

@sstill88 sstill88 commented Jan 8, 2025

Copy link
Copy Markdown
Collaborator

Description

This updates all of the logs to be structured (json_payload) logs. It also includes a notebook that demonstrates how to query the structured logs.

Changes

  • Added logs and/or updated logging/print statements to queryable logs
  • added sigterm handler to cerulean_cloud/cloud_run_orchestrator/handler.py. This prints a log if an event like a timeout or manual stop occurs. Though it cannot print the type of sigterm received, some likely reasons for specific messages are documented in the notebook
  • updated action.yaml to include the utils file that has structured_log
  • Added notebooks/CloudRunLogs.ipynb and associated notebooks/logging_utils.py file for querying the logger
  • Updated test/test_cerulean_cloud/test_roda_sentinelhub_client.py to include method="GET" (this test wasn't catching errors because it didn't have the right method)

Reviewers

  • Does it look reasonable?
  • Test out notebooks/CloudRunLogs.ipynb:
    • Make sure this version is deployed on TEST
    • Run a list of scenes
    • Set the correct revision_name in the notebook
    • Run the cells of the notebook
  • Do we like the logging format?

@github-actions

github-actions Bot commented Jan 8, 2025

Copy link
Copy Markdown

🍹 preview on cerulean-cloud-images/test

Pulumi report
  Previewing update (test):
@ previewing update..........

@ previewing update..............
  pulumi:pulumi:Stack cerulean-cloud-images-test running 
@ previewing update....
  gcp:container:Registry cerulean-cloud-images-test-registry  
@ previewing update.....
  docker:index:Image cerulean-cloud-images-test-cr-orchestrator-image  Building your image for linux/amd64 architecture.
  docker:index:Image cerulean-cloud-images-test-cr-orchestrator-image  Building your image for linux/amd64 architecture.
  docker:index:Image cerulean-cloud-images-test-cr-offset-tile-image  Building your image for linux/amd64 architecture.
  docker:index:Image cerulean-cloud-images-test-cr-offset-tile-image  Building your image for linux/amd64 architecture.
@ previewing update....
  docker:index:Image cerulean-cloud-images-test-cr-tipg-image  Building your image for linux/amd64 architecture.
  docker:index:Image cerulean-cloud-images-test-cr-tipg-image  Building your image for linux/amd64 architecture.
  pulumi:pulumi:Stack cerulean-cloud-images-test  
Diagnostics:
docker:index:Image (cerulean-cloud-images-test-cr-orchestrator-image):
  Building your image for linux/amd64 architecture.
  To ensure you are building for the correct platform, consider explicitly setting the `platform` field on ImageBuildOptions.

docker:index:Image (cerulean-cloud-images-test-cr-offset-tile-image):
  Building your image for linux/amd64 architecture.
  To ensure you are building for the correct platform, consider explicitly setting the `platform` field on ImageBuildOptions.

docker:index:Image (cerulean-cloud-images-test-cr-tipg-image):
  Building your image for linux/amd64 architecture.
  To ensure you are building for the correct platform, consider explicitly setting the `platform` field on ImageBuildOptions.

Resources:
  5 unchanged

  

@github-actions

github-actions Bot commented Jan 8, 2025

Copy link
Copy Markdown

🍹 preview on cerulean-cloud/test

Pulumi report
   Previewing update (test):

@ previewing update.....
   pulumi:pulumi:Stack cerulean-cloud-test running 
@ previewing update....
   pulumi:providers:docker cerulean-cloud-images-test-gcr  
   gcp:storage:Bucket cerulean-cloud-test-bucket-cf-ais  
   gcp:cloudtasks:Queue cerulean-cloud-test-queue-cloud-tasks-ais-analysis  
   gcp:sql:DatabaseInstance cerulean-cloud-test-database-instance  
   gcp:serviceaccount:Account cerulean-cloud-test-cf-ais  
-- gcp:storage:BucketObject cerulean-cloud-test-source-cf-ais delete original 
+- gcp:storage:BucketObject cerulean-cloud-test-source-cf-ais replace [diff: ~detectMd5hash,name,source]
++ gcp:storage:BucketObject cerulean-cloud-test-source-cf-ais create replacement [diff: ~detectMd5hash,name,source]
   gcp:sql:User cerulean-cloud-test-database-users  
   gcp:projects:IAMMember cerulean-cloud-test-cf-ais-iam  
   gcp:sql:Database cerulean-cloud-test-database  
~  gcp:cloudfunctions:Function cerulean-cloud-test-cf-ais update [diff: ~environmentVariables,secretEnvironmentVariables,sourceArchiveObject]
   gcp:cloudfunctions:FunctionIamMember cerulean-cloud-test-cf-ais-invoker  
@ previewing update..........
   gcp:serviceaccount:Account cerulean-cloud-test-cr-offset-tile  
   docker:index:RemoteImage cerulean-cloud-images-test-remote-offset  
   docker:index:RemoteImage cerulean-cloud-images-test-remote-tipg  
   docker:index:RemoteImage cerulean-cloud-images-test-remote-orchestrator  
   gcp:projects:IAMMember cerulean-cloud-test-cr-offset-tile-cloudSqlClient  
   gcp:projects:IAMMember cerulean-cloud-test-cr-offset-tile-secretmanagerSecretAccessor  
   gcp:secretmanager:SecretIamMember cerulean-cloud-test-cr-offset-tile-secret-accessor-binding  
   pulumi:pulumi:Stack cerulean-cloud-test running warning: serving_state is deprecated: `serving_state` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.
   pulumi:pulumi:Stack cerulean-cloud-test running warning: env_froms is deprecated: `env_from` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.
   pulumi:pulumi:Stack cerulean-cloud-test running warning: working_dir is deprecated: `working_dir` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.
~  gcp:cloudrun:Service cerulean-cloud-test-cr-offset-tiles update [diff: ~metadata,template]
   gcp:cloudrun:IamPolicy cerulean-cloud-test-cr-noauth-iam-policy-offset  
@ previewing update.....
   aws:iam:Role cerulean-cloud-test-lambda-titiler-role  
   aws:s3:Bucket cerulean-cloud-test-titiler-lambda-archive  
   aws:iam:Policy cerulean-cloud-test-lambda-titiler-policy  
   aws:sns:Topic cerulean-cloud-test-lambda-APIAbuseAlert  
   gcp:storage:Bucket cerulean-cloud-test-bucket-cf-sr  
   aws:apigatewayv2:Api cerulean-cloud-test-lambda-titiler-api  
   gcp:cloudtasks:Queue cerulean-cloud-test-queue-cr-orchestrator  
@ previewing update....
   gcp:serviceaccount:Account cerulean-cloud-test-cr-orchestrator  
   gcp:serviceaccount:Account cerulean-cloud-test-cf-sr  
   gcp:serviceaccount:Account cerulean-cloud-test-cr-tipg  
   aws:iam:Role cerulean-cloud-test-lambda-sentinel1-iam  
   aws:iam:RolePolicyAttachment cerulean-cloud-test-lambda-titiler-attachment2  
   aws:iam:RolePolicyAttachment cerulean-cloud-test-lambda-titiler-attachment  
   aws:sns:TopicSubscription cerulean-cloud-test-lambda-titiler-email-support  
   aws:sns:TopicSubscription cerulean-cloud-test-lambda-titiler-email-jona  
   aws:sns:TopicSubscription cerulean-cloud-test-lambda-titiler-email-jason  
   aws:sns:TopicSubscription cerulean-cloud-test-lambda-titiler-email-aemon  
-- gcp:storage:BucketObject cerulean-cloud-test-source-cf-sr delete original 
+- gcp:storage:BucketObject cerulean-cloud-test-source-cf-sr replace [diff: ~detectMd5hash,name,source]
++ gcp:storage:BucketObject cerulean-cloud-test-source-cf-sr create replacement [diff: ~detectMd5hash,name,source]
   gcp:projects:IAMMember cerulean-cloud-test-cr-orchestrator-cloudTasksEnqueuer  
-- gcp:storage:BucketObject cerulean-cloud-test-source-cf-historical-run delete original 
+- gcp:storage:BucketObject cerulean-cloud-test-source-cf-historical-run replace [diff: ~detectMd5hash,name,source]
++ gcp:storage:BucketObject cerulean-cloud-test-source-cf-historical-run create replacement [diff: ~detectMd5hash,name,source]
   gcp:projects:IAMMember cerulean-cloud-test-cr-orchestrator-cloudSqlClient  
   gcp:projects:IAMMember cerulean-cloud-test-cr-orchestrator-secretmanagerSecretAccessor  
   aws:iam:RolePolicyAttachment cerulean-cloud-test-lambda-sentinel1-basic-execution  
   gcp:projects:IAMMember cerulean-cloud-test-cr-tipg-cloudSqlClient  
   gcp:projects:IAMMember cerulean-cloud-test-cf-sr-iam  
   gcp:secretmanager:SecretIamMember cerulean-cloud-test-cr-tipg-secret-accessor-binding  
   gcp:projects:IAMMember cerulean-cloud-test-cr-tipg-secretmanagerSecretAccessor  
   gcp:secretmanager:SecretIamMember cerulean-cloud-test-cr-orchestrator-secret-accessor-binding  
   pulumi:pulumi:Stack cerulean-cloud-test running warning: serving_state is deprecated: `serving_state` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.
   pulumi:pulumi:Stack cerulean-cloud-test running warning: env_froms is deprecated: `env_from` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.
   pulumi:pulumi:Stack cerulean-cloud-test running warning: working_dir is deprecated: `working_dir` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.
   pulumi:pulumi:Stack cerulean-cloud-test running warning: serving_state is deprecated: `serving_state` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.
   pulumi:pulumi:Stack cerulean-cloud-test running warning: env_froms is deprecated: `env_from` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.
   pulumi:pulumi:Stack cerulean-cloud-test running warning: working_dir is deprecated: `working_dir` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.
~  gcp:cloudrun:Service cerulean-cloud-test-cr-tipg update [diff: ~metadata]
~  gcp:cloudrun:Service cerulean-cloud-test-cr-orchestrator update [diff: ~metadata,template]
   gcp:cloudrun:IamPolicy cerulean-cloud-test-cr-noauth-iam-policy-tipg  
   gcp:cloudrun:IamPolicy cerulean-cloud-test-cr-noauth-iam-policy-orchestrator  
~  gcp:cloudfunctions:Function cerulean-cloud-test-cf-sr update [diff: ~secretEnvironmentVariables,sourceArchiveObject]
~  gcp:cloudfunctions:Function cerulean-cloud-test-cf-historical-run update [diff: ~secretEnvironmentVariables,sourceArchiveObject]
   aws:lambda:Function cerulean-cloud-test-lambda-sentinel1-sub  
   gcp:cloudfunctions:FunctionIamMember cerulean-cloud-test-cf-sr-invoker  
   gcp:cloudfunctions:FunctionIamMember cerulean-cloud-test-cf-historical-run-invoker  
   aws:lambda:Permission cerulean-cloud-test-lambda-sentinel1-permission  
   aws:sns:TopicSubscription cerulean-cloud-test-sentinel1-subscription  
@ previewing update..........................................................................................................................
~  aws:s3:BucketObject cerulean-cloud-test-titiler-lambda-archive update [diff: ~source]
~  aws:lambda:Function cerulean-cloud-test-lambda-titiler-sentinel update [diff: ~sourceCodeHash]
   aws:apigatewayv2:Integration cerulean-cloud-test-lambda-titiler-integration  
   aws:cloudwatch:MetricAlarm cerulean-cloud-test-lambda-titiler-alarm  
   aws:lambda:Permission cerulean-cloud-test-lambda-titiler-permission  
   aws:apigatewayv2:Route cerulean-cloud-test-lambda-titiler-route  
   aws:apigatewayv2:Stage cerulean-cloud-test-lambda-titiler-stage  
   pulumi:pulumi:Stack cerulean-cloud-test running Creating lambda package in [/home/runner/work/cerulean-cloud/cerulean-cloud] [running in Docker]...
   pulumi:pulumi:Stack cerulean-cloud-test running Checking Docker is available...
   pulumi:pulumi:Stack cerulean-cloud-test running Building container image...
   pulumi:pulumi:Stack cerulean-cloud-test running Sucessfully built container image with id sha256:285566eca62f43a437d6ad9970241c37b74605c2dd0d1090eae47d6707a71954
   pulumi:pulumi:Stack cerulean-cloud-test running Creating installation package.zip ...
   pulumi:pulumi:Stack cerulean-cloud-test running Sucessfully created package.zip at /home/runner/work/cerulean-cloud/cerulean-cloud/package.zip
   pulumi:pulumi:Stack cerulean-cloud-test  9 warnings; 6 messages
Diagnostics:
 pulumi:pulumi:Stack (cerulean-cloud-test):
   Creating lambda package in [/home/runner/work/cerulean-cloud/cerulean-cloud] [running in Docker]...
   Checking Docker is available...
   Building container image...
   Sucessfully built container image with id sha256:285566eca62f43a437d6ad9970241c37b74605c2dd0d1090eae47d6707a71954
   Creating installation package.zip ...
   Sucessfully created package.zip at /home/runner/work/cerulean-cloud/cerulean-cloud/package.zip

   warning: serving_state is deprecated: `serving_state` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.
   warning: env_froms is deprecated: `env_from` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.
   warning: working_dir is deprecated: `working_dir` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.
   warning: serving_state is deprecated: `serving_state` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.
   warning: env_froms is deprecated: `env_from` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.
   warning: working_dir is deprecated: `working_dir` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.
   warning: serving_state is deprecated: `serving_state` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.
   warning: env_froms is deprecated: `env_from` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.
   warning: working_dir is deprecated: `working_dir` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.

Resources:
   ~ 8 to update
   +-3 to replace
   11 changes. 56 unchanged

   

Comment thread notebooks/CloudRunLogs.ipynb Outdated
Comment thread notebooks/CloudRunLogs.ipynb Outdated
Comment thread cerulean_cloud/cloud_run_orchestrator/handler.py
Comment thread cerulean_cloud/cloud_run_orchestrator/handler.py

@jonaraphael jonaraphael left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks fabulous. All comments universally resolved.

@jonaraphael jonaraphael merged commit 385517c into main Jan 28, 2025
@jonaraphael jonaraphael deleted the feat/logging-overhaul branch January 28, 2025 22:38
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.

2 participants