Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Latest version 0.3b0 raises an error that Envelope is not JSON serializable #91

Closed
tcsatheesh opened this issue May 21, 2020 · 2 comments

Comments

@tcsatheesh
Copy link

tcsatheesh commented May 21, 2020

When trying the sample from https://github.com/microsoft/opentelemetry-azure-monitor-python/blob/master/azure_monitor/examples/metrics/observer.py I get the error

TypeError: Object of type 'Envelope' is not JSON serializable..

My current hack/workaround is to update this function
def _metric_to_envelope( self, metric_record: MetricRecord ) -> protocol.Envelope:

in this file https://github.com/microsoft/opentelemetry-azure-monitor-python/blob/master/azure_monitor/src/azure_monitor/export/metrics/__init__.py

to return a dictionary.
return envelope.to_dict().

@lzchen
Copy link
Contributor

lzchen commented May 21, 2020

Nice. Thanks for catching this. PR [#92] will fix this issue.

@lzchen
Copy link
Contributor

lzchen commented May 21, 2020

Fixed in v0.3b1

@lzchen lzchen closed this as completed Jun 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants