Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapClient ¶
WrapClient wraps http.Client to inject opentracing span to outgoing call if and only if root span exists in request context.
Example ¶
client := WrapClient(&http.Client{}, "span.name") span := opentracing.StartSpan("test_call") defer span.Finish() req, _ := http.NewRequest(http.MethodGet, "http://localhost/test", nil) opentracing.GlobalTracer().Inject( span.Context(), opentracing.HTTPHeaders, opentracing.HTTPHeadersCarrier(req.Header)) client.Do(req)
Output:
func WrapExternalClient ¶
WrapExternalClient wraps http.Client with tracing and creates opentracing span to outgoing calls, if and only if context of request contains root span. default operation name for that span is http.request
Example ¶
client := WrapExternalClient(&http.Client{}, "external_call") span := opentracing.StartSpan("test_call") defer span.Finish() req, _ := http.NewRequest(http.MethodGet, "http://localhost/test", nil) ctx := opentracing.ContextWithSpan(context.TODO(), span) client.Do(req.WithContext(ctx))
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.