Skip to content

feat: Add _createInProjectGroup to logger options - #2558

Merged
Luca Forstner (lforst) merged 3 commits into
mainfrom
lforst/dum-e/seoul-2e602ba525
Oct 1, 2026
Merged

Luca Forstner (lforst) merged 3 commits into
mainfrom
lforst/dum-e/seoul-2e602ba525

Conversation

@lforst

@lforst Luca Forstner (lforst) commented Oct 1, 2026 •

Copy link
Copy Markdown
Member
  • Braintrust projects can be organized into project groups. Before this change, initLogger() could only find or create a project by name or ID. There was no way to say "this project should live in group X", so new projects created by the logger always ended up outside any group.
  • initLogger() now accepts a _createInProjectGroup option, which takes the name of an existing project group.
    • When the logger registers its project, it sends the group name along with the request. A new project gets created inside that group.
    • If a project with that name already exists outside the group, the server rejects registration with a 409. The SDK surfaces that error and does not quietly fall back to registering without a group.
    • If projectId is also passed, the ID still wins and the group option is ignored, same as how projectId already takes precedence over projectName.
  • The SDK normally caches project lookups, so loggers for the same project share one registration request. Loggers that use a group skip this cache, both for reading and writing. Otherwise a cached result could hide the fact that the project isn't actually in the requested group. Loggers without a group keep using the shared cache as before.
  • Registration still happens lazily, on first use rather than when initLogger() is called.
  • The group name is also included in exported logger and span identifiers. Before the project ID is known, an export carries the arguments needed to look the project up later. Whoever receives the export now registers in the same group. The format matches what the Python SDK produces.
const logger = initLogger({
  projectName: "my-project",
  // New: create the project inside an existing project group
  _createInProjectGroup: "my-group",
});

@lforst
Luca Forstner (lforst) merged commit 11f4c04 into main Oct 1, 2026
57 checks passed
@lforst
Luca Forstner (lforst) deleted the lforst/dum-e/seoul-2e602ba525 branch October 1, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants