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

Logging metrics factory #70

Open
glbrntt opened this issue May 1, 2020 · 11 comments
Open

Logging metrics factory #70

glbrntt opened this issue May 1, 2020 · 11 comments

Comments

@glbrntt
Copy link

glbrntt commented May 1, 2020

When adding metrics to an application or framework it would be useful to have some indication of the metrics emitted during execution to serve as a basic sanity check ("when I do this does metric X get emitted?").

Providing a metrics factory which prints to stdout/stderr whenever a value is recorded would be helpful for this case. Is this something we think we should provide in swift-metrics?

@ktoso
Copy link
Member

ktoso commented May 1, 2020

Sounds like a useful one -- I have a similar thing in my projects where it can capture the emitted metrics and assertions can be performed on them.

I do agree that it's useful, but I'm also on the side that swift-metrics (and swift-log) should contain no implementations, all backends should be external libs, even if small ones IMHO and these libs are best to remain as little impl and opinionated as possible (main reason being that this is a tremendously slippery slope, once we add a small thing, and another small thing, people get used to "the lib has things" and more and more stuff gets added).

I'm supportive, but would love to find a way we can put those not as the part of "the API project". If it's too difficult for such under the apple/ namespace perhaps we could use the swift-server org or some other idea?

@MrLotU
Copy link
Contributor

MrLotU commented May 1, 2020

Fully agree with @ktoso here.

Great idea but probably not best suited to be included in the swift-metrics project directly

@glbrntt
Copy link
Author

glbrntt commented May 1, 2020

I do agree that it's useful, but I'm also on the side that swift-metrics (and swift-log) should contain no implementations, all backends should be external libs, even if small ones IMHO and these libs are best to remain as little impl and opinionated as possible (main reason being that this is a tremendously slippery slope, once we add a small thing, and another small thing, people get used to "the lib has things" and more and more stuff gets added).

I totally get this and agree it's a slippery slope.

My concern is that putting this in another package would introduce a level of friction that would render it pointless: I wouldn't want to release a framework which depended on it (even if it was only in tests) and I probably wouldn't manually add/remove it from my package manifest whenever I wanted to do a quick sanity check. In all likelihood I'd end up copying and pasting it whenever I needed it.

@glbrntt
Copy link
Author

glbrntt commented May 4, 2020

@ktoso I was thinking about this a little over the weekend: maybe a more general purpose metrics-testing package could be a home for this.

@ktoso
Copy link
Member

ktoso commented May 13, 2020

Hey there, sorry was offline for the last week.

You mean as separate target/library but inside this repo, and call it some EventCaptureTestMetricHandler? (the impl I use for logging I call "LogCapture" I guess, so thinking if the word capturing could make sense for the family of such handlers... the same for metrics/tracing/logging)

I still think it's a slippery slope to add more things here rather than make many smaller repos -- smaller repos put these "on level playing field" as any other person's implementation and show more intent that yes, there should be tons of implementations by various people, rather than in this repo as "the" one... but others maybe disagree. I'm kind of hoping it's not hard for us to spin new repos in swift-server org perhaps if we want to make such handlers available?

@weissi @tomerd wdyt?

@glbrntt
Copy link
Author

glbrntt commented May 13, 2020

I actually meant in a separate repo :)

@ktoso
Copy link
Member

ktoso commented May 13, 2020

Oh awesome :-) Then I'm super supportive of it.
Others may want to chime in, but sounds great to me.

@MrLotU
Copy link
Contributor

MrLotU commented May 13, 2020

Having a swift-metrics-tools kind of repository in the swift-server org sounds like a great idea to me.

👍

@tomerd
Copy link
Member

tomerd commented May 13, 2020

sorry for the slow response here, for whatever reasons my email filtered our this thread.

I agree with everything that was said here. I also find myself needing this often in debugging context so would be nice to have a utility to bridge metrics into logs in that context. I also agree that a separate package/repo is the way to go. @glbrntt is this something you want to kick off?

@glbrntt
Copy link
Author

glbrntt commented May 14, 2020

Yeah, I'm happy to do that; I'll pitch something to the forums to help shape this.

@glbrntt
Copy link
Author

glbrntt commented May 18, 2020

fyi: https://forums.swift.org/t/metrics-extras/36616

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

No branches or pull requests

4 participants