Skip to content

Add headers to documentation #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { WorkersSDK } from "opentelemetry-sdk-workers";

export interface Env {
OTLP_ENDPOINT: string;
OTLP_API_KEY: string;
}

export default {
Expand All @@ -29,8 +30,10 @@ export default {
): Promise<Response> {
const sdk = new WorkersSDK(request, ctx, {
service: "worker",
/* The OTLP/HTTP JSON Endpoint to send traces */
endpoint: env.OTLP_ENDPOINT
/* The OTLP/HTTP JSON Endpoint to send traces */
endpoint: env.OTLP_ENDPOINT,
/* Any headers you might send; For example, authentication headers */
headers: { "api-key": env.OTLP_API_KEY }
});
return sdk.sendResponse(new Response("Hello World!"));
},
Expand All @@ -50,7 +53,9 @@ export default {
/* This is the service.name */
service: "worker",
/* The OTLP/HTTP JSON Endpoint to send traces */
endpoint: env.OTLP_ENDPOINT
endpoint: env.OTLP_ENDPOINT,
/* Any headers you might send; For example, authentication headers */
headers: { "api-key": env.OTLP_API_KEY }
});

try {
Expand Down Expand Up @@ -79,8 +84,11 @@ export default {
service: "worker",
/* The OTLP/HTTP JSON Endpoint to send traces */
endpoint: env.OTLP_ENDPOINT,
/* Any headers you might send; For example, authentication headers */
headers: { "api-key": env.OTLP_API_KEY }
logExporter: new OTLPJsonLogExporter({
url: env.OTLP_ENDPOINT
url: env.OTLP_ENDPOINT,
headers: { "api-key": env.OTLP_API_KEY }
}),
});

Expand Down