-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding otel in consent (#3417)
* feat: adding otel in consent * chore: addressing comments * fix: lint errors --------- Co-authored-by: Siddharth <[email protected]>
- Loading branch information
1 parent
991e792
commit adc1aff
Showing
6 changed files
with
94 additions
and
0 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,36 @@ | ||
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 { W3CTraceContextPropagator } from "@opentelemetry/core" | ||
|
||
import { env } from "./env" | ||
|
||
const sdk = new NodeSDK({ | ||
textMapPropagator: new W3CTraceContextPropagator(), | ||
resource: new Resource({ | ||
[SemanticResourceAttributes.SERVICE_NAME]: env.TRACING_SERVICE_NAME, | ||
}), | ||
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: 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,5 @@ | ||
export async function register() { | ||
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.