Skip to content

[Enhancement] Do some code optimization.[metrics] #4201

@Alonexc

Description

@Alonexc

Search before asking

  • I had searched in the issues and found no similar issues.

Enhancement Request

image
image
image
image
located at:
eventmesh-metrics-plugin/eventmesh-metrics-prometheus/src/main/java/org/apache/eventmesh/metrics/prometheus/metrics PrometheusGrpcExporter PrometheusHttpExporter PrometheusTcpExporter
eventmesh-metrics-plugin/eventmesh-metrics-prometheus/src/main/java/org/apache/eventmesh/metrics/prometheus/utils/PrometheusExporterUtils.java line 73
analysis and explanation:
a. Field 'paramPairs' may be 'final'
b. Non-static initializers are rarely used, and can be confusing for most developers because they only run when new class instances are created. When possible, non-static initializers should be refactored into standard constructors or field initializers.
c. Local variable 'array' is redundant

Describe the solution you'd like

a.add final
image
b. Use another way to initialize this instance
image
c.inline variable
image

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgood first issueIssues for first-time contributors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions