@azure/eventgrid
Advanced tools
Comparing version 3.0.0-alpha.20210224.1 to 3.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.Data.EventGrid.${operationName}`, spanOptions); | ||
span.setAttribute("az.namespace", "Microsoft.Messaging.EventGrid"); | ||
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.Data.EventGrid" }) }); | ||
} | ||
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.Data.EventGrid", | ||
namespace: "Microsoft.Messaging.EventGrid" | ||
}); | ||
//# sourceMappingURL=tracing.js.map |
@@ -6,3 +6,3 @@ { | ||
"description": "An isomorphic client library for the Azure Event Grid service.", | ||
"version": "3.0.0-alpha.20210224.1", | ||
"version": "3.0.0-alpha.20210226.1", | ||
"keywords": [ | ||
@@ -9,0 +9,0 @@ "node", |
@@ -226,3 +226,3 @@ # Azure Event Grid client library for JavaScript | ||
`EventGridDeserializer` can be used to deserialize events delivered by Event Grid. When deserializing an event, you need to know the schema used to deliver the event. In this example we have events being delivered to an Azure Service Bus Topic in the Cloud Events schema. Using the Service Bus SDK we can recieve these events from the Service Bus Topic and then deserialize them using `EventGridDeserializer` and use `isSystemEvent` to detect what type of events they are. | ||
`EventGridDeserializer` can be used to deserialize events delivered by Event Grid. When deserializing an event, you need to know the schema used to deliver the event. In this example we have events being delivered to an Azure Service Bus Queue in the Cloud Events schema. Using the Service Bus SDK we can receive these events from the Service Bus Queue and then deserialize them using `EventGridDeserializer` and use `isSystemEvent` to detect what type of events they are. | ||
@@ -243,3 +243,3 @@ ```js | ||
// so we just pluck the first one. | ||
const event = (await consumer.decodeCloudEvents(message.body))[0]; | ||
const event = (await consumer.deserializeCloudEvents(message.body))[0]; | ||
@@ -246,0 +246,0 @@ if (isSystemEvent("Microsoft.ContainerRegistry.ImagePushed", event)) { |
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
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
1296506
14913