Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix tests
  • Loading branch information
flobernd committed Nov 21, 2024
commit c18a0e4647b971557124f130fdeea08155cf6f8d
10 changes: 5 additions & 5 deletions tests/Tests/ClientConcepts/OpenTelemetry/OpenTelemetryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public async Task BasicOpenTelemetryTest()

await client.SearchAsync<Project>(s => s.Index("test").Query(q => q.MatchAll(m => { })));

VerifyActivity(oTelActivity, "search", "GET", "http://localhost:9200/test/_search?pretty=true&error_trace=true");
VerifyActivity(oTelActivity, "search", "POST", "http://localhost:9200/test/_search?pretty=true&error_trace=true");

static void VerifyActivity(Activity oTelActivity, string operation, string displayName, string url = null)
static void VerifyActivity(Activity oTelActivity, string displayName, string operation, string url = null)
{
oTelActivity.Should().NotBeNull();

Expand All @@ -53,13 +53,13 @@ static void VerifyActivity(Activity oTelActivity, string operation, string displ

oTelActivity.Tags.Should().Contain(n => n.Key == "elastic.transport.product.name" && n.Value == "elasticsearch-net");
oTelActivity.Tags.Should().Contain(n => n.Key == "db.system" && n.Value == "elasticsearch");
oTelActivity.Tags.Should().Contain(n => n.Key == "db.operation" && n.Value == operation);
oTelActivity.Tags.Should().Contain(n => n.Key == "db.operation" && n.Value == displayName);
oTelActivity.Tags.Should().Contain(n => n.Key == "db.user" && n.Value == "elastic");
oTelActivity.Tags.Should().Contain(n => n.Key == "url.full" && n.Value == (url ?? "http://localhost:9200/?pretty=true&error_trace=true"));
oTelActivity.Tags.Should().Contain(n => n.Key == "server.address" && n.Value == "localhost");
oTelActivity.Tags.Should().Contain(n => n.Key == "http.request.method" && n.Value == (operation == "ping" ? "HEAD" : "POST"));
oTelActivity.Tags.Should().Contain(n => n.Key == "http.request.method" && n.Value == (displayName == "ping" ? "HEAD" : "POST"));

switch (operation)
switch (displayName)
{
case "search":
oTelActivity.Tags.Should().Contain(n => n.Key == "db.elasticsearch.path_parts.index" && n.Value == "test");
Expand Down
Loading