Public Dto objects locked down with internal constructors - Outside Code Review #5770
Replies: 2 comments 8 replies
-
Can you elaborate on this? OTLPExporter from this repo allows exporting to OTel Collector already. What is it missing? |
Beta Was this translation helpful? Give feedback.
-
I will share with you some snap shots, but keep in mind this all started with a tracing system that does not use system.diagnotics.activity and was implemented from the ground up based on our understanding of the W3C open telemetry and trace context white papers. we started to implement our own ILoggerProvider and wanted be able to export to an otel collector. we learned that we will need to transform what the Microsoft logger outputs to a protobuf request. are first attempt involved instantiating the OtlpLogExporter, then instantiating an instance of OpenTelemetry.Logs.LogRecord so we could map the log record. this is where it becomes impossible to use OtlpLogExporter without resorting to hacking the log record. there is no public constructor available and I refuse to resort to reflection to initialize a class from a SDK. because it means that class can change at any time and then I will have to refactor and rebuild. I think it is still funny that you have an obsolete internal constructor that states, don't remove because implementations are calling this via reflection. the one thing you could do to make this work for me and probable everyone else. is visit each of your OtlpExporters and make it so we have the ability transform our own object into the protobuf service request for the signal that is being exported. and not hard code us to object conventions that microsoft has used. not everyone is onboard with the one family framework. even turning the LogRecord into ILogRecord and give us a public interface that can be passed to the exporter would meet the needs and still have your code locked down nice and tight and all internalized. |
Beta Was this translation helpful? Give feedback.
-
I have been learning about open telemetry by building some instrumentation from the context up. I have now started looking at how I can integrate with the OtelCollectors. This is where things got rough. I soon discovered that the LogMessage Dto does not have a public default constructor. I would have to resort to reflection to instantiate a message. as a systems architect I do not condone hacks in order to accomplish something, because of the risk of breakage in future versions of an SDK.
I started a code review of the open telemetry api. I have discovered a few things.
as a consumer of this software, what I would like to see happen.
revisit all public facing data contracts and add a public default constructor, this will make it easy and not a hack to map from 3rd party log, trace, metrics to an open telemetry signal contract.
open up the transformers and exporters so we can export our 3rd party signal and transform it into a open telemetry signal.
Beta Was this translation helpful? Give feedback.
All reactions