Skip to content

Conversation

felixbarny
Copy link
Member

Part of #133057

@felixbarny felixbarny self-assigned this Aug 28, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@elasticsearchmachine elasticsearchmachine added Team:StorageEngine v9.2.0 external-contributor Pull request authored by a developer outside the Elasticsearch team labels Aug 28, 2025
Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

I'm not familiar with Otel related domain classes, but the integration into rest and transport action LGTM.

ObjectPath search = ObjectPath.createFromResponse(
client().performRequest(new Request("GET", "metrics-generic.otel-default" + "/_search"))
);
assertThat(search.evaluate("hits.total.value"), equalTo(1));
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we validate the response here as in the next one?

// If the processing of the request fails,
// the server MUST respond with appropriate HTTP 4xx or HTTP 5xx status code.
// https://opentelemetry.io/docs/specs/otlp/#failures-1
status = RestStatus.INTERNAL_SERVER_ERROR;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we be checking the returned errors in the responses? For instance, if they all report bad argument, this should be BAD_REQUEST?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm wondering whether I misinterpreted the spec here. Maybe we should also return 200, similar to what we do in the _bulk API, no matter of one, almost all, or all individual items have failed. We then rely on the rejected data points and the error message to convey that all items have failed.

// If the processing of the request fails,
// the server MUST respond with appropriate HTTP 4xx or HTTP 5xx status code.
new MetricsResponse(
RestStatus.INTERNAL_SERVER_ERROR,
Copy link
Contributor

Choose a reason for hiding this comment

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

@martijnvg I don't think we want to return 500 here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Which return code would be more appropriate here?

@kkrik-es
Copy link
Contributor

Let's split the data point and tsid logic to separate PRs and add unit tests.

@felixbarny
Copy link
Member Author

Let's split the data point and tsid logic to separate PRs and add unit tests.

I've reverted the changes to the action classes and created unit tests for grouping and dynamic templates. Please have another look.

I'll follow up with the transport/rest action changes.

I like that the test coverage is ensure more by unit tests rather than integration tests. This makes debugging and test execution a lot easier. I'll still add more rest tests but I suppose they can be a bit lighter on test coverage where covering the edge cases is handled by the unit tests.

@felixbarny felixbarny requested a review from kkrik-es August 29, 2025 16:56
@felixbarny felixbarny enabled auto-merge (squash) August 29, 2025 17:47
@felixbarny felixbarny merged commit 374b96b into elastic:main Aug 30, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external-contributor Pull request authored by a developer outside the Elasticsearch team >non-issue :StorageEngine/TSDB You know, for Metrics Team:StorageEngine v9.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants