Skip to content

Comments

Remove RequestContext from JsonProcessingMetricsReporter#2406

Merged
Hazel-Datastax merged 4 commits intomainfrom
hazel/update-jsonprocessingmetricsreporter
Feb 24, 2026
Merged

Remove RequestContext from JsonProcessingMetricsReporter#2406
Hazel-Datastax merged 4 commits intomainfrom
hazel/update-jsonprocessingmetricsreporter

Conversation

@Hazel-Datastax
Copy link
Contributor

@Hazel-Datastax Hazel-Datastax commented Feb 23, 2026

What this PR does:
When I am working on the MCP support for collection commands, I encounter a No REST request in progress error.

The reason is that JsonProcessingMetricsReporter is @ApplicationScoped but injects @RequestScoped RequestContext. When an MCP request (non-JAX-RS) triggers command execution, the CDI proxy for RequestContext tries to use the JAX-RS SecurityContext constructor → IllegalStateException: No REST request in progress.

The metrics reporter only uses requestContext.tenant() in getCustomTags(). Since all callers already have tenant available via commandContext.requestContext().tenant(), I think we can remove the RequestContext and simply pass the tenant as a parameter.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Changes manually tested
  • Automated Tests added/updated
  • Documentation added/updated
  • CLA Signed: DataStax CLA

@github-actions
Copy link
Contributor

github-actions bot commented Feb 24, 2026

📈 Integration Test Coverage Delta vs Main Branch (dse69-it)

Metric Value
Main Branch 70.58%
This PR 70.59%
Delta 🟢 +0.01%
✅ Coverage improved!

@github-actions
Copy link
Contributor

github-actions bot commented Feb 24, 2026

Integration Test Coverage Report (dse69-it)

Overall Project 70.59% 🍏
Files changed 95.9% 🍏

File Coverage
InsertOneCommandResolver.java 100% 🍏
InsertManyCommandResolver.java 100% 🍏
CollectionInsertAttemptBuilder.java 100% 🍏
JsonProcessingMetricsReporter.java 98.29% -1.71% 🍏
DeleteCollectionOperation.java 95.7% 🍏
ReadAndUpdateCollectionOperation.java 95.42% 🍏
InsertCollectionOperation.java 91.83% 🍏
FindCollectionOperation.java 88.51% 🍏
DocumentShredder.java 83.18% -0.25% 🍏
CollectionReadOperation.java 80.15% 🍏

@github-actions
Copy link
Contributor

github-actions bot commented Feb 24, 2026

📈 Integration Test Coverage Delta vs Main Branch (hcd-it)

Metric Value
Main Branch 72.32%
This PR 72.33%
Delta 🟢 +0.01%
✅ Coverage improved!

@github-actions
Copy link
Contributor

github-actions bot commented Feb 24, 2026

Integration Test Coverage Report (hcd-it)

Overall Project 72.33% 🍏
Files changed 95.9% 🍏

File Coverage
InsertOneCommandResolver.java 100% 🍏
InsertManyCommandResolver.java 100% 🍏
CollectionInsertAttemptBuilder.java 100% 🍏
JsonProcessingMetricsReporter.java 98.29% -1.71% 🍏
ReadAndUpdateCollectionOperation.java 96.9% 🍏
DeleteCollectionOperation.java 95.7% 🍏
InsertCollectionOperation.java 94.62% 🍏
FindCollectionOperation.java 94.32% 🍏
DocumentShredder.java 85.47% -0.25% 🍏
CollectionReadOperation.java 80.15% 🍏

@github-actions
Copy link
Contributor

📈 Unit Test Coverage Delta vs Main Branch

Metric Value
Main Branch 50.15%
This PR 50.16%
Delta 🟢 +0.01%
✅ Coverage improved!

@github-actions
Copy link
Contributor

Unit Test Coverage Report

Overall Project 50.16% -0.06% 🍏
Files changed 50%

File Coverage
DeleteCollectionOperation.java 98.87% 🍏
ReadAndUpdateCollectionOperation.java 96.9% 🍏
CollectionInsertAttemptBuilder.java 96.1% 🍏
InsertCollectionOperation.java 94.84% 🍏
FindCollectionOperation.java 80.05% 🍏
CollectionReadOperation.java 73.68% 🍏
DocumentShredder.java 65.59% -1.19%
InsertOneCommandResolver.java 0% -16.92%
InsertManyCommandResolver.java 0% -10.78%
JsonProcessingMetricsReporter.java 0% -21.93%

@Hazel-Datastax Hazel-Datastax changed the title remove RequestContext from JsonProcessingMetricsReporter Remove RequestContext from JsonProcessingMetricsReporter Feb 24, 2026
@Hazel-Datastax Hazel-Datastax marked this pull request as ready for review February 24, 2026 02:25
@Hazel-Datastax Hazel-Datastax requested a review from a team as a code owner February 24, 2026 02:25
Copy link
Contributor

@tatu-at-datastax tatu-at-datastax left a comment

Choose a reason for hiding this comment

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

LGTM

@Hazel-Datastax Hazel-Datastax merged commit f5da1ae into main Feb 24, 2026
3 checks passed
@Hazel-Datastax Hazel-Datastax deleted the hazel/update-jsonprocessingmetricsreporter branch February 24, 2026 17:42
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