Skip to content

Instantly share code, notes, and snippets.

View lmolkova's full-sized avatar

Liudmila Molkova lmolkova

View GitHub Profile
@lmolkova
lmolkova / minimal_instrumentation.md
Last active August 15, 2023 20:41
EventHub and ServiceBus instrumentation

Short version

Context propagation protocol

application SDK MUST propagate trace parent part of the context (version, traceId, parentId and traceFlags) in the message in Diagnostic-Id application property following W3C trace-context format for traceparent encoding.

Also, propagate W3C trace context using W3C Trace Context Propagator from OpenTelemetry. It should populate traceparent and tracestate application properties. traceparent must match Diagnostic-Id value.

When extracting the context, first get W3C trace-context and then (if missing) read Diagnostic-Id.

@lmolkova
lmolkova / WorkerScope.cs
Last active July 19, 2019 18:52
Worker scopes
using System;
using System.Diagnostics;
using Microsoft.Extensions.Logging;
namespace Microsoft.Extensions.Hosting
{
public static class LoggerExtensions
{
public static IDisposable BeginWorkerScope(this ILogger logger)
{
@lmolkova
lmolkova / operation.bond
Last active May 7, 2019 20:00
OperationTelemetry proposal
import "Domain.bond"
namespace AI
[Description("An instance of operation represents completion of an logical operation.")]
struct OperationData
: Domain
{
[Description("Schema version")]
10: required int32 ver = 2;
@lmolkova
lmolkova / proto_mappings.md
Last active October 29, 2018 22:02
Exceptions

Java Exception

Throwable property name Proto property Language-specific description
message message message that describes the current exception
cause inner_errors linked list of instances that caused the current exception
stackTrace stack_frames immediate frames on the call stack
suppressed ??? TODO exceptions that were suppressed in order to deliver this exception
throwable.getClass() error_info.error_type type of Throwable

C# Exception

@lmolkova
lmolkova / Program.cs
Last active May 23, 2018 01:01
Demo/prototype for preventing certain dependency calls based on the scope
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.DependencyCollector;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Queue;
namespace filtering