Skip to content

[Postgresql] [Bugfix] create new field query_id field to replace query field as dimension field #8248

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

Merged
merged 4 commits into from
Oct 26, 2023

Conversation

agithomas
Copy link
Contributor

@agithomas agithomas commented Oct 19, 2023

  • Bug

Proposed commit message

WHAT: The change helps to prevent the errors of storing data in ES when the query field in pg_stat_activity table exceeds 1024 byte length.
WHY: The length of the values stored in the query field can extend beyond 1024 bytes, which is the limit of dimension field length after a limit override

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

Author's Checklist

  • elastic-package build
  • elastic-package stack up -v -d --services package-registry
  • Validation of relationship between query and query_id field
  • Record count validation
  • Index Field mapping validation
  • Index Settings validation

How to test this PR locally

  • elastic-package build
  • elastic-package stack up -v -d --services package-registry
  • Upgrade the package

Screenshots

image

Priority

High.

@elasticmachine
Copy link

elasticmachine commented Oct 19, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-10-26T04:58:12.134+0000

  • Duration: 18 min 3 sec

Test stats 🧪

Test Results
Failed 0
Passed 41
Skipped 0
Total 41

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@elasticmachine
Copy link

elasticmachine commented Oct 19, 2023

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (1/1) 💚
Files 100.0% (4/4) 💚
Classes 100.0% (4/4) 💚
Methods 93.333% (28/30) 👍 1.026
Lines 97.059% (165/170) 👍 5.482
Conditionals 100.0% (0/0) 💚

@agithomas
Copy link
Contributor Author

agithomas commented Oct 19, 2023

Index mappings after the change

  "query": {
    "type": "keyword",
    "ignore_above": 1024
  },
  "query_id": {
    "type": "keyword",
    "time_series_dimension": true
  },

@agithomas agithomas marked this pull request as ready for review October 19, 2023 10:31
@agithomas agithomas requested a review from a team as a code owner October 19, 2023 10:31
@agithomas agithomas self-assigned this Oct 19, 2023
@lalit-satapathy
Copy link
Contributor

@agithomas, @aliabbas-elastic,

Can we reproduce and verify that the issue is getting resolved by the PR?

BTW, I am able to get a user query populated into: postgresql.activity.query

Screenshot 2023-10-23 at 11 11 03 AM

@ali786XI
Copy link
Contributor

Can we reproduce and verify that the issue is getting resolved by the PR?

Sure @lalit-satapathy Let me look into it

@ali786XI
Copy link
Contributor

ali786XI commented Oct 23, 2023

Performed TSDB testing over the changes and everything is working fine

All 234 documents taken from index .ds-metrics-postgresql.activity-default-2023.10.23-000001 were successfully placed to index tsdb-index-enabled.

image

image

Copy link
Contributor

@lalit-satapathy lalit-satapathy left a comment

Choose a reason for hiding this comment

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

LGTM.

The original below error was not reproduced during the testing. The fix should address the issue.

Dimension fields must be less than [1024] bytes but was [1307]

@agithomas agithomas merged commit ad1a9dc into elastic:main Oct 26, 2023
@elasticmachine
Copy link

Package postgresql - 1.17.1 containing this change is available at https://epr.elastic.co/search?package=postgresql

@agithomas agithomas deleted the issue-sdh-3948-postgres branch February 12, 2025 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants