text: // Copyright (c) Microsoft Corporation.
  // Licensed under the MIT license.
  import { getTracer } from "@azure/core-tracing";
  import { SpanKind } from "@opentelemetry/api";
  /**
   * Creates a span using the global tracer.
   * @param name - The name of the operation being performed.
   * @param options - The options for the underlying http request.
   */
  export function createSpan(operationName, options = {}) {
      const tracer = getTracer();
      const tracingOptions = Object.assign({ spanOptions: {} }, options.tracingOptions);
      const spanOptions = Object.assign(Object.assign({}, tracingOptions.spanOptions), { kind: SpanKind.INTERNAL });
      const span = tracer.startSpan(`Azure.Identity.${operationName}`, spanOptions);
      span.setAttribute("az.namespace", "Microsoft.AAD");
      let newOptions = options;
      if (span.isRecording()) {
          newOptions = Object.assign(Object.assign({}, options), { tracingOptions: Object.assign(Object.assign({}, tracingOptions), { spanOptions: Object.assign(Object.assign({}, tracingOptions.spanOptions), { parent: span.context(), attributes: Object.assign(Object.assign({}, spanOptions.attributes), { "az.namespace": "Microsoft.AAD" }) }) }) });
      }
      return {
          span,
          options: newOptions
      };
  }
  //# sourceMappingURL=tracing.js.map