mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Merge pull request #414 from TeamPiped/sentry-fix
Add videoId scope and fix sentry transaction trace.
This commit is contained in:
commit
9a143f67b5
1 changed files with 10 additions and 0 deletions
|
@ -37,12 +37,18 @@ import static org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper
|
||||||
public class StreamHandlers {
|
public class StreamHandlers {
|
||||||
public static byte[] streamsResponse(String videoId) throws Exception {
|
public static byte[] streamsResponse(String videoId) throws Exception {
|
||||||
|
|
||||||
|
Sentry.configureScope(scope -> {
|
||||||
|
scope.setContexts("videoId", videoId);
|
||||||
|
});
|
||||||
|
|
||||||
final var futureStream = Multithreading.supplyAsync(() -> {
|
final var futureStream = Multithreading.supplyAsync(() -> {
|
||||||
ITransaction transaction = Sentry.startTransaction("StreamInfo fetch", "fetch");
|
ITransaction transaction = Sentry.startTransaction("StreamInfo fetch", "fetch");
|
||||||
try {
|
try {
|
||||||
return StreamInfo.getInfo("https://www.youtube.com/watch?v=" + videoId);
|
return StreamInfo.getInfo("https://www.youtube.com/watch?v=" + videoId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ExceptionUtils.rethrow(e);
|
ExceptionUtils.rethrow(e);
|
||||||
|
} finally {
|
||||||
|
transaction.finish();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
@ -189,6 +195,10 @@ public class StreamHandlers {
|
||||||
|
|
||||||
public static byte[] commentsResponse(String videoId) throws Exception {
|
public static byte[] commentsResponse(String videoId) throws Exception {
|
||||||
|
|
||||||
|
Sentry.configureScope(scope -> {
|
||||||
|
scope.setContexts("videoId", videoId);
|
||||||
|
});
|
||||||
|
|
||||||
CommentsInfo info = CommentsInfo.getInfo("https://www.youtube.com/watch?v=" + videoId);
|
CommentsInfo info = CommentsInfo.getInfo("https://www.youtube.com/watch?v=" + videoId);
|
||||||
|
|
||||||
List<Comment> comments = new ObjectArrayList<>();
|
List<Comment> comments = new ObjectArrayList<>();
|
||||||
|
|
Loading…
Reference in a new issue