From 0b34e3300a0918da5ad229f4150ac7942122fa4c Mon Sep 17 00:00:00 2001 From: Kevin Glowacz Date: Thu, 24 Oct 2024 20:45:58 +0000 Subject: [PATCH 1/3] Query span tests --- sdk/data/azcosmos/emulator_cosmos_container_test.go | 2 +- sdk/data/azcosmos/emulator_cosmos_database_test.go | 2 +- sdk/data/azcosmos/emulator_cosmos_query_test.go | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/data/azcosmos/emulator_cosmos_container_test.go b/sdk/data/azcosmos/emulator_cosmos_container_test.go index aa73e05adbb5..c2ce689f9db2 100644 --- a/sdk/data/azcosmos/emulator_cosmos_container_test.go +++ b/sdk/data/azcosmos/emulator_cosmos_container_test.go @@ -11,7 +11,7 @@ import ( func TestContainerCRUD(t *testing.T) { emulatorTests := newEmulatorTests(t) client := emulatorTests.getClient(t, newSpanValidator(t, &spanMatcher{ - ExpectedSpans: []string{"create_container aContainer", "read_container aContainer", "replace_container aContainer", "read_container_throughput aContainer", "replace_container_throughput aContainer", "delete_container aContainer"}, + ExpectedSpans: []string{"create_container aContainer", "read_container aContainer", "query_containers containerCRUD", "replace_container aContainer", "read_container_throughput aContainer", "replace_container_throughput aContainer", "delete_container aContainer"}, })) database := emulatorTests.createDatabase(t, context.TODO(), client, "containerCRUD") diff --git a/sdk/data/azcosmos/emulator_cosmos_database_test.go b/sdk/data/azcosmos/emulator_cosmos_database_test.go index c84ff7e44b06..5723d1bcfa20 100644 --- a/sdk/data/azcosmos/emulator_cosmos_database_test.go +++ b/sdk/data/azcosmos/emulator_cosmos_database_test.go @@ -11,7 +11,7 @@ import ( func TestDatabaseCRUD(t *testing.T) { emulatorTests := newEmulatorTests(t) client := emulatorTests.getClient(t, newSpanValidator(t, &spanMatcher{ - ExpectedSpans: []string{"create_database baseDbTest", "read_database baseDbTest", "delete_database baseDbTest", "read_database_throughput baseDbTest"}, + ExpectedSpans: []string{"create_database baseDbTest", "read_database baseDbTest", "query_databases localhost", "delete_database baseDbTest", "read_database_throughput baseDbTest"}, })) database := DatabaseProperties{ID: "baseDbTest"} diff --git a/sdk/data/azcosmos/emulator_cosmos_query_test.go b/sdk/data/azcosmos/emulator_cosmos_query_test.go index 992b4ec3e670..36e7f420a6d0 100644 --- a/sdk/data/azcosmos/emulator_cosmos_query_test.go +++ b/sdk/data/azcosmos/emulator_cosmos_query_test.go @@ -13,7 +13,7 @@ import ( func TestSinglePartitionQueryWithIndexMetrics(t *testing.T) { emulatorTests := newEmulatorTests(t) client := emulatorTests.getClient(t, newSpanValidator(t, &spanMatcher{ - ExpectedSpans: []string{}, + ExpectedSpans: []string{"query_items aContainer"}, })) database := emulatorTests.createDatabase(t, context.TODO(), client, "queryTests") @@ -88,7 +88,7 @@ func TestSinglePartitionQueryWithIndexMetrics(t *testing.T) { func TestSinglePartitionQuery(t *testing.T) { emulatorTests := newEmulatorTests(t) client := emulatorTests.getClient(t, newSpanValidator(t, &spanMatcher{ - ExpectedSpans: []string{}, + ExpectedSpans: []string{"query_items aContainer"}, })) database := emulatorTests.createDatabase(t, context.TODO(), client, "queryTests") @@ -176,7 +176,7 @@ func TestSinglePartitionQuery(t *testing.T) { func TestSinglePartitionQueryWithParameters(t *testing.T) { emulatorTests := newEmulatorTests(t) client := emulatorTests.getClient(t, newSpanValidator(t, &spanMatcher{ - ExpectedSpans: []string{}, + ExpectedSpans: []string{"query_items aContainer"}, })) database := emulatorTests.createDatabase(t, context.TODO(), client, "queryTests") @@ -228,7 +228,7 @@ func TestSinglePartitionQueryWithParameters(t *testing.T) { func TestSinglePartitionQueryWithProjection(t *testing.T) { emulatorTests := newEmulatorTests(t) client := emulatorTests.getClient(t, newSpanValidator(t, &spanMatcher{ - ExpectedSpans: []string{}, + ExpectedSpans: []string{"query_items aContainer"}, })) database := emulatorTests.createDatabase(t, context.TODO(), client, "queryTests") From 229967843e27c162423a3ac73d31c595ec8f9f3c Mon Sep 17 00:00:00 2001 From: Kevin Glowacz Date: Thu, 24 Oct 2024 17:29:24 +0000 Subject: [PATCH 2/3] Don't set a Tracer on the azcosmos Pagers --- sdk/data/azcosmos/cosmos_client.go | 2 -- sdk/data/azcosmos/cosmos_container.go | 2 -- sdk/data/azcosmos/cosmos_database.go | 2 -- 3 files changed, 6 deletions(-) diff --git a/sdk/data/azcosmos/cosmos_client.go b/sdk/data/azcosmos/cosmos_client.go index 8e605b3315ad..d180be30617b 100644 --- a/sdk/data/azcosmos/cosmos_client.go +++ b/sdk/data/azcosmos/cosmos_client.go @@ -278,7 +278,6 @@ func (c *Client) NewQueryDatabasesPager(query string, o *QueryDatabasesOptions) }, Fetcher: func(ctx context.Context, page *QueryDatabasesResponse) (QueryDatabasesResponse, error) { var err error - // Move the span to the pager once https://github.com/Azure/azure-sdk-for-go/issues/23294 is fixed spanName, err := getSpanNameForClient(c.accountEndpointUrl(), operationTypeQuery, resourceTypeDatabase, c.accountEndpointUrl().Hostname()) if err != nil { return QueryDatabasesResponse{}, err @@ -307,7 +306,6 @@ func (c *Client) NewQueryDatabasesPager(query string, o *QueryDatabasesOptions) return newDatabasesQueryResponse(azResponse) }, - Tracer: c.internal.Tracer(), }) } diff --git a/sdk/data/azcosmos/cosmos_container.go b/sdk/data/azcosmos/cosmos_container.go index bec7a82bbef2..0b4a8f166b0e 100644 --- a/sdk/data/azcosmos/cosmos_container.go +++ b/sdk/data/azcosmos/cosmos_container.go @@ -515,7 +515,6 @@ func (c *ContainerClient) NewQueryItemsPager(query string, partitionKey Partitio }, Fetcher: func(ctx context.Context, page *QueryItemsResponse) (QueryItemsResponse, error) { var err error - // Move the span to the pager once https://github.com/Azure/azure-sdk-for-go/issues/23294 is fixed spanName, err := c.getSpanForItems(operationTypeQuery) if err != nil { return QueryItemsResponse{}, err @@ -544,7 +543,6 @@ func (c *ContainerClient) NewQueryItemsPager(query string, partitionKey Partitio return newQueryResponse(azResponse) }, - Tracer: c.database.client.internal.Tracer(), }) } diff --git a/sdk/data/azcosmos/cosmos_database.go b/sdk/data/azcosmos/cosmos_database.go index 99ae2018a4ae..743097e68a6d 100644 --- a/sdk/data/azcosmos/cosmos_database.go +++ b/sdk/data/azcosmos/cosmos_database.go @@ -115,7 +115,6 @@ func (c *DatabaseClient) NewQueryContainersPager(query string, o *QueryContainer }, Fetcher: func(ctx context.Context, page *QueryContainersResponse) (QueryContainersResponse, error) { var err error - // Move the span to the pager once https://github.com/Azure/azure-sdk-for-go/issues/23294 is fixed spanName, err := c.getSpanForDatabases(operationTypeQuery, resourceTypeCollection) if err != nil { return QueryContainersResponse{}, err @@ -144,7 +143,6 @@ func (c *DatabaseClient) NewQueryContainersPager(query string, o *QueryContainer return newContainersQueryResponse(azResponse) }, - Tracer: c.client.internal.Tracer(), }) } From 2ba5ff29bf9f84d0630260177ead305e13df2cc3 Mon Sep 17 00:00:00 2001 From: Kevin Glowacz Date: Thu, 24 Oct 2024 18:16:59 +0000 Subject: [PATCH 3/3] Changelog --- sdk/data/azcosmos/CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/data/azcosmos/CHANGELOG.md b/sdk/data/azcosmos/CHANGELOG.md index 241f8171cef4..5403efa530c4 100644 --- a/sdk/data/azcosmos/CHANGELOG.md +++ b/sdk/data/azcosmos/CHANGELOG.md @@ -3,12 +3,13 @@ ## 1.1.1 (Unreleased) ### Features Added -* Set all Telemetry spans to have the Kind of SpanKindClient -* Set request_charge and status_code on all trace spans +* Set all Telemetry spans to have the Kind of SpanKindClient. See [PR 23618](https://github.com/Azure/azure-sdk-for-go/pull/23618) +* Set request_charge and status_code on all trace spans. See [PR 23652](https://github.com/Azure/azure-sdk-for-go/pull/23652) ### Breaking Changes ### Bugs Fixed +* Pager Telemetry spans are now more consistent with the rest of the spans. See [PR 23658](https://github.com/Azure/azure-sdk-for-go/pull/23658) ### Other Changes