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

feature/BCF-2604-metrics: instrumenting prometheus metrics #49

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

patrickhuie19
Copy link
Contributor

@patrickhuie19 patrickhuie19 commented Aug 28, 2023

Instruments default go prometheus metrics.

Note: And bumps go to 1.20.0

go 1.17.0 is required for the /x/sys library. I bumped to 1.20.0 to match the go version of /smartcontractkit/chainlink

Library consumers can obtain metrics by running the new ServeMetrics API exposed by Server. Like Serve, ServeMetrics is blocking and the resources associated with the metrics server are closed by the done signal.

The default endpoint for the metrics is :2112/metrics, though the port can be configured by the consumer.

To test, checkout examples/simple/server and run go run . in one terminal. In a separate terminal run curl http://localhost:2112/metrics. The beginning of the output should look like the following:

wsrpc % curl http://localhost:2112/metrics
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0
go_gc_duration_seconds{quantile="0.25"} 0
go_gc_duration_seconds{quantile="0.5"} 0
go_gc_duration_seconds{quantile="0.75"} 0
go_gc_duration_seconds{quantile="1"} 0
go_gc_duration_seconds_sum 0
go_gc_duration_seconds_count 0
# HELP go_goroutines Number of goroutines that currently exist.
# TYPE go_goroutines gauge
go_goroutines 14
...
...

@patrickhuie19 patrickhuie19 force-pushed the feature/BCF-2604-metrics branch from b6e915c to df18c3f Compare August 28, 2023 17:02
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

Successfully merging this pull request may close these issues.

1 participant