Skip to content

Commit

Permalink
ci(changesets): version packages (#23)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and github-actions[bot] authored Feb 6, 2023
1 parent 8391689 commit 34cddce
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 58 deletions.
57 changes: 0 additions & 57 deletions .changeset/real-students-hide.md

This file was deleted.

56 changes: 56 additions & 0 deletions packages/opentelemetry-sdk-workers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,61 @@
# opentelemetry-sdk-workers

## 0.6.0

### Minor Changes

- [#21](https://github.com/RichiCoder1/opentelemetry-sdk-workers/pull/21) [`8391689`](https://github.com/RichiCoder1/opentelemetry-sdk-workers/commit/839168910f689368f463dd4d2ea4b2bf9eecb9c6) Thanks [@RichiCoder1](https://github.com/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`:

```typescript
/* 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 the `Fetcher` type in the `@cloudflare/worker-types` in order for them to be available on `sdk.env`.
## 0.5.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-sdk-workers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opentelemetry-sdk-workers",
"version": "0.5.0",
"version": "0.6.0",
"description": "Open Telemetry Cloudflare Workers Library. Provides a basic sdk for instrumenting workers.",
"module": "dist/index.mjs",
"exports": {
Expand Down

0 comments on commit 34cddce

Please sign in to comment.