Skip to content

rails-lambda/aws-embedded-metrics

Repository files navigation

Aws::Embedded::Metrics for Ruby Actions Status

⚠️ Bare minimum code to explore Amazon CloudWatch Embedded Metrics with Ruby. Any and all help welcome to raise the quality of our implementation.

Enhancing workload observability using Amazon CloudWatch Embedded Metric Format

Inspiration

Pulled from these two projects using the Embedded Metric Format Specification as a reference guide.

However, unlike these projects, we differ in the following ways. Again, contributions are very much welcome if you want to see more or change this.

  • Initial focus on Lambda. No other sinks.
  • As such, no default Dimensions or Configuraiton for:
    • LogGroupName
    • LogStreamName
    • ServiceName
    • ServiceType

Installation

Add this line to your application's Gemfile:

gem 'aws-embedded-metrics-customink'

Usage

Simple configuration.

Aws::Embedded::Metrics.configure do |c|
  c.namespace = 'MyApplication'
end

Usage is in a scope block. All metrics are flushed afterward

Aws::Embedded::Metrics.logger do |metrics|
  metrics.put_dimension 'SomeDimension', 'SomeDimensionValue'
  metrics.set_property  'EventKey', 'some/s3/path'
  metrics.put_metric    'Processor', 232, 'Milliseconds'
  metrics.put_metric    'Total', 4008, 'Milliseconds'
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bin/test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/customink/aws-embedded-metrics-customink. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Aws::Embedded::Metrics project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 99.0%
  • Shell 1.0%