forked from open-telemetry/opentelemetry-ruby-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef88293
commit 00c8687
Showing
2 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |