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

Refactor metrics layer implementation #353

Merged
merged 6 commits into from
Jun 17, 2024
Merged

Conversation

adam-cattermole
Copy link
Member

@adam-cattermole adam-cattermole commented Jun 5, 2024

Changes

Tried to slightly improve the metrics layer implementation:

  • Replaced some unnecessary loops with contains
  • Less to_string calls and passing ref
  • Removed clone on group_times and instead only clone the keys
  • The metrics layer is now disabled for in memory and only runs for the other storage options (as there are no datastore calls and therefore no metrics for in mem)
    • The fmt_layer and telemetry_layer have been moved to independent functions for type inference
  • Fixed a bug in setting the level for the telemetry_layer - there were no metrics when the endpoint was provided so it is now set independently on the telemetry_layer (in the new fn)
  • Finally changed the datastore spans to be info level apart from for disk storage where they are debug

@adam-cattermole adam-cattermole force-pushed the optimize-metrics-layer branch 3 times, most recently from c66fc01 to f006a8d Compare June 7, 2024 14:00
@adam-cattermole adam-cattermole marked this pull request as ready for review June 7, 2024 14:04
@adam-cattermole adam-cattermole force-pushed the optimize-metrics-layer branch 2 times, most recently from 37f6cd0 to eb43d92 Compare June 10, 2024 08:51
@adam-cattermole adam-cattermole force-pushed the optimize-metrics-layer branch from eb43d92 to 69187b1 Compare June 11, 2024 14:23
Copy link
Member

@alexsnaps alexsnaps left a comment

Choose a reason for hiding this comment

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

Some minor remarks... Also wondering, are all the &str 'static? Cause... 🤔
When you bench'ed this, could you see the clones at all in the flamegraphs?

limitador-server/src/metrics.rs Outdated Show resolved Hide resolved
limitador-server/src/metrics.rs Outdated Show resolved Hide resolved
@adam-cattermole adam-cattermole force-pushed the optimize-metrics-layer branch from ce82c47 to 1a579fb Compare June 17, 2024 10:21
@adam-cattermole adam-cattermole merged commit 71ea11e into main Jun 17, 2024
7 checks passed
@adam-cattermole adam-cattermole deleted the optimize-metrics-layer branch June 17, 2024 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants