Skip to content

Commit

Permalink
[receiver/discovery] Combine matching conditions with different statu…
Browse files Browse the repository at this point in the history
…ses (#4588)

Define a match conditions status as a field instead of a map key. This way we make the status evaluation deterministic. The first matching rule defines the status of the discovery endpoint. Without this reorganization it's unclear which status wins in case of overlapping matching rules.

For example the following configuration:
```
    receivers:
      prometheus_simple:
        rule: type == "hostport" and command contains "otelcol"
        resource_attributes:
          one.key: one.value
          two.key: two.value
        status:
          metrics:
            successful:
            - regexp: ^otelcol_process_uptime$
              first_only: true
              log_record:
                body: Successfully connected to prometheus server
```
is changed to
```
    receivers:
      prometheus_simple:
        rule: type == "hostport" and command contains "otelcol"
        resource_attributes:
          one.key: one.value
          two.key: two.value
        status:
          metrics:
            - status: successful
              regexp: ^otelcol_process_uptime$
              first_only: true
              log_record:
                body: Successfully connected to prometheus server
```
  • Loading branch information
dmitryax authored Apr 3, 2024
1 parent d02757f commit 6bd1050
Show file tree
Hide file tree
Showing 40 changed files with 1,141 additions and 1,077 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

### 🛑 Breaking changes 🛑

- (Splunk) `receiver/discovery`: Remove `severity_text` field from log evaluation statements. ([#4583](https://github.com/signalfx/splunk-otel-collector/pull/4583))
- (Splunk) `receiver/discovery`: Update metrics and logs evaluation statements schema:
- Remove `severity_text` field from log evaluation statements ([#4583](https://github.com/signalfx/splunk-otel-collector/pull/4583))
- Combine matching conditions with different statuses in one list ([#4588](https://github.com/signalfx/splunk-otel-collector/pull/4588))

## v0.97.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,26 @@
# password: splunk.discovery.default
# status:
# metrics:
# successful:
# - strict: mysql.locks
# first_only: true
# log_record:
# body: Mysql receiver is working!
# - status: successful
# strict: mysql.locks
# first_only: true
# log_record:
# body: Mysql receiver is working!
# statements:
# failed:
# - regexp: "Can't connect to MySQL server on .* [(]111[)]"
# first_only: true
# log_record:
# append_pattern: true
# body: The container cannot be reached by the Collector. The container is refusing MySQL connections.
# partial:
# - regexp: 'Access denied for user'
# first_only: true
# log_record:
# append_pattern: true
# body: >-
# Make sure your user credentials are correctly specified using the
# `--set splunk.discovery.receivers.mysql.config.username="<username>"` and
# `--set splunk.discovery.receivers.mysql.config.password="<password>"` command or the
# `SPLUNK_DISCOVERY_RECEIVERS_mysql_CONFIG_username="<username>"` and
# `SPLUNK_DISCOVERY_RECEIVERS_mysql_CONFIG_password="<password>"` environment variables.
# - status: failed
# regexp: "Can't connect to MySQL server on .* [(]111[)]"
# first_only: true
# log_record:
# append_pattern: true
# body: The container cannot be reached by the Collector. The container is refusing MySQL connections.
# - status: partial
# regexp: 'Access denied for user'
# first_only: true
# log_record:
# append_pattern: true
# body: >-
# Make sure your user credentials are correctly specified using the
# `--set splunk.discovery.receivers.mysql.config.username="<username>"` and
# `--set splunk.discovery.receivers.mysql.config.password="<password>"` command or the
# `SPLUNK_DISCOVERY_RECEIVERS_mysql_CONFIG_username="<username>"` and
# `SPLUNK_DISCOVERY_RECEIVERS_mysql_CONFIG_password="<password>"` environment variables.
Original file line number Diff line number Diff line change
Expand Up @@ -19,50 +19,53 @@
# service: splunk.discovery.default
# status:
# metrics:
# successful:
# - strict: oracledb.cpu_time
# first_only: true
# log_record:
# body: oracledb receiver is working!
# - status: successful
# strict: oracledb.cpu_time
# first_only: true
# log_record:
# body: oracledb receiver is working!
# statements:
# failed:
# - regexp: "connection refused"
# first_only: true
# log_record:
# append_pattern: true
# body: The container is not serving http connections.
# - regexp: "received goaway and there are no active streams"
# first_only: true
# log_record:
# append_pattern: true
# body: Unable to connect and scrape metrics.
# - regexp: "dial tcp: lookup"
# first_only: true
# log_record:
# append_pattern: true
# body: Unable to resolve oracledb tcp endpoint
# - regexp: 'error executing select .*: EOF'
# first_only: true
# log_record:
# append_pattern: true
# body: Unable to execute select from oracledb. Verify endpoint and user permissions.
# partial:
# - regexp: "listener does not currently know of service requested"
# first_only: true
# log_record:
# append_pattern: true
# body: >-
# Make sure your oracledb service is correctly specified using the
# `--set splunk.discovery.receivers.oracledb.config.service="<service>"` command or the
# `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_service="<service>"` environment variable.
# - regexp: 'invalid username/password'
# first_only: true
# log_record:
# append_pattern: true
# body: >-
# Make sure your user credentials are correctly specified using the
# `--set splunk.discovery.receivers.oracledb.config.username="<username>"` and
# `--set splunk.discovery.receivers.oracledb.config.password="<password>"` command or the
# `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_username="<username>"` and
# `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_password="<password>"` environment variables.
#
# - status: failed
# regexp: "connection refused"
# first_only: true
# log_record:
# append_pattern: true
# body: The container is not serving http connections.
# - status: failed
# regexp: "received goaway and there are no active streams"
# first_only: true
# log_record:
# append_pattern: true
# body: Unable to connect and scrape metrics.
# - status: failed
# regexp: "dial tcp: lookup"
# first_only: true
# log_record:
# append_pattern: true
# body: Unable to resolve oracledb tcp endpoint
# - status: failed
# regexp: 'error executing select .*: EOF'
# first_only: true
# log_record:
# append_pattern: true
# body: Unable to execute select from oracledb. Verify endpoint and user permissions.
# - status: partial
# regexp: "listener does not currently know of service requested"
# first_only: true
# log_record:
# append_pattern: true
# body: >-
# Make sure your oracledb service is correctly specified using the
# `--set splunk.discovery.receivers.oracledb.config.service="<service>"` command or the
# `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_service="<service>"` environment variable.
# - status: partial
# regexp: 'invalid username/password'
# first_only: true
# log_record:
# append_pattern: true
# body: >-
# Make sure your user credentials are correctly specified using the
# `--set splunk.discovery.receivers.oracledb.config.username="<username>"` and
# `--set splunk.discovery.receivers.oracledb.config.password="<password>"` command or the
# `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_username="<username>"` and
# `SPLUNK_DISCOVERY_RECEIVERS_oracledb_CONFIG_password="<password>"` environment variables.
Original file line number Diff line number Diff line change
Expand Up @@ -18,59 +18,63 @@
# password: splunk.discovery.default
# status:
# metrics:
# successful:
# - strict: postgresql.commits
# first_only: true
# log_record:
# body: PostgreSQL receiver is working!
# - status: successful
# strict: postgresql.commits
# first_only: true
# log_record:
# body: PostgreSQL receiver is working!
# statements:
# failed:
# - regexp: 'connect: network is unreachable'
# first_only: true
# log_record:
# 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:
# append_pattern: true
# body: The container is refusing PostgreSQL connections.
# partial:
# - regexp: 'pq: password authentication failed for user'
# first_only: true
# log_record:
# 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:
# 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:
# 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:
# 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;"`
# - status: failed
# regexp: 'connect: network is unreachable'
# first_only: true
# log_record:
# append_pattern: true
# body: The container cannot be reached by the Collector. Make sure they're in the same network.
# - status: failed
# regexp: 'connect: connection refused'
# first_only: true
# log_record:
# append_pattern: true
# body: The container is refusing PostgreSQL connections.
# - status: partial
# regexp: 'pq: password authentication failed for user'
# first_only: true
# log_record:
# 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.
# - status: partial
# regexp: 'pq: database .* does not exist'
# first_only: true
# log_record:
# 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.
# - status: partial
# regexp: 'pq: SSL is not enabled on the server'
# first_only: true
# log_record:
# 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.
# - status: partial
# regexp: 'pq: pg_stat_statements must be loaded via shared_preload_libraries'
# first_only: true
# log_record:
# 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 @@ -16,54 +16,58 @@
# default: {}
# status:
# metrics:
# successful:
# - strict: redis.uptime
# first_only: true
# log_record:
# body: redis receiver is working!
# - status: successful
# strict: redis.uptime
# first_only: true
# log_record:
# body: redis receiver is working!
# statements:
# failed:
# - regexp: "connection refused"
# first_only: true
# log_record:
# append_pattern: true
# body: The container is not serving http connections.
# - regexp: "received goaway and there are no active streams"
# first_only: true
# log_record:
# append_pattern: true
# body: Unable to connect and scrape metrics.
# - regexp: "dial tcp: lookup"
# first_only: true
# log_record:
# append_pattern: true
# body: Unable to resolve redis tcp endpoint
# partial:
# - regexp: 'NOAUTH Authentication required.'
# first_only: true
# log_record:
# append_pattern: true
# body: >-
# Make sure your user credentials are correctly specified using the
# `--set splunk.discovery.receivers.redis.config.password="<password>"` and
# `--set splunk.discovery.receivers.redis.config.username="<username>"` commands or the
# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password="<password>"` and
# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password="<password>"` environment variables.
# - regexp: 'called without any password configured for the default user'
# first_only: true
# log_record:
# append_pattern: true
# body: >-
# Make sure your user credentials are correctly specified using the
# `--set splunk.discovery.receivers.redis.config.password="<password>"` command or the
# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password="<password>"` environment variables.
# - regexp: 'WRONGPASS invalid username-password pair or user is disabled'
# first_only: true
# log_record:
# append_pattern: true
# body: >-
# Make sure your user credentials are correctly specified using the
# `--set splunk.discovery.receivers.redis.config.password="<password>"` and
# `--set splunk.discovery.receivers.redis.config.username="<username>"` commands or the
# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password="<password>"` and
# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password="<password>"` environment variables.
# - status: failed
# regexp: "connection refused"
# first_only: true
# log_record:
# append_pattern: true
# body: The container is not serving http connections.
# - status: failed
# regexp: "received goaway and there are no active streams"
# first_only: true
# log_record:
# append_pattern: true
# body: Unable to connect and scrape metrics.
# - status: failed
# regexp: "dial tcp: lookup"
# first_only: true
# log_record:
# append_pattern: true
# body: Unable to resolve redis tcp endpoint
# - status: partial
# regexp: 'NOAUTH Authentication required.'
# first_only: true
# log_record:
# append_pattern: true
# body: >-
# Make sure your user credentials are correctly specified using the
# `--set splunk.discovery.receivers.redis.config.password="<password>"` and
# `--set splunk.discovery.receivers.redis.config.username="<username>"` commands or the
# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password="<password>"` and
# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password="<password>"` environment variables.
# - status: partial
# regexp: 'called without any password configured for the default user'
# first_only: true
# log_record:
# append_pattern: true
# body: >-
# Make sure your user credentials are correctly specified using the
# `--set splunk.discovery.receivers.redis.config.password="<password>"` command or the
# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password="<password>"` environment variables.
# - status: partial
# regexp: 'WRONGPASS invalid username-password pair or user is disabled'
# first_only: true
# log_record:
# append_pattern: true
# body: >-
# Make sure your user credentials are correctly specified using the
# `--set splunk.discovery.receivers.redis.config.password="<password>"` and
# `--set splunk.discovery.receivers.redis.config.username="<username>"` commands or the
# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password="<password>"` and
# `SPLUNK_DISCOVERY_RECEIVERS_redis_CONFIG_password="<password>"` environment variables.
Loading

0 comments on commit 6bd1050

Please sign in to comment.