Skip to content

Commit

Permalink
chore: update example (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
YunosukeY authored Feb 25, 2024
1 parent 4f2aefd commit 1bcb34d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion examples/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@kimitsu/otel-sdk-web": "^1.0.0",
"@kimitsu/otel-sdk-web": "^1.3.0",
"next": "14.1.0",
"react": "^18",
"react-dom": "^18"
Expand Down
7 changes: 1 addition & 6 deletions examples/nextjs/src/Examples/LogExample.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import type React from "react";
import { logger } from "./otel";
import { SeverityNumber } from "@opentelemetry/api-logs";

const LogExample: React.FC = () => {
logger.emit({
severityNumber: SeverityNumber.INFO,
severityText: "INFO",
body: "client component",
});
logger.info("client component");

return null;
};
Expand Down
7 changes: 4 additions & 3 deletions examples/nextjs/src/Examples/TraceExample.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { context, trace } from "@opentelemetry/api";
import type React from "react";
import { useEffect } from "react";
import { tracer } from "./otel";

const ClientFetchTraceExample: React.FC = () => {
useEffect(() => {
const span = tracer.startSpan("client manual Span");
const span = tracer.startSpan("client manual span");
span.end();

// eslint-disable-next-line @typescript-eslint/no-floating-promises
context.with(trace.setSpan(context.active(), span), async () => {
tracer.startActiveSpan("nested span", async (span) => {
await fetch("https://example.com/", {
method: "GET",
mode: "no-cors",
Expand Down
8 changes: 4 additions & 4 deletions examples/nextjs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@
wrap-ansi "^8.1.0"
wrap-ansi-cjs "npm:wrap-ansi@^7.0.0"

"@kimitsu/otel-sdk-web@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@kimitsu/otel-sdk-web/-/otel-sdk-web-1.0.0.tgz#ae08ae9aad168ac700f7c83f2d0949dc40f82df0"
integrity sha512-CKSQQkt4bfDAn26Y3OkvHkjt1qGsPaJAla+PbJSyHxMUVaDv1K16fg0Og21Xw2l9lThFMVDWlYSnaEwhYFIPfw==
"@kimitsu/otel-sdk-web@^1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@kimitsu/otel-sdk-web/-/otel-sdk-web-1.3.0.tgz#5c6e34e697f67df538daa6fd17274b9bb16ef9a1"
integrity sha512-1IaF9uuuTtu9HTULLMMpuTqgiY9djeUCBHRsFWMx85AjvaYLLiwoMkWUgw3uDgM9c/Q9RosSnnBLoHgWpXriMQ==
dependencies:
"@opentelemetry/api" "^1.7.0"
"@opentelemetry/api-logs" "^0.48.0"
Expand Down

0 comments on commit 1bcb34d

Please sign in to comment.