Package gocql provides functions to trace the gocql/gocql package (


      To trace Cassandra commands, use our query wrapper WrapQuery.





      This section is empty.


      This section is empty.


      This section is empty.


      type Iter

      type Iter struct {
      	// contains filtered or unexported fields

        Iter inherits from gocql.Iter and contains a span.

        func (*Iter) Close

        func (tIter *Iter) Close() error

          Close closes the Iter and finish the span created on Iter call.

          type Query

          type Query struct {
          	// contains filtered or unexported fields

            Query inherits from gocql.Query, it keeps the tracer and the context.

            func WrapQuery

            func WrapQuery(q *gocql.Query, opts ...WrapOption) *Query

              WrapQuery wraps a gocql.Query into a traced Query under the given service name. Note that the returned Query structure embeds the original gocql.Query structure. This means that any method returning the query for chaining that is not part of this package's Query structure should be called before WrapQuery, otherwise the tracing context could be lost.

              To be more specific: it is ok (and recommended) to use and chain the return value of `WithContext` and `PageState` but not that of `Consistency`, `Trace`, `Observer`, etc.

              func (*Query) Exec

              func (tq *Query) Exec() error

                Exec is rewritten so that it passes by our custom Iter

                func (*Query) Iter

                func (tq *Query) Iter() *Iter

                  Iter starts a new span at query.Iter call.

                  func (*Query) MapScan

                  func (tq *Query) MapScan(m map[string]interface{}) error

                    MapScan wraps in a span query.MapScan call.

                    func (*Query) PageState

                    func (tq *Query) PageState(state []byte) *Query

                      PageState rewrites the original function so that spans are aware of the change.

                      func (*Query) Scan

                      func (tq *Query) Scan(dest ...interface{}) error

                        Scan wraps in a span query.Scan call.

                        func (*Query) ScanCAS

                        func (tq *Query) ScanCAS(dest ...interface{}) (applied bool, err error)

                          ScanCAS wraps in a span query.ScanCAS call.

                          func (*Query) WithContext

                          func (tq *Query) WithContext(ctx context.Context) *Query

                            WithContext adds the specified context to the traced Query structure.

                            type WrapOption

                            type WrapOption func(*queryConfig)

                              WrapOption represents an option that can be passed to WrapQuery.

                              func NoDebugStack

                              func NoDebugStack() WrapOption

                                NoDebugStack prevents stack traces from being attached to spans finishing with an error. This is useful in situations where errors are frequent and performance is critical.

                                func WithAnalytics

                                func WithAnalytics(on bool) WrapOption

                                  WithAnalytics enables Trace Analytics for all started spans.

                                  func WithAnalyticsRate

                                  func WithAnalyticsRate(rate float64) WrapOption

                                    WithAnalyticsRate sets the sampling rate for Trace Analytics events correlated to started spans.

                                    func WithResourceName

                                    func WithResourceName(name string) WrapOption

                                      WithResourceName sets a custom resource name to be used with the traced query. By default, the query statement is extracted automatically. This method should be used when a different resource name is desired or in performance critical environments. The gocql library returns the query statement using an fmt.Sprintf call, which can be costly when called repeatedly. Using WithResourceName will avoid that call. Under normal circumstances, it is safe to rely on the default.

                                      func WithServiceName

                                      func WithServiceName(name string) WrapOption

                                        WithServiceName sets the given service name for the returned query.

                                        Source Files