Skip to content

feat(Otel): Add first structlog events for OTel event pipeline#7237

Open
khvn26 wants to merge 1 commit intomainfrom
feat/otel-structlog-events
Open

feat(Otel): Add first structlog events for OTel event pipeline#7237
khvn26 wants to merge 1 commit intomainfrom
feat/otel-structlog-events

Conversation

@khvn26
Copy link
Copy Markdown
Member

@khvn26 khvn26 commented Apr 14, 2026

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to #7012

Adds the first product-meaningful structured log events for the OTel event pipeline (RFC). These events flow through StructlogOTelProcessor in flagsmith-common 3.7.0 and reach the OTel Collector when OTEL_EXPORTER_OTLP_ENDPOINT is set.

Events added:

Event Signal Attributes
code_references.scan.created Adoption: org has set up CI scanning organisation.id, code_references.count, feature.count
code_references.cleanup_issues.created Retention: org acting on stale flag insights organisation.id, issues_created.count
workflows.change_request.committed Adoption: org using governance workflows organisation.id, environment.id, feature_states.count

Code references events are backend-only (CI pushes scans, GitHub issues created server-side). Change request committed is a multi-actor flow (requester ≠ approver) that the frontend Amplitude SDK can't reliably attribute.

Adding an event is a one-liner:

logger = structlog.get_logger("code_references")
logger.info("scan.created", organisation__id=org_id, code_references__count=3)

The StructlogOTelProcessor normalises this to an OTel LogRecord with EventName=code_references.scan.created and dotted attributes (organisation.id, code_references.count).

Infra changes (collector config, SG rules, service discovery, env vars) tracked in Flagsmith/pulumi#170.

How did you test this code?

Unit tests using pytest-structlog log fixture assert the exact event shape for all 3 events. make lint and make typecheck clean.

@khvn26 khvn26 requested review from a team as code owners April 14, 2026 17:38
@khvn26 khvn26 requested review from gagantrivedi and germangarces and removed request for a team April 14, 2026 17:38
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, reopen this pull request to trigger a review.

@khvn26 khvn26 requested review from a team and asaphko April 14, 2026 17:38
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Apr 14, 2026 5:40pm
flagsmith-frontend-preview Ignored Ignored Preview Apr 14, 2026 5:40pm
flagsmith-frontend-staging Ignored Ignored Preview Apr 14, 2026 5:40pm

Request Review

@github-actions github-actions bot added api Issue related to the REST API infrastructure feature New feature or request and removed infrastructure labels Apr 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-7237 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-7237 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7237 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-7237 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-e2e:pr-7237 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7237 Finished ✅ Results

Add product-meaningful structured log events to support the OTel event
pipeline (RFC #6918). These events flow through the StructlogOTelProcessor
in flagsmith-common and reach the OTel Collector when OTEL_EXPORTER_OTLP_ENDPOINT
is configured.

Events added:
- code_references.scan.created — adoption signal for CI scanning
- code_references.cleanup_issues.created — retention signal for stale flag action
- workflows.change_request.committed — governance/workflow adoption signal

Also adds OTEL_EXPORTER_OTLP_ENDPOINT to staging task definitions.

beep boop
@khvn26 khvn26 force-pushed the feat/otel-structlog-events branch from 06a1b71 to cd8209e Compare April 14, 2026 17:40
@khvn26 khvn26 changed the title feat: add structlog events for OTel event pipeline feat: Add structlog events for OTel event pipeline Apr 14, 2026
@github-actions github-actions bot added feature New feature or request and removed feature New feature or request infrastructure labels Apr 14, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.29%. Comparing base (1cd16ea) to head (cd8209e).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7237   +/-   ##
=======================================
  Coverage   98.29%   98.29%           
=======================================
  Files        1351     1351           
  Lines       50747    50767   +20     
=======================================
+ Hits        49880    49900   +20     
  Misses        867      867           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  57.7 seconds
commit  06a1b71
info  🔄 Run: #16042 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  44.6 seconds
commit  06a1b71
info  🔄 Run: #16042 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  43.7 seconds
commit  06a1b71
info  🔄 Run: #16042 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 3 seconds
commit  06a1b71
info  🔄 Run: #16042 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  56.5 seconds
commit  cd8209e
info  🔄 Run: #16043 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  44.5 seconds
commit  cd8209e
info  🔄 Run: #16043 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  1 minute, 7 seconds
commit  cd8209e
info  🔄 Run: #16043 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  52.4 seconds
commit  cd8209e
info  🔄 Run: #16043 (attempt 1)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Visual Regression

16 screenshots compared. See report for details.
View full report

@khvn26 khvn26 changed the title feat: Add structlog events for OTel event pipeline feat(Otel): Add structlog events for OTel event pipeline Apr 14, 2026
@khvn26 khvn26 changed the title feat(Otel): Add structlog events for OTel event pipeline feat(Otel): Add first structlog events for OTel event pipeline Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants