launchdarkly-server-sdk-otel 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0 (2024-04-05)
4
+
5
+
6
+ ### Features
7
+
8
+ * Add tracing hook implementation ([#1](https://github.com/launchdarkly/ruby-server-sdk-otel/issues/1)) ([420630e](https://github.com/launchdarkly/ruby-server-sdk-otel/commit/420630e50c00cdfd17ccabd5e34b0b3744b5fe63))
9
+
10
+ ## Change log
11
+
12
+ All notable changes to the LaunchDarkly Ruby OTEL library will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
data/CODEOWNERS ADDED
@@ -0,0 +1,2 @@
1
+ # Repository Maintainers
2
+ * @launchdarkly/team-sdk-ruby
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,54 @@
1
+ # Contributing to the LaunchDarkly Server-side OTEL library for Ruby
2
+
3
+ LaunchDarkly has published an [SDK contributor's guide](https://docs.launchdarkly.com/sdk/concepts/contributors-guide) that provides a detailed explanation of how our SDKs work. See below for additional information on how to contribute to this library.
4
+
5
+ ## Submitting bug reports and feature requests
6
+
7
+ The LaunchDarkly SDK team monitors the [issue tracker](https://github.com/launchdarkly/ruby-server-sdk-otel/issues) in the library repository. Bug reports and feature requests specific to this library should be filed in this issue tracker. The SDK team will respond to all newly filed issues within two business days.
8
+
9
+ ## Submitting pull requests
10
+
11
+ We encourage pull requests and other contributions from the community. Before submitting pull requests, ensure that all temporary or unintended code is removed. Don't worry about adding reviewers to the pull request; the LaunchDarkly SDK team will add themselves. The SDK team will acknowledge all pull requests within two business days.
12
+
13
+ ## Build instructions
14
+
15
+ ### Prerequisites
16
+
17
+ This library is built with [Bundler](https://bundler.io/). To install Bundler, run `gem install bundler`. You might need `sudo` to execute the command successfully.
18
+
19
+ To install the runtime dependencies:
20
+
21
+ ```
22
+ bundle install
23
+ ```
24
+
25
+ ### Testing
26
+
27
+ To run all unit tests:
28
+
29
+ ```
30
+ bundle exec rspec spec
31
+ ```
32
+
33
+ ### Building documentation
34
+
35
+ Documentation is built automatically with YARD for each release. To build the documentation locally:
36
+
37
+ ```
38
+ cd docs
39
+ make
40
+ ```
41
+
42
+ The output will appear in `docs/build/html`.
43
+
44
+ ## Code organization
45
+
46
+ A special case is the namespace `LaunchDarkly::Otel::Impl`, and any namespaces within it. Everything under `Impl` is considered a private implementation detail: all files there are excluded from the generated documentation, and are considered subject to change at any time and not supported for direct use by application developers. We do this because Ruby's scope/visibility system is somewhat limited compared to other languages: a method can be `private` or `protected` within a class, but there is no way to make it visible to other classes in the library yet invisible to code outside of the library, and there is similarly no way to hide a class.
47
+
48
+ So, if there is a class whose existence is entirely an implementation detail, it should be in `Impl`. Similarly, classes that are _not_ in `Impl` must not expose any public members that are not meant to be part of the supported public API. This is important because of our guarantee of backward compatibility for all public APIs within a major version: we want to be able to change our implementation details to suit the needs of the code, without worrying about breaking a customer's code. Due to how the language works, we can't actually prevent an application developer from referencing those classes in their code, but this convention makes it clear that such use is discouraged and unsupported.
49
+
50
+ ## Documenting types and methods
51
+
52
+ All classes and public methods outside of `LaunchDarkly::Otel::Impl` should have documentation comments. These are used to build the API documentation that is published at https://launchdarkly.github.io/ruby-server-sdk-otel/ and https://www.rubydoc.info/gems/launchdarkly-server-sdk-otel. The documentation generator is YARD; see https://yardoc.org/ for the comment format it uses.
53
+
54
+ Please try to make the style and terminology in documentation comments consistent with other documentation comments in the library. Also, if a class or method is being added that has an equivalent in other libraries, and if we have described it in a consistent away in those other libraries, please reuse the text whenever possible (with adjustments for anything language-specific) rather than writing new text.
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in launchdarkly-server-sdk-otel.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.21"
13
+ gem "rubocop-performance", "~> 1.15"
14
+ gem "rubocop-rake", "~> 0.6"
15
+ gem "rubocop-rspec", "~> 2.27"
data/LICENSE.txt ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2024 Catamorphic, Co.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/PROVENANCE.md ADDED
@@ -0,0 +1,43 @@
1
+ ## Verifying SDK build provenance with the SLSA framework
2
+
3
+ LaunchDarkly uses the [SLSA framework](https://slsa.dev/spec/v1.0/about) (Supply-chain Levels for Software Artifacts) to help developers make their supply chain more secure by ensuring the authenticity and build integrity of our published SDK packages.
4
+
5
+ As part of [SLSA requirements for level 3 compliance](https://slsa.dev/spec/v1.0/requirements), LaunchDarkly publishes provenance about our SDK package builds using [GitHub's generic SLSA3 provenance generator](https://github.com/slsa-framework/slsa-github-generator/blob/main/internal/builders/generic/README.md#generation-of-slsa3-provenance-for-arbitrary-projects) for distribution alongside our packages. These attestations are available for download from the GitHub release page for the release version under Assets > `multiple-provenance.intoto.jsonl`.
6
+
7
+ To verify SLSA provenance attestations, we recommend using [slsa-verifier](https://github.com/slsa-framework/slsa-verifier). Example usage for verifying SDK packages is included below:
8
+
9
+ <!-- x-release-please-start-version -->
10
+ ```
11
+ # Set the version of the SDK to verify
12
+ VERSION=1.0.0
13
+ ```
14
+ <!-- x-release-please-end -->
15
+
16
+ ```
17
+ # Download gem
18
+ $ gem fetch launchdarkly-server-sdk-otel -v $VERSION
19
+
20
+ # Download provenance from Github release
21
+ $ curl --location -O \
22
+ https://github.com/launchdarkly/ruby-server-sdk-otel/releases/download/${VERSION}/launchdarkly-server-sdk-otel-${VERSION}.gem.intoto.jsonl
23
+
24
+ # Run slsa-verifier to verify provenance against package artifacts
25
+ $ slsa-verifier verify-artifact \
26
+ --provenance-path launchdarkly-server-sdk-otel-${VERSION}.gem.intoto.jsonl \
27
+ --source-uri github.com/launchdarkly/ruby-server-sdk-otel \
28
+ launchdarkly-server-sdk-otel-${VERSION}.gem
29
+ ```
30
+
31
+ Below is a sample of expected output.
32
+
33
+ ```
34
+ Verified signature against tlog entry index 78214752 at URL: https://rekor.sigstore.dev/api/v1/log/entries/24296fb24b8ad77ab941c118ef7e0b2d656b962a0d670c6ac91cfa37d07b7b121ae560b00a978ecf
35
+ Verified build using builder "https://github.com/slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@refs/tags/v1.10.0" at commit f43b3ad834103fdc282652efbfe4963e8dfa737b
36
+ Verifying artifact launchdarkly-server-sdk-otel-0.0.0.gem: PASSED
37
+
38
+ PASSED: Verified SLSA provenance
39
+ ```
40
+
41
+ Alternatively, to verify the provenance manually, the SLSA framework specifies [recommendations for verifying build artifacts](https://slsa.dev/spec/v1.0/verifying-artifacts) in their documentation.
42
+
43
+ **Note:** These instructions do not apply when building our libraries from source.
data/README.md ADDED
@@ -0,0 +1,78 @@
1
+ LaunchDarkly Server-side OTEL library for Ruby
2
+ ==============================================
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/launchdarkly-server-sdk-otel.svg)](http://badge.fury.io/rb/launchdarkly-server-sdk-otel)
5
+
6
+ [![Quality Control](https://github.com/launchdarkly/ruby-server-sdk-otel/actions/workflows/ci.yml/badge.svg)](https://github.com/launchdarkly/ruby-server-sdk-otel/actions/workflows/ci.yml)
7
+ [![RubyDoc](https://img.shields.io/static/v1?label=docs+-+all+versions&message=reference&color=00add8)](https://www.rubydoc.info/gems/launchdarkly-server-sdk-otel)
8
+ [![GitHub Pages](https://img.shields.io/static/v1?label=docs+-+latest&message=reference&color=00add8)](https://launchdarkly.github.io/ruby-server-sdk-otel)
9
+
10
+ LaunchDarkly overview
11
+ -------------------------
12
+ [LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves trillions of feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/home/getting-started) using LaunchDarkly today!
13
+
14
+ [![Twitter Follow](https://img.shields.io/twitter/follow/launchdarkly.svg?style=social&label=Follow&maxAge=2592000)](https://twitter.com/intent/follow?screen_name=launchdarkly)
15
+
16
+ Supported Ruby versions
17
+ -----------------------
18
+
19
+ This version of the library has a minimum Ruby version of 3.0.0, or 9.4.0 for JRuby.
20
+
21
+ Getting started
22
+ -----------
23
+
24
+ Install the gem and add to the application's Gemfile by executing:
25
+
26
+ $ bundle add launchdarkly-server-sdk-otel
27
+
28
+ If bundler is not being used to manage dependencies, install the gem by executing:
29
+
30
+ $ gem install launchdarkly-server-sdk-otel
31
+
32
+ The provided `TracingHook` can be setup as shown below:
33
+
34
+ ```ruby
35
+ require 'ldclient-rb'
36
+ require 'ldclient-otel'
37
+ require 'opentelemetry/sdk'
38
+
39
+ config = LaunchDarkly::Config.new({logger: logger, hooks: [LaunchDarkly::Otel::TracingHook.new]})
40
+ client = LaunchDarkly::LDClient.new(sdk_key, config)
41
+
42
+ tracer = OpenTelemetry.tracer_provider.tracer('my_app_or_library', '0.1.0')
43
+ tracer.in_span('top-level span') do |span|
44
+ _ = client.variation(feature_flag_key, context, false)
45
+ end
46
+ ```
47
+
48
+ Learn more
49
+ -----------
50
+
51
+ Read our [documentation](http://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [reference guide for the ruby SDK](http://docs.launchdarkly.com/docs/ruby-sdk-reference).
52
+
53
+ Generated API documentation for all versions of the library is on [RubyDoc.info](https://www.rubydoc.info/gems/launchdarkly-server-sdk-otel). The API documentation for the latest version is also on [GitHub Pages](https://launchdarkly.github.io/ruby-server-sdk-otel).
54
+
55
+ Contributing
56
+ ------------
57
+
58
+ We encourage pull requests and other contributions from the community. Check out our [contributing guidelines](CONTRIBUTING.md) for instructions on how to contribute to this library.
59
+
60
+ Verifying library build provenance with the SLSA framework
61
+ ------------
62
+
63
+ LaunchDarkly uses the [SLSA framework](https://slsa.dev/spec/v1.0/about) (Supply-chain Levels for Software Artifacts) to help developers make their supply chain more secure by ensuring the authenticity and build integrity of our published library packages. To learn more, see the [provenance guide](PROVENANCE.md).
64
+
65
+ About LaunchDarkly
66
+ -----------
67
+
68
+ * LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
69
+ * Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
70
+ * Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
71
+ * Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
72
+ * Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
73
+ * LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read [our documentation](https://docs.launchdarkly.com/sdk) for a complete list.
74
+ * Explore LaunchDarkly
75
+ * [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
76
+ * [docs.launchdarkly.com](https://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDK reference guides
77
+ * [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation
78
+ * [blog.launchdarkly.com](https://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/SECURITY.md ADDED
@@ -0,0 +1,5 @@
1
+ # Reporting and Fixing Security Issues
2
+
3
+ Please report all security issues to the LaunchDarkly security team by submitting a bug bounty report to our [HackerOne program](https://hackerone.com/launchdarkly?type=team). LaunchDarkly will triage and address all valid security issues following the response targets defined in our program policy. Valid security issues may be eligible for a bounty.
4
+
5
+ Please do not open issues or pull requests for security issues. This makes the problem immediately visible to everyone, including potentially malicious actors.
data/docs/Makefile ADDED
@@ -0,0 +1,26 @@
1
+ ifeq ($(LD_RELEASE_VERSION),)
2
+ TITLE=LaunchDarkly Ruby OTEL Library
3
+ else
4
+ TITLE=LaunchDarkly Ruby OTEL Library ($(LD_RELEASE_VERSION))
5
+ endif
6
+
7
+ .PHONY: dependencies html
8
+
9
+ html: dependencies
10
+ rm -rf ./build
11
+ cd .. && yard doc \
12
+ -o docs/build/html \
13
+ --title "$(TITLE)" \
14
+ --no-private \
15
+ --markup markdown \
16
+ --embed-mixins \
17
+ -r docs/index.md \
18
+ lib/*.rb \
19
+ lib/**/*.rb \
20
+ lib/**/**/*.rb \
21
+ lib/**/**/**/*.rb
22
+ rm -f build/html/frames.html
23
+
24
+ dependencies:
25
+ gem install --conservative yard
26
+ gem install --conservative redcarpet # provides Markdown formatting
data/docs/index.md ADDED
@@ -0,0 +1,7 @@
1
+ # LaunchDarkly Server-side OTEL library for Ruby
2
+
3
+ This generated API documentation lists all types and methods in the SDK.
4
+
5
+ The API documentation for the most recent release is hosted on [GitHub Pages](https://launchdarkly.github.io/ruby-server-sdk-otel). API documentation for current and past releases is hosted on [RubyDoc.info](https://www.rubydoc.info/gems/launchdarkly-server-sdk-otel).
6
+
7
+ Source code and readme: [GitHub](https://github.com/launchdarkly/ruby-server-sdk-otel)
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/ldclient-otel/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "launchdarkly-server-sdk-otel"
7
+ spec.version = LaunchDarkly::Otel::VERSION
8
+ spec.authors = ["LaunchDarkly"]
9
+ spec.email = ["team@launchdarkly.com"]
10
+
11
+ spec.summary = "LaunchDarkly SDK OTEL integration"
12
+ spec.description = "LaunchDarkly SDK OTEL integration for the Ruby server side SDK"
13
+ spec.homepage = "https://github.com/launchdarkly/ruby-server-sdk-otel"
14
+ spec.required_ruby_version = ">= 3.0.0"
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = "https://github.com/launchdarkly/ruby-server-sdk-otel"
18
+ spec.metadata["changelog_uri"] = "https://github.com/launchdarkly/ruby-server-sdk-otel/blob/main/CHANGELOG.md"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(__dir__) do
23
+ `git ls-files -z`.split("\x0").reject do |f|
24
+ (File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
25
+ end
26
+ end
27
+ spec.bindir = "exe"
28
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_runtime_dependency "launchdarkly-server-sdk", "~> 8.4.0"
32
+ spec.add_runtime_dependency "opentelemetry-sdk", "~> 1.4.0"
33
+
34
+ # For more information and examples about making a new gem, check out our
35
+ # guide at: https://bundler.io/guides/creating_gem.html
36
+ end
@@ -0,0 +1,128 @@
1
+ require 'ldclient-rb'
2
+ require 'opentelemetry/sdk'
3
+
4
+ module LaunchDarkly
5
+ module Otel
6
+ class TracingHookOptions
7
+ #
8
+ # Experimental: If set to true, then the tracing hook will add spans for each variation method call. Span events
9
+ # are always added and are unaffected by this setting.
10
+ #
11
+ # The default value is false.
12
+ #
13
+ # This feature is experimental and the data in the spans, or nesting of spans, could change in future versions.
14
+ #
15
+ # @return [Boolean, nil]
16
+ #
17
+ attr_reader :add_spans
18
+
19
+ #
20
+ # If set to true, then the tracing hook will add the evaluated flag value to span events.
21
+ #
22
+ # The default is false.
23
+ #
24
+ # @return [Boolean]
25
+ #
26
+ attr_reader :include_variant
27
+
28
+ #
29
+ # The logger used for hook execution. Provide a custom logger or use the default which logs to the console.
30
+ #
31
+ # @return [Logger]
32
+ #
33
+ attr_reader :logger
34
+
35
+ #
36
+ # Configuration options to control the effect of the TracingHook.
37
+ #
38
+ # @param opts [Hash] the configuration options
39
+ # @option opts [Boolean, nil] :add_spans See {#add_spans}.
40
+ # @option opts [Boolean] :include_variant See {#include_variant}.
41
+ # @option opts [Logger] :logger See {#logger}.
42
+ #
43
+ def initialize(opts = {})
44
+ @add_spans = opts.fetch(:add_spans, nil)
45
+ @include_variant = opts.fetch(:include_variant, false)
46
+ @logger = opts[:logger] || LaunchDarkly::Otel.default_logger
47
+ end
48
+ end
49
+
50
+ class TracingHook
51
+ include LaunchDarkly::Interfaces::Hooks::Hook
52
+
53
+ #
54
+ # @param config [TracingHookOptions]
55
+ #
56
+ def initialize(config = TracingHookOptions.new())
57
+ @config = config
58
+ @tracer = OpenTelemetry.tracer_provider.tracer('launchdarkly')
59
+ end
60
+
61
+ #
62
+ # Get metadata about the hook implementation.
63
+ #
64
+ # @return [Metadata]
65
+ #
66
+ def metadata
67
+ LaunchDarkly::Interfaces::Hooks::Metadata.new('LaunchDarkly Tracing Hook')
68
+ end
69
+
70
+ #
71
+ # The before method is called during the execution of a variation method before the flag value has been
72
+ # determined. The method is executed synchronously.
73
+ #
74
+ # @param evaluation_series_context [EvaluationSeriesContext] Contains information about the evaluation being
75
+ # performed. This is not mutable.
76
+ # @param data [Hash] A record associated with each stage of hook invocations. Each stage is called with the data
77
+ # of the previous stage for a series. The input record should not be modified.
78
+ # @return [Hash] Data to use when executing the next state of the hook in the evaluation series.
79
+ #
80
+ def before_evaluation(evaluation_series_context, data)
81
+ return data unless @config.add_spans
82
+
83
+ attributes = {
84
+ 'feature_flag.context.key' => evaluation_series_context.context.fully_qualified_key,
85
+ 'feature_flag.key' => evaluation_series_context.key,
86
+ }
87
+ span = @tracer.start_span(evaluation_series_context.method, attributes: attributes)
88
+ ctx = OpenTelemetry::Trace.context_with_span(span)
89
+ token = OpenTelemetry::Context.attach(ctx)
90
+
91
+ data.merge({span: span, token: token})
92
+ end
93
+
94
+ #
95
+ # The after method is called during the execution of the variation method after the flag value has been
96
+ # determined. The method is executed synchronously.
97
+ #
98
+ # @param evaluation_series_context [EvaluationSeriesContext] Contains read-only information about the evaluation
99
+ # being performed.
100
+ # @param data [Hash] A record associated with each stage of hook invocations. Each stage is called with the data
101
+ # of the previous stage for a series.
102
+ # @param detail [LaunchDarkly::EvaluationDetail] The result of the evaluation. This value should not be
103
+ # modified.
104
+ # @return [Hash] Data to use when executing the next state of the hook in the evaluation series.
105
+ #
106
+ def after_evaluation(evaluation_series_context, data, detail)
107
+ if data[:span].is_a?(OpenTelemetry::Trace::Span)
108
+ OpenTelemetry::Context.detach(data[:token])
109
+ data[:span].finish()
110
+ end
111
+
112
+ span = OpenTelemetry::Trace.current_span
113
+ return data if span.nil?
114
+
115
+ event = {
116
+ 'feature_flag.key' => evaluation_series_context.key,
117
+ 'feature_flag.provider_name' => 'LaunchDarkly',
118
+ 'feature_flag.context.key' => evaluation_series_context.context.fully_qualified_key,
119
+ }
120
+ event['feature_flag.variant'] = detail.value.to_s if @config.include_variant
121
+
122
+ span.add_event('feature_flag', attributes: event)
123
+
124
+ data
125
+ end
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LaunchDarkly
4
+ module Otel
5
+ VERSION = '1.0.0' # x-release-please-version
6
+ end
7
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'ldclient-otel/tracing_hook'
4
+ require_relative 'ldclient-otel/version'
5
+ require 'logger'
6
+
7
+ module LaunchDarkly
8
+ #
9
+ # Namespace for the LaunchDarkly Otel SDK.
10
+ #
11
+ module Otel
12
+ #
13
+ # @return [Logger] the Rails logger if in Rails, or a default Logger at WARN level otherwise
14
+ #
15
+ def self.default_logger
16
+ if defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger
17
+ Rails.logger
18
+ else
19
+ log = ::Logger.new($stdout)
20
+ log.level = ::Logger::WARN
21
+ log
22
+ end
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,12 @@
1
+ {
2
+ "packages": {
3
+ ".": {
4
+ "release-type": "ruby",
5
+ "bump-minor-pre-major": true,
6
+ "versioning": "default",
7
+ "include-component-in-tag": false,
8
+ "include-v-in-tag": false,
9
+ "extra-files": ["PROVENANCE.md", "lib/ldclient-otel/version.rb"]
10
+ }
11
+ }
12
+ }
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: launchdarkly-server-sdk-otel
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - LaunchDarkly
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-04-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: launchdarkly-server-sdk
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 8.4.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 8.4.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: opentelemetry-sdk
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.4.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.4.0
41
+ description: LaunchDarkly SDK OTEL integration for the Ruby server side SDK
42
+ email:
43
+ - team@launchdarkly.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".release-please-manifest.json"
49
+ - ".rspec"
50
+ - ".rubocop.yml"
51
+ - CHANGELOG.md
52
+ - CODEOWNERS
53
+ - CONTRIBUTING.md
54
+ - Gemfile
55
+ - LICENSE.txt
56
+ - PROVENANCE.md
57
+ - README.md
58
+ - Rakefile
59
+ - SECURITY.md
60
+ - docs/Makefile
61
+ - docs/index.md
62
+ - launchdarkly-server-sdk-otel.gemspec
63
+ - lib/ldclient-otel.rb
64
+ - lib/ldclient-otel/tracing_hook.rb
65
+ - lib/ldclient-otel/version.rb
66
+ - release-please-config.json
67
+ homepage: https://github.com/launchdarkly/ruby-server-sdk-otel
68
+ licenses: []
69
+ metadata:
70
+ homepage_uri: https://github.com/launchdarkly/ruby-server-sdk-otel
71
+ source_code_uri: https://github.com/launchdarkly/ruby-server-sdk-otel
72
+ changelog_uri: https://github.com/launchdarkly/ruby-server-sdk-otel/blob/main/CHANGELOG.md
73
+ post_install_message:
74
+ rdoc_options: []
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: 3.0.0
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ requirements: []
88
+ rubygems_version: 3.5.3
89
+ signing_key:
90
+ specification_version: 4
91
+ summary: LaunchDarkly SDK OTEL integration
92
+ test_files: []