client_java icon indicating copy to clipboard operation
client_java copied to clipboard

Add Exemplar.toString

Open anuraaga opened this issue 4 years ago • 2 comments
trafficstars

Useful for example, in test assertions, see https://github.com/open-telemetry/opentelemetry-java/pull/3353/files#diff-10589ce2b6c8942193e382b96c566ac748a995454f2d7527b2bb7e762cd520f1R422

@fstab

/cc @jseureth

anuraaga avatar Jul 06 '21 04:07 anuraaga

Thanks for the PR. It would be useful to produce the same format as TextFormat.writeOpenMetrics100(), so that the toString() representation doesn't differ from the OpenMetrics format. What do you think?

fstab avatar Jul 08 '21 20:07 fstab

Thanks @fstab - I took a look in but it seems quite difficult since TextFormat has some fairly complicated private methods such as omWriteTimestamp. Not to mention that TextFormat is not in simpleclient. So it's an interesting idea but I think unless we were to move at least some TextFormat logic into simpleclient it doesn't seem practical, it's essentially a circular dependency. I suppose conceptually speaking, simpleclient is protocol-agnostic, so expecting toString to follow a protocol is probably not practical.

anuraaga avatar Jul 09 '21 02:07 anuraaga