-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Size() method to pdata Structures #5920
Comments
This operation is pretty expensive, and we try to discourage the use of this in metrics, since the amount of CPU needed to calculate this is way too much compare with the usefulness. This may change when we change to lazy unmarshalling, but I would suggest to retain that until then. As an alternative for the moment you still have |
@bogdandrutu I wasn't aware of the |
@bogdandrutu One note about this it's not very friendly to interact with. Seems like the only way to get a |
Someone closed to soon this #3842 Happy to review a proposed API (short PR just showing the public things initially to discuss). |
Where do you intend to use this? As mentioned usually is expensive operation and value added is not worth it (in my opinion) |
@bogdandrutu We plan to use it to observe how data flow changes over a pipeline. While the operation is expensive we plan to mitigate that by doing sampling and short-duration observations. |
fyi: @cpheps we have a metric at grpc/http level for bytes received/exported that may help, that is cheap to have. |
Currently all the pdata structures have a way to count the number of objects in them:
LogRecordCount()
MetricCount()
andDataPointCount()
SpanCount()
It would be useful in some cases to have access to the size of the pdata structure. The primary use case would be so components could measure their data throughput and record it via custom telemetry metrics. I have done some benchmarks and this operation can be expensive at scale. Due to this I would not want to include the data throughput metrics in the current set of built in component metrics.
The implementation is very straight forward for all pdata types, here is an example using metrics:
This will give the protobuf size of the object, counting all the sub objects. I would want to add a warning to the function comment indicating possible performance impact at scale.
The text was updated successfully, but these errors were encountered: