Skip to content

Commit 7fb8c6e

Browse files
committed
[Tests] Updates OpenTelemetry tests for updated conventions
1 parent 5585808 commit 7fb8c6e

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'
@@ -37,10 +39,20 @@
3739
expect(span.name).to eq 'search'
3840
end
3941

42+
# These conventions were updated in elastic-transport 8.5, so checking for both:
43+
# db.elasticsearch.path_parts - <= 8.5
44+
# db.operation.parameter - > 8.5
45+
#
4046
it 'sets the path parts' do
4147
CLIENT.index(index: 'myindex', id: 1, body: { title: 'Test' })
42-
expect(span.attributes['db.elasticsearch.path_parts.index']).to eq 'myindex'
43-
expect(span.attributes['db.elasticsearch.path_parts.id']).to eq 1
48+
expect(
49+
span.attributes['db.operation.parameter.index'] ||
50+
span.attributes['db.elasticsearch.path_parts.index']
51+
).to eq 'myindex'
52+
expect(
53+
span.attributes['db.operation.parameter.id'] ||
54+
span.attributes['db.elasticsearch.path_parts.id']
55+
).to eq 1
4456
end
4557
end
4658
end

0 commit comments

Comments
 (0)