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

Postgresql discovery config - add OTel native receiver #3957

Merged
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
84f2d77
remove smart agent postgresql configs and use native receiver for config
greatestusername Nov 20, 2023
0fa2afb
write bundled test for otel postgresql receiver
greatestusername Nov 20, 2023
edba6de
ordering
greatestusername Nov 20, 2023
f082aca
Merge branch 'signalfx:main' into postgresql-discovery-config
greatestusername-splunk Nov 20, 2023
702ad46
Merge branch 'signalfx:main' into postgresql-discovery-config
greatestusername-splunk Nov 21, 2023
16db21e
adjust windows bundles
greatestusername Nov 21, 2023
a53318f
remove old bunded test and add k8s bits to otel native bundled test
greatestusername Nov 21, 2023
c0ec51d
Merge branch 'signalfx:main' into postgresql-discovery-config
greatestusername-splunk Nov 22, 2023
38293b7
re-add smartagent-postgresql discovery with enabled set to false
greatestusername Nov 27, 2023
133061d
Merge branch 'signalfx:main' into postgresql-discovery-config
greatestusername-splunk Nov 27, 2023
e63cd1e
Merge branch 'postgresql-discovery-config' of https://github.com/grea…
greatestusername Nov 27, 2023
dfb1f13
Merge branch 'signalfx:main' into postgresql-discovery-config
greatestusername-splunk Dec 1, 2023
3167875
add back smartagent postgresql bundled_test
greatestusername Dec 1, 2023
23370bc
gofmt
greatestusername Dec 1, 2023
10369d1
Merge branch 'signalfx:main' into postgresql-discovery-config
greatestusername-splunk Dec 11, 2023
65ef8dc
Merge branch 'signalfx:main' into postgresql-discovery-config
greatestusername-splunk Dec 12, 2023
4a15e95
Update internal/confmapprovider/discovery/bundle/bundle.d/receivers/p…
greatestusername-splunk Dec 13, 2023
0e22df7
reference existing testdata files and remove copies.
greatestusername Dec 13, 2023
09ea3a6
update properties.discovery.yaml.example
greatestusername Dec 14, 2023
c12d747
Merge remote-tracking branch 'upstream/main' into postgresql-discover…
greatestusername Dec 14, 2023
299fe78
fix for bundledfs
greatestusername Dec 14, 2023
33e0bd6
fix alpha ordering
greatestusername Dec 14, 2023
f71ee95
Merge branch 'signalfx:main' into postgresql-discovery-config
greatestusername-splunk Dec 14, 2023
307e68a
Merge branch 'signalfx:main' into postgresql-discovery-config
greatestusername-splunk Dec 18, 2023
0389e2d
add breaking change to postgresql discovery in changelog and update d…
greatestusername Dec 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ splunk.discovery:
k8s_observer:
enabled: true
receivers:
postgresql:
enabled: true
smartagent/collectd/mysql:
enabled: true
smartagent/collectd/nginx:
enabled: true
smartagent/postgresql:
enabled: true
enabled: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#####################################################################################
# This file is generated by the Splunk Distribution of the OpenTelemetry Collector. #
# #
# It reflects the default configuration bundled in the Collector executable for use #
# in discovery mode (--discovery) and is provided for reference or customization. #
# Please note that any changes made to this file will need to be reconciled during #
# upgrades of the Collector. #
#####################################################################################
# postgresql:
# enabled: true
# rule:
# docker_observer: type == "container" and any([name, image, command], {# matches "(?i)postgres"}) and not (command matches "splunk.discovery")
# host_observer: type == "hostport" and command matches "(?i)postgres" and not (command matches "splunk.discovery")
# k8s_observer: type == "port" and pod.name matches "(?i)postgres"
# config:
# default:
# username: splunk.discovery.default
# password: splunk.discovery.default
# status:
# metrics:
# successful:
# - strict: postgresql.commits
# first_only: true
# log_record:
# severity_text: info
# body: PostgreSQL receiver is working!
# statements:
# failed:
# - regexp: 'connect: network is unreachable'
# first_only: true
# log_record:
# severity_text: info
# append_pattern: true
# body: The container cannot be reached by the Collector. Make sure they're in the same network.
# - regexp: 'connect: connection refused'
# first_only: true
# log_record:
# severity_text: info
# append_pattern: true
# body: The container is refusing PostgreSQL connections.
# partial:
# - regexp: 'pq: password authentication failed for user'
# first_only: true
# log_record:
# severity_text: info
# append_pattern: true
# body: >-
# Please ensure your user credentials are correctly specified with
# `--set splunk.discovery.receivers.postgresql.config.username="<username>"` and
# `--set splunk.discovery.receivers.postgresql.config.password="<password>"` or
# `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_username="<username>"` and
# `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_password="<password>"` environment variables.
# - regexp: 'pq: database .* does not exist'
# first_only: true
# log_record:
# severity_text: info
# append_pattern: true
# body: >-
# Make sure the target database is correctly specified using the
# `--set splunk.discovery.receivers.postgresql.config.databases="[<db>]"` command or the
# `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_databases="[<db>]"` environment variable.
# - regexp: 'pq: SSL is not enabled on the server'
# first_only: true
# log_record:
# severity_text: info
# append_pattern: true
# body: >-
# Make sure the target database has SSL enabled or set insecure using the
# `--set splunk.discovery.receivers.postgresql.config.tls::insecure="<boolean>"` command or the
# `SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_tls_x3a__x3a_insecure="<boolean>"` environment variable.
# - regexp: 'pq: pg_stat_statements must be loaded via shared_preload_libraries'
# first_only: true
# log_record:
# severity_text: info
# append_pattern: true
# body: >-
# Make sure your PostgreSQL database has
# `shared_preload_libraries = 'pg_stat_statements'`
# in the postgresql.conf file and that
# `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;`
# has been run for each database you would like to monitor.
# For example:
# `psql --dbname "<db-name>" -c "CREATE EXTENSION pg_stat_statements;"`
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# upgrades of the Collector. #
#####################################################################################
# smartagent/postgresql:
# enabled: true
# enabled: false
# rule:
# docker_observer: type == "container" and any([name, image, command], {# matches "(?i)postgres"}) and not (command matches "splunk.discovery")
# host_observer: type == "hostport" and command matches "(?i)postgres" and not (command matches "splunk.discovery")
Expand Down Expand Up @@ -86,4 +86,4 @@
# `CREATE EXTENSION IF NOT EXISTS pg_stat_statements;`
# has been run for each database you would like to monitor.
# For example:
# `psql --dbname "<db-name>" -c "CREATE EXTENSION pg_stat_statements;"`
# `psql --dbname "<db-name>" -c "CREATE EXTENSION pg_stat_statements;"`
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#####################################################################################
# Do not edit manually! #
# All changes must be made to associated .tmpl file before running 'make bundle.d'. #
#####################################################################################
postgresql:
enabled: true
rule:
docker_observer: type == "container" and any([name, image, command], {# matches "(?i)postgres"}) and not (command matches "splunk.discovery")
host_observer: type == "hostport" and command matches "(?i)postgres" and not (command matches "splunk.discovery")
k8s_observer: type == "port" and pod.name matches "(?i)postgres"
config:
default:
username: splunk.discovery.default
password: splunk.discovery.default
status:
metrics:
successful:
- strict: postgresql.commits
first_only: true
log_record:
severity_text: info
body: PostgreSQL receiver is working!
statements:
failed:
- regexp: 'connect: network is unreachable'
first_only: true
log_record:
severity_text: info
append_pattern: true
body: The container cannot be reached by the Collector. Make sure they're in the same network.
- regexp: 'connect: connection refused'
first_only: true
log_record:
severity_text: info
append_pattern: true
body: The container is refusing PostgreSQL connections.
partial:
- regexp: 'pq: password authentication failed for user'
first_only: true
log_record:
severity_text: info
append_pattern: true
body: >-
Please ensure your user credentials are correctly specified with
`--set splunk.discovery.receivers.postgresql.config.username="<username>"` and
`--set splunk.discovery.receivers.postgresql.config.password="<password>"` or
`SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_username="<username>"` and
`SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_password="<password>"` environment variables.
- regexp: 'pq: database .* does not exist'
first_only: true
log_record:
severity_text: info
append_pattern: true
body: >-
Make sure the target database is correctly specified using the
`--set splunk.discovery.receivers.postgresql.config.databases="[<db>]"` command or the
`SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_databases="[<db>]"` environment variable.
- regexp: 'pq: SSL is not enabled on the server'
first_only: true
log_record:
severity_text: info
append_pattern: true
body: >-
Make sure the target database has SSL enabled or set insecure using the
`--set splunk.discovery.receivers.postgresql.config.tls::insecure="<boolean>"` command or the
`SPLUNK_DISCOVERY_RECEIVERS_postgresql_CONFIG_tls_x3a__x3a_insecure="<boolean>"` environment variable.
- regexp: 'pq: pg_stat_statements must be loaded via shared_preload_libraries'
first_only: true
log_record:
severity_text: info
append_pattern: true
body: >-
Make sure your PostgreSQL database has
`shared_preload_libraries = 'pg_stat_statements'`
in the postgresql.conf file and that
`CREATE EXTENSION IF NOT EXISTS pg_stat_statements;`
has been run for each database you would like to monitor.
For example:
`psql --dbname "<db-name>" -c "CREATE EXTENSION pg_stat_statements;"`
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{{ receiver "postgresql" }}:
rmfitzpatrick marked this conversation as resolved.
Show resolved Hide resolved
enabled: true
rule:
docker_observer: type == "container" and any([name, image, command], {# matches "(?i)postgres"}) and not (command matches "splunk.discovery")
host_observer: type == "hostport" and command matches "(?i)postgres" and not (command matches "splunk.discovery")
k8s_observer: type == "port" and pod.name matches "(?i)postgres"
config:
default:
username: {{ defaultValue }}
password: {{ defaultValue }}
status:
metrics:
successful:
- strict: postgresql.commits
first_only: true
log_record:
severity_text: info
body: PostgreSQL receiver is working!
statements:
failed:
- regexp: 'connect: network is unreachable'
first_only: true
log_record:
severity_text: info
append_pattern: true
body: The container cannot be reached by the Collector. Make sure they're in the same network.
- regexp: 'connect: connection refused'
first_only: true
log_record:
severity_text: info
append_pattern: true
body: The container is refusing PostgreSQL connections.
partial:
- regexp: 'pq: password authentication failed for user'
first_only: true
log_record:
severity_text: info
append_pattern: true
body: >-
Please ensure your user credentials are correctly specified with
`--set {{ configProperty "username" "<username>" }}` and
`--set {{ configProperty "password" "<password>" }}` or
`{{ configPropertyEnvVar "username" "<username>" }}` and
`{{ configPropertyEnvVar "password" "<password>" }}` environment variables.
- regexp: 'pq: database .* does not exist'
first_only: true
log_record:
severity_text: info
append_pattern: true
body: >-
Make sure the target database is correctly specified using the
`--set {{ configProperty "databases" "[<db>]" }}` command or the
`{{ configPropertyEnvVar "databases" "[<db>]" }}` environment variable.
- regexp: 'pq: SSL is not enabled on the server'
first_only: true
log_record:
severity_text: info
append_pattern: true
body: >-
Make sure the target database has SSL enabled or set insecure using the
`--set {{ configProperty "tls::insecure" "<boolean>" }}` command or the
`{{ configPropertyEnvVar "tls::insecure" "<boolean>" }}` environment variable.
- regexp: 'pq: pg_stat_statements must be loaded via shared_preload_libraries'
first_only: true
log_record:
severity_text: info
append_pattern: true
body: >-
Make sure your PostgreSQL database has
`shared_preload_libraries = 'pg_stat_statements'`
in the postgresql.conf file and that
`CREATE EXTENSION IF NOT EXISTS pg_stat_statements;`
has been run for each database you would like to monitor.
For example:
`psql --dbname "<db-name>" -c "CREATE EXTENSION pg_stat_statements;"`
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# All changes must be made to associated .tmpl file before running 'make bundle.d'. #
#####################################################################################
smartagent/postgresql:
enabled: true
enabled: false
rule:
docker_observer: type == "container" and any([name, image, command], {# matches "(?i)postgres"}) and not (command matches "splunk.discovery")
host_observer: type == "hostport" and command matches "(?i)postgres" and not (command matches "splunk.discovery")
Expand Down Expand Up @@ -82,4 +82,4 @@ smartagent/postgresql:
`CREATE EXTENSION IF NOT EXISTS pg_stat_statements;`
has been run for each database you would like to monitor.
For example:
`psql --dbname "<db-name>" -c "CREATE EXTENSION pg_stat_statements;"`
`psql --dbname "<db-name>" -c "CREATE EXTENSION pg_stat_statements;"`
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ receiver "smartagent/postgresql" }}:
enabled: true
enabled: false
rule:
docker_observer: type == "container" and any([name, image, command], {# matches "(?i)postgres"}) and not (command matches "splunk.discovery")
host_observer: type == "hostport" and command matches "(?i)postgres" and not (command matches "splunk.discovery")
Expand Down Expand Up @@ -78,4 +78,4 @@
`CREATE EXTENSION IF NOT EXISTS pg_stat_statements;`
has been run for each database you would like to monitor.
For example:
`psql --dbname "<db-name>" -c "CREATE EXTENSION pg_stat_statements;"`
`psql --dbname "<db-name>" -c "CREATE EXTENSION pg_stat_statements;"`
2 changes: 2 additions & 0 deletions internal/confmapprovider/discovery/bundle/bundle_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

//go:generate discoverybundler -r -t bundle.d/receivers/oracledb.discovery.yaml.tmpl
//go:generate discoverybundler -r -c -d ../../../../cmd/otelcol/config/collector/config.d.linux/receivers -t bundle.d/receivers/oracledb.discovery.yaml.tmpl
//go:generate discoverybundler -r -t bundle.d/receivers/postgresql.discovery.yaml.tmpl
//go:generate discoverybundler -r -c -d ../../../../cmd/otelcol/config/collector/config.d.linux/receivers -t bundle.d/receivers/postgresql.discovery.yaml.tmpl
//go:generate discoverybundler -r -t bundle.d/receivers/redis.discovery.yaml.tmpl
//go:generate discoverybundler -r -c -d ../../../../cmd/otelcol/config/collector/config.d.linux/receivers -t bundle.d/receivers/redis.discovery.yaml.tmpl
//go:generate discoverybundler -r -t bundle.d/receivers/smartagent-collectd-mysql.discovery.yaml.tmpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func TestBundleDir(t *testing.T) {
require.NoError(t, err)
require.Equal(t, []string{
"bundle.d/receivers/oracledb.discovery.yaml",
"bundle.d/receivers/postgresql.discovery.yaml",
"bundle.d/receivers/redis.discovery.yaml",
"bundle.d/receivers/smartagent-collectd-mysql.discovery.yaml",
"bundle.d/receivers/smartagent-collectd-nginx.discovery.yaml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
//go:embed bundle.d/extensions/host-observer.discovery.yaml
//go:embed bundle.d/extensions/k8s-observer.discovery.yaml
//go:embed bundle.d/receivers/oracledb.discovery.yaml
//go:embed bundle.d/receivers/postgresql.discovery.yaml
//go:embed bundle.d/receivers/redis.discovery.yaml
//go:embed bundle.d/receivers/smartagent-collectd-mysql.discovery.yaml
//go:embed bundle.d/receivers/smartagent-collectd-nginx.discovery.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
//go:embed bundle.d/extensions/host-observer.discovery.yaml
//go:embed bundle.d/extensions/k8s-observer.discovery.yaml
//go:embed bundle.d/receivers/oracledb.discovery.yaml
//go:embed bundle.d/receivers/postgresql.discovery.yaml
//go:embed bundle.d/receivers/redis.discovery.yaml
//go:embed bundle.d/receivers/smartagent-postgresql.discovery.yaml
var BundledFS embed.FS
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func TestBundleDir(t *testing.T) {
require.NoError(t, err)
require.Equal(t, []string{
"bundle.d/receivers/oracledb.discovery.yaml",
"bundle.d/receivers/postgresql.discovery.yaml",
"bundle.d/receivers/redis.discovery.yaml",
"bundle.d/receivers/smartagent-postgresql.discovery.yaml",
}, receivers)
Expand Down
2 changes: 2 additions & 0 deletions internal/confmapprovider/discovery/bundle/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var (
// in Components.Linux. If desired in windows BundledFS, ensure they are included in Components.Windows.
receivers = []string{
"oracledb",
"postgresql",
"redis",
"smartagent-collectd-mysql",
"smartagent-collectd-nginx",
Expand Down Expand Up @@ -60,6 +61,7 @@ var (
Windows: func() map[string]struct{} {
windows := map[string]struct{}{
"oracledb": {},
"postgresql": {},
"redis": {},
"smartagent-postgresql": {},
}
Expand Down
Loading
Loading