Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.
This repository was 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

Description

@tcsatheesh

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().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions