Skip to content

Commit 28eb056

Browse files
authored
Rename packages (#76)
1 parent d317d67 commit 28eb056

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1003
-412
lines changed

.changeset/rename-logfire-api.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
"logfire": minor
3+
---
4+
5+
BREAKING CHANGE: Package renamed from `@pydantic/logfire-api` to `logfire`.
6+
7+
This change makes the core API package easier to use with a simpler, unscoped name.
8+
9+
**Migration Guide**:
10+
11+
- Update package.json: Change `"@pydantic/logfire-api"` to `"logfire"`
12+
- Update imports: Change `from '@pydantic/logfire-api'` to `from 'logfire'`
13+
- Run `npm install` to update lockfiles
14+
15+
The package functionality remains identical. This is purely a naming change.
16+
17+
**Why this change?**
18+
The core API package is used across all runtimes (Node, browser, Cloudflare Workers) and deserves the simpler package name. The Node.js-specific SDK with auto-instrumentation is now `@pydantic/logfire-node`.

.changeset/rename-logfire-node.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
"@pydantic/logfire-node": minor
3+
---
4+
5+
BREAKING CHANGE: Package renamed from `logfire` to `@pydantic/logfire-node`.
6+
7+
This change clarifies that this package is the Node.js-specific SDK with OpenTelemetry auto-instrumentation.
8+
9+
**Migration Guide**:
10+
11+
- Update package.json: Change `"logfire"` to `"@pydantic/logfire-node"`
12+
- Update imports: Change `from 'logfire'` to `from '@pydantic/logfire-node'`
13+
- Run `npm install` to update lockfiles
14+
15+
The package functionality remains identical. This is purely a naming change.
16+
17+
**Why this change?**
18+
The core API package (now simply called `logfire`) is used across all runtimes. The Node.js SDK with auto-instrumentation is a more specialized package and should have a scoped, descriptive name.

.claude/settings.local.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
"WebSearch",
66
"Bash(npm run build)",
77
"Bash(npm run build:*)",
8-
"Bash(npx changeset:*)"
8+
"Bash(npx changeset:*)",
9+
"Skill(prp-workflow)",
10+
"Bash(tree:*)",
11+
"Bash(git mv:*)",
12+
"Bash(npm install)",
13+
"Bash(npm run test:*)",
14+
"Bash(npm run ci:*)"
915
],
1016
"deny": [],
1117
"ask": []

CLAUDE.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ This is a monorepo for the **Pydantic Logfire JavaScript SDK** - an observabilit
1010

1111
This is an **npm workspace monorepo** managed with **Turborepo**:
1212

13-
- `packages/logfire` - Main Node.js SDK with automatic OpenTelemetry instrumentation
14-
- `packages/logfire-api` - Core API package that can be used standalone for manual tracing (no auto-instrumentation)
13+
- `packages/logfire-node` - Node.js SDK with automatic OpenTelemetry instrumentation
14+
- `packages/logfire-api` - Core API package (published as `logfire`) that can be used standalone for manual tracing (no auto-instrumentation)
1515
- `packages/logfire-cf-workers` - Cloudflare Workers integration
1616
- `packages/logfire-browser` - Browser/web SDK
1717
- `packages/tooling-config` - Shared build and linting configuration
@@ -21,21 +21,21 @@ This is an **npm workspace monorepo** managed with **Turborepo**:
2121

2222
### Package Relationships
2323

24-
- `logfire-api` is the base package that provides the core tracing API (`span`, `info`, `debug`, `error`, etc.) - it wraps OpenTelemetry's trace API with convenience methods
25-
- `logfire` (Node.js SDK) depends on `logfire-api` and adds automatic instrumentation via `@opentelemetry/auto-instrumentations-node`
26-
- `logfire-cf-workers` depends on `logfire-api` and adds Cloudflare Workers-specific instrumentation
27-
- `logfire-browser` depends on `logfire-api` and adds browser-specific instrumentation
24+
- `logfire` (published from `packages/logfire-api`) is the base package that provides the core tracing API (`span`, `info`, `debug`, `error`, etc.) - it wraps OpenTelemetry's trace API with convenience methods
25+
- `@pydantic/logfire-node` (from `packages/logfire-node`) depends on `logfire` and adds automatic instrumentation via `@opentelemetry/auto-instrumentations-node`
26+
- `@pydantic/logfire-cf-workers` depends on `logfire` and adds Cloudflare Workers-specific instrumentation
27+
- `@pydantic/logfire-browser` depends on `logfire` and adds browser-specific instrumentation
2828

2929
### Key Concepts
3030

31-
**Trace API** (`logfire-api`):
31+
**Trace API** (`logfire` package):
3232

3333
- Provides convenience wrappers around OpenTelemetry spans with log levels (trace, debug, info, notice, warn, error, fatal)
3434
- Uses message template formatting with attribute extraction (see `formatter.ts`)
3535
- Uses ULID for trace ID generation (see `ULIDGenerator.ts`)
3636
- Supports attribute scrubbing for sensitive data (see `AttributeScrubber.ts`)
3737

38-
**Configuration** (`logfire` package):
38+
**Configuration** (`@pydantic/logfire-node` package):
3939

4040
- `configure()` function in `logfireConfig.ts` handles SDK initialization
4141
- Configuration can be provided programmatically or via environment variables:
@@ -79,7 +79,7 @@ npm run dev
7979
npm run test
8080

8181
# Run tests for a specific package
82-
cd packages/logfire && npm test
82+
cd packages/logfire-node && npm test
8383
```
8484

8585
### Linting and Type Checking
@@ -126,7 +126,7 @@ npm run release
126126

127127
```bash
128128
# Navigate to the package
129-
cd packages/logfire-api
129+
cd packages/logfire-api # or packages/logfire-node
130130

131131
# Run vitest with a filter
132132
npm test -- -t "test name pattern"

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ create an empty project:
3030
mkdir test-logfire-js
3131
cd test-logfire-js
3232
npm init -y es6 # creates package.json with `type: module`
33-
npm install logfire
33+
npm install @pydantic/logfire-node
3434
```
3535

3636
Then, create the following `hello.js` script in the directory:
3737

3838
```js
39-
import * as logfire from "logfire";
39+
import * as logfire from "@pydantic/logfire-node";
4040

4141
logfire.configure({
4242
token: "test-e2e-write-token",
@@ -59,11 +59,11 @@ the live view of your Logfire project.
5959

6060
### Cloudflare Workers
6161

62-
First, install the `@pydantic/logfire-cf-workers @pydantic/logfire-api` NPM
62+
First, install the `@pydantic/logfire-cf-workers logfire` NPM
6363
packages:
6464

6565
```sh
66-
npm install @pydantic/logfire-cf-workers @pydantic/logfire-api
66+
npm install @pydantic/logfire-cf-workers logfire
6767
```
6868

6969
Next, add `compatibility_flags = [ "nodejs_compat" ]` to your wrangler.toml or
@@ -94,7 +94,7 @@ function will extract your write token from the `env` object and provide the
9494
necessary configuration for the instrumentation:
9595

9696
```ts
97-
import * as logfire from "@pydantic/logfire-api";
97+
import * as logfire from "logfire";
9898
import { instrument } from "@pydantic/logfire-cf-workers";
9999

100100
const handler = {
@@ -159,11 +159,11 @@ This will point the instrumentation to Logfire.
159159
> [clear the data cache for your project](https://vercel.com/docs/data-cache/manage-data-cache).
160160
161161
Optionally, you can use the Logfire API package for creating manual spans.
162-
Install the `@pydantic/logfire-api` NPM package and call the respective methods
162+
Install the `logfire` NPM package and call the respective methods
163163
from your server-side code:
164164

165165
```tsx
166-
import * as logfire from "@pydantic/logfire-api";
166+
import * as logfire from "logfire";
167167

168168
export default async function Home() {
169169
return logfire.span("A warning span", {}, {
@@ -206,11 +206,11 @@ app.listen(PORT, () => {
206206
});
207207
```
208208

209-
Next, install the `logfire` and `dotenv` NPM packages to keep your Logfire write
209+
Next, install the `@pydantic/logfire-node` and `dotenv` NPM packages to keep your Logfire write
210210
token in a `.env` file:
211211

212212
```sh
213-
npm install logfire dotenv
213+
npm install @pydantic/logfire-node dotenv
214214
```
215215

216216
Add your token to the `.env` file:
@@ -220,11 +220,11 @@ LOGFIRE_TOKEN=your-write-token
220220
```
221221

222222
Then, create an `instrumentation.ts` file to set up the instrumentation. The
223-
`logfire` package includes a `configure` function that simplifies the setup:
223+
`@pydantic/logfire-node` package includes a `configure` function that simplifies the setup:
224224

225225
```ts
226226
// instrumentation.ts
227-
import * as logfire from "logfire";
227+
import * as logfire from "@pydantic/logfire-node";
228228
import "dotenv/config";
229229

230230
logfire.configure();
@@ -247,7 +247,7 @@ The examples directory includes a `Hello world` example that configures Deno
247247
OTel export to Logfire through environment variables.
248248

249249
Optionally, you can use the Logfire API package for creating manual spans.
250-
Install the `@pydantic/logfire-api` NPM package and call the respective methods
250+
Install the `logfire` NPM package and call the respective methods
251251
from your code.
252252

253253
### Configuring the instrumentation
@@ -259,8 +259,8 @@ to configure the instrumentation.
259259

260260
## Trace API
261261

262-
The `@pydantic/logfire-api` exports several convenience wrappers around the
263-
OpenTelemetry span creation API. The `logfire` package re-exports these.
262+
The `logfire` package exports several convenience wrappers around the
263+
OpenTelemetry span creation API. The `@pydantic/logfire-node` package re-exports these.
264264

265265
The following methods create spans with their respective log levels (ordered by
266266
severity):

examples/browser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"http-proxy-middleware": "^2.0.6"
1818
},
1919
"devDependencies": {
20-
"@pydantic/logfire-api": "*",
20+
"logfire": "*",
2121
"@pydantic/logfire-browser": "*",
2222
"@types/cors": "^2.8.17",
2323
"@types/express": "^4.17.21",

examples/cf-producer-worker/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"dependencies": {
1919
"@microlabs/otel-cf-workers": "^1.0.0-rc.49",
20-
"@pydantic/logfire-api": "*",
20+
"logfire": "*",
2121
"@pydantic/logfire-cf-workers": "*"
2222
}
2323
}

examples/cf-producer-worker/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* Learn more at https://developers.cloudflare.com/workers/
1212
*/
13-
import * as logfire from '@pydantic/logfire-api';
13+
import * as logfire from 'logfire';
1414
import { instrumentTail } from '@pydantic/logfire-cf-workers';
1515

1616
const handler = {

examples/cf-worker/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"wrangler": "^4.0.0"
1717
},
1818
"dependencies": {
19-
"@pydantic/logfire-api": "*",
19+
"logfire": "*",
2020
"@pydantic/logfire-cf-workers": "*"
2121
}
2222
}

examples/cf-worker/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* Learn more at https://developers.cloudflare.com/workers/
1212
*/
13-
import * as logfire from '@pydantic/logfire-api';
13+
import * as logfire from 'logfire';
1414
import { instrument } from '@pydantic/logfire-cf-workers';
1515

1616
const handler = {

0 commit comments

Comments
 (0)