[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eIManagedTracer\u003c/code\u003e interface, found in the \u003ccode\u003eGoogle.Cloud.Diagnostics.Common\u003c/code\u003e namespace, is used for managing the creation of trace spans and adding metadata to them.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eIManagedTracer\u003c/code\u003e allows you to annotate spans with custom labels through the \u003ccode\u003eAnnotateSpan\u003c/code\u003e method, providing detailed information about the operation.\u003c/p\u003e\n"],["\u003cp\u003eThis interface offers methods like \u003ccode\u003eGetCurrentSpanId\u003c/code\u003e and \u003ccode\u003eGetCurrentTraceId\u003c/code\u003e to retrieve the IDs of the current span and trace, respectively.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eRunInSpan\u003c/code\u003e family of methods, such as \u003ccode\u003eRunInSpan\u003c/code\u003e, \u003ccode\u003eRunInSpan<T>\u003c/code\u003e, and \u003ccode\u003eRunInSpanAsync<T>\u003c/code\u003e, facilitates executing functions within a trace span, even handling and re-throwing exceptions with added stack trace information.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eStartSpan\u003c/code\u003e method allows the creation of a new trace span, taking the most recently unfinished span as its parent.\u003c/p\u003e\n"]]],[],null,["# Google.Cloud.Diagnostics.Common - Interface IManagedTracer (5.3.0)\n\nVersion latestkeyboard_arrow_down\n\n- [5.3.0 (latest)](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common.IManagedTracer)\n- [5.2.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.2.0/Google.Cloud.Diagnostics.Common.IManagedTracer)\n- [5.1.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.1.0/Google.Cloud.Diagnostics.Common.IManagedTracer)\n- [5.0.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/5.0.0/Google.Cloud.Diagnostics.Common.IManagedTracer)\n- [4.4.0](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.4.0/Google.Cloud.Diagnostics.Common.IManagedTracer)\n- [4.3.1](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/4.3.1/Google.Cloud.Diagnostics.Common.IManagedTracer) \n\n public interface IManagedTracer\n\nReference documentation and code samples for the Google.Cloud.Diagnostics.Common interface IManagedTracer.\n\nManages creating spans for a trace as well as adding meta data to them.\n\nNamespace\n---------\n\n[Google.Cloud.Diagnostics.Common](/dotnet/docs/reference/Google.Cloud.Diagnostics.Common/latest/Google.Cloud.Diagnostics.Common)\n\nAssembly\n--------\n\nGoogle.Cloud.Diagnostics.Common.dll\n\nMethods\n-------\n\n### AnnotateSpan(Dictionary\\\u003cstring, string\\\u003e)\n\n void AnnotateSpan(Dictionary\u003cstring, string\u003e labels)\n\nAnnotates the current span with the given labels.\n\n### GetCurrentSpanId()\n\n ulong? GetCurrentSpanId()\n\nGets the current span id or null if none exists.\n\n### GetCurrentTraceId()\n\n string GetCurrentTraceId()\n\nGets the current trace id or null if none exists.\n\n### RunInSpan(Action, string, StartSpanOptions)\n\n void RunInSpan(Action action, string name, StartSpanOptions options = null)\n\nRuns the function in a span and will add a stacktrace from a thrown\nexception (the exception will be re-thrown) to the span.\n\n### RunInSpanAsync\\\u003cT\\\u003e(Func\\\u003cTask\\\u003cT\\\u003e\\\u003e, string, StartSpanOptions)\n\n Task\u003cT\u003e RunInSpanAsync\u003cT\u003e(Func\u003cTask\u003cT\u003e\u003e func, string name, StartSpanOptions options = null)\n\nRuns the function asynchronously in a span and will add a stacktrace\nfrom a thrown exception (the exception will be re-thrown) to the span.\n\n### RunInSpan\\\u003cT\\\u003e(Func\\\u003cT\\\u003e, string, StartSpanOptions)\n\n T RunInSpan\u003cT\u003e(Func\u003cT\u003e func, string name, StartSpanOptions options = null)\n\nRuns the function in a span and will add a stacktrace from a thrown\nexception (the exception will be re-thrown) to the span.\n\n### SetStackTrace(StackTrace)\n\n void SetStackTrace(StackTrace stackTrace)\n\nAdds the given StackTrace to the current span.\n\n### StartSpan(string, StartSpanOptions)\n\n ISpan StartSpan(string name, StartSpanOptions options = null)\n\nStarts a new span using the most recent (if any) unfinished span as the parent."]]