Skip to content

Commit 591b804

Browse files
committed
[Tests] Updates OpenTelemetry tests for updated conventions
1 parent cb47ced commit 591b804

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

elasticsearch/spec/integration/opentelemetry_spec.rb

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
# under the License.
1717

1818
if ENV['TEST_WITH_OTEL'] == 'true'
19-
ELASTICSEARCH_URL = ENV['TEST_ES_SERVER'] || "http://localhost:#{(ENV['PORT'] || 9200)}"
19+
require 'uri'
20+
21+
ELASTICSEARCH_URL = ENV['TEST_ES_SERVER'] || "http://localhost:#{ENV['PORT'] || 9200}"
2022
raise URI::InvalidURIError unless ELASTICSEARCH_URL =~ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/
2123

2224
require 'spec_helper'
@@ -45,10 +47,20 @@
4547
expect(span.name).to eq 'search'
4648
end
4749

50+
# These conventions were updated in elastic-transport 8.5, so checking for both:
51+
# db.elasticsearch.path_parts - <= 8.5
52+
# db.operation.parameter - > 8.5
53+
#
4854
it 'sets the path parts' do
4955
client.index(index: 'myindex', id: 1, body: { title: 'Test' })
50-
expect(span.attributes['db.elasticsearch.path_parts.index']).to eq 'myindex'
51-
expect(span.attributes['db.elasticsearch.path_parts.id']).to eq 1
56+
expect(
57+
span.attributes['db.operation.parameter.index'] ||
58+
span.attributes['db.elasticsearch.path_parts.index']
59+
).to eq 'myindex'
60+
expect(
61+
span.attributes['db.operation.parameter.id'] ||
62+
span.attributes['db.elasticsearch.path_parts.id']
63+
).to eq 1
5264
end
5365
end
5466
end

0 commit comments

Comments
 (0)