-
-
Notifications
You must be signed in to change notification settings - Fork 229
Description
I've tried to add some docs, and in the process a few things came up.
Docs PR: getsentry/sentry-docs#2790
Notes:
- StartTransaction vs CreateTransaction
Sentry's SDKs usestartTransactionbut .NET hasCreateTransaction
Java requires only "name" and .NET requires "name" and "op".
Code snippets in Java set an Op right after creating it, should it be in the Start method instead?
Java has Sentry.getSpan(); to get the current "span bound to the Hub". How do we do this in .NET?
Is this in JavaScript? If not, how do we do it there?
// C#:
var innerSpan = span.StartChild("task");
// Java
Span innerSpan = span.startChild("task", item.getName());
How do I set the span name in C#? Only operation in the method signature.
var transaction = SentrySdk.CreateTransaction("ProcessOrderBatch()", "batch");
try
{
procesOrderBatch();
transaction.Finish();
}
catch (Exception e)
{
// How do I set the exception? Or relate to an error event?
// Java: transaction.setThrowable(e);
transaction.Finish(SpanStatus.InternalError);
// this
SentrySdk.CaptureException(e); // How is the transaction and error linked?
// or
throw; // I expect the request is logged upstream so the reference to the Exception must have been given to the transaction earlier in this catch block
}
In Java we set the exception to the transaction, which is kept in a WeakRef so we can corelate the error event to the transaction.
How do we do this in C#?
Java has:
ISpan span = Sentry.getSpan();
if (span == null) {
span = Sentry.startTransaction("task");
} else {
span = span.startChild();
}How do we do this? Should we change Java to something else. I believe Go doesn't distinct between StartTran or StartSpan (thinking in the future with single span ingestion, does it matter?)