about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/index.ts30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/index.ts b/src/index.ts
index 261bed4..6b7bdd3 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -144,21 +144,14 @@ const server = Bun.serve({
       name: pathname,
       op: "http.server",
       description: `${request.method} ${pathname}`,
-      data: {
+      tags: {
         url: request.url,
         "http.method": request.method,
       },
-      tags: {
-        region: Bun.env.FLY_APP_REGION,
-      },
     });
     const span = transaction.startChild({
       op: "http.server",
       description: `${request.method} ${pathname}`,
-      data: {
-        url: request.url,
-        "http.method": request.method,
-      },
     });
     try {
       const file = files.get(pathname);
@@ -170,7 +163,8 @@ const server = Bun.serve({
           ) >= file?.mtime.getTime()
         ) {
           metrics.requestsByStatus.inc({ status_code: 304 });
-          span.setTag("http.status_code", 304);
+          span.setHttpStatus(304);
+          transaction.setHttpStatus(304);
           return new Response("", { status: 304, headers: defaultHeaders });
         }
         const encodings = (request.headers.get("accept-encoding") || "")
@@ -178,7 +172,8 @@ const server = Bun.serve({
           .map((x) => x.trim().toLowerCase());
         if (encodings.includes("br") && files.has(file.relPath + ".br")) {
           span.setTag("http.encoding", "br");
-          span.setTag("http.status_code", 200);
+          span.setHttpStatus(200);
+          transaction.setHttpStatus(200);
           return serveFile(files.get(file.relPath + ".br"), 200, {
             "content-encoding": "br",
             "content-type": file.type,
@@ -188,7 +183,8 @@ const server = Bun.serve({
           files.has(file.relPath + ".zst")
         ) {
           span.setTag("http.encoding", "zstd");
-          span.setTag("http.status_code", 200);
+          span.setHttpStatus(200);
+          transaction.setHttpStatus(200);
           return serveFile(files.get(file.relPath + ".zst"), 200, {
             "content-encoding": "zstd",
             "content-type": file.type,
@@ -198,23 +194,27 @@ const server = Bun.serve({
           files.has(file.relPath + ".gz")
         ) {
           span.setTag("http.encoding", "gzip");
-          span.setTag("http.status_code", 200);
+          span.setHttpStatus(200);
+          transaction.setHttpStatus(200);
           return serveFile(files.get(file.relPath + ".gz"), 200, {
             "content-encoding": "gzip",
             "content-type": file.type,
           });
         }
         span.setTag("http.encoding", "identity");
-        span.setTag("http.status_code", 200);
+        span.setHttpStatus(200);
+        transaction.setHttpStatus(200);
         return serveFile(file);
       } else {
         metrics.requestsByStatus.inc({ status_code: 404 });
         span.setTag("http.encoding", "identity");
-        span.setTag("http.status_code", 404);
+        span.setHttpStatus(404);
+        transaction.setHttpStatus(404);
         return serveFile(files.get("/404.html"), 404);
       }
     } catch (error) {
-      span.setTag("http.status_code", 503);
+      span.setHttpStatus(503);
+      transaction.setHttpStatus(503);
       metrics.requestsByStatus.inc({ status_code: 503 });
       Sentry.captureException(error);
       return new Response("Something went wrong", { status: 503 });