Skip to content

Commit

Permalink
Write a README, and tweak the API a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
sulami committed Dec 18, 2023
1 parent 48210c9 commit acc7b9e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 28 deletions.
58 changes: 31 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
# DegicaDatadog
# Degica Datadog

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/degica_datadog`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'degica_datadog'
```

And then execute:

$ bundle install

Or install it yourself as:

$ gem install degica_datadog
Internal library for StatsD and tracing.

## Usage

TODO: Write usage instructions here
1. Grab the gem from GitHub:
```ruby
gem 'degica_datadog', git: 'https://github.com/degica/degica_datadog.git', branch: 'main'
```
1. Set the `SERVICE_NAME` environment variable to the name of your service.
1. Then add this to your `config/application.rb` to enable tracing:
```ruby
require "degica_datadog"
## Development
DegicaDatadog::Tracing::init
```

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

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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
The setup above auto-instruments many components of the system, but you can add additional spans or span tags:

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/sulami/degica_datadog.
```ruby
# Create a new span.
DegicaDatadog::Tracing::span!("hats.process_payment") do
# Process a payment.
end
tags = {
"merchant_uuid" => merchant.uuid,
"merchant_name" => merchant.name,
}
# Add tags to the current span.
DegicaDatadog::Tracing::span_tags!(**tags)
# Add tags to the current root span.
DegicaDatadog::Tracing::root_span_tags!(**tags)
```
2 changes: 1 addition & 1 deletion lib/degica_datadog/tracing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def span_tags!(**tags)

# Please don't use this. It's just a temporary thing until we can get the
# statsd agent installed
def add_tags_to_root_span!(**tags)
def root_span_tags!(**tags)
return unless Config.enabled?

# forgive me my friends
Expand Down

0 comments on commit acc7b9e

Please sign in to comment.