grafana / pyroscope

Continuous Profiling Platform. Debug performance issues down to a single line of code

Home Page:https://grafana.com/oss/pyroscope/

Repository from Github https://github.comgrafana/pyroscopeRepository from Github https://github.comgrafana/pyroscope

[bug][pyroscope] Pyroscope does not ingest Speedscope files with multiple profiles

lagutrop opened this issue · comments

commented

Describe the bug

I've been using Pyroscope version 0.37.2 for a couple of months and decided to upgrade to the new version of Pyroscope (1.12). In the above version it was possible to call the ingest endpoint (POST localhost:4040/ingest?name=MyServiceName&from=1741682023&until=1741682083&format=speedscope) with multiple profiles like the example that you provide in your TestData folder.
Now with the upgrade to 1.12.0, I'm getting the following error

{
    "code": "unknown",
    "message": "invalid_argument: pyroscopeIngesterAdapter failed to convert metadata: unknown profile type: seconds"
}

To Reproduce

Use the last release build 1.12.0 and call the following endpoint in Postman for example

POST localhost:4040/ingest?name=MyServiceName&from=1741682023&until=1741682083&format=speedscope

In body select Raw and insert the following Speedscope

{
  "exporter": "speedscope@0.6.0",
  "$schema": "https://www.speedscope.app/file-format-schema.json",
  "name": "Two Samples",
  "activeProfileIndex": 1,
  "profiles": [
    {
      "type": "sampled",
      "name": "one",
      "unit": "seconds",
      "startValue": 0,
      "endValue": 14,
      "samples": [
        [0, 1, 2],
        [0, 1, 2],
        [0, 1, 3],
        [0, 1, 2],
        [0, 1]
      ],
      "weights": [1, 1, 4, 3, 5]
    },
    {
      "type": "sampled",
      "name": "two",
      "unit": "seconds",
      "startValue": 0,
      "endValue": 14,
      "samples": [
        [0, 1, 2],
        [0, 1, 2],
        [0, 1, 3],
        [0, 1, 2],
        [0, 1]
      ],
      "weights": [1, 1, 4, 3, 5]
    }
  ],
  "shared": {
    "frames": [
      { "name": "a" },
      { "name": "b" },
      { "name": "c" },
      { "name": "d" }
    ]
  }
}

The following error will appear, with status code 422 Unprocessable Entity.

{
    "code": "unknown",
    "message": "invalid_argument: pyroscopeIngesterAdapter failed to convert metadata: unknown profile type: seconds"
}

Expected behavior

The ingest endpoint should process this speedscope file correctly, since it is one of the files provided in TestData folder (https://github.com/grafana/pyroscope/blob/main/pkg/og/convert/speedscope/testdata/two-sampled.speedscope.json).

Environment

  • Infrastructure: Docker
  • Deployment tool: Docker-compose with image 1.12.0

Additional Context

2025-03-11 08:35:13 ts=2025-03-11T08:35:13.851202454Z caller=http.go:285 level=warn traceID=6804a615f0d03319 msg="POST /ingest?name=Postman1&from=1741682023&until=1741682083&format=speedscope (422) 841.156µs Response: "{\"code\":\"unknown\",\"message\":\"invalid_argument: pyroscopeIngesterAdapter failed to convert metadata: unknown profile type: seconds\"}\n" ws: false; Accept: /; Accept-Encoding: gzip, deflate, br; Connection: keep-alive; Content-Length: 914; Content-Type: application/json; Postman-Token: 7c16899e-266b-436f-9696-2b7ce78ab190; User-Agent: PostmanRuntime/7.43.0; "

Thanks for reporting.

I think this is a bug introduced during go Pyroscope <-> phlare merging in the ingest adapter. I will take a look.

commented

Hello, thanks for the answer. If there's any intermediate version that you want me to test, feel free to ask.

Thank you for your support.

No. The json you shared is enough. I will add it to our integration test suite along with the fix sometime soon.