|
25 | 25 | import com.google.gson.Gson; |
26 | 26 | import com.google.gson.JsonSyntaxException; |
27 | 27 | import com.google.gson.annotations.SerializedName; |
| 28 | +import io.opentelemetry.instrumentation.annotations.WithSpan; |
28 | 29 | import org.apache.tika.Tika; |
29 | 30 | import org.jspecify.annotations.Nullable; |
30 | 31 | import org.slf4j.event.Level; |
@@ -66,6 +67,7 @@ public final class MediaHelper { |
66 | 67 | * @throws Exception either if the file is not supported, if the conversion failed, |
67 | 68 | * or if the current thread is interrupted while converting a video file |
68 | 69 | */ |
| 70 | + @WithSpan("media.convert") |
69 | 71 | public static @Nullable File convert(File inputFile) throws Exception { |
70 | 72 | var mimeType = detectMimeType(inputFile); |
71 | 73 |
|
@@ -384,6 +386,7 @@ && isSizeCompliant(imageInfo.width(), imageInfo.height()) |
384 | 386 | * @throws MediaException if an error occurred processing passed-in image |
385 | 387 | * @throws InterruptedException if the current thread is interrupted while converting the file |
386 | 388 | */ |
| 389 | + @WithSpan("media.convert.image") |
387 | 390 | private static File convertToWebp(File file) throws MediaException, InterruptedException { |
388 | 391 | var webpImage = createTempFile("webp"); |
389 | 392 | var command = List.of( |
@@ -465,6 +468,7 @@ private static void deleteFile(File file) throws FileOperationException { |
465 | 468 | * @throws MediaException if file conversion is not successful |
466 | 469 | * @throws InterruptedException if the current thread is interrupted while converting the video file |
467 | 470 | */ |
| 471 | + @WithSpan("media.convert.video") |
468 | 472 | private static File convertToWebm(File file) throws MediaException, InterruptedException { |
469 | 473 | var webmVideo = createTempFile("webm"); |
470 | 474 | var logPrefix = webmVideo.getAbsolutePath() + "-passlog"; |
|
0 commit comments