Documentation

Overview

    Package elastic provides functions to trace the gopkg.in/olivere/elastic.v{3,5} packages.

    Example (V3)

      To trace elastic.v3 you create a TracedHTTPClient in the same way but all requests must use the DoC() call to pass the request context.

      Output:
      
      
      Example (V5)

        To start tracing elastic.v5 requests, create a new TracedHTTPClient that you will use when initializing the elastic.Client.

        Output:
        
        

        Index

        Examples

        Constants

        This section is empty.

        Variables

        This section is empty.

        Functions

        func NewHTTPClient

        func NewHTTPClient(opts ...ClientOption) *http.Client

          NewHTTPClient returns a new http.Client which traces requests under the given service name.

          Types

          type ClientOption

          type ClientOption func(*clientConfig)

            ClientOption represents an option that can be used when creating a client.

            func WithAnalytics

            func WithAnalytics(on bool) ClientOption

              WithAnalytics enables Trace Analytics for all started spans.

              func WithAnalyticsRate

              func WithAnalyticsRate(rate float64) ClientOption

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

                func WithResourceNamer

                func WithResourceNamer(namer func(url, method string) string) ClientOption

                  WithResourceNamer specifies a quantizing function which will be used to obtain a resource name for a given ElasticSearch request, using the request's URL and method. Note that the default quantizer obfuscates IDs and indexes and by replacing it, sensitive data could possibly be exposed, unless the new quantizer specifically takes care of that.

                  func WithServiceName

                  func WithServiceName(name string) ClientOption

                    WithServiceName sets the given service name for the client.

                    func WithTransport

                    func WithTransport(t *http.Transport) ClientOption

                      WithTransport sets the given transport as an http.Transport for the client.