iand675 / hs-opentelemetry

OpenTelemetry support for the Haskell programming language
https://iankduncan.com/projects/opentelemetry
BSD 3-Clause "New" or "Revised" License
75 stars 34 forks source link

Refactored LogRecords to be mutable so that attributes can be modified after creation #131

Closed evanlauer1 closed 4 months ago

evanlauer1 commented 5 months ago

Big Context

Logging Support is being added to hs-opentelemetry. Logging spec

Small (This PR) Context

LogRecords should be modifiable after creation for the purposes of LogRecordProcessors. This PR refactors LogRecord to contain a mutable IORef to an ImmutableLogRecord. It also adds convenience functions for adding attributes to LogRecords and a test suite that tests LoggerProviders and LogRecords.

LogRecords can only be read through the functions of ReadableLogRecord and modified by the functions of ReadWriteLogRecord. This is in accordance with the spec.

The type of the body field was changed from a type variable to an AnyValue so that processors and exporters can process logs from various sources that might have different body types.

Testing

evanlauer1 commented 5 months ago

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @evanlauer1 and the rest of your teammates on Graphite Graphite