Description
Is your feature request related to a problem? Please describe.
We often have issues where a particular query or class of queries to a database is either sending or returning a lot of data in certain cases. Imagine a MongoDB or Postgres query for an object that pulls back an entire 4mb object, when it only needs a single field value (i.e. a projection could save most of that 4mb). This can be hard to track down without some kind of instrumentation, especially when using an ORM like ActiveRecord or Mongoid.
Describe the goal of the feature
Expose request and response byte sizes as span attributes that get interpreted as measures in the Datadog UX.
Describe alternatives you've considered
n/a
Additional context
We implemented this for Redis (see https://github.com/Appboy/dd-trace-rb/blob/upgrade-to-1.18/lib/datadog/tracing/contrib/redis/trace_middleware.rb#L71 and https://github.com/Appboy/dd-trace-rb/blob/upgrade-to-1.18/lib/datadog/tracing/contrib/redis/trace_middleware.rb#L99) pretty readily. It would be great if this were standard tags for integration spans. It would be really cool if these could be aggregated in the UX in traces somehow (e.g. "this endpoint's avg/p50/p95/p99 bytes received from xyz-mongodb is 1.2mb/1.2mb/2.8mb/4.1mb") or turned into some kind of network graph visualization between services.
How does ddtrace
help you?
It's fantastic :) Excellent for knowing what's going on in our system!