Skip to content

Commit

Permalink
Merge branch 'main' into ansible_fix_loop_otelwinreg
Browse files Browse the repository at this point in the history
  • Loading branch information
pjanotti authored Jul 29, 2024
2 parents c285092 + d4a4191 commit d0c4cee
Show file tree
Hide file tree
Showing 15 changed files with 391 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -336,13 +336,13 @@ jobs:
id: get-matrix
run: |
includes=""
for service in "mongodb" "kafkametrics"; do
for service in "mongodb" "kafkametrics" "jmx/cassandra"; do
for arch in "amd64" "arm64"; do
if [ "$service" = "mongodb" ]; then
for mongodb_version in "4.0" "4.4" "5.0" "6.0" "7.0"; do
includes="${includes},{\"SERVICE\": \"${service}\", \"ARCH\": \"${arch}\", \"MONGODB_VERSION\": \"${mongodb_version}\"}"
done
else
elif [[ "$service" != "jmx/cassandra" || "arm64" != "$arch" ]]; then
includes="${includes},{\"SERVICE\": \"${service}\", \"ARCH\": \"${arch}\"}"
fi
done
Expand All @@ -364,7 +364,7 @@ jobs:
fetch-depth: 0
- run: echo "MONGODB_VERSION=${{ matrix.MONGODB_VERSION }}" > docker/.env
if: matrix.SERVICE == 'mongodb'
- run: docker compose -f docker/docker-compose.yml --profile integration-test-${{ matrix.SERVICE }}-discovery up -d --build --quiet-pull
- run: docker compose -f docker/docker-compose.yml --profile integration-test-${{ matrix.SERVICE }}-discovery up -d --wait --build --quiet-pull
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ integration-test-mongodb-discovery:
integration-test-kafkametrics-discovery:
@set -e; cd tests && $(GOTEST_SERIAL) $(BUILD_INFO_TESTS) --tags=discovery_integration_kafkametrics -v -timeout 5m -count 1 ./...

.PHONY: integration-test-jmx/cassandra-discovery
integration-test-jmx/cassandra-discovery:
@set -e; cd tests && $(GOTEST_SERIAL) $(BUILD_INFO_TESTS) --tags=discovery_integration_jmx -v -timeout 5m -count 1 ./...

.PHONY: smartagent-integration-test
smartagent-integration-test:
@set -e; cd tests && $(GOTEST_SERIAL) $(BUILD_INFO_TESTS) --tags=smartagent_integration -v -timeout 5m -count 1 ./...
Expand Down Expand Up @@ -224,3 +228,4 @@ install-test-tools:
.PHONY: integration-test-split
integration-test-split: install-test-tools
@set -e; cd tests && gotesplit --total=$(GOTESPLIT_TOTAL) --index=$(GOTESPLIT_INDEX) ./... -- -p 1 $(BUILD_INFO_TESTS) --tags=integration -v -timeout 5m -count 1

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#####################################################################################
# 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. #
#####################################################################################
# jmx/cassandra:
# enabled: true
# rule:
# docker_observer: type == "container" and any([name, image, command], {# matches "(?i)cassandra.*"}) and not (command matches "splunk.discovery")
# host_observer: type == "hostport" and command matches "(?i)cassandra.*" and not (command matches "splunk.discovery")
# k8s_observer: type == "port" and pod.name matches "(?i)cassandra.*"
# config:
# default:
# jar_path: /opt/opentelemetry-java-contrib-jmx-metrics.jar
# endpoint: "service:jmx:rmi:///jndi/rmi://`endpoint`/jmxrmi"
# target_system: cassandra
# collection_interval: 10s
# status:
# metrics:
# - status: successful
# strict: cassandra.client.request.count
# message: jmx/cassandra receiver is working!
# statements:
# - status: failed
# regexp: 'connect: network is unreachable'
# message: The container cannot be reached by the Collector. Make sure they're in the same network.
# - status: failed
# regexp: 'connect: connection refused'
# message: The container is refusing cassandra server connections.
30 changes: 30 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,36 @@ services:
build: ./cassandra
ports:
- "7199:7199"
# Cassandra without auth
cassandra-jmx-noauth:
profiles:
- cassandra
- integration-test-jmx/cassandra-discovery
build:
dockerfile_inline: |
FROM cassandra:5
ENV LOCAL_JMX=no
RUN sed -ri 's/ -Dcom\.sun\.management\.jmxremote\.authenticate=true/ -Dcom\.sun\.management\.jmxremote\.authenticate=false/' /etc/cassandra/cassandra-env.sh
RUN sed -ri 's/ -Dcom\.sun\.management\.jmxremote\.password\.file=\/etc\/cassandra\/jmxremote\.password//' /etc/cassandra/cassandra-env.sh
# Escape $JVM_OPTS by including extra $
# This command prepends content to /etc/cassandra/cassandra-env.sh
RUN echo "`echo 'JVM_OPTS="$$JVM_OPTS -Djava.rmi.server.hostname=0.0.0.0"'; echo 'export LOCAL_JMX="no"'; cat /etc/cassandra/cassandra-env.sh`" > /etc/cassandra/cassandra-env.sh
environment:
LOCAL_JMX: no
JVM_EXTRA_OPTS: "-Dcom.sun.management.jmxremote.authenticate=false"
JMX_PORT: "${JMX_PORT:-7199}"
ports:
- "${JMX_PORT:-7199}:${JMX_PORT:-7199}"
healthcheck:
interval: 10s
timeout: 10s
retries: 20
test:
- "CMD"
- "grep"
- "-q"
- "Startup complete"
- "/var/log/cassandra/system.log"
# Couchbase image for collectd-couchbase test:
couchbase:
image: quay.io/splunko11ytest/couchbase:latest
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/packaging/java-agent-release.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.5.0
v2.6.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#####################################################################################
# Do not edit manually! #
# All changes must be made to associated .tmpl file before running 'make bundle.d'. #
#####################################################################################
jmx/cassandra:
enabled: true
rule:
docker_observer: type == "container" and any([name, image, command], {# matches "(?i)cassandra.*"}) and not (command matches "splunk.discovery")
host_observer: type == "hostport" and command matches "(?i)cassandra.*" and not (command matches "splunk.discovery")
k8s_observer: type == "port" and pod.name matches "(?i)cassandra.*"
config:
default:
jar_path: /opt/opentelemetry-java-contrib-jmx-metrics.jar
endpoint: "service:jmx:rmi:///jndi/rmi://`endpoint`/jmxrmi"
target_system: cassandra
collection_interval: 10s
status:
metrics:
- status: successful
strict: cassandra.client.request.count
message: jmx/cassandra receiver is working!
statements:
- status: failed
regexp: 'connect: network is unreachable'
message: The container cannot be reached by the Collector. Make sure they're in the same network.
- status: failed
regexp: 'connect: connection refused'
message: The container is refusing cassandra server connections.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{ receiver "jmx/cassandra" }}:
enabled: true
rule:
docker_observer: type == "container" and any([name, image, command], {# matches "(?i)cassandra.*"}) and not (command matches "splunk.discovery")
host_observer: type == "hostport" and command matches "(?i)cassandra.*" and not (command matches "splunk.discovery")
k8s_observer: type == "port" and pod.name matches "(?i)cassandra.*"
config:
default:
jar_path: /opt/opentelemetry-java-contrib-jmx-metrics.jar
endpoint: "service:jmx:rmi:///jndi/rmi://`endpoint`/jmxrmi"
target_system: cassandra
collection_interval: 10s
status:
metrics:
- status: successful
strict: cassandra.client.request.count
message: jmx/cassandra receiver is working!
statements:
- status: failed
regexp: 'connect: network is unreachable'
message: The container cannot be reached by the Collector. Make sure they're in the same network.
- status: failed
regexp: 'connect: connection refused'
message: The container is refusing cassandra server connections.
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 @@ -23,6 +23,8 @@
//go:generate discoverybundler -r -t bundle.d/extensions/k8s-observer.discovery.yaml.tmpl
//go:generate discoverybundler -r -c -d ../../../../cmd/otelcol/config/collector/config.d.linux/extensions -t bundle.d/extensions/k8s-observer.discovery.yaml.tmpl

//go:generate discoverybundler -r -t bundle.d/receivers/jmx-cassandra.discovery.yaml.tmpl
//go:generate discoverybundler -r -c -d ../../../../cmd/otelcol/config/collector/config.d.linux/receivers -t bundle.d/receivers/jmx-cassandra.discovery.yaml.tmpl
//go:generate discoverybundler -r -t bundle.d/receivers/kafkametrics.discovery.yaml.tmpl
//go:generate discoverybundler -r -c -d ../../../../cmd/otelcol/config/collector/config.d.linux/receivers -t bundle.d/receivers/kafkametrics.discovery.yaml.tmpl
//go:generate discoverybundler -r -t bundle.d/receivers/mongodb.discovery.yaml.tmpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func TestBundleDir(t *testing.T) {
receivers, err := fs.Glob(BundledFS, "bundle.d/receivers/*.discovery.yaml")
require.NoError(t, err)
require.Equal(t, []string{
"bundle.d/receivers/jmx-cassandra.discovery.yaml",
"bundle.d/receivers/kafkametrics.discovery.yaml",
"bundle.d/receivers/mongodb.discovery.yaml",
"bundle.d/receivers/mysql.discovery.yaml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
//go:embed bundle.d/extensions/docker-observer.discovery.yaml
//go:embed bundle.d/extensions/host-observer.discovery.yaml
//go:embed bundle.d/extensions/k8s-observer.discovery.yaml
//go:embed bundle.d/receivers/jmx-cassandra.discovery.yaml
//go:embed bundle.d/receivers/kafkametrics.discovery.yaml
//go:embed bundle.d/receivers/mongodb.discovery.yaml
//go:embed bundle.d/receivers/mysql.discovery.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
//go:embed bundle.d/extensions/docker-observer.discovery.yaml
//go:embed bundle.d/extensions/host-observer.discovery.yaml
//go:embed bundle.d/extensions/k8s-observer.discovery.yaml
//go:embed bundle.d/receivers/jmx-cassandra.discovery.yaml
//go:embed bundle.d/receivers/kafkametrics.discovery.yaml
//go:embed bundle.d/receivers/mongodb.discovery.yaml
//go:embed bundle.d/receivers/mysql.discovery.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func TestBundleDir(t *testing.T) {
receivers, err := fs.Glob(BundledFS, "bundle.d/receivers/*.discovery.yaml")
require.NoError(t, err)
require.Equal(t, []string{
"bundle.d/receivers/jmx-cassandra.discovery.yaml",
"bundle.d/receivers/kafkametrics.discovery.yaml",
"bundle.d/receivers/mongodb.discovery.yaml",
"bundle.d/receivers/mysql.discovery.yaml",
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 @@ -31,6 +31,7 @@ var (
// If they are desired for !windows BundledFS inclusion (and a default linux conf.d entry), ensure they are included
// in Components.Linux. If desired in windows BundledFS, ensure they are included in Components.Windows.
receivers = []string{
"jmx-cassandra",
"kafkametrics",
"mongodb",
"mysql",
Expand Down Expand Up @@ -63,6 +64,7 @@ var (
}(),
Windows: func() map[string]struct{} {
windows := map[string]struct{}{
"jmx-cassandra": {},
"kafkametrics": {},
"mongodb": {},
"mysql": {},
Expand Down
Loading

0 comments on commit d0c4cee

Please sign in to comment.