mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Ignore ErrorResponse and implement tracing.
This commit is contained in:
parent
84fa3f5d64
commit
08b61a1d20
2 changed files with 17 additions and 1 deletions
|
@ -29,7 +29,12 @@ public class Main {
|
|||
YoutubeStreamExtractor.forceFetchAndroidClient(true);
|
||||
YoutubeStreamExtractor.forceFetchIosClient(true);
|
||||
|
||||
Sentry.init(Constants.SENTRY_DSN);
|
||||
Sentry.init(options -> {
|
||||
options.setDsn(Constants.SENTRY_DSN);
|
||||
options.setRelease(Constants.VERSION);
|
||||
options.addIgnoredExceptionForType(ErrorResponse.class);
|
||||
options.setTracesSampleRate(0.1);
|
||||
});
|
||||
|
||||
Injector.useSpecializer();
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ package me.kavin.piped.server.handlers;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.grack.nanojson.JsonObject;
|
||||
import com.grack.nanojson.JsonWriter;
|
||||
import io.sentry.ITransaction;
|
||||
import io.sentry.Sentry;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import me.kavin.piped.consts.Constants;
|
||||
import me.kavin.piped.utils.*;
|
||||
|
@ -36,6 +38,7 @@ public class StreamHandlers {
|
|||
public static byte[] streamsResponse(String videoId) throws Exception {
|
||||
|
||||
final var futureStream = Multithreading.supplyAsync(() -> {
|
||||
ITransaction transaction = Sentry.startTransaction("StreamInfo fetch", "fetch");
|
||||
try {
|
||||
return StreamInfo.getInfo("https://www.youtube.com/watch?v=" + videoId);
|
||||
} catch (Exception e) {
|
||||
|
@ -54,21 +57,29 @@ public class StreamHandlers {
|
|||
});
|
||||
|
||||
final var futureLBRY = Multithreading.supplyAsync(() -> {
|
||||
ITransaction transaction = Sentry.startTransaction("LBRY Stream fetch", "fetch");
|
||||
try {
|
||||
var childTask = transaction.startChild("fetch", "LBRY ID fetch");
|
||||
String lbryId = futureLbryId.get(2, TimeUnit.SECONDS);
|
||||
childTask.finish();
|
||||
|
||||
return LbryHelper.getLBRYStreamURL(lbryId);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.handle(e);
|
||||
} finally {
|
||||
transaction.finish();
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
final var futureDislikeRating = Multithreading.supplyAsync(() -> {
|
||||
ITransaction transaction = Sentry.startTransaction("Dislike Rating", "fetch");
|
||||
try {
|
||||
return RydHelper.getDislikeRating(videoId);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.handle(e);
|
||||
} finally {
|
||||
transaction.finish();
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue