contrib/gocql: add NewCluster function to trace clients#1995
contrib/gocql: add NewCluster function to trace clients#1995rarguelloF wants to merge 10 commits into
Conversation
BenchmarksBenchmark execution time: 2023-06-19 13:48:43 Comparing candidate commit 7737493 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 24 metrics, 0 unstable metrics. |
| telemetry.LoadIntegration(componentName) | ||
| } | ||
|
|
||
| type ClusterConfig struct { |
There was a problem hiding this comment.
Please add godoc comments for all these new public and exported types and functions
| return tb | ||
| } | ||
|
|
||
| // WithWrapOptions allows to specify options specific to the batch. |
There was a problem hiding this comment.
| // WithWrapOptions allows to specify options specific to the batch. | |
| // WithWrapOptions specifies options specific to the batch. |
| return tq | ||
| } | ||
|
|
||
| // WithWrapOptions allows to specify options specific to the query. |
There was a problem hiding this comment.
| // WithWrapOptions allows to specify options specific to the query. | |
| // WithWrapOptions specifies options specific to the query. |
| require.NoError(t, err) | ||
| q := session.Query("CREATE KEYSPACE trace WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'datacenter1' : 1 };") | ||
| err = q.Iter().Close() | ||
| require.Error(t, err) |
There was a problem hiding this comment.
This requires an error?
There was a problem hiding this comment.
added IF NOT EXISTS to the query so an error is not expected require.NoError
| q := session.Query("CREATE KEYSPACE trace WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'datacenter1' : 1 };") | ||
| q = q.WithWrapOptions(WithResourceName("test-resource")) | ||
| err = q.Iter().Close() | ||
| require.Error(t, err) |
There was a problem hiding this comment.
did same change here
| return tq | ||
| } | ||
|
|
||
| // WithWrapOptions specifies options specific to the query. |
There was a problem hiding this comment.
| // WithWrapOptions specifies options specific to the query. | |
| // WithWrapOptions applies the given set of options to the query. |
| return tb | ||
| } | ||
|
|
||
| // WithWrapOptions specifies options specific to the batch. |
There was a problem hiding this comment.
similar here, applies the given set of options to the
What does this PR do?
Adds
db.cassandra.contact.pointstocontrib/gocql.gocqltrace.NewClustermethod to wrap the Cassandra client since it's created instead of individual queries.WrapQueryandWrapBatchin favor of the newNewClustermethod.db.cassandra.contact.pointstag for clients traced withNewCluster.Motivation
We want to be able to tag
db.cassandra.contact.points(and probably other stuff from the config in the future). With the current way of tracing this integration (WrapQueryandWrapBatch), we don't have access to the information that was specified during the client initialization unless we use reflection, that we should avoid.Describe how to test/QA your changes
Reviewer's Checklist