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

Optimize the gcp_logging_log_entry table result or result timing by applying a timestamp filter and added the columns json_payload, proto_payload, metadata, resource, operation and tags Closes #507 #508

Merged
merged 14 commits into from
Jan 18, 2024

Conversation

ParthaI
Copy link
Contributor

@ParthaI ParthaI commented Oct 25, 2023

Integration test logs

Logs
N/A

Example query results

Results
> select log_name, receive_timestamp,timestamp, resource_type from gcp_logging_log_entry where log_name = 'projects/isldke-aaa/logs/diagnostic-log' and timestamp = '2023-09-29T10:09:08+05:30'
+----------+-------------------+-----------+---------------+
| log_name | receive_timestamp | timestamp | resource_type |
+----------+-------------------+-----------+---------------+
+----------+-------------------+-----------+---------------+

> select log_name, receive_timestamp,timestamp, resource_type from gcp_logging_log_entry where log_name = 'projects/isldke-aaa/logs/diagnostic-log' and timestamp <= '2023-09-29T10:09:08+05:30'
+-----------------------------------------+---------------------------+---------------------------+---------------+
| log_name                                | receive_timestamp         | timestamp                 | resource_type |
+-----------------------------------------+---------------------------+---------------------------+---------------+
| projects/isldke-aaa/logs/diagnostic-log | 2023-09-29T09:45:09+05:30 | 2023-09-29T09:45:06+05:30 | k8s_container |
| projects/isldke-aaa/logs/diagnostic-log | 2023-09-29T09:45:12+05:30 | 2023-09-29T09:45:09+05:30 | k8s_container |
+-----------------------------------------+---------------------------+---------------------------+---------------+

Time: 63.4s. Rows fetched: 2. Hydrate calls: 0.

> select log_name, receive_timestamp,timestamp, resource_type from gcp_logging_log_entry where log_name = 'projects/isldke-aaa/logs/diagnostic-log' and timestamp >= '2023-09-29T10:09:08+05:30'
+-----------------------------------------+---------------------------+---------------------------+---------------+
| log_name                                | receive_timestamp         | timestamp                 | resource_type |
+-----------------------------------------+---------------------------+---------------------------+---------------+
| projects/isldke-aaa/logs/diagnostic-log | 2023-09-29T10:09:18+05:30 | 2023-09-29T10:09:16+05:30 | k8s_container |
| projects/isldke-aaa/logs/diagnostic-log | 2023-09-29T10:09:11+05:30 | 2023-09-29T10:09:08+05:30 | k8s_container |
+-----------------------------------------+---------------------------+---------------------------+---------------+

Time: 5.8s. Rows fetched: 2. Hydrate calls: 0.

Copy link
Contributor

@cbruno10 cbruno10 left a comment

Choose a reason for hiding this comment

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

Other suggestions:

  • Remove "log_entry_" prefix from columns.
  • Consolidate JSON columns so each property has only 1 column, we can always add more columns later on. This will be a breaking change but I think will make the table columns more consistent and easy to maintain in the future.

// Default limit is set as 1000
pageSize := types.Int64(1000)
// Default limit is set as 10000
// After conducting tests with maximum page sizes of 1000, 5000, 17000, 20000, and 30000, we decided to stick with a page size of 10000 for performance improvement.
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
// After conducting tests with maximum page sizes of 1000, 5000, 17000, 20000, and 30000, we decided to stick with a page size of 10000 for performance improvement.
// 10000 seems to be a balanced limit, based on initial tests for retrieving 140k log entries: 5000 (124s), 10000 (88s), 20000 (84s)

Copy link

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the stale No recent activity has been detected on this issue/PR and it will be closed label Dec 29, 2023
@ParthaI ParthaI removed the stale No recent activity has been detected on this issue/PR and it will be closed label Jan 15, 2024
Copy link
Contributor

@cbruno10 cbruno10 left a comment

Choose a reason for hiding this comment

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

@ParthaI Please see comments, thanks!

gcp/table_gcp_logging_log_entry.go Outdated Show resolved Hide resolved
gcp/table_gcp_logging_log_entry.go Show resolved Hide resolved
@ParthaI ParthaI changed the title Optimize the gcp_logging_log_entry table result or result timing by applying a timestamp filter Closes #507 Optimize the gcp_logging_log_entry table result or result timing by applying a timestamp filter and added the columns json_payload, proto_payload, metadata, resource, operation and tags Closes #507 Jan 18, 2024
@bigdatasourav bigdatasourav merged commit 5952cfc into main Jan 18, 2024
1 check passed
@bigdatasourav bigdatasourav deleted the issue-507 branch January 18, 2024 10:00
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.

Optimize the gcp_logging_log_entry table result or result timing by applying a timestamp filter
3 participants