diff --git a/README.md b/README.md index f1e88fa..87dbc27 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ import { WorkersSDK } from "opentelemetry-sdk-workers"; export interface Env { OTLP_ENDPOINT: string; + OTLP_API_KEY: string; } export default { @@ -29,8 +30,10 @@ export default { ): Promise { 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!")); }, @@ -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 { @@ -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 } }), });