opentelemetry-instrumentation-ruby_llm 0.7.0 → 0.7.1
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c4a1a4d73f6af67b0e80799f194cc9e1b7d6fc8b5eee1960522e132d26037e7f
|
|
4
|
+
data.tar.gz: 056d2ce28ebf67ad85cd957f43706cbdf7fa786b48cd927aa58c131d1d325f58
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ec92f5658bd541102d670e07287c2cd4a5e311edb48ea97fd8c7a237e5efc27cc8192e03ec65a5f2d535bc029268a5d71ef0fac2129845601d46c53664aad06a
|
|
7
|
+
data.tar.gz: 24f8ea7a11d56d929fd68fc6d54948eb7275944972a89192d5355af2f77628e0462ecc19521748cea4070fc1b7224c46dd8d5f1897c99016640f3b9c0669ea41
|
|
@@ -72,9 +72,9 @@ module OpenTelemetry
|
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
@otel_attributes&.each { |key, value| span.set_attribute(key, value.respond_to?(:call) ? value.call : value) }
|
|
76
|
-
|
|
77
75
|
result
|
|
76
|
+
ensure
|
|
77
|
+
@otel_attributes&.each { |key, value| span.set_attribute(key, value.respond_to?(:call) ? value.call : value) }
|
|
78
78
|
end
|
|
79
79
|
end
|
|
80
80
|
|
|
@@ -406,6 +406,27 @@ class InstrumentationTest < Minitest::Test
|
|
|
406
406
|
assert_equal "fixed", span.attributes["custom.static"]
|
|
407
407
|
end
|
|
408
408
|
|
|
409
|
+
def test_with_otel_attributes_applied_on_api_failure
|
|
410
|
+
stub_request(:post, "https://api.openai.com/v1/chat/completions")
|
|
411
|
+
.to_return(status: 500, body: "Internal Server Error")
|
|
412
|
+
|
|
413
|
+
chat = RubyLLM.chat(model: "gpt-4o-mini")
|
|
414
|
+
chat.with_otel_attributes(
|
|
415
|
+
"langfuse.trace.name" => "My Agent",
|
|
416
|
+
"custom.last_role" => -> { chat.messages.last&.role.to_s }
|
|
417
|
+
)
|
|
418
|
+
|
|
419
|
+
assert_raises do
|
|
420
|
+
chat.ask("Hi")
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
span = EXPORTER.finished_spans.last
|
|
424
|
+
assert_equal "chat gpt-4o-mini", span.name
|
|
425
|
+
assert_equal OpenTelemetry::Trace::Status::ERROR, span.status.code
|
|
426
|
+
assert_equal "My Agent", span.attributes["langfuse.trace.name"]
|
|
427
|
+
assert_equal "user", span.attributes["custom.last_role"]
|
|
428
|
+
end
|
|
429
|
+
|
|
409
430
|
def test_works_without_otel_attributes
|
|
410
431
|
stub_chat_completion(chat_completion_body(content: "Hello!"))
|
|
411
432
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: opentelemetry-instrumentation-ruby_llm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Clarissa Borges
|
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
96
96
|
- !ruby/object:Gem::Version
|
|
97
97
|
version: '0'
|
|
98
98
|
requirements: []
|
|
99
|
-
rubygems_version:
|
|
99
|
+
rubygems_version: 4.0.6
|
|
100
100
|
specification_version: 4
|
|
101
101
|
summary: OpenTelemetry instrumentation for RubyLLM
|
|
102
102
|
test_files: []
|