Skip to content

Conversation

@shahrokni
Copy link
Contributor

@shahrokni shahrokni commented Jan 19, 2026

Relates to perses/perses#3786

Description 🖊️

This PR will add the current transform feature to the logs table.

image

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
    following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
  • All commits have DCO signoffs.

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.

@shahrokni shahrokni requested a review from jgbernalp January 19, 2026 12:35
@shahrokni shahrokni force-pushed the feat/add_transform_to_logs_table branch from 48a3ca0 to 9d07767 Compare January 19, 2026 12:39
@shahrokni shahrokni marked this pull request as ready for review January 19, 2026 12:39
@shahrokni shahrokni requested review from a team and AntoineThebaud as code owners January 19, 2026 12:39
const { onChange, value } = props;

const handleTransformsChange: TransformsEditorProps['onChange'] = (transforms) => {
console.log(transforms);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
console.log(transforms);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@shahrokni shahrokni force-pushed the feat/add_transform_to_logs_table branch from 9d07767 to 5610fc9 Compare January 19, 2026 13:36
@shahrokni shahrokni requested a review from jgbernalp January 19, 2026 13:37
@jgbernalp jgbernalp changed the title [FEATURE]: add teansform to the logs table [FEATURE]: add transforms to the logs table Jan 19, 2026
@jgbernalp
Copy link
Contributor

There seems to be an issue with the transforms editor. The columns value which is marked as required is not saved.

Screenshot 2026-01-19 at 15 13 44

@shahrokni
Copy link
Contributor Author

shahrokni commented Jan 19, 2026

There seems to be an issue with the transforms editor. The columns value which is marked as required is not saved.

Screenshot 2026-01-19 at 15 13 44

Shouldn't this be fixed with a dedicated issue for the transform editor?
I just embedded the current existing Transform Editor from the Shared repo into the Logs Table plugin
I have not even added the Extract transformer yet
I myself also found an issue

@jgbernalp
Copy link
Contributor

sure, but why don't do the fix first so we can actually test this is working?

@shahrokni
Copy link
Contributor Author

sure, but why don't do the fix first so we can actually test this is working?

Hmm, yes why not. Let's do the fix first.
I am just wondering, if the transform feature has been used seriously so far. It seems there are some serious issues with the feature. Have you ever tried this feature yourself from your side?

@jgbernalp
Copy link
Contributor

jgbernalp commented Jan 19, 2026

I just shared with you my testing of the feature, that's why I found the issue... There's probably a lack of testing for this, as this used to be working before.

Signed-off-by: Mahmoud <seyedmahmoud.shahrokni@amadeus.com>

Signed-off-by: Mahmoud Shahrokni <seyedmahmoud.shahrokni@amadeus.com>

Signed-off-by: Mahmoud Shahrokni <seyedmahmoud.shahrokni@amadeus.com>

Signed-off-by: Mahmoud Shahrokni <seyedmahmoud.shahrokni@amadeus.com>

Signed-off-by: Mahmoud Shahrokni <seyedmahmoud.shahrokni@amadeus.com>
@shahrokni shahrokni force-pushed the feat/add_transform_to_logs_table branch from 5610fc9 to dda2b60 Compare January 29, 2026 12:13
@shahrokni
Copy link
Contributor Author

shahrokni commented Jan 29, 2026

There seems to be an issue with the transforms editor. The columns value which is marked as required is not saved.

Screenshot 2026-01-19 at 15 13 44

@jgbernalp I would to mention that from what I understood the Transform has not been broken with a recent change.

Why doesn't it work?

We can not see the effect of the transform for a Log Table because it has never been used and designed for log table!

The data structure doesn't fit

The data transform utility does not recognize log entry structure. And what is really a column in a log entry table?
Please take into account that maybe some of these transform does not have any meaning for logs. If this is the case, the list of proper transforms should be configurable. It seems the transform was initially designed for a simple table

/* This is the utility */
export function transformData(
  data: Array<Record<string, unknown>>,
  transforms: Transform[]
): Array<Record<string, unknown>> => {/* ... */}
/* This is the log structure */ 
/* There is column here */
export interface LogEntry {
    timestamp: number;
    line: string;
    labels: Labels;
}
/* If you try the wrong usage, it throws an exception. (Type mismatch) */
  const rawLogs = queryResults
    .flatMap((result) => result?.data.logs?.entries ?? [])
    .sort((a, b) => b.timestamp - a.timestamp);

  const logs = useMemo(() => transformData(rawLogs, spec.transforms ?? []), [rawLogs, spec.transforms]);

Likely steps

  1. Make the Transform Kind dynamic (You should be able to include exclude items to the transform Kind)
  2. Implement logs table specific transforms
  3. Get back to this PR and force it use Logs specific transforms

@Gladorme
Copy link
Member

Gladorme commented Jan 29, 2026

Transformation principe has been thought to be re-used in any query type, but yeah currently there are only TimeSeriesQuery transformations, that will probably not work/make sense with logs or other query types.

I wonder if we should not create a new type of plugin (Transformation), so datasources can add their own transformations and people with specific needs can add their own too 🤔

@jgbernalp
Copy link
Contributor

IMO transforms should apply to a table data, regardless of the QueryType behind. When the data is on the table it has already been transformed from query type to Record of things. Maybe we should re check if this should be the case, but I think it does not make sense to force currently the logs to match the timeseries transforms...

@shahrokni
Copy link
Contributor Author

shahrokni commented Jan 30, 2026

IMO transforms should apply to a table data, regardless of the QueryType behind. When the data is on the table it has already been transformed from query type to Record of things. Maybe we should re check if this should be the case, but I think it does not make sense to force currently the logs to match the timeseries transforms...

I think the name Logs Table is misleading. What we see is not the table/table view.
We need to have an option to switch between this view and table view. (A simple table comprises rows and columns) You can find the same feature in Grafana (Logs Table View)

https://grafana.com/whats-new/2023-12-13-logs-table-ui/

Second 27

What is a Log Table View

A table view turn the logs into a structure suitable for rendering in a table. The transforms can be applied to the table view.

Steps

  1. Table view should process logs and extract set of possible columns
  2. Then it generates the according rows
  3. Then it should create the table
  4. Transforms can be applied to tables, as it has already been mentioned

@Gladorme
Copy link
Member

Gladorme commented Jan 30, 2026

IMO transforms should apply to a table data, regardless of the QueryType behind. When the data is on the table it has already been transformed from query type to Record of things. Maybe we should re check if this should be the case, but I think it does not make sense to force currently the logs to match the timeseries transforms...

I agree with this.

... We need to have an option to switch between this view and table view ...

I did not really use or check Log Table panel, so I can't tell what is the best solution

@jgbernalp
Copy link
Contributor

@shahrokni Not sure If understand correctly. What is the scope of the work you are planning to do? Have a button to switch from logs table to a generic table?

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

Successfully merging this pull request may close these issues.

4 participants