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

Implementation of metrics collector #180

Merged
merged 2 commits into from
Oct 5, 2024

Conversation

r4f4ss
Copy link

@r4f4ss r4f4ss commented Oct 3, 2024

Solves #162

[WIP] This PR only implements the metrics collector that collect metrics and export to local web server or InfluxDb or InfluxV2. Specify metrics will be a later task.

flags added:

PORTAL NETWORK METRICS

   
    --metrics                           (default: false)                   ($SHISUI_METRICS)
          Enable metrics collection and reporting
   
    --metrics.addr value                                                   ($SHISUI_METRICS_ADDR)
          Enable stand-alone metrics HTTP server listening interface.
   
    --metrics.influxdb                  (default: false)                   ($SHISUI_METRICS_INFLUXDB)
          Enable metrics export/push to an external InfluxDB database
   
    --metrics.influxdb.bucket value     (default: "shisui")                ($SHISUI_METRICS_INFLUXDB_BUCKET)
          InfluxDB bucket name to push reported metrics to (v2 only)
   
    --metrics.influxdb.database value   (default: "shisui")                ($SHISUI_METRICS_INFLUXDB_DATABASE)
          InfluxDB database name to push reported metrics to
   
    --metrics.influxdb.endpoint value   (default: "http://localhost:8086") ($SHISUI_METRICS_INFLUXDB_ENDPOINT)
          InfluxDB API endpoint to report metrics to
   
    --metrics.influxdb.organization value (default: "shisui")                ($SHISUI_METRICS_INFLUXDB_ORGANIZATION)
          InfluxDB organization name (v2 only)
   
    --metrics.influxdb.password value   (default: "test")                  ($SHISUI_METRICS_INFLUXDB_PASSWORD)
          Password to authorize access to the database
   
    --metrics.influxdb.tags value       (default: "host=localhost")        ($SHISUI_METRICS_INFLUXDB_TAGS)
          Comma-separated InfluxDB tags (key/values) attached to all measurements
   
    --metrics.influxdb.token value      (default: "test")                  ($SHISUI_METRICS_INFLUXDB_TOKEN)
          Token to authorize access to the database (v2 only)
   
    --metrics.influxdb.username value   (default: "test")                  ($SHISUI_METRICS_INFLUXDB_USERNAME)
          Username to authorize access to the database
   
    --metrics.influxdbv2                (default: false)                   ($SHISUI_METRICS_INFLUXDBV2)
          Enable metrics export/push to an external InfluxDB v2 database
   
    --metrics.port value                (default: 6060)                    ($SHISUI_METRICS_PORT)
          Metrics HTTP server listening port.
          Please note that --metrics.addr must be set
          to start the server.

I was able to follow this tutorial feeding InfluxDb with data and generate a grafana dashboard. Keep in mind that some metrics were not implemented in Shisui or may differ from the collected by Geth.

image

utils.PortalMetricsInfluxDBTokenFlag,
utils.PortalMetricsInfluxDBBucketFlag,
utils.PortalMetricsInfluxDBOrganizationFlag,
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add new flags or just use the flags in geth?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! Thanks, I will remove those redundant flags. The only issue is that the flags inherit default value from geth, for instance: --metrics.influxdb.bucket value (default: "geth"). In my opinion it is a very insignificant issue, it worth to do to avoid code redundance.

@GrapeBaBa GrapeBaBa merged commit d831ad6 into optimism-java:portal Oct 5, 2024
1 check failed
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.

3 participants