function tracingPolicy(options = {}) {
    const userAgent = getUserAgentValue(options.userAgentPrefix);
    return {
        name: tracingPolicyName,
        async sendRequest(request, next) {
            var _a;
            if (!((_a = request.tracingOptions) === null || _a === void 0 ? void 0 : _a.tracingContext)) {
                return next(request);
            }
            const span = tryCreateSpan(request, userAgent);
            if (!span) {
                return next(request);
            }
            try {
                const response = await next(request);
                tryProcessResponse(span, response);
                return response;
            }
            catch (err) {
                tryProcessError(span, err);
                throw err;
            }
        }
    };
}
/**
 * A simple policy to create OpenTelemetry Spans for each request made by the pipeline
 * that has SpanOptions with a parent.
 * Requests made without a parent Span will not be recorded.
 * @param options - Options to configure the telemetry logged by the tracing policy.
 */
A simple policy to create OpenTelemetry Spans for each request made by the pipeline
that has SpanOptions with a parent.
Requests made without a parent Span will not be recorded.
@param options - Options to configure the telemetry logged by the tracing policy.
A simple policy to create OpenTelemetry Spans for each request made by the pipeline that has SpanOptions with a parent . Requests made without a parent Span will not be recorded . @param options - Options to configure the telemetry logged by the tracing policy .
function tracingPolicy(options = {}) {
    const userAgent = getUserAgentValue(options.userAgentPrefix);
    return {
        name: tracingPolicyName,
        async sendRequest(request, next) {
            var _a;
            if (!((_a = request.tracingOptions) === null || _a === void 0 ? void 0 : _a.tracingContext)) {
                return next(request);
            }
            const span = tryCreateSpan(request, userAgent);
            if (!span) {
                return next(request);
            }
            try {
                const response = await next(request);
                tryProcessResponse(span, response);
                return response;
            }
            catch (err) {
                tryProcessError(span, err);
                throw err;
            }
        }
    };
}
function tracingPolicy ( options = { } ) { const userAgent = getUserAgentValue ( options . userAgentPrefix ) ; return { name : tracingPolicyName , async sendRequest ( request , next ) { var _a ; if ( ! ( ( _a = request . tracingOptions ) === null || _a === void 0 ? void 0 : _a . tracingContext ) ) { return next ( request ) ; } const span = tryCreateSpan ( request , userAgent ) ; if ( ! span ) { return next ( request ) ; } try { const response = await next ( request ) ; tryProcessResponse ( span , response ) ; return response ; } catch ( err ) { tryProcessError ( span , err ) ; throw err ; } } } ; }
A simple policy to create OpenTelemetry Spans for each request made by the pipeline
 that has SpanOptions with a parent.
A simple policy to create OpenTelemetry Spans for each request made by the pipeline that has SpanOptions with a parent .