Skip to content
This repository was archived by the owner on Dec 23, 2023. It is now read-only.

Deprecate MonitoredResource and change to use Resource.#1718

Merged
bogdandrutu merged 4 commits intocensus-instrumentation:masterfrom
bogdandrutu:monitored
Jan 30, 2019
Merged

Deprecate MonitoredResource and change to use Resource.#1718
bogdandrutu merged 4 commits intocensus-instrumentation:masterfrom
bogdandrutu:monitored

Conversation

@bogdandrutu
Copy link
Copy Markdown
Contributor

No description provided.

@mayurkale22
Copy link
Copy Markdown
Member

Can we combine this with #1590?

@bogdandrutu
Copy link
Copy Markdown
Contributor Author

@mayurkale22 feel free to push a PR after this 👍 (seriously already large changes, I was actually trying to understand how to split, put I think is simple enough)

@songy23
Copy link
Copy Markdown
Contributor

songy23 commented Jan 30, 2019

Please fix the nullness checker.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Jan 30, 2019

Codecov Report

Merging #1718 into master will increase coverage by 0.18%.
The diff coverage is 88.63%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1718      +/-   ##
============================================
+ Coverage     81.99%   82.17%   +0.18%     
- Complexity     1904     1909       +5     
============================================
  Files           280      283       +3     
  Lines          8937     8956      +19     
  Branches        850      849       -1     
============================================
+ Hits           7328     7360      +32     
+ Misses         1327     1316      -11     
+ Partials        282      280       -2
Impacted Files Coverage Δ Complexity Δ
...race/stackdriver/StackdriverV2ExporterHandler.java 86.2% <100%> (+0.05%) 42 <0> (ø) ⬇️
...s/contrib/monitoredresource/util/ResourceType.java 100% <100%> (ø) 1 <1> (ø) ⬇️
...rter/stats/stackdriver/StackdriverExportUtils.java 90.74% <100%> (+0.03%) 57 <0> (ø) ⬇️
...monitoredresource/util/GcpGceInstanceResource.java 100% <100%> (ø) 3 <3> (?)
...monitoredresource/util/MonitoredResourceUtils.java 31.25% <28.57%> (ø) 2 <0> (ø) ⬇️
...trib/monitoredresource/util/MonitoredResource.java 92.1% <90.32%> (+24.18%) 1 <0> (-2) ⬇️
...b/monitoredresource/util/K8sContainerResource.java 90.9% <90.9%> (ø) 2 <2> (?)
...monitoredresource/util/AwsEc2InstanceResource.java 91.66% <91.66%> (ø) 2 <2> (?)
... and 2 more

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 e8cba95...53cf379. Read the comment docs.

@bogdandrutu
Copy link
Copy Markdown
Contributor Author

@songy23 done

@songy23
Copy link
Copy Markdown
Contributor

songy23 commented Jan 30, 2019

Please fix the import.

@bogdandrutu
Copy link
Copy Markdown
Contributor Author

@songy23 finally working.

Copy link
Copy Markdown
Contributor

@songy23 songy23 left a comment

Choose a reason for hiding this comment

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

LGTM except minor comments.

*/
public abstract String getAccount();
public String getAccount() {
return firstNonNull(awsInstanceLabels.get(AwsEc2InstanceResource.ACCOUNT_ID_KEY), "");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

`firstNonNull here is not needed because it's already called: https://github.com/census-instrumentation/opencensus-java/pull/1718/files#diff-e0f6d1e015f871479d844cca09da8bc7R34. Same for all others in this class.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ignore this comment - just saw this is the key not the value.

*
* @since 0.20
*/
public class K8sContainerResource {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So project, instance-id and zone do not apply to the k8s resource?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

They are not related to k8s resource, but when we do autodetection if the pod/container runs on a GCE instance they will be added in the resource merging.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OK, make sense.

*
* @since 0.20
*/
public class K8sContainerResource {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OK, make sense.

@bogdandrutu bogdandrutu merged commit 1cd62e4 into census-instrumentation:master Jan 30, 2019
@bogdandrutu bogdandrutu deleted the monitored branch January 30, 2019 23:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants