Bot releases are visible (Hide)
Published by github-actions[bot] over 1 year ago
94ac17e
Thanks @RichiCoder1! - add support for providing propagators
You can now providers to the Workers SDK via config.propagators
. It's recommended to still provide the default WC3 Context and Baggage Providers.
For example:
/* Required to patch missing performance API in Cloudflare Workers. */
import "opentelemetry-sdk-workers/performance";
import { WorkersSDK } from "opentelemetry-sdk-workers";
import {
CompositePropagator,
W3CBaggagePropagator,
W3CTraceContextPropagator,
} from "@opentelemetry/core";
import { BigBrandPropagator } from "@big-brand/opentelemetry-propagator";
export interface Env {
OTLP_ENDPOINT: string;
}
export default {
async fetch(
request: Request,
env: Env,
ctx: ExecutionContext
): Promise<Response> {
const sdk = WorkersSDK.fromEnv(request, env, ctx, {
propagator: new CompositePropagator({
propagators: [
new BigBrandPropagator(),
new W3CTraceContextPropagator(),
new W3CBaggagePropagator(),
],
}),
});
try {
sdk.log.info("Test Log!");
const response = await sdk.fetch("https://httpbin.org/headers/");
return sdk.sendResponse(response);
} catch (ex) {
sdk.captureException(ex);
}
},
};
Published by github-actions[bot] over 1 year ago
b0b9be6
Thanks @RichiCoder1! - Clarify exporter fetch errorPublished by github-actions[bot] over 1 year ago
#21 8391689
Thanks @RichiCoder1! - Add support for fetch-based bindings.
You can now trace any fetch
-based bindings like Service Bindings or Durable Objects.
To use this support, you can pass in the Env to the third argument when creating the Workers SDK and access bindings via sdk.env.<BINDING>
.
For example, say you have an authentication service bound as auth
:
/* Required to patch missing performance API in Cloudflare Workers. */
import "opentelemetry-sdk-workers/performance";
import { WorkersSDK } from "opentelemetry-sdk-workers";
export interface Env {
OTLP_ENDPOINT: string;
/***
* Authentication Service
*/
AUTH: Fetcher /* Type available from @cloudflare/workers-types */;
}
export default {
async fetch(
request: Request,
env: Env,
ctx: ExecutionContext
): Promise<Response> {
const sdk = new WorkersSDK(request, ctx, env, {
/* This is the service.name */
service: "worker",
/* The OTLP/HTTP JSON Endpoint to send traces */
endpoint: env.OTLP_ENDPOINT,
});
try {
const authResponse = await sdk.env.AUTH.fetch(request);
if (!authResponse.ok) {
return sdk.sendResponse(authResponse);
}
const response = await sdk.fetch("https://httpbin.org/headers/");
return sdk.sendResponse(response);
} catch (ex) {
sdk.captureException(ex);
}
},
};
Note
When using TypeScript, you must provide the Environment type with bindings inheriting from theFetcher
type in the@cloudflare/worker-types
in order for them to be available onsdk.env
.
Published by github-actions[bot] over 1 year ago
This updates dependencies and makes a number of breaking changes for clarity or compatibility reasons. Be sure to review the notes carefully!
It also fleshes out support for using the fromEnv
helper in WorkersSDK to all moving more configuration out of code.
ac2178d
Thanks @RichiCoder1! - flesh out support for env vars for logging and compression
You can now provide OTEL_EXPORTER_LOGS_ENABLED=true
to enable the Logs Exporter, and OTEL_EXPORTER_COMPRESSION_ENABLED=false
to disable automatic exporter compression.
7e10209
Thanks @RichiCoder1! - BREAKING CHANGE: service name is now required
You must now provide the service name via the service
config option or via env.OTLP_SERVICE_NAME
if using fromEnv
.
#14 ba6864a
Thanks @BraunreutherA! - The gzip compression for the LogExporter is now optional, as some observability platforms won't accept gzipped streams. Compression is activated by default - please set the property "compress" to false in a LogExporter config to deactivate the compression.
Closes #10
e64b42f
Thanks @RichiCoder1! - BREAKING CHANGED: sdk.log
renamed to sdk.logger
and console.log disabled by default
The SDK logger has be renamed from sdk.log
to sdk.logger
to clarify that it's a provider and not a method itself.
In addition, the logger will no longer output to console.log
by default. If you'd like to re-enable this behavior, provider consoleLogEnabled: true
to the configuration or set env.OTEL_EXPORTER_LOGS_CONSOLE_ENABLED=true
if using fromEnv
.
This may change again in the future to provide multiple explicit "sinks".
Closes #15.
3fa6a2f
Thanks @RichiCoder1! - Update dependencies
8c732df
Thanks @RichiCoder1! - BREAKING CHANGE: URL provided to exporters will now be used verbatim
No change is required if you're just using the endpoint
option in the config.
If you're using exporters explicitly (for example Proto exporters or the Log exporters), you now must either either provide the fully qualified endpoint to url
or pass the base url in as endpoints.default
.
For example:
const sdk = new WorkersSDK(request, ctx, {
/* This is the service.name */
service: "worker",
/* The OTLP/HTTP JSON Endpoint to send traces */
endpoint: env.OTLP_ENDPOINT,
logExporter: new OTLPJsonLogExporter({
- url: env.OTLP_ENDPOINT
+ endpoints: { default: env.OTLP_ENDPOINT }
}),
});
or
const sdk = new WorkersSDK(request, ctx, {
/* This is the service.name */
service: "worker",
/* The OTLP/HTTP JSON Endpoint to send traces */
endpoint: env.OTLP_ENDPOINT,
logExporter: new OTLPJsonLogExporter({
- // https://api.otelprovider.io/
- url: env.OTLP_ENDPOINT
+ // https://api.otelprovider.io/v1/logs/
+ url: env.OTLP_LOGS_ENDPOINT
}),
});
Closes #16
a60240e
Thanks @RichiCoder1! - adapt to diary behavioral changesPublished by github-actions[bot] over 2 years ago
This release majorly reorganized how exporters are constructed. If you weren't using an exporter directly, you shouldn't be affected.
It also adds 🪵 Log 🪵 support! It's currently opt in as a number of providers don't implement support for it by default. See logging for more details.
In addition, gzip
support is enabled by default and you can now send traces and logs encoded as protobuf.
10d3aa8
Thanks @RichiCoder1! - Added OTLP/HTTP Protobuf support as an optional exporter
#8 cd0f07b
Thanks @RichiCoder1! - Reorganized exporters and added exporter base for extensibility.
Exporters are now in exporters/
and implement a Cloudflare fetch-based exporter base.
#8 cd0f07b
Thanks @RichiCoder1! - Add compression support to outgoing requests
Published by github-actions[bot] over 2 years ago
bbe5dd6
Thanks @RichiCoder1! - Republishing to solve publishing issues.