-
Notifications
You must be signed in to change notification settings - Fork 711
Add GCP test and coverage targets #804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GCP test and coverage targets #804
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm seeing test failures still:
% pytest ext/opentelemetry-exporter-cloud-monitoring/tests/test_cloud_monitoring.py -k test_get_metric_descriptor
ext/opentelemetry-exporter-cloud-monitoring/tests/test_cloud_monitoring.py::TestCloudMonitoringMetricsExporter::test_get_metric_descriptor FAILED [100%]
========================================================================== FAILURES ===========================================================================
________________________________________________ TestCloudMonitoringMetricsExporter.test_get_metric_descriptor ________________________________________________
self = <tests.test_cloud_monitoring.TestCloudMonitoringMetricsExporter testMethod=test_get_metric_descriptor>
def test_get_metric_descriptor(self):
client = mock.Mock()
exporter = CloudMonitoringMetricsExporter(client=client)
exporter.project_name = self.project_name
self.assertIsNone(
> exporter._get_metric_descriptor(
MetricRecord(MockMetric(), (), UnsupportedAggregator())
)
)
ext/opentelemetry-exporter-cloud-monitoring/tests/test_cloud_monitoring.py:107:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <opentelemetry.exporter.cloud_monitoring.CloudMonitoringMetricsExporter object at 0x10b042310>
record = <opentelemetry.sdk.metrics.export.MetricRecord object at 0x109723d90>
def _get_metric_descriptor(
self, record: MetricRecord
) -> Optional[MetricDescriptor]:
""" We can map Metric to MetricDescriptor using Metric.name or
MetricDescriptor.type. We create the MetricDescriptor if it doesn't
exist already and cache it. Note that recreating MetricDescriptors is
a no-op if it already exists.
:param record:
:return:
"""
> instrument = record.instrument
E AttributeError: 'MetricRecord' object has no attribute 'instrument'
ext/opentelemetry-exporter-cloud-monitoring/src/opentelemetry/exporter/cloud_monitoring/__init__.py:70: AttributeError
Also a warning about using app default credentials, looks like some calls to GCP aren't getting mocked?
...ntelemetry-exporter-cloud-monitoring/src/opentelemetry/exporter/cloud_monitoring/__init__.py
Show resolved
Hide resolved
d55f780
to
43c797e
Compare
The calls to GCP were getting mocked, but theres another thing we do |
@c24t want to give a quick final pass and we'll merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks @AndrewAXue!
* chore: remove binary format Co-authored-by: Daniel Dyla <[email protected]>
I forgot to add the tests for Cloud Monitoring exporter into tox.ini :/