Skip to content
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

Feature: Valuable support or record!(span,"key", "value") #138

Closed
taqtiqa-mark opened this issue Apr 12, 2022 · 2 comments
Closed

Feature: Valuable support or record!(span,"key", "value") #138

taqtiqa-mark opened this issue Apr 12, 2022 · 2 comments

Comments

@taqtiqa-mark
Copy link
Contributor

taqtiqa-mark commented Apr 12, 2022

We should document whether or not we support the valuable crate. The tracing crate has announced experimental support

Use case:
This allows users to record both user-defined types, and standard library collections such as Vec and HashMap, as structured data attached to tracing spans.

Case For

  1. We mimic the tracing crate - its familiar for tracing users.
  2. It is convenient.

Case Against

  1. It's a special-purpose use case, e.g. debugging, we can likely better support more simply.
  2. We should discourage pushing complex user-defined types, and standard library collections to the tracing UI as a general practice - moving such volumes of data around the network will cripple your app performance - see 1.
  3. As we mimic tracing crate behavior we can expect to approach tracing "like" performance.
  4. It's yet another crate to build.

One Alternative

Better, in my mind, is to stick with a simple record!(span, "key", "value") API.
For more complex use cases, the documents should encourage users to employ the standard format!(). Specifically, for example: record!(span, "key", format!("{:#?}", udt)). For more complex user defined types and data they have the ability to implement Display and/or Debug traits. The Debug trait will likely already exist in most development stories. In performance monitoring stories there are strong incentives to keep-it-simple, and here the Display trait can be repurposed to support that use case.

We should document whether or not "Object-safe value inspection, used to pass un-typed structured data across trait-object boundaries." is within the scope of Minitrace, or not.
I think not.

Thoughts?

In particular, my focus (head-space), is occupied by the #[trace] attribute... there may be Minitrace implementation details that mean it is more performant to use the valuable crate when recording and passing these data to Jaeger, datadog etc.

@taqtiqa-mark taqtiqa-mark changed the title Doc: Valuable support or Feature: record("key", "value") Feature: Valuable support or record("key", "value") Apr 12, 2022
@taqtiqa-mark
Copy link
Contributor Author

Better, in my mind, is to stick with a simple span.record("key", "value") API.

In fact we could make the public API even smaller with record!(span,"key", "value")

@taqtiqa-mark taqtiqa-mark changed the title Feature: Valuable support or record("key", "value") Feature: Valuable support or record!(span,"key", "value") Apr 27, 2022
@andylokandy
Copy link
Collaborator

since minitrace is compatible with the log crate, the structured log can be attached to span via logging macro from log crate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants