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

Am I using the correct library? #465

Open
genglinxiao opened this issue Jan 3, 2024 · 4 comments
Open

Am I using the correct library? #465

genglinxiao opened this issue Jan 3, 2024 · 4 comments

Comments

@genglinxiao
Copy link

Hi there,

This should probably go to a forum instead of issues, but I cannot find more suitable and active place for it:

I'm developing a dotnet application that extract data from a device and then feed it into a monitoring backend that uses Prometheus. I was pointed to this library and I was able to get it going, except that there are more default metrics than my own metrics. I was searching for ways to disable the default metrics and then saw this thread: 80

If I get it correctly, the user of this library is supposed to append rather than change metrics, which makes me wondering, am I using the correct library? If not, what is the proper way of developing a customized prometheus client using dotnet/C# on Linux platform?

Thanks!

@sandersaares
Copy link
Member

Does the chapter in the readme on Suppressing default metrics provide what you need?

@genglinxiao
Copy link
Author

Does the chapter in the readme on Suppressing default metrics provide what you need?

Hi @sandersaares , yes, suppressing default metrics would work for me. However, my question is more on the design side. Maybe, this library is designed for scenarios quite different from mine and suppressing default metrics is a kind of hack that force this library into my application?

@sandersaares
Copy link
Member

In general, if you can think of metrics as "observing a variable in my code" then this library is likely well suited as long as your observations can be modeled using the Prometheus APIs of counter, gauge and histogram.

Where people sometimes experience difficulties is when they want to do ad-hoc transformation from arbitrary data into Prometheus data. For a simple example, people sometimes ask to make a counter decrease in value. In a Prometheus context, that is not a valid operation, so this library does not allow that - you cannot go from "There have been 9 events observed" to "There have been 8 events observed" (unless you apply a hack such as deleting and re-creating the metric). Sometimes people want this because they are just trying to translate some other system to the Prometheus format. This library is not suitable for that - it only allows operations that make sense in a Prometheus context.

@genglinxiao
Copy link
Author

In general, if you can think of metrics as "observing a variable in my code" then this library is likely well suited as long as your observations can be modeled using the Prometheus APIs of counter, gauge and histogram.

Where people sometimes experience difficulties is when they want to do ad-hoc transformation from arbitrary data into Prometheus data. For a simple example, people sometimes ask to make a counter decrease in value. In a Prometheus context, that is not a valid operation, so this library does not allow that - you cannot go from "There have been 9 events observed" to "There have been 8 events observed" (unless you apply a hack such as deleting and re-creating the metric). Sometimes people want this because they are just trying to translate some other system to the Prometheus format. This library is not suitable for that - it only allows operations that make sense in a Prometheus context.

Thanks! That's understandable. How about monitoring multiple clients? I'm sorry if this is too obvious, but I may have to get data from multiple devices, how can I differentiate the items from different devices? All these devices are connected to the same computer that runs my code. Do I need a different library to support this?

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

No branches or pull requests

2 participants