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

Introduce tokio-trace #827

Merged
merged 61 commits into from
Feb 19, 2019
Merged

Introduce tokio-trace #827

merged 61 commits into from
Feb 19, 2019

Commits on Jan 15, 2019

  1. Add tokio-trace-core crate

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    c4cf988 View commit details
    Browse the repository at this point in the history
  2. Add tokio-trace crate

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    b60d478 View commit details
    Browse the repository at this point in the history
  3. Add licenses

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    c1212f0 View commit details
    Browse the repository at this point in the history
  4. Add a README to tokio-trace

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    754d4b6 View commit details
    Browse the repository at this point in the history
  5. Add more examples and usage information to the tokio-trace readme

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    8a10214 View commit details
    Browse the repository at this point in the history
  6. Add a README to the tokio-trace-core crate

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    00fa609 View commit details
    Browse the repository at this point in the history
  7. Add new docs/examples from READMEs to RustDoc

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    36059f6 View commit details
    Browse the repository at this point in the history
  8. Integrate upstream changes

    This picks up upstream changes from hawkw/tokio-trace-prototype#168.
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    bab2f40 View commit details
    Browse the repository at this point in the history
  9. Support setting targets in log-like event macros

    Apparently we were missing this. I wrote a doc example that used it and
    was surprised when it didn't work.
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    cf3ee71 View commit details
    Browse the repository at this point in the history
  10. Make doctest examples more compile-y

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    4720652 View commit details
    Browse the repository at this point in the history
  11. Disallow bad stuff in tokio-trace-core

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    5b07f84 View commit details
    Browse the repository at this point in the history
  12. Add support for no-message event! macro invocations

    Looks like this was overlooked in hawkw/tokio-trace-prototype#168.
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    f226df0 View commit details
    Browse the repository at this point in the history
  13. Fix event macros with more than one field

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    234ce89 View commit details
    Browse the repository at this point in the history
  14. Add RustDocs and examples to all event macros

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    7ea47e3 View commit details
    Browse the repository at this point in the history
  15. Add real tests for macros

    I didn't want these to be covered only by doctests.
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    53d8159 View commit details
    Browse the repository at this point in the history
  16. Handle missing cases for event! macro

    The new tests revealed these.
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    9d1f6d8 View commit details
    Browse the repository at this point in the history
  17. Stop benchmarks from breaking the build

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    3db8af9 View commit details
    Browse the repository at this point in the history
  18. *Actually* fix benchmarks breaking the build

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    25f7eea View commit details
    Browse the repository at this point in the history
  19. Clean up weird code in benchmarks

    I think this was originally intended to avoid the benchmarks getting
    optimized away, but that doesn't seem to be a problem.
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    603d39f View commit details
    Browse the repository at this point in the history
  20. A nonexistant subscriber should never be interested

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    1c31da1 View commit details
    Browse the repository at this point in the history
  21. Update copyright date in tokio-trace/LICENSE

    Thanks to @seanmonstar.
    
    Co-Authored-By: hawkw <eliza@buoyant.io>
    seanmonstar and hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    13caf1e View commit details
    Browse the repository at this point in the history
  22. Document when to use spans versus events

    Thanks to @davidbarsky!
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    39947e9 View commit details
    Browse the repository at this point in the history
  23. Remove vestigial lifetime

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    3e00d91 View commit details
    Browse the repository at this point in the history
  24. Seal the field::Record and field::AsField traits

    As suggested by @seanmonstar.
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    b7f51fc View commit details
    Browse the repository at this point in the history
  25. Document why events in log-like macros are dropped

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    5c3935b View commit details
    Browse the repository at this point in the history
  26. Use a drop guard in dispatcher::with_default

    As suggested by @seanmonstar.
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    a75120e View commit details
    Browse the repository at this point in the history
  27. Change deny attribute to match tokio-sync

    Co-Authored-By: hawkw <eliza@buoyant.io>
    carllerche and hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    2108be8 View commit details
    Browse the repository at this point in the history
  28. Update date in tokio-trace/tokio-trace-core/LICENSE

    Co-Authored-By: hawkw <eliza@buoyant.io>
    carllerche and hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    4855fb2 View commit details
    Browse the repository at this point in the history
  29. Remove weird glob import

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    788fb88 View commit details
    Browse the repository at this point in the history
  30. Rename field_named -> field

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    35aefd0 View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    6745db6 View commit details
    Browse the repository at this point in the history
  32. Misc cleanup

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    851662e View commit details
    Browse the repository at this point in the history
  33. Replace Interest consts with functions

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    6072167 View commit details
    Browse the repository at this point in the history
  34. Make Field::name infallible

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    ecd7bb1 View commit details
    Browse the repository at this point in the history
  35. Move CURRENT_DISPATCH to tokio-trace-core

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    7c4fa3e View commit details
    Browse the repository at this point in the history
  36. Assorted minor docs fixes

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    194e404 View commit details
    Browse the repository at this point in the history
  37. Add examples for tokio-trace-core macros

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    30088ab View commit details
    Browse the repository at this point in the history
  38. More assorted docs fixes

    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    5acc8bc View commit details
    Browse the repository at this point in the history
  39. Dispatch no longer implements Subscriber

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    7eeeae6 View commit details
    Browse the repository at this point in the history
  40. Configuration menu
    Copy the full SHA
    9478dbe View commit details
    Browse the repository at this point in the history
  41. Remove CurrentSpanPerThread

    It should eventually live in the `tokio-trace-subscriber` crate.
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    39eded2 View commit details
    Browse the repository at this point in the history
  42. rustfmt

    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    1808355 View commit details
    Browse the repository at this point in the history
  43. fix em dashes for @davidbarsky

    hawkw committed Jan 15, 2019
    Configuration menu
    Copy the full SHA
    3991923 View commit details
    Browse the repository at this point in the history

Commits on Jan 17, 2019

  1. Fix typo

    hawkw committed Jan 17, 2019
    Configuration menu
    Copy the full SHA
    cd8e609 View commit details
    Browse the repository at this point in the history
  2. Span::close should close spans immediately

    (like the docs say it does)
    hawkw committed Jan 17, 2019
    Configuration menu
    Copy the full SHA
    eb438ef View commit details
    Browse the repository at this point in the history
  3. More docs improvement

    thanks to @stjepang!
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 17, 2019
    Configuration menu
    Copy the full SHA
    9d018ea View commit details
    Browse the repository at this point in the history

Commits on Jan 18, 2019

  1. Inline Interest::is_*

    This shaves about 1-2ns off the disabled span benchmarks
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 18, 2019
    Configuration menu
    Copy the full SHA
    e867ffc View commit details
    Browse the repository at this point in the history
  2. Inline the hottest Span methods

    hawkw committed Jan 18, 2019
    Configuration menu
    Copy the full SHA
    f0170be View commit details
    Browse the repository at this point in the history
  3. macros: Move test for NEVER interest to callsite

    This lets us completely skip `Span::new` in this case. This brings the benchmarks for the disabled case back into parity with `log`.
    
    Before:
    ```
         Running target/release/deps/no_subscriber-1064195d321c8640
    
    running 5 tests
    test bench_1_atomic_load              ... bench:           0 ns/iter (+/- 0)
    test bench_costly_field_no_subscriber ... bench:           6 ns/iter (+/- 0)
    test bench_log_no_logger              ... bench:           0 ns/iter (+/- 0)
    test bench_no_span_no_subscriber      ... bench:           0 ns/iter (+/- 0)
    test bench_span_no_subscriber         ... bench:           6 ns/iter (+/- 0)
    
    test result: ok. 0 passed; 0 failed; 0 ignored; 5 measured; 0 filtered out
    
         Running target/release/deps/subscriber-7319775649c47f41
    
    running 4 tests
    test span_no_fields          ... bench:          37 ns/iter (+/- 10)
    test span_repeatedly         ... bench:       5,626 ns/iter (+/- 812)
    test span_with_fields        ... bench:         101 ns/iter (+/- 20)
    test span_with_fields_record ... bench:       1,035 ns/iter (+/- 171)
    
    test result: ok. 0 passed; 0 failed; 0 ignored; 4 measured; 0 filtered out
    ```
    After:
    ```
         Running target/release/deps/no_subscriber-1064195d321c8640
    
    running 5 tests
    test bench_1_atomic_load              ... bench:           0 ns/iter (+/- 0)
    test bench_costly_field_no_subscriber ... bench:           0 ns/iter (+/- 0)
    test bench_log_no_logger              ... bench:           0 ns/iter (+/- 0)
    test bench_no_span_no_subscriber      ... bench:           0 ns/iter (+/- 0)
    test bench_span_no_subscriber         ... bench:           0 ns/iter (+/- 0)
    
    test result: ok. 0 passed; 0 failed; 0 ignored; 5 measured; 0 filtered out
    
         Running target/release/deps/subscriber-7319775649c47f41
    
    running 4 tests
    test span_no_fields          ... bench:          36 ns/iter (+/- 8)
    test span_repeatedly         ... bench:       5,381 ns/iter (+/- 1,075)
    test span_with_fields        ... bench:         110 ns/iter (+/- 19)
    test span_with_fields_record ... bench:       1,019 ns/iter (+/- 247)
    
    test result: ok. 0 passed; 0 failed; 0 ignored; 4 measured; 0 filtered out
    ```
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jan 18, 2019
    Configuration menu
    Copy the full SHA
    d1195ef View commit details
    Browse the repository at this point in the history
  4. All event invocations should skip the never case

    Ugh, code duplication :/
    hawkw committed Jan 18, 2019
    Configuration menu
    Copy the full SHA
    096b3a7 View commit details
    Browse the repository at this point in the history

Commits on Feb 6, 2019

  1. trace: Improve support for batching field values (#880)

    This branch reworks `tokio-trace`'s field recording APIs to improve
    performance in cases where field values are provided in batches. 
    
    `tokio-trace` supports recording values for span fields either when the
    span is constructed, or at any point during its lifetime. In order to
    support this, the current implementation represents each field value
    recorded with a separate call to a `Subscriber::record_$TYPE` function.
    This can incur significant overhead --- for example, if the span data is
    stored behind a mutex, every call to `record` must reacquire the lock. 
    
    Providing most or all of the fields on a span up-front as it is
    constructed is likely to be the common case, but in the current design,
    this use-case has to pay performance costs in order to support the less
    common case of adding values post-initialization. Even in situations
    where some field values are unknown, if a majority are recorded at
    construction-time, each individual value takes a separate trip through
    the `record` pipeline.
    
    This branch rewrites this API so that all field recording is done by a
    `ValueSet` type, which groups together multiple values. A subscriber may
    pass an implementation of `Record` to the `ValueSet`'s `record`
    function, which will record all the provided values with that recorder.
    When a span is constructed, the `Subscriber::new_span` method is called
    with a `ValueSet` containing all the fields provided to the `span!`
    macro, and additional fields may be recorded either individually or in
    batches.
    
    In addition, the previous implementation of `Event`s on top of `Span`s
    has been removed and replaced with a new `Event` type which goes through
    a separate `Subscriber::event` function. Events are always known to have
    all their values at construction time, since the event cannot live long
    enough to have more values added. Thus, an `Event` also contains a
    `ValueSet`.
    
    I've added new test-support code for expecting certain fields to be
    recorded by spans and events, and written new tests to cover this
    behaviour. I've also updated the example code, and my experience doing
    so suggests that the new API is also somewhat more ergonomic to use.
    
    These changes result in significant improvement on the benchmark that
    simulates recording multiple fields on a span 
    (`bench_span_with_fields_record`).
    
    Before:
    ```
         Running target/release/deps/no_subscriber-a6af9f5aa4934184
    
    running 5 tests
    test bench_1_atomic_load              ... bench:           0 ns/iter (+/- 0)
    test bench_costly_field_no_subscriber ... bench:           0 ns/iter (+/- 0)
    test bench_log_no_logger              ... bench:           0 ns/iter (+/- 0)
    test bench_no_span_no_subscriber      ... bench:           0 ns/iter (+/- 0)
    test bench_span_no_subscriber         ... bench:           0 ns/iter (+/- 0)
    
    test result: ok. 0 passed; 0 failed; 0 ignored; 5 measured; 0 filtered out
    
         Running target/release/deps/subscriber-ba753dc1d87e480d
    
    running 4 tests
    test span_no_fields          ... bench:          41 ns/iter (+/- 5)
    test span_repeatedly         ... bench:       5,418 ns/iter (+/- 658)
    test span_with_fields        ... bench:         110 ns/iter (+/- 42)
    test span_with_fields_record ... bench:       1,047 ns/iter (+/- 240)
    
    test result: ok. 0 passed; 0 failed; 0 ignored; 4 measured; 0 filtered out
    ```
    
    After:
    ```
         Running target/release/deps/no_subscriber-611d60b262fbbcfb
    
    running 5 tests
    test bench_1_atomic_load              ... bench:           0 ns/iter (+/- 0)
    test bench_costly_field_no_subscriber ... bench:           1 ns/iter (+/- 0)
    test bench_log_no_logger              ... bench:           0 ns/iter (+/- 0)
    test bench_no_span_no_subscriber      ... bench:           0 ns/iter (+/- 0)
    test bench_span_no_subscriber         ... bench:           0 ns/iter (+/- 0)
    
    test result: ok. 0 passed; 0 failed; 0 ignored; 5 measured; 0 filtered out
    
         Running target/release/deps/subscriber-7a1279c84c0d50ff
    
    running 4 tests
    test span_no_fields          ... bench:          37 ns/iter (+/- 9)
    test span_repeatedly         ... bench:       4,502 ns/iter (+/- 712)
    test span_with_fields        ... bench:          54 ns/iter (+/- 17)
    test span_with_fields_record ... bench:         364 ns/iter (+/- 38)
    
    test result: ok. 0 passed; 0 failed; 0 ignored; 4 measured; 0 filtered out
    ```
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw authored Feb 6, 2019
    Configuration menu
    Copy the full SHA
    9dc0129 View commit details
    Browse the repository at this point in the history
  2. Re-introduce ValueSet length limit

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Feb 6, 2019
    Configuration menu
    Copy the full SHA
    fc2fa65 View commit details
    Browse the repository at this point in the history

Commits on Feb 7, 2019

  1. Add some utility impls for Record

    These have to be in `-core` due to the orphan rules, but seem very
    handy.
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Feb 7, 2019
    Configuration menu
    Copy the full SHA
    e56cb74 View commit details
    Browse the repository at this point in the history
  2. Fix callsite macro not accepting string field names

    The `trace_dbg!` macro requires this.
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Feb 7, 2019
    Configuration menu
    Copy the full SHA
    7f590f5 View commit details
    Browse the repository at this point in the history
  3. Add From<Subscriber> impl for Dispatch

    See also tokio-rs/tracing@5296a4c
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Feb 7, 2019
    Configuration menu
    Copy the full SHA
    f2c8354 View commit details
    Browse the repository at this point in the history

Commits on Feb 12, 2019

  1. tokio-trace: Extend macros to allow trailing commas (#891)

    Trailing commas are optional when fields are included, and when fields
    are delimited from the format string for the message.
    
    Before these would error:
    ```
    event!(tokio_trace::Level::DEBUG, foo = 3, bar = 3,);
    event!(tokio_trace::Level::DEBUG, { foo = 2, bar = 78, }, "baz");
    ```
    
    Now they do not. Tests have been extended.
    
    Signed-off-by: Kevin Leimkuhler <kevinl@buoyant.io>
    kleimkuhler authored and hawkw committed Feb 12, 2019
    Configuration menu
    Copy the full SHA
    93e66e6 View commit details
    Browse the repository at this point in the history
  2. tokio-trace: Extend span! rules (#893)

    * tokio-trace: Extend `span!` rules
    
    Add the ability to define a target and log level for
    individual spans.
    
    `level: ...` must be included since both `$lvl` and `$name` are `expr`.
    
    The macro tests and documentation tests have been extended.
    
    Signed-off-by: Kevin Leimkuhler <kevinl@buoyant.io>
    
    * Add additional `span!` test
    
    Change default log level of `span!` to `TRACE` to reflect the default
    level used in `callsite!`.
    
    Signed-off-by: Kevin Leimkuhler <kevinl@buoyant.io>
    kleimkuhler authored and hawkw committed Feb 12, 2019
    Configuration menu
    Copy the full SHA
    4b163eb View commit details
    Browse the repository at this point in the history

Commits on Feb 19, 2019

  1. Don't publish tokio-trace/tokio-trace-core yet

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Feb 19, 2019
    Configuration menu
    Copy the full SHA
    d3e5735 View commit details
    Browse the repository at this point in the history
  2. Rename Enter to Inner

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Feb 19, 2019
    Configuration menu
    Copy the full SHA
    37c4dcb View commit details
    Browse the repository at this point in the history
  3. *Actually* rename Enter to Inner

    Looks like RLS missed a couple uses
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Feb 19, 2019
    Configuration menu
    Copy the full SHA
    f07bcc2 View commit details
    Browse the repository at this point in the history
  4. run rustfmt

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Feb 19, 2019
    Configuration menu
    Copy the full SHA
    bf798d9 View commit details
    Browse the repository at this point in the history