Skip to content

Commit

Permalink
fix: gcp tracing (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
dohaki authored Jun 11, 2024
1 parent 7e5b85d commit b80a2c6
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@across-protocol/sdk-v2": "^0.23.10",
"@balancer-labs/sdk": "^1.1.5",
"@google-cloud/logging": "^11.0.0",
"@google-cloud/opentelemetry-cloud-trace-exporter": "^2.2.0",
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/instrumentation-express": "^0.40.1",
"@opentelemetry/instrumentation-http": "^0.52.0",
Expand Down
7 changes: 6 additions & 1 deletion src/lib/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ import { registerInstrumentations } from "@opentelemetry/instrumentation";
import { HttpInstrumentation } from "@opentelemetry/instrumentation-http";
import { ExpressInstrumentation } from "@opentelemetry/instrumentation-express";
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
import { TraceExporter } from "@google-cloud/opentelemetry-cloud-trace-exporter";

const provider = new NodeTracerProvider();
const exporter = new TraceExporter();

export function initTracing() {
const provider = new NodeTracerProvider();
provider.register();
provider.addSpanProcessor(new BatchSpanProcessor(exporter));

registerInstrumentations({
instrumentations: [new ExpressInstrumentation(), new HttpInstrumentation()],
Expand Down
40 changes: 40 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,25 @@
stream-events "^1.0.5"
uuid "^9.0.0"

"@google-cloud/opentelemetry-cloud-trace-exporter@^2.2.0":
version "2.2.0"
resolved "https://registry.yarnpkg.com/@google-cloud/opentelemetry-cloud-trace-exporter/-/opentelemetry-cloud-trace-exporter-2.2.0.tgz#9214e98610c3eb73181215a90690cb5734f1d202"
integrity sha512-C3xQwPY+hm9xUkT3eFAtrj5yL4eLHZ5nuw2fzULT6qYGjZeXs88L/lZRk4ZdlkUlU1fuhHJE6McDB9/9v1SJnQ==
dependencies:
"@google-cloud/opentelemetry-resource-util" "^2.2.0"
"@grpc/grpc-js" "^1.1.8"
"@grpc/proto-loader" "^0.7.0"
google-auth-library "^9.0.0"
google-proto-files "^4.0.0"

"@google-cloud/opentelemetry-resource-util@^2.2.0":
version "2.2.0"
resolved "https://registry.yarnpkg.com/@google-cloud/opentelemetry-resource-util/-/opentelemetry-resource-util-2.2.0.tgz#3b27ca58aa1e2bfb1c702b8031fc14ad49a814f5"
integrity sha512-rqgb5U0EV7N/f2zmQzJFZPesfww/uob8iI72OfNKh/RRF+eNpFNwaxAMelug39kBrIVEKYRcRkV+nW9BR8mxdw==
dependencies:
"@opentelemetry/semantic-conventions" "^1.22.0"
gcp-metadata "^6.0.0"

"@google-cloud/paginator@^3.0.7":
version "3.0.7"
resolved "https://registry.yarnpkg.com/@google-cloud/paginator/-/paginator-3.0.7.tgz#fb6f8e24ec841f99defaebf62c75c2e744dd419b"
Expand Down Expand Up @@ -936,6 +955,14 @@
teeny-request "^8.0.0"
uuid "^8.0.0"

"@grpc/grpc-js@^1.1.8":
version "1.8.22"
resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-1.8.22.tgz#847930c9af46e14df05b57fc12325db140ceff1d"
integrity sha512-oAjDdN7fzbUi+4hZjKG96MR6KTEubAeMpQEb+77qy+3r0Ua5xTFuie6JOLr4ZZgl5g+W5/uRTS2M1V8mVAFPuA==
dependencies:
"@grpc/proto-loader" "^0.7.0"
"@types/node" ">=12.12.47"

"@grpc/grpc-js@~1.10.3":
version "1.10.7"
resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-1.10.7.tgz#1abce1a8c4c90b79dbbe57d7e4310f3b0ce72899"
Expand Down Expand Up @@ -5729,6 +5756,14 @@ google-p12-pem@^4.0.0:
dependencies:
node-forge "^1.3.1"

google-proto-files@^4.0.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/google-proto-files/-/google-proto-files-4.2.0.tgz#130a6caa307b02541cbc6005234e3fe156768027"
integrity sha512-Yl3ZtTSpkOLjHTqHn91NhDp2jMPzpHWowSGz3S30N6gkqOXrJwUu44alR9dX+NyHK3n165uR+jezOH365b1pPA==
dependencies:
protobufjs "^7.0.0"
walkdir "^0.4.0"

gopd@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c"
Expand Down Expand Up @@ -10276,6 +10311,11 @@ [email protected]:
core-util-is "1.0.2"
extsprintf "^1.2.0"

walkdir@^0.4.0:
version "0.4.1"
resolved "https://registry.yarnpkg.com/walkdir/-/walkdir-0.4.1.tgz#dc119f83f4421df52e3061e514228a2db20afa39"
integrity sha512-3eBwRyEln6E1MSzcxcVpQIhRG8Q1jLvEqRmCZqS3dsfXEDR/AhOF4d+jHg1qvDCpYaVRZjENPQyrVxAkQqxPgQ==

web-encoding@^1.0.2, web-encoding@^1.0.6:
version "1.1.5"
resolved "https://registry.yarnpkg.com/web-encoding/-/web-encoding-1.1.5.tgz#fc810cf7667364a6335c939913f5051d3e0c4864"
Expand Down

0 comments on commit b80a2c6

Please sign in to comment.