fix: Prevent InvalidTypeIdException when Prometheus metric has 'type'… - #5696
Open
nagendramohan wants to merge 1 commit into
Open
fix: Prevent InvalidTypeIdException when Prometheus metric has 'type'…#5696nagendramohan wants to merge 1 commit into
nagendramohan wants to merge 1 commit into
Conversation
… label Add @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) on PrometheusResult to override the parent DataSourceResult interface's polymorphic type handling. This prevents Jackson from interpreting a metric label named 'type' as the polymorphic type discriminator, which caused InvalidTypeIdException during deserialization. The type dispatch is already handled explicitly via switch statement in ExecuteDirectQueryActionResponse, so polymorphic type annotations are not needed on the concrete class. Resolves opensearch-project#5684 Signed-off-by: Nagendra Mohan <nagendramohan1990@gmail.com>
nagendramohan
requested review from
LantaoJin,
RyanL1997,
Swiddis,
acarbonetto,
ahkcs,
anirudha,
dai-chen,
joshuali925,
mengweieric,
noCharger,
penghuo,
ps48,
qianheng-aws,
songkant-aws,
vamsimanohar,
ykmr1224 and
yuancu
as code owners
August 11, 2026 05:10
Contributor
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Contributor
PR Code Suggestions ✨Explore these optional code suggestions:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… label
Add @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) on PrometheusResult to override the parent DataSourceResult interface's polymorphic type handling. This prevents Jackson from interpreting a metric label named 'type' as the polymorphic type discriminator, which caused InvalidTypeIdException during deserialization.
The type dispatch is already handled explicitly via switch statement in ExecuteDirectQueryActionResponse, so polymorphic type annotations are not needed on the concrete class.
Resolves #5684
Description
PromQL queries fail with
InvalidTypeIdExceptionwhen a metric contains a label namedtype. This happens because theDataSourceResultinterface uses
@JsonTypeInfo(property = "type")for polymorphic deserialization, and Jackson interprets the metric'stypelabel as thetype discriminator.
Fix: Add
@JsonTypeInfo(use = JsonTypeInfo.Id.NONE)onPrometheusResultto override the parent's polymorphic type handling. The typedispatch is already handled explicitly via switch statement in
ExecuteDirectQueryActionResponse, so annotation-based polymorphism is unnecessary on the concrete class.Includes a regression test with a metric containing
"type": "gauge"label.Related Issues
Resolves #5684
Check List
created.
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check
here.