@azure/communication-chat
Advanced tools
Comparing version 1.0.0-alpha.20210219.1 to 1.0.0-alpha.20210226.1
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { getTracer } from "@azure/core-tracing"; | ||
import { SpanKind } from "@opentelemetry/api"; | ||
import { createSpanFunction } from "@azure/core-tracing"; | ||
/** | ||
* Creates a span using the global tracer. | ||
* @internal | ||
* @param name - The name of the operation being performed. | ||
* @param tracingOptions - The options for the underlying http request. | ||
*/ | ||
export function createSpan(operationName, operationOptions) { | ||
const tracer = getTracer(); | ||
const tracingOptions = operationOptions.tracingOptions || {}; | ||
const spanOptions = Object.assign(Object.assign({}, tracingOptions.spanOptions), { kind: SpanKind.INTERNAL }); | ||
const span = tracer.startSpan(`Azure.Communication.${operationName}`, spanOptions); | ||
span.setAttribute("az.namespace", "Microsoft.Communication"); | ||
let newSpanOptions = tracingOptions.spanOptions || {}; | ||
if (span.isRecording()) { | ||
newSpanOptions = Object.assign(Object.assign({}, tracingOptions.spanOptions), { parent: span.context(), attributes: Object.assign(Object.assign({}, spanOptions.attributes), { "az.namespace": "Microsoft.Communication" }) }); | ||
} | ||
const newTracingOptions = Object.assign(Object.assign({}, tracingOptions), { spanOptions: newSpanOptions }); | ||
const newOperationOptions = Object.assign(Object.assign({}, operationOptions), { tracingOptions: newTracingOptions }); | ||
return { | ||
span, | ||
updatedOptions: newOperationOptions | ||
}; | ||
} | ||
export const createSpan = createSpanFunction({ | ||
packagePrefix: "Azure.Communication", | ||
namespace: "Microsoft.Communication" | ||
}); | ||
//# sourceMappingURL=tracing.js.map |
{ | ||
"name": "@azure/communication-chat", | ||
"version": "1.0.0-alpha.20210219.1", | ||
"version": "1.0.0-alpha.20210226.1", | ||
"description": "Azure client library for Azure Communication Chat services", | ||
@@ -5,0 +5,0 @@ "sdk-type": "client", |
@@ -1,13 +0,11 @@ | ||
import { Span } from "@opentelemetry/api"; | ||
import { OperationOptions } from "@azure/core-http"; | ||
/** | ||
* Creates a span using the global tracer. | ||
* @internal | ||
* @param name - The name of the operation being performed. | ||
* @param tracingOptions - The options for the underlying http request. | ||
*/ | ||
export declare function createSpan<T extends OperationOptions>(operationName: string, operationOptions: T): { | ||
span: Span; | ||
export declare const createSpan: <T extends { | ||
tracingOptions?: import("@azure/core-tracing").OperationTracingOptions | undefined; | ||
}>(operationName: string, operationOptions: T | undefined) => { | ||
span: import("@opentelemetry/api").Span; | ||
updatedOptions: T; | ||
}; | ||
//# sourceMappingURL=tracing.d.ts.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
650714
7366