Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Replace MonitoredResource with Resource#508

Merged
c24t merged 5 commits intocensus-instrumentation:masterfrom
c24t:resources
Feb 20, 2019
Merged

Replace MonitoredResource with Resource#508
c24t merged 5 commits intocensus-instrumentation:masterfrom
c24t:resources

Conversation

@c24t
Copy link
Copy Markdown
Member

@c24t c24t commented Feb 20, 2019

This PR:

  • adds a new Resource class that implements the Resource API spec
  • removes all MonitoredResource classes and changes get_instance so that it returns a Resource instead of a MonitoredResource
  • removes the monitored_resource_util module and moves its contents into monitored_resource
  • updates the stackdriver exporters and tests to reflect these changes

See also the PR to deprecate MonitoredResource in the java client.

I'll rename the monitored_resource_util package monitored_resource in another PR.

Addresses #457.

@c24t c24t requested a review from mayurkale22 February 20, 2019 01:46
@c24t c24t requested review from a team, reyang and songy23 as code owners February 20, 2019 01:46

class MonitoredResource(object):
"""MonitoredResource returns the resource type and resource labels.
def is_gke_environment():
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The is_x_environment methods were moved from utils.

Comment thread opencensus/common/monitored_resource_util/monitored_resource.py Outdated
self.assertEquals(resource.get_type(), 'aws_ec2_instance')
self.assertEquals(resource.get_labels(), mocked_labels)

def test_gke_environment(self):
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

These tests were moved from test_monitored_resource_util.

Comment thread opencensus/common/resource.py
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 overall. Note that gke_container resource is now replaced with k8s_containter resource, and it needs to be updated in the following PRs.

@c24t c24t merged commit 4eb2f79 into census-instrumentation:master Feb 20, 2019
@c24t c24t deleted the resources branch February 20, 2019 22:36
@c24t c24t added the resources label Feb 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants