Skip to content

Commit

Permalink
Azcosmos no tracer to pager (#23658)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjg authored Oct 31, 2024
1 parent 9964c6e commit 12965bc
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 14 deletions.
5 changes: 3 additions & 2 deletions sdk/data/azcosmos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions sdk/data/azcosmos/cosmos_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -307,7 +306,6 @@ func (c *Client) NewQueryDatabasesPager(query string, o *QueryDatabasesOptions)

return newDatabasesQueryResponse(azResponse)
},
Tracer: c.internal.Tracer(),
})
}

Expand Down
2 changes: 0 additions & 2 deletions sdk/data/azcosmos/cosmos_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -544,7 +543,6 @@ func (c *ContainerClient) NewQueryItemsPager(query string, partitionKey Partitio

return newQueryResponse(azResponse)
},
Tracer: c.database.client.internal.Tracer(),
})
}

Expand Down
2 changes: 0 additions & 2 deletions sdk/data/azcosmos/cosmos_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -144,7 +143,6 @@ func (c *DatabaseClient) NewQueryContainersPager(query string, o *QueryContainer

return newContainersQueryResponse(azResponse)
},
Tracer: c.client.internal.Tracer(),
})
}

Expand Down
2 changes: 1 addition & 1 deletion sdk/data/azcosmos/emulator_cosmos_container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion sdk/data/azcosmos/emulator_cosmos_database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
8 changes: 4 additions & 4 deletions sdk/data/azcosmos/emulator_cosmos_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 12965bc

Please sign in to comment.