forked from signalfx/splunk-otel-collector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update bundled test and configs for oraclediscovery * update bundled test and configs for oraclediscovery * running bundled_test now evaluate metrics matching * add working bundled_test * update fail and partial messages for receiver config variables * order of bundled configs matters * make fmt and add more time * lower durations, add in args for endpoint and service * reduce time on image pull and add to windows bundle * add to bundle_windows_test * lower times on tests * address feedback on yaml template and test using env var * gotta make generate-metrics * re-arrange bundled test * add oracledb to the discovery readme * make generate-metrics fmt * address feedback * Update internal/confmapprovider/discovery/README.md Co-authored-by: Ryan Fitzpatrick <10867373+rmfitzpatrick@users.noreply.github.com> * fix to re-check and other attribute fields * add new test data for bundled test * add generated yaml --------- Co-authored-by: greatestusername-splunk <83726369+greatestusername-splunk@users.noreply.github.com> Co-authored-by: Ryan Fitzpatrick <10867373+rmfitzpatrick@users.noreply.github.com>
- Loading branch information
1 parent
dcc4616
commit 7ed22cc
Showing
13 changed files
with
365 additions
and
5 deletions.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
cmd/otelcol/config/collector/config.d.linux/receivers/oracledb.discovery.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
##################################################################################### | ||
# 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. # | ||
##################################################################################### | ||
# oracledb: | ||
# enabled: true | ||
# rule: | ||
# docker_observer: type == "container" and any([name, image, command], {# matches "(?i)oracle"}) and not (command matches "splunk.discovery") | ||
# host_observer: type == "hostport" and command matches "(?i)oracle" and not (command matches "splunk.discovery") | ||
# k8s_observer: type == "port" and pod.name matches "(?i)oracle" | ||
# config: | ||
# default: | ||
# endpoint: splunk.discovery.default | ||
# username: splunk.discovery.default | ||
# password: splunk.discovery.default | ||
# service: splunk.discovery.default | ||
# status: | ||
# metrics: | ||
# successful: | ||
# - strict: oracledb.cpu_time | ||
# first_only: true | ||
# log_record: | ||
# severity_text: info | ||
# body: oracledb receiver is working! | ||
# statements: | ||
# failed: | ||
# - regexp: "connection refused" | ||
# first_only: true | ||
# log_record: | ||
# severity_text: info | ||
# 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: | ||
# severity_text: info | ||
# append_pattern: true | ||
# body: Unable to connect and scrape metrics. | ||
# - regexp: "dial tcp: lookup" | ||
# first_only: true | ||
# log_record: | ||
# severity_text: info | ||
# append_pattern: true | ||
# body: Unable to resolve oracledb tcp endpoint | ||
# - regexp: 'error executing select .*: EOF' | ||
# first_only: true | ||
# log_record: | ||
# severity_text: info | ||
# 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: | ||
# severity_text: info | ||
# 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: | ||
# severity_text: info | ||
# 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. | ||
# |
This file contains 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
72 changes: 72 additions & 0 deletions
72
internal/confmapprovider/discovery/bundle/bundle.d/receivers/oracledb.discovery.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
##################################################################################### | ||
# Do not edit manually! # | ||
# All changes must be made to associated .tmpl file before running 'make bundle.d'. # | ||
##################################################################################### | ||
oracledb: | ||
enabled: true | ||
rule: | ||
docker_observer: type == "container" and any([name, image, command], {# matches "(?i)oracle"}) and not (command matches "splunk.discovery") | ||
host_observer: type == "hostport" and command matches "(?i)oracle" and not (command matches "splunk.discovery") | ||
k8s_observer: type == "port" and pod.name matches "(?i)oracle" | ||
config: | ||
default: | ||
endpoint: splunk.discovery.default | ||
username: splunk.discovery.default | ||
password: splunk.discovery.default | ||
service: splunk.discovery.default | ||
status: | ||
metrics: | ||
successful: | ||
- strict: oracledb.cpu_time | ||
first_only: true | ||
log_record: | ||
severity_text: info | ||
body: oracledb receiver is working! | ||
statements: | ||
failed: | ||
- regexp: "connection refused" | ||
first_only: true | ||
log_record: | ||
severity_text: info | ||
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: | ||
severity_text: info | ||
append_pattern: true | ||
body: Unable to connect and scrape metrics. | ||
- regexp: "dial tcp: lookup" | ||
first_only: true | ||
log_record: | ||
severity_text: info | ||
append_pattern: true | ||
body: Unable to resolve oracledb tcp endpoint | ||
- regexp: 'error executing select .*: EOF' | ||
first_only: true | ||
log_record: | ||
severity_text: info | ||
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: | ||
severity_text: info | ||
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: | ||
severity_text: info | ||
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. | ||
68 changes: 68 additions & 0 deletions
68
internal/confmapprovider/discovery/bundle/bundle.d/receivers/oracledb.discovery.yaml.tmpl
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{{ receiver "oracledb" }}: | ||
enabled: true | ||
rule: | ||
docker_observer: type == "container" and any([name, image, command], {# matches "(?i)oracle"}) and not (command matches "splunk.discovery") | ||
host_observer: type == "hostport" and command matches "(?i)oracle" and not (command matches "splunk.discovery") | ||
k8s_observer: type == "port" and pod.name matches "(?i)oracle" | ||
config: | ||
default: | ||
endpoint: {{ defaultValue }} | ||
username: {{ defaultValue }} | ||
password: {{ defaultValue }} | ||
service: {{ defaultValue }} | ||
status: | ||
metrics: | ||
successful: | ||
- strict: oracledb.cpu_time | ||
first_only: true | ||
log_record: | ||
severity_text: info | ||
body: oracledb receiver is working! | ||
statements: | ||
failed: | ||
- regexp: "connection refused" | ||
first_only: true | ||
log_record: | ||
severity_text: info | ||
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: | ||
severity_text: info | ||
append_pattern: true | ||
body: Unable to connect and scrape metrics. | ||
- regexp: "dial tcp: lookup" | ||
first_only: true | ||
log_record: | ||
severity_text: info | ||
append_pattern: true | ||
body: Unable to resolve oracledb tcp endpoint | ||
- regexp: 'error executing select .*: EOF' | ||
first_only: true | ||
log_record: | ||
severity_text: info | ||
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: | ||
severity_text: info | ||
append_pattern: true | ||
body: >- | ||
Make sure your oracledb service is correctly specified using the | ||
`--set {{ configProperty "service" "<service>" }}` command or the | ||
`{{ configPropertyEnvVar "service" "<service>" }}` environment variable. | ||
- regexp: 'invalid username/password' | ||
first_only: true | ||
log_record: | ||
severity_text: info | ||
append_pattern: true | ||
body: >- | ||
Make sure your user credentials are correctly specified using the | ||
`--set {{ configProperty "username" "<username>" }}` and | ||
`--set {{ configProperty "password" "<password>" }}` command or the | ||
`{{ configPropertyEnvVar "username" "<username>" }}` and | ||
`{{ configPropertyEnvVar "password" "<password>" }}` environment variables. | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright Splunk, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//go:build integration | ||
|
||
package tests | ||
|
||
import ( | ||
"fmt" | ||
"runtime" | ||
"testing" | ||
|
||
"github.com/signalfx/splunk-otel-collector/tests/testutils" | ||
) | ||
|
||
func TestOracledbDockerObserver(t *testing.T) { | ||
testutils.SkipIfNotContainerTest(t) | ||
if runtime.GOOS == "darwin" { | ||
t.Skip("unable to share sockets between mac and d4m vm: https://github.com/docker/for-mac/issues/483#issuecomment-758836836") | ||
} | ||
|
||
testutils.AssertAllMetricsReceived(t, "bundled.yaml", "otlp_exporter.yaml", | ||
oracledb, []testutils.CollectorBuilder{ | ||
func(c testutils.Collector) testutils.Collector { | ||
cc := c.(*testutils.CollectorContainer) | ||
cc.Container = cc.Container.WithBinds("/var/run/docker.sock:/var/run/docker.sock:ro") | ||
cc.Container = cc.Container.WillWaitForLogs("Discovering for next") | ||
cc.Container = cc.Container.WithUser(fmt.Sprintf("999:%d", testutils.GetDockerGID(t))) | ||
return cc | ||
}, | ||
func(collector testutils.Collector) testutils.Collector { | ||
return collector.WithEnv(map[string]string{ | ||
"ORACLEDB_URL": "oracle://otel:password@localhost:1521/XE", | ||
"SPLUNK_DISCOVERY_DURATION": "10s", | ||
// confirm that debug logging doesn't affect runtime | ||
"SPLUNK_DISCOVERY_LOG_LEVEL": "debug", | ||
"ORACLE_PASSWORD": "password", | ||
}).WithArgs( | ||
"--discovery", | ||
"--set", "splunk.discovery.receivers.oracledb.config.username=otel", | ||
"--set", "splunk.discovery.receivers.oracledb.config.password='${ORACLE_PASSWORD}'", | ||
"--set", "splunk.discovery.receivers.oracledb.config.endpoint=localhost:1521", | ||
"--set", "splunk.discovery.receivers.oracledb.config.service=XE", | ||
"--set", `splunk.discovery.extensions.k8s_observer.enabled=false`, | ||
"--set", `splunk.discovery.extensions.host_observer.enabled=false`, | ||
) | ||
}, | ||
}, | ||
) | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
exporters: | ||
otlp: | ||
endpoint: "${OTLP_ENDPOINT}" | ||
tls: | ||
insecure: true | ||
|
||
service: | ||
telemetry: | ||
logs: | ||
level: debug | ||
pipelines: | ||
metrics: | ||
exporters: [otlp] |
This file contains 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
Oops, something went wrong.