question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Performance API follow up

See original GitHub issue

I’ve tried to add some docs, and in the process a few things came up.

Docs PR: https://github.com/getsentry/sentry-docs/pull/2790

Notes:

  • StartTransaction vs CreateTransaction Sentry’s SDKs use startTransaction but .NET has CreateTransaction

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?)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:13 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
Tyrrrzcommented, Jan 26, 2021

Closing this, as the only remaining issue is tracked in #738

1reaction
maciejwalkowiakcommented, Jan 18, 2021

Java has Transaction.get/setTransaction and Scope.getTransactionName, Scope.getTransaction, and Scope.setTransaction. Should we rename?

SentryTransaction#transaction ideally would be “name”, but this is the json property that’s expected on the backend. If we want custom property we would need to write custom json serializer. Anyway, this property is hidden from the user. From the user point of view, he passes “name” to SentryTransaction constructor.

Regarding Scope#setTransactionName - it’s taken into account only if there is an ongoing transaction - then we call SentryTransaction#setName. If there is no transaction set on scope, calling setTransactionName is no-op. I’ve lost track a bit - is this behavior incorrect?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Performance API - MDN Web Docs - Mozilla
An entry on the performance timeline encapsulating a single performance metric. All performance metrics inherit from this interface.
Read more >
How to practically use Performance API to measure ...
Find out how Performance API can help you accurately measure the performance of web pages and get metrics for a single resource.
Read more >
An Introduction to the Performance API
The Performance API measures the responsiveness of your live web application on real user devices and network connections.
Read more >
Breaking Down the Performance API
The Performance API includes the Performance Timeline API and, together, they constitute a wide range of methods that fetch useful metrics on ......
Read more >
User timing API - web.dev
Enter the User Timing API which provides a mechanism you can use to ... The first step in speeding up a slow web...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found