googleapis / env-tests-logging

Apache License 2.0
3 stars 6 forks source link

test monitored resource label consistency #58

Open daniel-sanche opened 2 years ago

daniel-sanche commented 2 years ago

We have a test to make sure monitored resources are captured, but it checks labels against a list specific to each language/environment pair. We should define our expectations for each environment, and make sure it is tested consistently across languages

minherz commented 2 years ago
It would be great if we can elaborate this FR little more. Public documentation describes labels expected with each resource type. The list of the supported resource types is very long, the libraries support only the following: resource type environment comment
gce_instance GCE
gae_app GAE Java tries to public suffixes _flex and _standard to reflect on two types of GAE but it is inconsistent with Google Cloud
k8s_container GKE
cloud_run_revision Cloud Run
cloud_function Cloud Function Currently not supported in Java
global Global

Each of these resource types has a defined set of labels. These labels are populated by Logging agents. I would expect from the test to verify that the same set of labels is populated by the libraries when structured logging is enabled.

daniel-sanche commented 2 years ago

Sorry, most of these issues were created assuming I'm the one coming back to them later, so I didn't go into much detail.

The way the current monitored resource environment test works is it checks to make sure each label in self.monitored_resource_labels is set. self.monitored_resource_labels is configured differently for each individual language/environment pair. So there is no guarantee the Python library on Cloud Run is populating identical fields to the java library running on the same environment.

Our end goal is to make sure the languages all behave consistently, so we want to make sure the languages are all populating the same fields the same way when run on the same environment.

TL;DR: This issue is about re-writing this test to be more specific in what it expects

daniel-sanche commented 2 years ago

I would expect from the test to verify that the same set of labels is populated by the libraries when structured logging is enabled.

It's not just when structured logging is enabled, we still want to capture the monitored resources and all the proper metadata when using grpc to send logs