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

[tracing-core] Remove `static requirement from Event #1048

Closed
wants to merge 34 commits into from

Conversation

dvdplm
Copy link
Contributor

@dvdplm dvdplm commented Oct 18, 2020

As mentioned on the 0.2 breaking changes tracking ticket, #922, there's an opportunity to make less use of 'static items for core types, making tracing easier to deploy in "non-vanilla" contexts such as non-browser Wasm.

This PR explores what it would look like to change Event<'a> from taking &'static Metadata<'static> to &'a Metadata<'b>.

The code here builds on a previous PR, #1020, where the 'static strings of the Metadata were changed to Cow<'a, str>. I think the changes here could be made without that PR, but still have to try that.

Relevant commits.

There are likely plenty of fallout from this PR in other parts of the code, but I still wanted to put this up as a draft to discuss the direction.

Closes #1047

NOTE: requires changes in opentelemetry-rust as well
…e to just have `name` be a `Cow<'a, str>` instead for clarity.
* master:
  tracing: Instrument std::future::Future (tokio-rs#808)
  tracing: move `ValueSet` construction out of closures (tokio-rs#987)
Store Cows for name and target but return &str
Change test-only `CloseState` to use `String`
Undo a few changes that are no longer necessary
* upstream/master:
  subscriber: warn if trying to enable a statically disabled level (tokio-rs#990)
  subscriber: use macros for module declarations (tokio-rs#1009)
  chore: remove `stdlib.rs` (tokio-rs#1008)
  core: fix linked list tests reusing `Registration`s (tokio-rs#1016)
  subscriber: support dash in target names (tokio-rs#1012)
  docs: switch to intra-doc links in tracing-core (tokio-rs#1010)
  tracing-opentelemetry: implement additional record types (bool, i64, u64) (tokio-rs#1007)
  core: add intrusive linked list for callsite registry (tokio-rs#988)
  serde: allow tracing-serde to work on no_std. (tokio-rs#960)
  tracing: remove `Into<Option<Id>>` impl for `Span` (tokio-rs#1003)
  tracing: make `Entered` `!Send` (tokio-rs#1001)
  chore: fix nightly clippy warnings (tokio-rs#991)
  chore: bump all crate versions (tokio-rs#998)
  macros: fix the `tracing-macros` crate not compiling (tokio-rs#1000)
  tracing: prepare to release 0.1.21 (tokio-rs#997)
  core: prepare to release 0.1.17 (tokio-rs#996)
  subscriber: make `PartialOrd` & `Ord` impls more correct (tokio-rs#995)
  core, tracing: don't inline dispatcher::get_default (tokio-rs#994)
  core: make `Level` and `LevelFilter` `Copy` (tokio-rs#992)
* upstream/master:
  opentelemetry: prepare for 0.8.0 release (tokio-rs#1036)
  docs: add favicon for extra pretty docs (tokio-rs#1033)
  subscriber: fix `reload` ergonomics (tokio-rs#1035)
  chore(deps): update crossbeam-channel requirement from 0.4.2 to 0.5.0 (tokio-rs#1031)
  opentelemetry: Assign default ids if missing (tokio-rs#1027)
  chore: remove deprecated add-path from CI (tokio-rs#1026)
  attributes:  fix `#[instrument(err)]` in case of early returns (tokio-rs#1006)
  core: remove mandatory liballoc dependency with no-std (tokio-rs#1017)
  chore(deps): update cfg-if requirement from 0.1.10 to 1.0.0 (tokio-rs#1023)
* upstream/master:
  chore(deps): update pin-project requirement from 0.4 to 1.0 (tokio-rs#1038)
  chore: remove duplicated section from tracing/README.md (tokio-rs#1046)
* upstream/master:
  subscriber: remove TraceLogger (tokio-rs#1052)
  subscriber: make Registry::enter/exit much faster (tokio-rs#1058)
  chore(deps): update env_logger requirement from 0.7 to 0.8 (tokio-rs#1050)
* dp-target-is-cow:
  subscriber: remove TraceLogger (tokio-rs#1052)
  subscriber: make Registry::enter/exit much faster (tokio-rs#1058)
  Use impl Into<Cow<'a, str>
  chore(deps): update env_logger requirement from 0.7 to 0.8 (tokio-rs#1050)
  No need for extra lifetime
  Add constructor for dynamic data
  chore: fix tracing-macros::dbg (tokio-rs#1054)
  Feature gate usage of Cow in Metadata
  chore(deps): update pin-project requirement from 0.4 to 1.0 (tokio-rs#1038)
  chore: remove duplicated section from tracing/README.md (tokio-rs#1046)
* upstream/master:
  subscriber: update sharded-slab to 0.1, pool hashmap allocations (tokio-rs#1062)
  subscriber: remove deprecated type, structs, and methods tokio-rs#1030
  core: rename Subscriber to Collect (tokio-rs#1015)
  chore: fix rustdoc warning in tracing-subscriber (tokio-rs#1061)
* dp-target-is-cow:
  subscriber: update sharded-slab to 0.1, pool hashmap allocations (tokio-rs#1062)
  subscriber: remove deprecated type, structs, and methods tokio-rs#1030
  core: rename Subscriber to Collect (tokio-rs#1015)
  chore: fix rustdoc warning in tracing-subscriber (tokio-rs#1061)
@bryangarza
Copy link
Member

@dvdplm - Seems that no one took a look at the Draft when you originally posted it. I am doing some cleanup on the open PRs. Could you please reopen if you would like to start the conversation back up? Thanks!

@bryangarza bryangarza closed this May 6, 2022
@bryangarza bryangarza added this to Untriaged PRs in PR finish line via automation May 9, 2022
@bryangarza bryangarza moved this from Untriaged PRs to Done in PR finish line May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Consider changing Event struct to have non-'static metadata (Cow?)
2 participants