console icon indicating copy to clipboard operation
console copied to clipboard

Don't send task names as strings

Open hds opened this issue 1 year ago • 3 comments

What problem are you trying to solve?

Currently task names are sent as strings to tokio-console (the instrumentation client).

Instead they should be sent as metadata and the field value should be sent as a reference to the metadata element. This will reduce the data sent over the wire, especially in cases where a task with a fixed name is repeatedly spawned.

See comment for reference: https://github.com/tokio-rs/console/pull/452#discussion_r1316158519

How should the problem be solved?

Send task names as metadata and reference the metadata in the spawn event.

hds avatar Sep 06 '23 13:09 hds

Hi @hds, I am interested in implementing this feature. I believe we need to update the Field to expose the ID, as currently, we can only retrieve its name from the public API. Or have I misunderstood this feature?

Rustin170506 avatar Nov 28 '23 13:11 Rustin170506

@hi-rustin that's correct, this change will require an upstream change in tracing to expose the numeric index of a tracing::field::Field. I'm happy to merge a PR that makes such a change.

hawkw avatar Nov 28 '23 22:11 hawkw

I'm happy to merge a PR that makes such a change.

Thanks for your reply! I've submitted https://github.com/tokio-rs/tracing/pull/2820.

Rustin170506 avatar Nov 29 '23 12:11 Rustin170506