metrics-rs / metrics

A metrics ecosystem for Rust.
MIT License
1.08k stars 148 forks source link

new release with updated macros #403

Closed JaydenElliott closed 10 months ago

JaydenElliott commented 10 months ago

Hey, I was wondering if you could publish a new release to include the new macro code. I was having trouble figuring out why my code wasn't running, only to realise that I was missing metrics-macros + some other stuff which isn't mentioned on the main github readme.

tobz commented 10 months ago

Sounds like you're having a problem with the existing crate releases that is unrelated to any of the changes that are currently unreleased. Or you're having a problem with using unreleased features by pulling in metrics as a Git dependency?

Either way, can you update this issue with your actual problem and the steps to reproduce it?

JaydenElliott commented 10 months ago

There is no bug, just confusion in regards to crate releases that I assume other newcomers might have also. This was my process:

  1. searched for metrics on crates.io and imported latest 0.21.1.
  2. I then went to https://github.com/metrics-rs/metrics/tree/main/metrics/examples/basic and used the example counter syntax:
counter!("test_counter");
  1. Received error
    
    error: expected `,`
    --> src/main.rs:121:20
    |
    121 |     let counter1 = counter!("test_counter");
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `counter` (in Nightly builds, run with -Z macro-backtrace for more info)


After awhile, I realised that this version `0.21.1` requires a crate `metric-macros` that isn't listed anywhere on the main github page (as its not used anymore).

Just wondering when the next crates.io release will be? I am unable to directly use the repo in my cargo.toml due to some constraints. 
tobz commented 10 months ago

Gotcha, yeah.

When will the next release be?

I'm not sure when the next release will be, because there's a lot of stuff in flux at the moment that needs to be polished up, and other things slated to be included to get more of the breaking changes out of the way rather than having them be a slow trickle.

Let's say weeks from now (4-6 weeks) at the earliest, most likely.

Compilation error based on using the example code

That error wasn't telling you that a crate is missing -- because you would have gotten an error like "cannot find counter! in current scope" or something to that effect. The error above is telling you that you can't use the macro in that way.

Mismatch between API in released crate and latest code in source control

Thanks for providing the steps, now I can see what your mindset was.

It seems like the missing link here was just that you didn't actually select the Git tag corresponding to the release you were using to see the source code that the release was specifically cut from.

Generally speaking, there's really nothing I can do about that (development is likely to always be in flux, so you have to know to find the tag/branch that represents the crate version you're using) but I would ultimately suggest using the crate documentation as it exists in docs.rs. I've put a lot of effort into that side of things, so the example code in the crate documentation should always be representative of the version of metrics (or the various other metric-* crates) you're using.