LabKit-Ruby 🔬🔬🔬🔬🔬
LabKit-Ruby is minimalist library to provide functionality for Ruby services at GitLab.
LabKit-Ruby is the Ruby companion for LabKit, a minimalist library to provide functionality for Go services at GitLab.
LabKit-Ruby and LabKit are intended to provide similar functionality, but use the semantics of their respective languages, so are not intended to provide identical APIS.
Documentation
API Documentation is available at the Rubydoc site.
Changelog
The changelog is available via tagged release notes
Functionality
LabKit-Ruby provides functionality in a number of areas:
Labkit::Contextused for providing context information to log messages.Labkit::Correlationfor accessing the correlation id. (Generated and propagated byLabkit::Context)Labkit::UserExperienceSlifor tracking User Experience SLIs. More on the README.Labkit::FIPSfor checking for FIPS mode and using FIPS-compliant algorithms.Labkit::Loggingfor sanitizing log messages.Labkit::Metricsfor metrics. More on the README.Labkit::RSpecfor RSpec matchers to test Labkit functionality (requires selective loading). More on the README.Labkit::Tracingfor handling and propagating distributed traces.
Developing
Anyone can contribute!
$ git clone [email protected]:gitlab-org/labkit-ruby.git
$ cd labkit-ruby
$ bundle install
$ # Autoformat code and auto-correct linters
$ bundle exec rake fix
$ # Run tests, linters
$ bundle exec rake verify
Please also review the development section of the LabKit (go) README for details of the LabKit architectural philosophy.
To work on some of the scripts we use for releasing a new version,
make sure to add a new .env.sh.
cp .env.example.sh .env.sh`
Inside .env.sh, add a personal acccess token for the CHANGELOG_GITLAB_TOKEN
environment variable. Next source the file:
. .env.sh
Releasing a new version
Releasing a new version can be done by pushing a new tag, or creating it from the interface.
A new changelog will automatically be added to the release on Gitlab.
The new version will automatically be published to gitlab-labkit on
rubygems when the pipeline
for the tag completes. It might take a few minutes before the update
is available.
A gem called labkit-ruby is
also published to RubyGems.org as a placeholder. The same bot that
pushes this gem has access.