Skip to content

Commit

Permalink
feat: Update example and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
kaylareopelle committed Sep 17, 2024
1 parent ef88293 commit 00c8687
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 5 deletions.
20 changes: 15 additions & 5 deletions instrumentation/logger/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OpenTelemetry Logger Instrumentation

TODO: Update description. This README is incomplete.
The Logger instrumentation is a community-maintained bridge for the Ruby [logger][logger-home] standard library.

## How do I get started?

Expand Down Expand Up @@ -30,23 +30,33 @@ OpenTelemetry::SDK.configure do |c|
end
```

TODO: Add documentation for config options.

## Examples

TODO: Create example
Example usage can be seen in the `./example/logger.rb` file [here](https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/logger/example/logger.rb)

## Development

The test suite leverages [appraisal][appraisal] to verify the integration across multiple Rails versions. To run the tests with appraisal:

```shell
cd instrumentation/logger
bundle exec appraisal install
bundle exec appraisal rake test
```

## How can I get involved?

The `opentelemetry-instrumentation-logger` gem source is [on github][repo-github], along with related gems including `opentelemetry-api` and `opentelemetry-sdk`.
The `opentelemetry-instrumentation-logger` gem source is [on github][repo-github], along with related gems including `opentelemetry-logs-api` and `opentelemetry-logs-sdk`.

The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us in [GitHub Discussions][discussions-url] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].

## License

The `opentelemetry-instrumentation-logger` gem is distributed under the Apache 2.0 license. See [LICENSE][license-github] for more information.

[appraisal]: https://github.com/thoughtbot/appraisal
[bundler-home]: https://bundler.io
[logger-home]: https://github.com/ruby/logger
[repo-github]: https://github.com/open-telemetry/opentelemetry-ruby
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/LICENSE
[ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
Expand Down
32 changes: 32 additions & 0 deletions instrumentation/logger/example/logger.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# frozen_string_literal: true
# TODO: Test me once the logs API/SDK gems have been released
# Since the gems aren't released, this is broken atm
require 'bundler/inline'

gemfile(true) do
source 'https://rubygems.org'

gem 'logger'
gem 'opentelemetry-sdk'
gem 'opentelemetry-logs-api'
gem 'opentelemetry-logs-sdk'
gem 'opentelemetry-instrumentation-logger', path: '../'
end

require 'opentelemetry-logs-sdk'
require 'opentelemetry-instrumentation-logger'
require 'logger'

# Don't attempt to export traces, Logger instrumentation only emits logs.
ENV['OTEL_TRACES_EXPORTER'] ||= 'none'

OpenTelemetry::SDK.configure do |c|
c.use OpenTelemetry::Instrumentation::Logger
end

at_exit do
OpenTelemetry.logger_provider.shutdown
end

logger = Logger.new
logger.debug('emerald ash borer')

0 comments on commit 00c8687

Please sign in to comment.