Skip to content

Conversation

meltsufin
Copy link
Member

Fixes: #71.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jan 22, 2020
@codecov
Copy link

codecov bot commented Jan 22, 2020

Codecov Report

Merging #78 into master will decrease coverage by 0.28%.
The diff coverage is 33.33%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #78      +/-   ##
============================================
- Coverage     76.24%   75.96%   -0.29%     
  Complexity      571      571              
============================================
  Files            42       42              
  Lines          3334     3353      +19     
  Branches        232      237       +5     
============================================
+ Hits           2542     2547       +5     
- Misses          647      660      +13     
- Partials        145      146       +1
Impacted Files Coverage Δ Complexity Δ
...om/google/cloud/logging/MonitoredResourceUtil.java 47.24% <33.33%> (-3.69%) 8 <1> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c4577b5...0af0330. Read the comment docs.

ContainerName("container_name"),
InstanceId("instance_id"),
InstanceName("instance_name"),
Location("location"),

Choose a reason for hiding this comment

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

Is there a reason to use "location" instead of "region"?

Copy link
Member Author

Choose a reason for hiding this comment

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

I looked at log entries that get ingested from stdout, and they all have the location attribute. So, I tried to match that.


/* Detect monitored Resource type using environment variables, else return global as default. */
private static Resource getAutoDetectedResourceType() {
if (System.getenv("K_SERVICE") != null &&

Choose a reason for hiding this comment

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

Steren's note: Note that checking the presence of K_SERVICE and other env vars is not sufficient to differentiate between Cloud Run and any other Knative installation (e.g. Cloud Run for Anthos).

Would adding a check for "KUBERNETES_SERVICE_HOST" == null, fix this issue?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that makes sense.

@meltsufin meltsufin changed the title Add support for Cloud Run monitored resource Jan 22, 2020
@averikitsch
Copy link

@chingor13 can you approve?

@chingor13 chingor13 merged commit b3c1b68 into googleapis:master Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
4 participants