Postgres database agent support - #2103
Closed
JayPolanco wants to merge 3 commits into
Closed
Conversation
Contributor
Author
|
Not needed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the issue
Self-managed PostgreSQL monitoring on EC2 requires the CloudWatch Agent to collect counter metrics, DB Load (active session sampling at 1s), and Top SQL statistics. The upstream OTel PostgreSQL receiver (v0.150.0) provides the foundation but has gaps for these requirements.
Description of changes
Embedded upstream v0.150.0 postgresqlreceiver into receiver/postgresqlreceiver/ with adapted module paths and inlined internal/sqlquery dependency.
Registered new components in service/defaultcomponents/components.go:
Gap fixes on top of upstream (reviewer focus):
Independent query_sample collection_interval — Added
CollectionIntervaltoQuerySampleCollectionand separateControllerConfigincreateLogsReceiver. Allows 1s DB Load sampling without affecting 60s counter collection.CollectionIntervalfieldlogsControllerConfigoverride logicNewLogsControllerpostgresql.sessions metric — New gauge metric querying
pg_stat_activity GROUP BY statefor session state breakdown (active/idle/idle_in_transaction). Disabled by default viametricsconfig.collectSessionStatesmethodTop SQL local_blks columns — Added
local_blks_hit,local_blks_read,local_blks_dirtied,local_blks_writtento the top query SQL template.Exclude receiver self-connection from DB Load — Added
pid <> pg_backend_pid()filter to the query sample template to prevent the receiver's own database connection from inflating active session counts.Updated components_test.go for new receiver and connector counts.
License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Tests
components_test.goupdated and passingRequirements
make fmtandmake fmt-shmake lint