From 5e5cc088dd118099990d31acd5367ab19a51e5be Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Sun, 24 Mar 2024 23:08:30 -0700 Subject: [PATCH 1/2] Move solr to quay --- .github/workflows/integration-test.yml | 4 ++++ .../testdata/server => docker/solr}/Dockerfile | 0 .../smartagent/collectd-solr/collectd_solr_test.go | 11 +---------- 3 files changed, 5 insertions(+), 10 deletions(-) rename {tests/receivers/smartagent/collectd-solr/testdata/server => docker/solr}/Dockerfile (100%) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index b20d297e8f..25af46a9fa 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -221,6 +221,10 @@ jobs: image: quay.io/splunko11ytest/redis_server:latest ports: - "6379:6379" + solr: + image: quay.io/splunko11ytest/solr:latest + ports: + - "8983:8983" strategy: matrix: ARCH: [ "amd64", "arm64" ] diff --git a/tests/receivers/smartagent/collectd-solr/testdata/server/Dockerfile b/docker/solr/Dockerfile similarity index 100% rename from tests/receivers/smartagent/collectd-solr/testdata/server/Dockerfile rename to docker/solr/Dockerfile diff --git a/tests/receivers/smartagent/collectd-solr/collectd_solr_test.go b/tests/receivers/smartagent/collectd-solr/collectd_solr_test.go index 661016b357..359dc1ea8c 100644 --- a/tests/receivers/smartagent/collectd-solr/collectd_solr_test.go +++ b/tests/receivers/smartagent/collectd-solr/collectd_solr_test.go @@ -17,22 +17,13 @@ package tests import ( - "path" "testing" "github.com/signalfx/splunk-otel-collector/tests/testutils" ) func TestCollectdSolrReceiverProvidesAllMetrics(t *testing.T) { - containers := []testutils.Container{ - testutils.NewContainer().WithContext( - path.Join(".", "testdata", "server"), - ).WithExposedPorts("8983:8983").WithName( - "solr", - ).WillWaitForPorts("8983").WillWaitForLogs("Time spent:"), - } - testutils.AssertAllMetricsReceived( - t, "all.yaml", "all_metrics_config.yaml", containers, nil, + t, "all.yaml", "all_metrics_config.yaml", nil, nil, ) } From 7e7fb8e9af584d41db248511209ab8fbb26505d6 Mon Sep 17 00:00:00 2001 From: Antoine Toulme Date: Sun, 24 Mar 2024 23:23:16 -0700 Subject: [PATCH 2/2] move to golden files as well --- tests/go.mod | 3 + tests/go.sum | 6 + .../collectd-solr/collectd_solr_test.go | 72 +- .../collectd-solr/testdata/all_expected.yaml | 1071 +++++++++++++++++ .../testdata/all_metrics_config.yaml | 10 +- .../testdata/resource_metrics/all.yaml | 61 - 6 files changed, 1157 insertions(+), 66 deletions(-) create mode 100644 tests/receivers/smartagent/collectd-solr/testdata/all_expected.yaml delete mode 100644 tests/receivers/smartagent/collectd-solr/testdata/resource_metrics/all.yaml diff --git a/tests/go.mod b/tests/go.mod index 2b79fb4918..37d110d9ed 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -8,6 +8,8 @@ require ( github.com/go-sql-driver/mysql v1.8.0 github.com/google/uuid v1.6.0 github.com/knadh/koanf v1.5.0 + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden v0.96.0 + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.96.0 github.com/shirou/gopsutil/v3 v3.24.2 github.com/stretchr/testify v1.9.0 github.com/testcontainers/testcontainers-go v0.20.1 @@ -70,6 +72,7 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/morikuni/aec v1.0.0 // indirect github.com/mostynb/go-grpc-compression v1.2.2 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.96.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc5 // indirect github.com/opencontainers/runc v1.1.12 // indirect diff --git a/tests/go.sum b/tests/go.sum index be2803f362..2fb7902037 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -922,6 +922,12 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/npillmayer/nestext v0.1.3/go.mod h1:h2lrijH8jpicr25dFY+oAJLyzlya6jhnuG+zWp9L0Uk= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden v0.96.0 h1:6xhEYeFRjui33hCCP8tD9B2R2VCGNdNrzi+pivp0osk= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden v0.96.0/go.mod h1:7CDMyrWBi/iST+UVvheDNjZX8VWyboTJqkXHz7gpLDI= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.96.0 h1:iynLFjnG869r53AIhiavbEVMZoPqCba7Mijm+9MRdOo= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.96.0/go.mod h1:FuTdjIZj7Un07dcbJs06IF1DJiYfpQkc4oklhNWE8fg= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.96.0 h1:nzAR1IjPcbgLNFmJElLPyRlLOfijAkQcWo4L9CXixu4= +github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.96.0/go.mod h1:Zn0A4V5t3uNr2FYsgnzT4t0OBqdOk8jcPjgHgy3jHG0= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= diff --git a/tests/receivers/smartagent/collectd-solr/collectd_solr_test.go b/tests/receivers/smartagent/collectd-solr/collectd_solr_test.go index 359dc1ea8c..f2b09ad5c3 100644 --- a/tests/receivers/smartagent/collectd-solr/collectd_solr_test.go +++ b/tests/receivers/smartagent/collectd-solr/collectd_solr_test.go @@ -17,13 +17,81 @@ package tests import ( + "context" + "fmt" + "path/filepath" + "runtime" "testing" + "time" + + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest/pmetrictest" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/receiver/otlpreceiver" + "go.opentelemetry.io/collector/receiver/receivertest" + "go.uber.org/zap" "github.com/signalfx/splunk-otel-collector/tests/testutils" ) func TestCollectdSolrReceiverProvidesAllMetrics(t *testing.T) { - testutils.AssertAllMetricsReceived( - t, "all.yaml", "all_metrics_config.yaml", nil, nil, + checkGoldenFile(t, "all_metrics_config.yaml", "all_expected.yaml", + pmetrictest.IgnoreTimestamp(), + pmetrictest.IgnoreMetricValues( + "gauge.solr.core_usablespace", + "counter.solr.node_collections_requests", + "counter.solr.node_metrics_requests", + "counter.solr.http_2xx_responses", + "counter.solr.http_requests", + "gauge.solr.jetty_request_latency", + "gauge.solr.jvm_heap_usage", + "gauge.solr.jvm_total_memory_used", + "gauge.solr.jvm_memory_pools_Metaspace_usage", + ), ) } + +func checkGoldenFile(t *testing.T, configFile string, expectedFilePath string, options ...pmetrictest.CompareMetricsOption) { + f := otlpreceiver.NewFactory() + port := testutils.GetAvailablePort(t) + c := f.CreateDefaultConfig().(*otlpreceiver.Config) + c.GRPC.NetAddr.Endpoint = fmt.Sprintf("localhost:%d", port) + sink := &consumertest.MetricsSink{} + receiver, err := f.CreateMetricsReceiver(context.Background(), receivertest.NewNopCreateSettings(), c, sink) + require.NoError(t, err) + require.NoError(t, receiver.Start(context.Background(), componenttest.NewNopHost())) + t.Cleanup(func() { + require.NoError(t, receiver.Shutdown(context.Background())) + }) + logger, _ := zap.NewDevelopment() + + dockerHost := "0.0.0.0" + if runtime.GOOS == "darwin" { + dockerHost = "host.docker.internal" + } + p, err := testutils.NewCollectorContainer(). + WithConfigPath(filepath.Join("testdata", configFile)). + WithLogger(logger). + WithEnv(map[string]string{"OTLP_ENDPOINT": fmt.Sprintf("%s:%d", dockerHost, port)}). + Build() + require.NoError(t, err) + require.NoError(t, p.Start()) + t.Cleanup(func() { + require.NoError(t, p.Shutdown()) + }) + + expected, err := golden.ReadMetrics(filepath.Join("testdata", expectedFilePath)) + //require.NoError(t, err) + + assert.EventuallyWithT(t, func(tt *assert.CollectT) { + if len(sink.AllMetrics()) == 0 { + assert.Fail(tt, "No metrics collected") + return + } + err := pmetrictest.CompareMetrics(expected, sink.AllMetrics()[len(sink.AllMetrics())-1], options...) + assert.NoError(tt, err) + }, 10*time.Second, 1*time.Second) +} diff --git a/tests/receivers/smartagent/collectd-solr/testdata/all_expected.yaml b/tests/receivers/smartagent/collectd-solr/testdata/all_expected.yaml new file mode 100644 index 0000000000..4b62f37d6a --- /dev/null +++ b/tests/receivers/smartagent/collectd-solr/testdata/all_expected.yaml @@ -0,0 +1,1071 @@ +resourceMetrics: + - resource: {} + scopeMetrics: + - metrics: + - gauge: + dataPoints: + - asInt: "0" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: 172.17.0.3:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.core_deleted_docs + - gauge: + dataPoints: + - asInt: "32" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: 172.17.0.3:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.core_max_docs + - gauge: + dataPoints: + - asInt: "32" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: 172.17.0.3:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.core_num_docs + - gauge: + dataPoints: + - asInt: "6" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: 172.17.0.3:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.searcher_warmup + - gauge: + dataPoints: + - asInt: "149281173504" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: 172.17.0.3:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.core_totalspace + - gauge: + dataPoints: + - asInt: "9201172480" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: 172.17.0.3:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.core_usablespace + - gauge: + dataPoints: + - asInt: "28388" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: 172.17.0.3:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.core_index_size + - gauge: + dataPoints: + - asInt: "1" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: 172.17.0.3:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.document_cache_cumulative_hitratio + - gauge: + dataPoints: + - asInt: "1" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: 172.17.0.3:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.field_value_cache_cumulative_hitratio + - gauge: + dataPoints: + - asInt: "0" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: 172.17.0.3:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.query_result_cache_cumulative_hitratio + - gauge: + dataPoints: + - asDouble: 48.730375 + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: 172.17.0.3:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.search_query_response + - name: counter.solr.search_query_requests + sum: + aggregationTemporality: 2 + dataPoints: + - asInt: "1" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: 172.17.0.3:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + isMonotonic: true + - gauge: + dataPoints: + - asInt: "0" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: 172.17.0.3:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.replication_handler_response + - name: counter.solr.replication_handler_requests + sum: + aggregationTemporality: 2 + dataPoints: + - asInt: "0" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: 172.17.0.3:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + isMonotonic: true + - gauge: + dataPoints: + - asDouble: 35.91122398996872 + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: 172.17.0.3:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.update_request_handler_response + - name: counter.solr.update_handler_requests + sum: + aggregationTemporality: 2 + dataPoints: + - asInt: "15" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: 172.17.0.3:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + isMonotonic: true + - name: counter.solr.node_collections_requests + sum: + aggregationTemporality: 2 + dataPoints: + - asInt: "136" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: localhost:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + isMonotonic: true + - name: counter.solr.node_cores_requests + sum: + aggregationTemporality: 2 + dataPoints: + - asInt: "1" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: localhost:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + isMonotonic: true + - name: counter.solr.node_zookeeper_requests + sum: + aggregationTemporality: 2 + dataPoints: + - asInt: "0" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: localhost:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + isMonotonic: true + - name: counter.solr.node_metrics_requests + sum: + aggregationTemporality: 2 + dataPoints: + - asInt: "64" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: localhost:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + isMonotonic: true + - name: counter.solr.http_2xx_responses + sum: + aggregationTemporality: 2 + dataPoints: + - asInt: "218" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: localhost:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + isMonotonic: true + - name: counter.solr.http_4xx_responses + sum: + aggregationTemporality: 2 + dataPoints: + - asInt: "0" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: localhost:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + isMonotonic: true + - name: counter.solr.http_5xx_responses + sum: + aggregationTemporality: 2 + dataPoints: + - asInt: "0" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: localhost:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + isMonotonic: true + - name: counter.solr.http_requests + sum: + aggregationTemporality: 2 + dataPoints: + - asInt: "218" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: localhost:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + isMonotonic: true + - gauge: + dataPoints: + - asDouble: 16.155495352758063 + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: localhost:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.jetty_request_latency + - gauge: + dataPoints: + - asDouble: 0.43362680077552795 + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: localhost:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.jvm_heap_usage + - gauge: + dataPoints: + - asInt: "-1" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: localhost:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.jvm_total_memory + - gauge: + dataPoints: + - asInt: "334653232" + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: localhost:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.jvm_total_memory_used + - gauge: + dataPoints: + - asDouble: 0.9906743534041744 + attributes: + - key: cluster + value: + stringValue: default + - key: collection + value: + stringValue: techproducts + - key: core + value: + stringValue: techproducts_shard1_replica_n1 + - key: dsname + value: + stringValue: value + - key: leader + value: + stringValue: "true" + - key: node + value: + stringValue: localhost:8983_solr + - key: plugin + value: + stringValue: solr + - key: plugin_instance + value: + stringValue: localhost:8983 + - key: shard + value: + stringValue: shard1 + - key: system.type + value: + stringValue: solr + timeUnixNano: "1000000" + name: gauge.solr.jvm_memory_pools_Metaspace_usage + scope: {} diff --git a/tests/receivers/smartagent/collectd-solr/testdata/all_metrics_config.yaml b/tests/receivers/smartagent/collectd-solr/testdata/all_metrics_config.yaml index d4f65537ca..20499dfcd3 100644 --- a/tests/receivers/smartagent/collectd-solr/testdata/all_metrics_config.yaml +++ b/tests/receivers/smartagent/collectd-solr/testdata/all_metrics_config.yaml @@ -6,17 +6,21 @@ receivers: extraMetrics: ["*"] intervalSeconds: 1 +processors: + batch: + groupbyattrs: + keys: + - host.name exporters: otlp: endpoint: "${OTLP_ENDPOINT}" tls: insecure: true - debug: - service: pipelines: metrics: receivers: - smartagent/collectd_solr - exporters: [otlp, debug] + processors: [batch, groupbyattrs] + exporters: [otlp] diff --git a/tests/receivers/smartagent/collectd-solr/testdata/resource_metrics/all.yaml b/tests/receivers/smartagent/collectd-solr/testdata/resource_metrics/all.yaml deleted file mode 100644 index b829574353..0000000000 --- a/tests/receivers/smartagent/collectd-solr/testdata/resource_metrics/all.yaml +++ /dev/null @@ -1,61 +0,0 @@ -resource_metrics: - - scope_metrics: - - metrics: - - name: counter.solr.http_2xx_responses - type: IntMonotonicCumulativeSum - - name: counter.solr.http_4xx_responses - type: IntMonotonicCumulativeSum - - name: counter.solr.http_5xx_responses - type: IntMonotonicCumulativeSum - - name: counter.solr.http_requests - type: IntMonotonicCumulativeSum - - name: counter.solr.node_collections_requests - type: IntMonotonicCumulativeSum - - name: counter.solr.node_cores_requests - type: IntMonotonicCumulativeSum - - name: counter.solr.node_metrics_requests - type: IntMonotonicCumulativeSum - - name: counter.solr.node_zookeeper_requests - type: IntMonotonicCumulativeSum - - name: counter.solr.replication_handler_requests - type: IntMonotonicCumulativeSum - - name: counter.solr.search_query_requests - type: IntMonotonicCumulativeSum - - name: counter.solr.update_handler_requests - type: IntMonotonicCumulativeSum - - name: gauge.solr.core_deleted_docs - type: IntGauge - - name: gauge.solr.core_index_size - type: IntGauge - - name: gauge.solr.core_max_docs - type: IntGauge - - name: gauge.solr.core_num_docs - type: IntGauge - - name: gauge.solr.core_totalspace - type: IntGauge - - name: gauge.solr.core_usablespace - type: IntGauge - - name: gauge.solr.document_cache_cumulative_hitratio - type: IntGauge - - name: gauge.solr.field_value_cache_cumulative_hitratio - type: IntGauge - - name: gauge.solr.jetty_request_latency - type: DoubleGauge - - name: gauge.solr.jvm_heap_usage - type: DoubleGauge - - name: gauge.solr.jvm_memory_pools_Metaspace_usage - type: DoubleGauge - - name: gauge.solr.jvm_total_memory - type: IntGauge - - name: gauge.solr.jvm_total_memory_used - type: IntGauge - - name: gauge.solr.query_result_cache_cumulative_hitratio - type: IntGauge - - name: gauge.solr.replication_handler_response - type: IntGauge - - name: gauge.solr.search_query_response - type: DoubleGauge - - name: gauge.solr.searcher_warmup - type: IntGauge - - name: gauge.solr.update_request_handler_response - type: DoubleGauge