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

Allow setting of a publishing interval #46

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

Conversation

lloydwatkin
Copy link

@lloydwatkin lloydwatkin commented Mar 5, 2024

Picking up on @decaffeinatedio's pull request, this change allows the developer to set a publishing frequency.

This is useful for us as we autoscale on utilisation metric and once every 60 seconds isn't neccessarily fine grained enough.

Test output

lloyd@xps13:~/Code/sidekiq-cloudwatchmetrics$ rspec

Sidekiq::CloudWatchMetrics
  .enable!
    in a sidekiq server
      creates a metrics publisher and installs hooks
    in client mode
      does nothing
  Publisher
    #publish
      publishes sidekiq metrics to cloudwatch
      Overriding publishing interval
        Default interval (60 seconds)
          behaves like a metric publisher
2024-03-05T13:16:15.697Z pid=594112 tid=cne0 INFO: Started Sidekiq CloudWatch Metrics Publisher
            Publishes the correct number of times
        Short interval (1 second)
          behaves like a metric publisher
2024-03-05T13:16:16.906Z pid=594112 tid=cnnw INFO: Started Sidekiq CloudWatch Metrics Publisher
            Publishes the correct number of times
      with lots of queues
        publishes sidekiq metrics to cloudwatch in batches of 20
      with process tags
        publishes metrics including tag as a dimension
      with custom dimensions
        publishes metrics with custom dimensions
      with a custom namespace
        publishes metrics with the specified namespace
      when there are no processes yet
        does not publish Utilization (to avoid NaN values)
      when the only process has no threads yet
        does not publish Utilization (to avoid NaN values)
      when only one process has no threads yet
        publishes partial Utilization (to avoid NaN values)
      when per process metrics are disabled
        only publishes a single Utilization metric
    #stop
      doesn't raise ThreadError

Finished in 2.5 seconds (files took 0.52256 seconds to load)
14 examples, 0 failures

lloyd@xps13:~/Code/sidekiq-cloudwatchmetrics$

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.

1 participant