Skip to content

feat: Add charts API#811

Merged
kodiakhq[bot] merged 7 commits intomainfrom
tom/v2-api-charts
Jun 9, 2025
Merged

feat: Add charts API#811
kodiakhq[bot] merged 7 commits intomainfrom
tom/v2-api-charts

Conversation

@teeohhem
Copy link
Contributor

@teeohhem teeohhem commented May 13, 2025

  • Utilizes renderChartConfig and CH client to query for chart data
  • Implements API input schema
  • Adds lots of tests

Testing Notes:

  • To use swagger, go to localhost:8000/api/v2/docs
  • Authorize using your access key found in localhost:8000/me
  • Under the charts route, click "Try it out"
  • Use example payload:
{
  "startTime": <insert valid timestamp ms>,
  "endTime": <insert valid timestamp ms>,
  "granularity": "1h",
  "series": [
    {
      "sourceId": "<insert valid sourceid>",
      "aggFn": "count",
      "where": "SeverityText:error",
      "groupBy": []
    }
  ]
}

It was easiest for me to go to the UI, create a new chart and grab the sourceid and start/end timestamps from the URL, plug it in and profit.

Note: It was apparent to me that we will need to provide at least GET support for sources, otherwise that ID is not easily obtained.

Ref: HDX-1651

@changeset-bot
Copy link

changeset-bot bot commented May 13, 2025

⚠️ No Changeset found

Latest commit: 37c25cc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented May 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hyperdx-v2-oss-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2025 7:52pm

@teeohhem teeohhem marked this pull request as ready for review May 15, 2025 16:51
@teeohhem teeohhem requested a review from dhable May 15, 2025 16:51
@teeohhem teeohhem changed the base branch from v2 to main June 2, 2025 19:56
expect(Number(response.body.data[0]['series_0.data'])).toEqual(1);
});

it('should handle lucene query errors gracefully', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should there be a corresponding test to handle sql errors - e.g. what does it return when I give it a non-sql where clause when whereLanguage == 'sql'?

@teeohhem
Copy link
Contributor Author

teeohhem commented Jun 9, 2025

@dhable PR updated with ur feedback and tests updated.

@kodiakhq kodiakhq bot merged commit cb4045b into main Jun 9, 2025
6 of 7 checks passed
@kodiakhq kodiakhq bot deleted the tom/v2-api-charts branch June 9, 2025 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants