Skip to content

feat: adds multiple teams / customers / bus to connectors - #4875

Merged
akshaydeo merged 1 commit into
devfrom
07-03-feat_adds_multiple_teams___customers___bus_to_connectors
Jul 3, 2026
Merged

feat: adds multiple teams / customers / bus to connectors#4875
akshaydeo merged 1 commit into
devfrom
07-03-feat_adds_multiple_teams___customers___bus_to_connectors

Conversation

@roroghost17

@roroghost17 roroghost17 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds support for multi-value governance attributes (team IDs/names, customer IDs/names, business unit IDs/names) as trace span attributes, complementing the existing single-value variants.

Changes

  • Added new trace attribute constants for plural governance identifiers: bifrost.team.ids, bifrost.team.names, bifrost.customer.ids, bifrost.customer.names, bifrost.business_unit.ids, and bifrost.business_unit.names
  • Wired up the corresponding context keys (BifrostContextKeyGovernanceTeamIDs, BifrostContextKeyGovernanceTeamNames, BifrostContextKeyGovernanceCustomerIDs, BifrostContextKeyGovernanceCustomerNames, BifrostContextKeyGovernanceBusinessUnitIDs, BifrostContextKeyGovernanceBusinessUnitNames) to set these attributes on trace spans during request execution

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

Populate the new plural governance context keys on a request context and verify the resulting trace span contains the expected multi-value attributes.

go test ./...

Breaking changes

  • Yes
  • No

Related issues

Security considerations

The new attributes propagate governance-scoped identifiers (team, customer, business unit) into trace spans. Ensure these values are not considered sensitive in your observability backend, or that appropriate access controls are in place on trace data.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 940e2f39-707b-4f7d-a23b-c8588272a2e8

📥 Commits

Reviewing files that changed from the base of the PR and between 815c4ce and 8239767.

📒 Files selected for processing (2)
  • core/bifrost.go
  • core/schemas/trace.go

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved request tracing so it now includes additional multi-value context details when available.
    • This helps make diagnostics and observability more complete for requests involving multiple teams, customers, or business units.

Walkthrough

This PR adds six new exported trace attribute constants for pluralized governance context (team IDs/names, customer IDs/names, business unit IDs/names) and updates executeRequestWithRetries to set these tracer attributes when the corresponding context values are present.

Changes

Governance Tracer Attributes

Layer / File(s) Summary
New pluralized trace attribute constants
core/schemas/trace.go
Adds six new exported constants (AttrBifrostTeamIDs, AttrBifrostTeamNames, AttrBifrostCustomerIDs, AttrBifrostCustomerNames, AttrBifrostBusinessUnitIDs, AttrBifrostBusinessUnitNames) to the Bifrost trace attribute namespace.
Span attribute population in retry flow
core/bifrost.go
In executeRequestWithRetries, conditionally reads slice-based governance context values and sets the new plural tracer attributes on the span when non-empty.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • maximhq/bifrost#3730: Both PRs modify executeRequestWithRetries in core/bifrost.go to add new tracer span attributes during retry/LLM-call attempts.
  • maximhq/bifrost#3732: Both PRs extend core/schemas/trace.go tracing constants and consume them in executeRequestWithRetries for governance/team/customer-related attributes.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is related to the change, but the wording is vague and the trailing "bus to connectors" phrase is unclear. Use a concise title that names the core change, such as adding plural governance trace attributes for teams, customers, and business units.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description matches the template well and includes the required summary, changes, testing, breaking changes, and security sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 07-03-feat_adds_multiple_teams___customers___bus_to_connectors

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Comment @coderabbitai help to get the list of available commands.

@CLAassistant

CLAassistant commented Jul 3, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@roroghost17
roroghost17 marked this pull request as ready for review July 3, 2026 06:36
@greptile-apps

greptile-apps Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

The change is purely additive, wiring six new []string context keys to trace span attributes with no modification to existing behavior.

The attribute constants and context-key reads are consistent with the rest of the governance tracing block, and []string values are already handled correctly elsewhere in the span attribute store. The only gap is that none of the six new key-to-attribute mappings are covered by tests, which means a copy-paste error between any of the six blocks could go undetected.

core/bifrost.go — the new attribute-setting blocks have no test coverage.

Important Files Changed

Filename Overview
core/schemas/trace.go Adds six new AttrBifrost* string constants for plural governance identifiers; purely additive, no existing constant is modified.
core/bifrost.go Wires up six []string context keys to span attributes inside executeRequestWithRetries; pattern is consistent with existing governance attributes but no tests cover the new mappings.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Gov as Governance Plugin
    participant Ctx as Request Context
    participant Bifrost as executeRequestWithRetries
    participant Tracer as Tracer.SetAttribute
    participant Span as Span Attributes

    Gov->>Ctx: Store []string under BifrostContextKeyGovernanceTeamIDs etc.
    Bifrost->>Ctx: ctx.Value(key).([]string)
    Ctx-->>Bifrost: "[]string{...}"
    Bifrost->>Tracer: SetAttribute(handle, AttrBifrostTeamIDs, teamIDs)
    Bifrost->>Tracer: SetAttribute(handle, AttrBifrostTeamNames, teamNames)
    Bifrost->>Tracer: SetAttribute(handle, AttrBifrostCustomerIDs, customerIDs)
    Bifrost->>Tracer: SetAttribute(handle, AttrBifrostCustomerNames, customerNames)
    Bifrost->>Tracer: SetAttribute(handle, AttrBifrostBusinessUnitIDs, businessUnitIDs)
    Bifrost->>Tracer: SetAttribute(handle, AttrBifrostBusinessUnitNames, businessUnitNames)
    Tracer->>Span: Span.Attributes stored as map[string]any
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Gov as Governance Plugin
    participant Ctx as Request Context
    participant Bifrost as executeRequestWithRetries
    participant Tracer as Tracer.SetAttribute
    participant Span as Span Attributes

    Gov->>Ctx: Store []string under BifrostContextKeyGovernanceTeamIDs etc.
    Bifrost->>Ctx: ctx.Value(key).([]string)
    Ctx-->>Bifrost: "[]string{...}"
    Bifrost->>Tracer: SetAttribute(handle, AttrBifrostTeamIDs, teamIDs)
    Bifrost->>Tracer: SetAttribute(handle, AttrBifrostTeamNames, teamNames)
    Bifrost->>Tracer: SetAttribute(handle, AttrBifrostCustomerIDs, customerIDs)
    Bifrost->>Tracer: SetAttribute(handle, AttrBifrostCustomerNames, customerNames)
    Bifrost->>Tracer: SetAttribute(handle, AttrBifrostBusinessUnitIDs, businessUnitIDs)
    Bifrost->>Tracer: SetAttribute(handle, AttrBifrostBusinessUnitNames, businessUnitNames)
    Tracer->>Span: Span.Attributes stored as map[string]any
Loading

Reviews (1): Last reviewed commit: "feat: adds multiple teams / customers / ..." | Re-trigger Greptile

Comment thread core/bifrost.go

akshaydeo commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Merge activity

  • Jul 3, 8:03 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 3, 8:04 AM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo
akshaydeo merged commit 83591ca into dev Jul 3, 2026
15 of 16 checks passed
@akshaydeo
akshaydeo deleted the 07-03-feat_adds_multiple_teams___customers___bus_to_connectors branch July 3, 2026 08:04
yangtuooc added a commit to yangtuooc/bifrost that referenced this pull request Jul 3, 2026
* upstream/dev:
  feat: adds multiple teams / customers / bus to connectors (maximhq#4875)
  fix: small latency return fixes (maximhq#4876)
  Added missing OpenAI responses methods for lifecycle related tasks (maximhq#3125)
  feat: latency info on errors (maximhq#4867)
  feat: add `user_name`, `team_ids`, `team_names`, `customer_ids`, `customer_names`, `business_unit_ids`, `business_unit_names` to log list select columns (maximhq#4866)
  feat: add multi-value attribution cell with plural fallback for logs columns (maximhq#4865)
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.

3 participants