Skip to content

Conversation

@taiphanvan2k3
Copy link
Member

  • Updated ConversationRepository to include IsStarred in the conversation query and streamlined parameter handling for improved readability and maintainability.
  • Refactored OpenTelemetryExtensions to consolidate tracing configuration, ensuring proper resource attributes and OTLP exporter setup for better observability.
  • Improved exception handling in GlobalExceptionMiddleware to provide clearer error messages without leaking internal details.

- Updated ConversationRepository to include IsStarred in the conversation query and streamlined parameter handling for improved readability and maintainability.
- Refactored OpenTelemetryExtensions to consolidate tracing configuration, ensuring proper resource attributes and OTLP exporter setup for better observability.
- Improved exception handling in GlobalExceptionMiddleware to provide clearer error messages without leaking internal details.
@taiphanvan2k3 taiphanvan2k3 self-assigned this Dec 2, 2025
@taiphanvan2k3 taiphanvan2k3 merged commit ad73391 into main Dec 2, 2025
1 check passed
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 2, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Three files modified to consolidate SQL parameter handling in repository queries, refactor OpenTelemetry configuration with GCP-specific resource attributes, and update exception middleware to expose internal error details in error responses.

Changes

Cohort / File(s) Summary
Repository Query Consolidation
src/Infrastructure/Repositories/ConversationRepository.cs
Introduced CreateCommonParameters helper method to eliminate duplication of SQL parameter construction (@userId, @searchTerm, @isStarred). Parameters now reused for both count and data queries; added IsStarred to SELECT list and updated query to use combined parameters with explicit @offset and @limit.
OpenTelemetry Configuration Refactoring
src/Web.Api/Extensions/OpenTelemetryExtensions.cs
Consolidated separate resource construction and OpenTelemetry setup into unified AddOpenTelemetry().WithTracing configuration. Added SetResourceBuilder with service metadata and GCP attributes (cloud.provider, cloud.platform, gcp.project_id, faas.name, faas.version, service.namespace). Centralized OTLP exporter endpoint handling with Cloud Run-specific logic and conditional console exporter wiring.
Exception Middleware Error Details
src/Web.Api/Middleware/GlobalExceptionMiddleware.cs
Changed default unhandled exception details to return inner exception message (or exception message) instead of static string, potentially exposing internal error information to clients.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • OpenTelemetry refactoring: Verify GCP attribute mappings are correct and Cloud Run environment detection logic is sound
  • Parameter consolidation: Ensure SQL parameter reuse across count and data queries doesn't introduce injection vulnerabilities or logic errors
  • Exception details exposure: Confirm the change to display internal exception messages aligns with security and logging policies

Poem

A rabbit hops through code so neat,
Consolidating queries—what a treat!
Telemetry sparkles with GCP grace,
While exceptions reveal their true face. ✨🐰


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between e1b9192 and 6203537.

📒 Files selected for processing (3)
  • src/Infrastructure/Repositories/ConversationRepository.cs (2 hunks)
  • src/Web.Api/Extensions/OpenTelemetryExtensions.cs (2 hunks)
  • src/Web.Api/Middleware/GlobalExceptionMiddleware.cs (1 hunks)

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

@taiphanvan2k3 taiphanvan2k3 deleted the fix/error-sql-when-search-list-of-histories branch December 2, 2025 10:28
taiphanvan2k3 added a commit that referenced this pull request Dec 22, 2025
…arch-list-of-histories

fix: Error sql when searching list of histories
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