launchdarkly-observability 0.2.1 → 0.2.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2baa5acc1de9a83e4ca42ea6ad84dcd561e33385a65e710a7617bae21a81dbca
4
- data.tar.gz: 526f1bc59cc2d878c01a23fb34218ca3125398d57dabfdc570b1324365980ab2
3
+ metadata.gz: d46f86b88f2c7b3dfd876ef07b2135e8d11f8939c66a1071246ebb627b387f0d
4
+ data.tar.gz: 28d3c8ab27674a1e4ca3996c805d97136782198b2da0a96e8f64902d49ed1f4e
5
5
  SHA512:
6
- metadata.gz: daa9be90cce223d086aa59791bd6d4e42fdb84b5a82afb54de62327bf19bebb02bd004e45e2066c1058e6ede1bcfd8715368b128a1b258b2cb2601810c9d2af3
7
- data.tar.gz: 86f0cd398ec94b9edb14b5aeb7efa6dd068d6f0335b38417acb386394fe4edc8b598e7e42ec667da7f8b2718a376a59797ca7f504abbe7e14dc2d3b43ef2347a
6
+ metadata.gz: cd64fc216a9af53ec0c78bc4af429edf051e0da37b8568e4611d78bd0863711d2ca0b94fb8de97c39b30de4f0828c4eb2a874ce5148e0491f0ba320f716ad96f
7
+ data.tar.gz: 40114279e622a08632d68b63f5faebb4f77230cfe72f8a7a723b2a27898f81bf1c7a2179204068ebb3c178451339f8de7e0ca52840a77fe8d68c9e0721151663
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.2.2](https://github.com/launchdarkly/observability-sdk/compare/launchdarkly-observability-ruby/0.2.1...launchdarkly-observability-ruby/0.2.2) (2026-06-22)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **ruby:** omit nil feature_flag.context.id for invalid contexts ([#641](https://github.com/launchdarkly/observability-sdk/issues/641)) ([587e2e4](https://github.com/launchdarkly/observability-sdk/commit/587e2e40764bade29198c47e6746887f1af6d856))
14
+
8
15
  ## [0.2.1](https://github.com/launchdarkly/observability-sdk/compare/launchdarkly-observability-ruby/0.2.0...launchdarkly-observability-ruby/0.2.1) (2026-06-02)
9
16
 
10
17
 
@@ -91,12 +91,23 @@ module LaunchDarklyObservability
91
91
  FEATURE_FLAG_PROVIDER_NAME => 'LaunchDarkly'
92
92
  }
93
93
 
94
- context = series_context.context
95
- if context
96
- attrs[FEATURE_FLAG_CONTEXT_ID] = context.fully_qualified_key
97
- end
94
+ attrs[FEATURE_FLAG_CONTEXT_ID] = context_id_for(series_context)
98
95
 
99
- attrs
96
+ # OpenTelemetry rejects nil attribute values and logs an error for each
97
+ # one. Drop nils centrally so individual call sites cannot reintroduce the
98
+ # "invalid attribute value type NilClass" noise (e.g. an invalid context
99
+ # whose fully_qualified_key is nil).
100
+ attrs.compact
101
+ end
102
+
103
+ # Returns the fully-qualified context key, or nil if unavailable.
104
+ #
105
+ # An invalid context (e.g. a non-string context kind) is still a non-nil
106
+ # object but yields a nil fully_qualified_key. OpenTelemetry rejects nil
107
+ # attribute values ("invalid attribute value type NilClass"), so callers
108
+ # must omit the attribute entirely when this returns nil.
109
+ def context_id_for(series_context)
110
+ series_context.context&.fully_qualified_key
100
111
  end
101
112
 
102
113
  def serialize_value(value)
@@ -127,10 +138,7 @@ module LaunchDarklyObservability
127
138
  FEATURE_FLAG_PROVIDER_NAME => 'LaunchDarkly'
128
139
  }
129
140
 
130
- context = series_context.context
131
- if context
132
- event_attributes[FEATURE_FLAG_CONTEXT_ID] = context.fully_qualified_key
133
- end
141
+ event_attributes[FEATURE_FLAG_CONTEXT_ID] = context_id_for(series_context)
134
142
 
135
143
  if detail.variation_index
136
144
  event_attributes[FEATURE_FLAG_RESULT_VARIANT] = detail.variation_index.to_s
@@ -146,7 +154,9 @@ module LaunchDarklyObservability
146
154
  add_reason_event_details(event_attributes, reason)
147
155
  end
148
156
 
149
- span.add_event(FEATURE_FLAG_EVENT_NAME, attributes: event_attributes)
157
+ # See build_before_attributes: drop nil values so a missing context id (or
158
+ # any future optional attribute) cannot emit a nil-attribute OTel error.
159
+ span.add_event(FEATURE_FLAG_EVENT_NAME, attributes: event_attributes.compact)
150
160
  end
151
161
 
152
162
  def add_reason_event_details(event_attributes, reason)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LaunchDarklyObservability
4
- VERSION = '0.2.1' # x-release-please-version
4
+ VERSION = '0.2.2' # x-release-please-version
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: launchdarkly-observability
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - LaunchDarkly
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-06-02 00:00:00.000000000 Z
11
+ date: 2026-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: launchdarkly-server-sdk