-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: prometheus monitoring #10
Conversation
Can you please fix the linting errors? |
parser/context.go
Outdated
@@ -35,5 +37,6 @@ func NewContext( | |||
Database: db, | |||
Modules: modules, | |||
Logger: logger, | |||
Prometheus: prometheus.NewServer(config.Monitoring.Port), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this case an error if config.Monitoring
is null (i.e. it was not sent inside the config? I think we should just return a nil
Prometheus instead. We could just pass config.Monitoring
to the NewServer
method and return a nil
instance if the monitoring is either disabled or the config is not set at all. Then, inside the main we just call .Start
with a nil
check and if the server is nil
then we do nothing. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was forcing the definition of the monitoring
section inside the config. We can make it optional, as you suggest, to maintain backward compatibility.
Description
This PR allows to expose a
/metrics
endpoint that can be used to monitor a parser trough prometheus.The monitoring can be enabled trough the config file by adding a new
monitoring
section like this:Checklist
Files changed
in the Github PR explorer.