public interface IManagedTracerReference documentation and code samples for the Google.Cloud.Diagnostics.Common interface IManagedTracer.
Manages creating spans for a trace as well as adding meta data to them.
Namespace
Google.Cloud.Diagnostics.CommonAssembly
Google.Cloud.Diagnostics.Common.dll
Methods
AnnotateSpan(Dictionary<string, string>)
void AnnotateSpan(Dictionary<string, string> labels)Annotates the current span with the given labels.
| Parameter | |
|---|---|
| Name | Description | 
labels | 
        Dictionarystringstring | 
      
GetCurrentSpanId()
ulong? GetCurrentSpanId()Gets the current span id or null if none exists.
| Returns | |
|---|---|
| Type | Description | 
ulong | 
        |
GetCurrentTraceId()
string GetCurrentTraceId()Gets the current trace id or null if none exists.
| Returns | |
|---|---|
| Type | Description | 
string | 
        |
RunInSpan(Action, string, StartSpanOptions)
void RunInSpan(Action action, string name, StartSpanOptions options = null)Runs the function in a span and will add a stacktrace from a thrown exception (the exception will be re-thrown) to the span.
| Parameters | |
|---|---|
| Name | Description | 
action | 
        ActionThe action to run in a span.  | 
      
name | 
        stringThe name of the span. Must not be null.  | 
      
options | 
        StartSpanOptionsThe span options to override default values.  | 
      
RunInSpanAsync<T>(Func<Task<T>>, string, StartSpanOptions)
Task<T> RunInSpanAsync<T>(Func<Task<T>> func, string name, StartSpanOptions options = null)Runs the function asynchronously in a span and will add a stacktrace from a thrown exception (the exception will be re-thrown) to the span.
| Parameters | |
|---|---|
| Name | Description | 
func | 
        FuncTaskThe function to run in a span.  | 
      
name | 
        stringThe name of the span. Must not be null.  | 
      
options | 
        StartSpanOptionsThe span options to override default values.  | 
      
| Returns | |
|---|---|
| Type | Description | 
Task | 
        The result from the call to   | 
      
| Type Parameter | |
|---|---|
| Name | Description | 
T | 
        |
RunInSpan<T>(Func<T>, string, StartSpanOptions)
T RunInSpan<T>(Func<T> func, string name, StartSpanOptions options = null)Runs the function in a span and will add a stacktrace from a thrown exception (the exception will be re-thrown) to the span.
| Parameters | |
|---|---|
| Name | Description | 
func | 
        FuncThe function to run in a span.  | 
      
name | 
        stringThe name of the span. Must not be null.  | 
      
options | 
        StartSpanOptionsThe span options to override default values.  | 
      
| Returns | |
|---|---|
| Type | Description | 
T | 
        The result from the call to   | 
      
| Type Parameter | |
|---|---|
| Name | Description | 
T | 
        |
SetStackTrace(StackTrace)
void SetStackTrace(StackTrace stackTrace)Adds the given StackTrace to the current span.
| Parameter | |
|---|---|
| Name | Description | 
stackTrace | 
        StackTrace | 
      
StartSpan(string, StartSpanOptions)
ISpan StartSpan(string name, StartSpanOptions options = null)Starts a new span using the most recent (if any) unfinished span as the parent.
| Parameters | |
|---|---|
| Name | Description | 
name | 
        stringThe name of the span. Must not be null.  | 
      
options | 
        StartSpanOptionsThe span options to override default values.  | 
      
| Returns | |
|---|---|
| Type | Description | 
ISpan | 
        An ISpan that will end the current span when disposed.  |