MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / tryCreateSpan

Function tryCreateSpan

out/cli.cjs:76570–76596  ·  view source on GitHub ↗
(tracingClient, request3, userAgent)

Source from the content-addressed store, hash-verified

76568 packageName: "@azure/core-rest-pipeline",
76569 packageVersion: SDK_VERSION
76570 });
76571 } catch (e3) {
76572 logger.warning(`Error when creating the TracingClient: ${getErrorMessage(e3)}`);
76573 return void 0;
76574 }
76575}
76576function tryCreateSpan(tracingClient, request3, userAgent) {
76577 try {
76578 const { span, updatedOptions } = tracingClient.startSpan(`HTTP ${request3.method}`, { tracingOptions: request3.tracingOptions }, {
76579 spanKind: "client",
76580 spanAttributes: {
76581 "http.method": request3.method,
76582 "http.url": request3.url,
76583 requestId: request3.requestId
76584 }
76585 });
76586 if (!span.isRecording()) {
76587 span.end();
76588 return void 0;
76589 }
76590 if (userAgent) {
76591 span.setAttribute("http.user_agent", userAgent);
76592 }
76593 const headers = tracingClient.createRequestHeaders(updatedOptions.tracingOptions.tracingContext);
76594 for (const [key, value] of Object.entries(headers)) {
76595 request3.headers.set(key, value);
76596 }
76597 return { span, tracingContext: updatedOptions.tracingOptions.tracingContext };
76598 } catch (e3) {
76599 logger.warning(`Skipping creating a tracing span due to an error: ${getErrorMessage(e3)}`);

Callers 1

sendRequestFunction · 0.85

Calls 4

getErrorMessageFunction · 0.85
endMethod · 0.80
entriesMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…