This repository has been archived by the owner on Feb 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: adding opentelemetry * test: fix test --------- Co-authored-by: Nicolas Burtey <[email protected]>
- Loading branch information
1 parent
d4aa4a3
commit f01165f
Showing
7 changed files
with
549 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { NodeSDK } from "@opentelemetry/sdk-node"; | ||
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http"; | ||
import { Resource } from "@opentelemetry/resources"; | ||
import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions"; | ||
import { SimpleSpanProcessor } from "@opentelemetry/sdk-trace-node"; | ||
import { NetInstrumentation } from "@opentelemetry/instrumentation-net"; | ||
import { HttpInstrumentation } from "@opentelemetry/instrumentation-http"; | ||
import { GraphQLInstrumentation } from "@opentelemetry/instrumentation-graphql"; | ||
import { propagation } from "@opentelemetry/api" | ||
import { W3CTraceContextPropagator } from "@opentelemetry/core" | ||
|
||
const sdk = new NodeSDK({ | ||
textMapPropagator: new W3CTraceContextPropagator(), | ||
resource: new Resource({ | ||
[SemanticResourceAttributes.SERVICE_NAME]: process.env.TRACING_SERVICE_NAME || "blink-fiat", | ||
}), | ||
spanProcessor: new SimpleSpanProcessor(new OTLPTraceExporter()), | ||
instrumentations: [ | ||
new NetInstrumentation(), | ||
new HttpInstrumentation(), | ||
new GraphQLInstrumentation({ | ||
mergeItems: true, | ||
allowValues: true, | ||
}), | ||
], | ||
}); | ||
sdk.start(); | ||
|
||
process.on("SIGTERM", () => { | ||
sdk | ||
.shutdown() | ||
.then(() => console.log("Tracing terminated")) | ||
.catch((error) => console.log("Error terminating tracing", error)) | ||
.finally(() => process.exit(0)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export async function register() { | ||
console.log("register", process.env.NEXT_RUNTIME) | ||
|
||
if (process.env.NEXT_RUNTIME === "nodejs") { | ||
await import("./instrumentation.node") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ | |
module.exports = { | ||
experimental: { | ||
serverActions: true, | ||
instrumentationHook: true, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.