Skip to content

refactor(metrics): delete influxdb storage for metrics#6725

Merged
kuny0707 merged 5 commits into
tronprotocol:developfrom
317787106:feature/delete_influxdb
May 8, 2026
Merged

refactor(metrics): delete influxdb storage for metrics#6725
kuny0707 merged 5 commits into
tronprotocol:developfrom
317787106:feature/delete_influxdb

Conversation

@317787106
Copy link
Copy Markdown
Collaborator

What does this PR do?

Removes InfluxDB as a metrics storage backend, along with all related configuration, dependencies, and code. Prometheus remains as the sole monitoring interface.

Closes #6665.

Why are these changes required?

java-tron currently maintains two parallel monitoring systems: Prometheus (org.tron.common.prometheus) and MetricsUtil + InfluxDB (org.tron.core.metrics.MetricsUtil). Keeping both creates fragmented metric definitions, duplicated maintenance, and operational overhead. InfluxDB support has the following specific drawbacks:

  1. Fragmented metrics: Two systems produce inconsistent metric definitions with different granularity and labelling, increasing cognitive burden for developers and operators.
  2. Incomplete coverage: MetricsUtil lacks dimensions such as per-peer, per-API, chain sync, DB, and JVM metrics that Prometheus already covers.
  3. Operational complexity: InfluxDB requires a separate deployment, has low community adoption compared to the Prometheus/Grafana ecosystem, and has no mature dashboards or alerting rules for java-tron.
  4. Stability risk: InfluxDB write failures could affect node stability; removing the dependency eliminates this external coupling entirely.

Prometheus, combined with tron-docker, provides a production-ready monitoring solution that supersedes InfluxDB for all known use cases.

Changes:

  • framework/build.gradle: Removed com.github.davidb:metrics-influxdb:0.8.2 dependency.
  • MetricsUtil: Deleted the init() method and all InfluxDB reporter logic (InfluxdbReporter, InfluxdbProtocols).
  • ApplicationImpl: Removed MetricsUtil.init() call from startup().
  • CommonParameter: Removed metricsStorageEnable, influxDbIp, influxDbPort, influxDbDatabase, and metricsReportInterval fields.
  • Args: Removed initRocksDbBackupProperty-style parsing of all METRICS_INFLUXDB_* and METRICS_STORAGE_ENABLE config keys.
  • ConfigKey: Removed METRICS_STORAGE_ENABLE, METRICS_INFLUXDB_IP, METRICS_INFLUXDB_PORT, METRICS_INFLUXDB_DATABASE, METRICS_REPORT_INTERVAL constants.
  • config.conf: Removed the storageEnable and influxdb { ... } block from node.metrics.
  • ParameterTest: Removed assertions for the deleted InfluxDB parameter fields.

Configuration change: The following config block (excludes node.metrics) is no longer read and should be removed from node config files:

node.metrics {
  storageEnable = false
  influxdb {
    ip = ""
    port = 8086
    database = ""
    metricsReportInterval = 10
  }
}

This PR has been tested by:

  • Unit Tests

Follow up

Operators currently using InfluxDB for metrics should migrate to Prometheus. The tron-docker metric_monitor provides a ready-to-use Prometheus + Grafana setup.

Extra details

The /wallet/monitor/getstatsinfo HTTP endpoint remains available as an auxiliary interface (served by MetricsUtil counters/meters/histograms via dropwizard metrics-core), but it is no longer the recommended primary monitoring path.

Copy link
Copy Markdown
Contributor

@Sunny6889 Sunny6889 left a comment

Choose a reason for hiding this comment

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

[Discussion] Suggestion: warn operators about legacy InfluxDB keys

HOCON silently ignores unknown keys, so anyone with node.metrics.storageEnable = true (or node.metrics.influxdb.*) in their config will upgrade cleanly and then watch their metrics pipeline go dark with no signal as to why. The default is false, so the affected user count is small, but for those who did enable it the failure mode is bad: silent loss of monitoring on a production node.

A one-shot startup warning costs ~10 lines and turns a silent regression into an actionable log line. Sketch:

private static void warnOnLegacyInfluxdbKeys(Config config) {
  String[] legacy = {
      "node.metrics.storageEnable",
      "node.metrics.influxdb.ip",
      "node.metrics.influxdb.port",
      "node.metrics.influxdb.database",
      "node.metrics.influxdb.metricsReportInterval",
  };
  for (String key : legacy) {
    if (config.hasPath(key)) {
      logger.warn("Config key '{}' is no longer supported; the InfluxDB metrics "
          + "backend was removed in v4.8.2 and the value is being ignored. "
          + "Migrate to Prometheus: "
          + "https://github.com/tronprotocol/tron-docker/tree/develop/metric_monitor",
          key);
    }
  }
}

@317787106
Copy link
Copy Markdown
Collaborator Author

@Sunny6889 There is no need to add warnOnLegacyInfluxdbKeys:

  1. Typesafe Config silently ignores unknown keys by default. A node with stale InfluxDB keys in its config starts and runs correctly without any intervention — no warning is needed for correctness.
  2. Migration notices belong in release notes, not in runtime code. Operators upgrading across a breaking change consult the changelog; a log line they may never see is a poor substitute for documented migration guidance.
  3. The function has a finite useful lifespan but an indefinite maintenance cost. Once the ecosystem has moved past v4.8.2, the code becomes dead weight — but the tests, the warning string, and the key list all stay in the codebase until someone actively removes them.

@Sunny6889 Sunny6889 requested a review from bladehan1 May 8, 2026 10:02
Copy link
Copy Markdown
Collaborator

@bladehan1 bladehan1 left a comment

Choose a reason for hiding this comment

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

LGTM

@kuny0707 kuny0707 merged commit 91cfae4 into tronprotocol:develop May 8, 2026
13 checks passed
@github-project-automation github-project-automation Bot moved this to Done in java-tron May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Feature] Drop InfluxDB support for metrics storage

5 participants