Skip to content

Commit

Permalink
Adapt HTTP and Postgres spans
Browse files Browse the repository at this point in the history
The HTTP spans wrapping the Apollo and Yoga spans now have `POST
/graphql` in their span name. This seems like a good change.

The PostgreSQL spans now have the name of the DB after the span
name, and their name more closely resembles a span category. In
addition, there are now spans that represent the connection. We
should amend the extractor to better deal with these spans.
  • Loading branch information
unflxw committed Apr 3, 2023
1 parent a9b96a7 commit e62e637
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/express-apollo/tests/spec/app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
graphql_query = "{ books { title author } }"
response = HTTP.post("#{@test_app_url}/graphql", :json => { :query => graphql_query })

expect(Span.root!).to be_http_span_with_route("HTTP POST")
expect(Span.root!).to be_http_span_with_route("POST /graphql")
expect(response.code.to_i).to eq(200)
expect(graphql_query).to have_graphql_span
end
Expand Down
2 changes: 1 addition & 1 deletion test/express-yoga/tests/spec/app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
graphql_query = "{ books { title author } }"
response = HTTP.post("#{@test_app_url}/graphql", :json => { :query => graphql_query })

expect(Span.root!).to be_http_span_with_route("HTTP POST")
expect(Span.root!).to be_http_span_with_route("POST /graphql")
expect(response.code.to_i).to eq(200)
expect(graphql_query).to have_graphql_span
end
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/span.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def transitive_parent_of?(child)
def sql_child_by_library_and_type(library:, type:)
sql_span = children.find do |child_span|
child_span.instrumentation_library_name == library &&
child_span.name == type
child_span.name.start_with?(type)
end

unless sql_span
Expand Down

0 comments on commit e62e637

Please sign in to comment.