Contents

MetricReport.EncodingFormat

A value that controls the JSON structure used when encoding a metric report.

Declaration

enum EncodingFormat

Discussion

Set encodingFormatKey in a JSONEncoder’s userInfo dictionary to choose the encoding format before archiving reports:

let encoder = JSONEncoder()
encoder.userInfo[MetricReport.encodingFormatKey] = MetricReport.EncodingFormat.byStateReportingDomain
let data = try encoder.encode(report)

The .byStateReportingDomain format organizes metric values by MetricGroup, which can be more convenient for log pipelines that process one category at a time.

Topics

Encoding formats

See Also

Metric data