Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private createSpan(methodName: string, requestOptions: RequestOptionsBase = {}): Span {
const tracer = getTracer();
return tracer.startSpan(methodName, requestOptions && requestOptions.spanOptions);
}
private createSpan(options: T, operationName: keyof TClient) {
const span = getTracer().startSpan(`${this.baseOperationName}.${operationName}`, {
...options.spanOptions,
kind: SpanKind.INTERNAL
});
let newOptions = options;
if (span.isRecording()) {
newOptions = Spanner.addParentToOptions(options, span);
}
return { span, newOptions };
}
export function createSpan(
operationName: string,
tracingOptions: OperationTracingOptions = {}
): { span: Span; spanOptions: SpanOptions } {
const tracer = getTracer();
const spanOptions: SpanOptions = {
...tracingOptions.spanOptions,
kind: SpanKind.INTERNAL
};
const span = tracer.startSpan(`Azure.Storage.DataLake.${operationName}`, spanOptions);
let newOptions = tracingOptions.spanOptions || {};
if (span.isRecording()) {
newOptions = {
...tracingOptions,
parent: span
};
}
return {
export function createMessageSpan(parentSpan?: Span | SpanContext): Span {
const tracer = getTracer();
const span = tracer.startSpan("Azure.EventHubs.message", {
kind: SpanKind.PRODUCER,
parent: parentSpan
});
return span;
}
): Span {
const links: Link[] = [];
for (const receivedEvent of receivedEvents) {
const spanContext = extractSpanContextFromEventData(receivedEvent);
if (spanContext == null) {
continue;
}
links.push({
spanContext
});
}
const span = getTracer().startSpan("Azure.EventHubs.process", {
kind: SpanKind.CONSUMER,
links,
parent: getParentSpan(tracingOptions)
});
span.setAttributes({
component: "eventhubs",
"message_bus.destination": eventHubProperties.eventHubName,
"peer.address": eventHubProperties.endpoint
});
return span;
}
private _createSendSpan(
parentSpan?: Span | SpanContext,
spanContextsToLink: SpanContext[] = []
): Span {
const links: Link[] = spanContextsToLink.map((spanContext) => {
return {
spanContext
};
});
const tracer = getTracer();
const span = tracer.startSpan("Azure.EventHubs.send", {
kind: SpanKind.CLIENT,
parent: parentSpan,
links
});
span.setAttribute("message_bus.destination", this._eventHubName);
span.setAttribute("peer.address", this._endpoint);
return span;
}
export function createSpan(
operationName: string,
tracingOptions: OperationTracingOptions = {}
): { span: Span; spanOptions: SpanOptions } {
const tracer = getTracer();
const spanOptions: SpanOptions = {
...tracingOptions.spanOptions,
kind: SpanKind.INTERNAL
};
const span = tracer.startSpan(`Azure.Storage.Blob.${operationName}`, spanOptions);
let newOptions = tracingOptions.spanOptions || {};
if (span.isRecording()) {
newOptions = {
...tracingOptions,
parent: span
};
}
return {
private createSpan(methodName: string, requestOptions?: RequestOptionsBase): Span {
const tracer = getTracer();
return tracer.startSpan(methodName, requestOptions && requestOptions.spanOptions);
}