minitrace-rust icon indicating copy to clipboard operation
minitrace-rust copied to clipboard

Feature: Cargo feature - minitrace/max_level_off and minitrace/release_max_level_off

Open taqtiqa-mark opened this issue 2 years ago • 3 comments

In general I don't, yet, believe there is use for Minitrace counterparts to the Logging and Tracing crates features related to levels debug, warn, error and info.

I believe users are better served by leaving levels to the application author to setup via cfg/cfg_attr and Cargo features - supported by some documentation/guidance/template.

That said, I do think there is utility in Minitrace having the features (named for consistency with Logging and Tracing crates):

  • max_level_off
  • release_max_level_off

These features would control the value of some constant. The proc-macro-attribute #[trace(...)]checks this constant value before constructing a span. By default, span creation is enabled.

taqtiqa-mark avatar Mar 19 '22 10:03 taqtiqa-mark

cc @zhongzc

andylokandy avatar Mar 19 '22 16:03 andylokandy

I agree that we provide the same max_level_* and release_max_level_* like log.

Ref: https://docs.rs/log/latest/log/#compile-time-filters

zhongzc avatar Mar 21 '22 03:03 zhongzc

I agree that we provide the same max_level_* and release_max_level_* like log.

Hmm, I'm actually against implementing max_level_* and release_max_level_* like log, and I am only proposing/suggesting support for max_level_off and release_max_level_off.

I'm not sure that anyone is proposing we limit the levels the Minitrace supports. That is, currently Minitrace does not constrain users to adopt any particular level hierarchy. I'd like to keep things that way, at least that is my current thinking.

My concern is that having:

... max_level_* and release_max_level_* like log

is a usability restriction/limitation with no performance/run-time benefit.

taqtiqa-mark avatar Mar 21 '22 06:03 taqtiqa-mark

Discussed in https://github.com/tikv/minitrace-rust/issues/96

andylokandy avatar Jul 18 '23 15:07 andylokandy