Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request body of POST to traces and experiments missing "parameters" #100

Open
awendelin-work opened this issue Jul 19, 2024 · 0 comments
Open

Comments

@awendelin-work
Copy link

There appears to be an inconsistency between the reference trace-server and the openapi specification. The examples below are done using trace-compass-incubator built from commit 4b14d71637df2cedecd48d4287851315418a2d31.

According to the openapi specification, the POST to import a trace is
supposed to look like:

curl -i --header "Content-Type: application/json" --header "Accept: application/json" --request POST --data '{"uri":"/home/<redacted>/builds/tsp-python-client/tracecompass-test-traces/ctf/src/main/resources/context-switches/context-switches-ust"}' http://localhost:8080/tsp/api/traces

But that gives back a response like:

HTTP/1.1 400 Bad Request
Server: Jetty(12.0.9)
Date: Fri, 19 Jul 2024 14:26:12 GMT
Content-Type: text/plain
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: origin, content-type, accept, authorization
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS, HEAD
Vary: Accept-Encoding
Content-Length: 443

Unrecognized field "uri" (class org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.model.views.QueryParameters), not marked as ignorable (2 known properties: "parameters", "filters"])
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 9] (through reference chain: org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.model.views.QueryParameters["uri"])

What you actually need to send is:

curl -i --header "Content-Type: application/json" --header "Accept: application/json" --request POST --data '{"parameters": {"uri":"/home/<redacted>/builds/tsp-python-client/tracecompass-test-traces/ctf/src/main/resources/context-switches/context-switches-ust"}}' http://localhost:8080/tsp/api/traces

Which returns:

HTTP/1.1 200 OK
Server: Jetty(12.0.9)
Date: Fri, 19 Jul 2024 14:28:05 GMT
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: origin, content-type, accept, authorization
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS, HEAD
Vary: Accept-Encoding
Content-Length: 268

{"name":"context-switches-ust","path":"/home/<redacted>/builds/tsp-python-client/tracecompass-test-traces/ctf/src/main/resources/context-switches/context-switches-ust","UUID":"8f0b3517-e95f-31c5-ba70-ee889f8883c0","nbEvents":0,"start":0,"end":0,"indexingStatus":"CLOSED"}

The openapi specification is missing the wrapping "parameters" object in
the request body schema that the server requires.

The same applies to opening an experiment where this fails with a 400:

curl -i --header "Content-Type: application/json" --header "Accept: application/json" --request POST --data '{"traces":["8f0b3517-e95f-31c5-ba70-ee889f8883c0"], "name": "broken"}' http://localhost:8080/tsp/api/experiments

But this works:

curl -i --header "Content-Type: application/json" --header "Accept: application/json" --request POST --data '{"parameters": {"traces":["8f0b3517-e95f-31c5-ba70-ee889f8883c0"], "name": "broken"}}' http://localhost:8080/tsp/api/experiments

So there are two main issues with the specification here:

  1. The request body schema for "putTrace" aka POST to /traces is missing "parameters"
  2. The request body schema for "postExperiment" aka POST to /experiments is missing "parameters"
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

No branches or pull requests

1 participant