grafana / opensearch-datasource

Apache License 2.0
27 stars 21 forks source link

Fix: handle empty trace group and last updated values #445

Closed kevinwcyu closed 1 month ago

kevinwcyu commented 2 months ago

What this PR does / why we need it: Fixes an issue where some trace groups and last updated values are empty. This causes a panic when parsing the returned trace from OpenSearch into a data frame field.

Which issue(s) this PR fixes:

Special notes for your reviewer: You can test this by:

  1. Clone https://github.com/opensearch-project/opentelemetry-demo and run it with the following
    git clone https://github.com/opensearch-project/opentelemetry-demo.git
    cd opentelemetry-demo
    docker compose up -d
  2. Start your local Grafana instance on another port other than 3000
    [server]
    http_port = 4000
  3. Open http://localhost:4000 (use the port you set above) and create an opensearch data source with the following settings (password is my_%New%_passW0rd!@#) data source config
  4. Go to http://localhost:8089/ click Edit under the "Running" heading in the header and increase the Number of users and Spawn rate settings (I used 250 for Number of users and 50 for Spawn rate)
  5. Go to http://localhost:4000/explore set the time range to last 24 hours and run a Lucene Trace query (no need to fill in the query field).
  6. When you run OpenSearch without this PR it should have an An error occurred within the plugin error. It should return results with the trace group and last updated field blank when running OpenSearch with this PR. fixed

    Here's an image of the OpenSearch dashboard that shows that it leaves those fields blank

    opensearch

Note: I'm not sure exactly when a trace without a trace group or last updated value is generated, you may have to wait some time though.