Skip to content

Commit

Permalink
[fix][spm]: Change default metrics namespace to match new default in …
Browse files Browse the repository at this point in the history
…spanmetricsconnector (#6007)

## Which problem is this PR solving?
- Resolves #5982

## Description of the changes
- Make `traces_span_metrics` the new namespace default.
- Fixed the failing SPM integration test by setting the default
namespace when querying from prometheus to `traces_span_metrics`. This
matches the new default namespace in the `spanmetricsconnector` which
was changed in `v0.109.0` (see
f7o/opentelemetry-collector-contrib@371bc59)
- This change is backwards compatible because it modifies the default.
As a result, if anyone isn't using a custom namespace they will not be
broken by these changes.

## How was this change tested?
- CI

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Mahad Zaryab <[email protected]>
  • Loading branch information
mahadzaryab1 authored Sep 22, 2024
1 parent ff1b678 commit 6a96e18
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 19 deletions.
3 changes: 1 addition & 2 deletions docker-compose/monitor/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ services:
environment:
- METRICS_STORAGE_TYPE=prometheus
- PROMETHEUS_SERVER_URL=http://prometheus:9090
- PROMETHEUS_QUERY_SUPPORT_SPANMETRICS_CONNECTOR=${PROMETHEUS_QUERY_SUPPORT_SPANMETRICS_CONNECTOR:-true}
- PROMETHEUS_QUERY_NAMESPACE=${PROMETHEUS_QUERY_NAMESPACE:-}
- PROMETHEUS_QUERY_DURATION_UNIT=${PROMETHEUS_QUERY_DURATION_UNIT:-}
- PROMETHEUS_QUERY_NORMALIZE_CALLS=true
Expand All @@ -22,7 +21,7 @@ services:
backend:
# This is the host name used in Prometheus scrape configuration.
aliases: [spm_metrics_source]
image: otel/opentelemetry-collector-contrib:${OTEL_IMAGE_TAG:-0.89.0}
image: otel/opentelemetry-collector-contrib:${OTEL_IMAGE_TAG:-0.109.0}
volumes:
- ${OTEL_CONFIG_SRC:-./otel-collector-config-connector.yml}:/etc/otelcol/otel-collector-config.yml
command: --config /etc/otelcol/otel-collector-config.yml
Expand Down
1 change: 1 addition & 0 deletions docker-compose/monitor/otel-collector-config-connector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ receivers:
protocols:
grpc:
http:
endpoint: "0.0.0.0:4318"

exporters:
prometheus:
Expand Down
11 changes: 8 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0
github.com/kr/pretty v0.3.1
github.com/olivere/elastic v6.2.37+incompatible
github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector v0.108.0
github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector v0.109.0
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter v0.108.0
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.108.0
github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension v0.108.0
Expand Down Expand Up @@ -96,6 +96,11 @@ require (
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/elastic/lunes v0.1.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/pdatautil v0.109.0 // indirect
)

require (
github.com/IBM/sarama v1.43.3 // indirect
github.com/alecthomas/participle/v2 v2.1.1 // indirect
Expand Down Expand Up @@ -162,12 +167,12 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.108.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.108.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.109.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.108.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/kafka v0.108.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal v0.108.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.108.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.108.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.109.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.108.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/azure v0.108.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.108.0 // indirect
Expand Down
20 changes: 12 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ github.com/elastic/go-elasticsearch/v8 v8.15.0 h1:IZyJhe7t7WI3NEFdcHnf6IJXqpRf+8
github.com/elastic/go-elasticsearch/v8 v8.15.0/go.mod h1:HCON3zj4btpqs2N1jjsAy4a/fiAul+YBP00mBH4xik8=
github.com/elastic/go-grok v0.3.1 h1:WEhUxe2KrwycMnlvMimJXvzRa7DoByJB4PVUIE1ZD/U=
github.com/elastic/go-grok v0.3.1/go.mod h1:n38ls8ZgOboZRgKcjMY8eFeZFMmcL9n2lP0iHhIDk64=
github.com/elastic/lunes v0.1.0 h1:amRtLPjwkWtzDF/RKzcEPMvSsSseLDLW+bnhfNSLRe4=
github.com/elastic/lunes v0.1.0/go.mod h1:xGphYIt3XdZRtyWosHQTErsQTd4OP1p9wsbVoHelrd4=
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
Expand Down Expand Up @@ -394,8 +396,8 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector v0.108.0 h1:K50wU48oObjZPAJI5H5o5Awe3bvCV26Oj1+4fU++wtY=
github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector v0.108.0/go.mod h1:YF2SGiBXD6gcG2ZURhthEfSeYsKNGYqxONp2hr7b0ss=
github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector v0.109.0 h1:d/eNSZeGwocYCxTGUT05xExxg2FdGtNylPeU/MbmFPE=
github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector v0.109.0/go.mod h1:AHXtu7UsgawW1p5N7h46yImYhAco4wzCUlAJcdkxvI4=
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter v0.108.0 h1:42coTKWVcCQV3sbfdfebi+Js0+XorXgBOTJItiKAy+s=
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/kafkaexporter v0.108.0/go.mod h1:krFix2JnTlapRQkaSEs9g9oVCSrIRIy5/7hrUluJaHE=
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.108.0 h1:UM6fhqbCQra8SGfdAiR21toB4Kcvnds4aqj9Yi9kwWQ=
Expand All @@ -406,20 +408,22 @@ github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage v0.1
github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage v0.108.0/go.mod h1:uCn10h/QlirtEIPyEkEYLuf6IorSabZ4JTp1+dFUip0=
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.108.0 h1:NCY/JZmljwOjtWOcWqZWz7sOEHgPcW+JNORNPcIBSjg=
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.108.0/go.mod h1:osDf+vagg+N6yH5HBZNnDxCMA0oiMg/C3wVckFe/QHo=
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.108.0 h1:+VLLHBSbtEiLMtSi8ESWM4PPDs/H6XKf0RHWWIX8RjE=
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.108.0/go.mod h1:L4KHT5M01zjg0wYmNSX2VArC088vccVa7p4XBrcb48g=
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.109.0 h1:4VBRgtyh3hHSgAVGgs4bvNwJd0oUGyxVA3eQO2ujNsA=
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.109.0/go.mod h1:9MGQCqxdCNBhdD+7QBZ6hH9HipXe5CajMafVKglD5f0=
github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.108.0 h1:DGQwT+PdalEB/LYiE36r/XnFTaU3h+z8cR2LfS3qxm0=
github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.108.0/go.mod h1:pPQV7fCCb3HOo70YMUnnhN3d+0toR23W+eqvOQckpuM=
github.com/open-telemetry/opentelemetry-collector-contrib/internal/kafka v0.108.0 h1:ZABQPbay+ilVHJbbmpuHmtIJBFCbGfMNdkAP7zNXb04=
github.com/open-telemetry/opentelemetry-collector-contrib/internal/kafka v0.108.0/go.mod h1:CQyrhcehFnuGRSYQtqrLT1V9mstkN66SSIEDzHuIcLA=
github.com/open-telemetry/opentelemetry-collector-contrib/internal/pdatautil v0.109.0 h1:A2YjC0zAh4oe8rBV94hUCwq0NEWA6TsVkKnwMa5TF10=
github.com/open-telemetry/opentelemetry-collector-contrib/internal/pdatautil v0.109.0/go.mod h1:Qz5ugyCxgcAiGjvp6UkJqMVtco6+d8VXj/6J6U7JVlo=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal v0.108.0 h1:7EKRVuc8GRrAfde2/fh+CFMsJQAQGICg686sRyIk3QI=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/batchpersignal v0.108.0/go.mod h1:+ghcpLt2BBbqOm+vv6CeSXK/aLHB4cXiLdsfFNZXeqg=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.108.0 h1:WUV7wEVjjEgp8TRcQquQj/2NfRY84Vch43+zG/Pizqk=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl v0.108.0/go.mod h1:9mkPZ5pz6HktjWtUdqRmqAsP7VzP/gpIwQ8z/h2YXAU=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.108.0 h1:so+V3rT18oyHJmPs5lBNBLlU8tnHU9h/tkA3Q7q8m7c=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.108.0/go.mod h1:G+N43ID1sP2CnffxkYdMyuJpep2UcGQUyq4HiAmcYSw=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.108.0 h1:vU6a7EKHBu80err/1SCn+8fLpSCdR1PoSzdyydXDcjQ=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.108.0/go.mod h1:dHSW1ec9ZHZ/92+NoLEJd5UaL4tRVmnn+DvEQqdJ7f0=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.109.0 h1:Mi0qKcH4VjyyZsbaWYG038drk5FCFL7igVM8abEL4ZY=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.109.0/go.mod h1:KvJWxR0bDk9Qh0ktw4gOFsd/ZrJ7p5KTAQueEJsaK9Q=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.109.0 h1:3kXFgdEEKw37ftdRC7SmXAiZuLahVavqOYRhlJVMLc8=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.109.0/go.mod h1:HtaWI5WJKJkBhHz2R7Xb2n7R3fdBPhfKieYcQajNCTo=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.108.0 h1:LtTLGiv057JhM621FUr+dZ+hlgkTqC7kq/9MbaUAKoM=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.108.0/go.mod h1:uCAM9cEmQ5bQtzMvbkW/MhjSrB3j7vGzQMwhJdfRuNY=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/azure v0.108.0 h1:+QJK3dwdX3LOwbagbWDkgoK/47fUmBcLCjxqXjHjc3o=
Expand Down
2 changes: 1 addition & 1 deletion plugin/metrics/prometheus/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestWithDefaultConfiguration(t *testing.T) {
assert.Equal(t, "http://localhost:9090", f.options.ServerURL)
assert.Equal(t, 30*time.Second, f.options.ConnectTimeout)

assert.Empty(t, f.options.MetricNamespace)
assert.Equal(t, "traces_span_metrics", f.options.MetricNamespace)
assert.Equal(t, "ms", f.options.LatencyUnit)
}

Expand Down
10 changes: 5 additions & 5 deletions plugin/metrics/prometheus/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ const (
defaultConnectTimeout = 30 * time.Second
defaultTokenFilePath = ""

defaultSupportSpanmetricsConnector = true
defaultMetricNamespace = ""
defaultLatencyUnit = "ms"
defaultNormalizeCalls = false
defaultNormalizeDuration = false
// the default configuration here matches the default namespace in the span metrics connector
defaultMetricNamespace = "traces_span_metrics"
defaultLatencyUnit = "ms"
defaultNormalizeCalls = false
defaultNormalizeDuration = false
)

// Options stores the configuration entries for this storage.
Expand Down

0 comments on commit 6a96e18

Please sign in to comment.