You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If it is possible to capture the exception and associate it with the Activity?
In OpenTelemetry Python there is such feature (although I think it is more like a question to the language/runtime rather than API) where we know if there is exception and derive status code.
and if there is any listener, will get the notification in stopping the activity and then can check if the exception is set there using GetCustomProperty. I'll think if we'll have a better way to handle it.
If developers perform exception handling in a central place (e.g. the evil global exception handler, or catching exception from top level code), is there a way for them to know what's the enclosing activity? (I guess no?)
try{using(varfoo=newActivity("foo")){using(varbaz=newActivity("baz"){DoSomething();}
DoSomething();}using(varbar=newActivity("bar")){DoSomething();}}catch(FoobarExceptionex){log(ex,MagicalFunctionWhichReturnsTheEnclosingActivity(ex).Name,// this is hard since activity is disposed alreadyMagicalFunctionWhichReturnsTheVeryContext(ex).SpanId,);}
IsRecording vs. no activity allocation. I commented before that not creating activity breaks propagation of the context. Which will break user scenarios. So we need Activity to be created or at least context propagated. Thus it needs some indication on whether recording enabled or not.
Having specific callback for sampling instead of having the sampling decision made in creation callback is not aligned with OpenTelemetry spec. Some features like attributes returned by Sampler to be associated with the Span will simply not work.
I agree a single inline thread is hard to follow - I am already trying to move discussion to the PR which does allow for inline annotations and replies to different threads of conversation. I think this is similar to properties we'd get from a google doc. I don't really want to move yet again to google doc because (a) it is different than the convention every other .NET design issue uses, (b) every time we move the discussion forum it breaks the flow and makes it that much harder to understand the history or accumulate issues in one place.
It is very tempting (I am guilty too) to keep replying back to this issue. To try and break that pattern I copied each of the issues you raised to comments in relevant portions of the PR and responded there instead.
@chandramouleswaran, sorry for the late reply I have missed this one unintentionally. thanks for the reminder.
ActivitySource.StartActivity overload APIs provide multiple options to specify the parent context.
/// Creates a new Activity object if there is any listener to the Activity, returns null otherwise.publicActivity?StartActivity(stringname,ActivityKindkind=ActivityKind.Internal);/// Creates a new <see cref="Activity"/> object if there is any listener to the Activity events, returns null otherwise.publicActivity?StartActivity(stringname,ActivityKindkind,ActivityContextparentContext,IEnumerable<KeyValuePair<string,string?>>?tags=null,IEnumerable<ActivityLink>?links=null,DateTimeOffsetstartTime=default);/// Creates a new <see cref="Activity"/> object if there is any listener to the Activity events, returns null otherwise.publicActivity?StartActivity(stringname,ActivityKindkind,stringparentId,IEnumerable<KeyValuePair<string,string?>>?tags=null,IEnumerable<ActivityLink>?links=null,DateTimeOffsetstartTime=default);
Here are the options:
If you use the first overload which not providing ActivityContext nor parent Id, we'll create the Activity and have the parent pointing at the existing Activity.Current. This should address the async scenario as Activity.Current is defined as AsyncLocal which transfers with the context of the async call.
If you use the second overload, you can provide the parent ActivityContext (which includes the parent trace Id, span Id, flags and state). You have the control to set the parent context to the newly created Activity.
If you use the third overload, you can create the Activity object using the parent Id only.
Please let me know if you have more questions or anything unclear here.
Activity
noahfalk commentedon Mar 3, 2020
@tarekgh is the primary dev owner, I am actively assisting. So far design feedback has been occurring in #32660
reyang commentedon Mar 12, 2020
Looks great! Thanks @tarekgh and @noahfalk!
One question related to
If it is possible to capture the exception and associate it with the Activity?
In OpenTelemetry Python there is such feature (although I think it is more like a question to the language/runtime rather than API) where we know if there is exception and derive status code.
tarekgh commentedon Mar 12, 2020
Thanks @reyang for your review.
I don't think we can automatically capture the exception inside using block without try-catch. The user can write the code like:
and if there is any listener, will get the notification in stopping the activity and then can check if the exception is set there using
GetCustomProperty. I'll think if we'll have a better way to handle it.reyang commentedon Mar 12, 2020
If developers perform exception handling in a central place (e.g. the evil global exception handler, or catching exception from top level code), is there a way for them to know what's the enclosing activity? (I guess no?)
34 remaining items
SergeyKanzhelev commentedon Mar 18, 2020
I don't know how to comment on this thread. I'll try. Pretty-please, can we switch to google doc?
UpdateNameis absolutely needed. Asp.Net Core listener wouldn't work without it: https://github.com/open-telemetry/opentelemetry-dotnet/blob/633dda37bdb171f337596ba4b53021b5d35f117c/src/OpenTelemetry.Collector.AspNetCore/Implementation/HttpInListener.cs#L148IsRecordingvs. no activity allocation. I commented before that not creating activity breaks propagation of the context. Which will break user scenarios. So we need Activity to be created or at least context propagated. Thus it needs some indication on whether recording enabled or not.noahfalk commentedon Mar 19, 2020
I agree a single inline thread is hard to follow - I am already trying to move discussion to the PR which does allow for inline annotations and replies to different threads of conversation. I think this is similar to properties we'd get from a google doc. I don't really want to move yet again to google doc because (a) it is different than the convention every other .NET design issue uses, (b) every time we move the discussion forum it breaks the flow and makes it that much harder to understand the history or accumulate issues in one place.
It is very tempting (I am guilty too) to keep replying back to this issue. To try and break that pattern I copied each of the issues you raised to comments in relevant portions of the PR and responded there instead.
SergeyKanzhelev commentedon Mar 19, 2020
@noahfalk yes, PR in designs repo is OK.
tarekgh commentedon Mar 29, 2020
Just FYI, I have updated the design proposal dotnet/designs#98 to reflect the latest discussions and decisions.
chandramouleswaran commentedon Apr 3, 2020
Any updates here?
tarekgh commentedon Apr 3, 2020
@chandramouleswaran, sorry for the late reply I have missed this one unintentionally. thanks for the reminder.
ActivitySource.StartActivity overload APIs provide multiple options to specify the parent context.
Here are the options:
Please let me know if you have more questions or anything unclear here.
tarekgh commentedon Apr 14, 2020
dotnet/apireviews#117
terrajobst commentedon Apr 17, 2020
(marked as approved because that's what we decided in the notes but I didn't update the item during the review)
tarekgh commentedon May 18, 2020
Use new Activity to Replace OT Span: open-telemetry/opentelemetry-dotnet#660