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

DropWizard metrics #76

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

DropWizard metrics #76

wants to merge 11 commits into from

Conversation

51-code
Copy link

@51-code 51-code commented Sep 19, 2024

Setup can be found in Metrics.java.

Includes new config parameter: prometheus.port with a default of 1234. This is the port for the Jetty server that provides the metrics.

Metrics include:

  • records (how many messages have gone through)
  • bytes (how many bytes have gone through)
  • resends (how many times messages have been needed to resend to RELP)
  • connects (how many times a connection has been made to RELP)
  • retriedConnects (how many times a connection attempt has had to be retried)
  • sendLatency (latency of processing the whole message as it comes in and sending it to RELP)
  • connectLatency (latency of connecting to RELP)

I tried my best to not fill the existing objects with the metrics, so I made decorators where applicable. The metrics are somewhat scattered, as objects have different responsibilities:

  • ManagedRelpConnection includes resends, retriedConnects, records and bytes. Would have liked to make this a decorator as well, but resends and retriedConnects are inner logic of the object when a message has been sent so this would need refactoring to do the metrics in a decorator.
  • The new MetricRelpConnection includes connects and connectLatency. RelpConnection is the only object that actually deals with the connections so these metrics were placed in its decorator.
  • The new MetricRelpConversion includes sendLatency because RelpConversion is the object that has a hold on the whole processing of the message.

@51-code 51-code added the enhancement New feature or request label Sep 19, 2024
@51-code 51-code self-assigned this Sep 19, 2024
@51-code 51-code linked an issue Sep 19, 2024 that may be closed by this pull request
Copy link

@p000010u p000010u left a comment

Choose a reason for hiding this comment

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

lgtm

src/main/java/com/teragrep/lsh_01/Main.java Outdated Show resolved Hide resolved
src/main/java/com/teragrep/lsh_01/Main.java Outdated Show resolved Hide resolved
src/test/java/CredentialsTest.java Show resolved Hide resolved
src/test/java/LookupTest.java Show resolved Hide resolved
src/test/java/MetricTest.java Outdated Show resolved Hide resolved
src/test/java/RebindTest.java Show resolved Hide resolved
src/test/java/fakes/RelpConnectionFake.java Outdated Show resolved Hide resolved
src/test/java/fakes/ThrowingRelpConnectionFake.java Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add metrics
4 participants