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

Type of yValues in an XY model series is listed as int64 but encoded as double #101

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

Comments

@awendelin-work
Copy link

The trace-server (built from incubator
4b14d71637df2cedecd48d4287851315418a2d31) returns XY model data which
is inconsistent with the openapi specification.

The XY endpoint to fetch the model
(https://localhost:8080/tsp/api/experiments/{expUUID}/outputs/XY/{outputId}/xy)
lists in its response schema that yValues is an array of int64, but
the actual values returned by the trace-server are encoded as doubles.

In org.eclipse.tracecompass.incubator, the series is serialized by
SeriesModelSerializer.java which takes in an ISeriesModel and
writes its data to JSON. The relevant part is:

public void serialize(ISeriesModel value, ...)
    ...
    gen.writeObjectField("yValues", value.getData())
    ...

getData is defined by the interface ISeriesModel as:

/**
 * Get the y values
 *
 * @return An array of y values
 */
double[] getData();

A consumer following the specification will attempt to parse the
yValues as an int64 and either fail or truncate the values.

Example of a series:

{
  "seriesId": 2,
  "seriesName": "2",
  "xValues": [
    28170745093,
    28180756897,
    28190770283,
    28200779146,
    28201221406,
    28211228374
  ],
  "yValues": [
    10913.0,
    12613.0,
    12177.0,
    12455.0,
    14821.0,
    17925.0
  ],
  "style": {
    "parentKey": null,
    "values": {
      "series-type": "scatter"
    }
  }
},

To me it makes sense that the yValues should listed as doubles in
the openapi specification, and that that's where the issue lies.

diff --git a/API.yaml b/API.yaml
index af1ee4c..5c36fa4 100644
--- a/API.yaml
+++ b/API.yaml
@@ -2246,8 +2246,8 @@ components:
           type: array
           description: Series' Y values
           items:
-            type: integer
-            format: int64
+            type: number
+            format: double
       description: This model includes the series output style values.
     XYModel:
       required:
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