From f0d0418ffc885aa053dea92ca88fd29a6f504239 Mon Sep 17 00:00:00 2001 From: Christos Markou Date: Thu, 9 Jan 2025 21:45:10 +0200 Subject: [PATCH 1/8] [chore][receivercreator] Replace positional arguements with named (#36910) #### Description This PR replace positional arguements with named in struct initialization. Addresses https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/36581#discussion_r1893021861 Signed-off-by: ChrsMark --- receiver/receivercreator/config_test.go | 4 ++-- receiver/receivercreator/discovery.go | 2 +- receiver/receivercreator/observerhandler_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/receiver/receivercreator/config_test.go b/receiver/receivercreator/config_test.go index 1bb751939140..2a9a02ec0d74 100644 --- a/receiver/receivercreator/config_test.go +++ b/receiver/receivercreator/config_test.go @@ -90,7 +90,7 @@ func TestLoadConfig(t *testing.T) { Rule: `type == "port"`, ResourceAttributes: map[string]any{"one": "two"}, rule: portRule, - signals: receiverSignals{true, true, true}, + signals: receiverSignals{metrics: true, logs: true, traces: true}, }, "nop/1": { receiverConfig: receiverConfig{ @@ -103,7 +103,7 @@ func TestLoadConfig(t *testing.T) { Rule: `type == "port"`, ResourceAttributes: map[string]any{"two": "three"}, rule: portRule, - signals: receiverSignals{true, true, true}, + signals: receiverSignals{metrics: true, logs: true, traces: true}, }, }, WatchObservers: []component.ID{ diff --git a/receiver/receivercreator/discovery.go b/receiver/receivercreator/discovery.go index 1908be3da7f5..a640b1385440 100644 --- a/receiver/receivercreator/discovery.go +++ b/receiver/receivercreator/discovery.go @@ -124,7 +124,7 @@ func (builder *k8sHintsBuilder) createScraper( } recTemplate, err := newReceiverTemplate(fmt.Sprintf("%v/%v_%v", subreceiverKey, pod.UID, port), userConfMap) - recTemplate.signals = receiverSignals{true, false, false} + recTemplate.signals = receiverSignals{metrics: true, logs: false, traces: false} return &recTemplate, err } diff --git a/receiver/receivercreator/observerhandler_test.go b/receiver/receivercreator/observerhandler_test.go index c6575d371c9e..87ce5d9778e3 100644 --- a/receiver/receivercreator/observerhandler_test.go +++ b/receiver/receivercreator/observerhandler_test.go @@ -78,7 +78,7 @@ func TestOnAddForMetrics(t *testing.T) { rule: portRule, Rule: `type == "port"`, ResourceAttributes: map[string]any{}, - signals: receiverSignals{true, true, true}, + signals: receiverSignals{metrics: true, logs: true, traces: true}, }, } From cc19e6bc65c42fbbbd94dca992803391602ac078 Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Thu, 9 Jan 2025 21:21:01 +0100 Subject: [PATCH 2/8] [processor/k8sattributes] update internally stored pods with replicaset/deployment information (#37088) #### Description This PR adapts the k8sattributes processor to update its internally stored pods with the information about their respective replica sets and deployments, after the replica set information is received via the informer. This can happen during the initial sync of the processor, where it can happen that the replica set information for existing pods is received after the pods have already been received and stored internally. #### Link to tracking issue Fixes #37056 #### Testing Added unit test #### Documentation --------- Signed-off-by: Florian Bacher --- .chloggen/k8sattributes-deployment-name.yaml | 27 + processor/k8sattributesprocessor/e2e_test.go | 497 ++++++++++++++++++ .../internal/kube/client.go | 29 +- 3 files changed, 540 insertions(+), 13 deletions(-) create mode 100644 .chloggen/k8sattributes-deployment-name.yaml diff --git a/.chloggen/k8sattributes-deployment-name.yaml b/.chloggen/k8sattributes-deployment-name.yaml new file mode 100644 index 000000000000..7492b491faf1 --- /dev/null +++ b/.chloggen/k8sattributes-deployment-name.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: k8sattributesprocessor + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Ensure the pods gathered by the processor contain the information about their related replica sets and deployments after the initial sync + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [37056] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/processor/k8sattributesprocessor/e2e_test.go b/processor/k8sattributesprocessor/e2e_test.go index 47d57b2c6a29..7de25e62e3b7 100644 --- a/processor/k8sattributesprocessor/e2e_test.go +++ b/processor/k8sattributesprocessor/e2e_test.go @@ -1087,6 +1087,503 @@ func TestE2E_NamespacedRBACNoPodIP(t *testing.T) { } } +// TestE2E_ClusterRBACCollectorRestart tests the k8s attributes processor in a k8s cluster with the collector's service account having +// cluster-wide permissions to list/watch namespaces, nodes, pods and replicasets. The config in the test does not +// set filter::namespace, and the telemetrygen image has a latest tag but no digest. +// The test starts the collector after the telemetrygen objects, to verify the initial sync of the k8sattributesproccessor +// captures all available resources in the cluster in a way that ensures the relations between them (e.g. pod <-> replicaset <-> deployment) are not lost. +// The test requires a prebuilt otelcontribcol image uploaded to a kind k8s cluster defined in +// `/tmp/kube-config-otelcol-e2e-testing`. Run the following command prior to running the test locally: +// +// kind create cluster --kubeconfig=/tmp/kube-config-otelcol-e2e-testing +// make docker-otelcontribcol +// KUBECONFIG=/tmp/kube-config-otelcol-e2e-testing kind load docker-image otelcontribcol:latest +func TestE2E_ClusterRBACCollectorStartAfterTelemetryGen(t *testing.T) { + testDir := filepath.Join("testdata", "e2e", "clusterrbac") + + k8sClient, err := k8stest.NewK8sClient(testKubeConfig) + require.NoError(t, err) + + nsFile := filepath.Join(testDir, "namespace.yaml") + buf, err := os.ReadFile(nsFile) + require.NoErrorf(t, err, "failed to read namespace object file %s", nsFile) + nsObj, err := k8stest.CreateObject(k8sClient, buf) + require.NoErrorf(t, err, "failed to create k8s namespace from file %s", nsFile) + + testNs := nsObj.GetName() + defer func() { + require.NoErrorf(t, k8stest.DeleteObject(k8sClient, nsObj), "failed to delete namespace %s", testNs) + }() + + metricsConsumer := new(consumertest.MetricsSink) + tracesConsumer := new(consumertest.TracesSink) + logsConsumer := new(consumertest.LogsSink) + profilesConsumer := new(consumertest.ProfilesSink) + shutdownSinks := startUpSinks(t, metricsConsumer, tracesConsumer, logsConsumer, profilesConsumer) + defer shutdownSinks() + + testID := uuid.NewString()[:8] + createTeleOpts := &k8stest.TelemetrygenCreateOpts{ + ManifestsDir: filepath.Join(testDir, "telemetrygen"), + TestID: testID, + OtlpEndpoint: fmt.Sprintf("otelcol-%s.%s:4317", testID, testNs), + // `telemetrygen` doesn't support profiles + // https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/36127 + // TODO: add "profiles" to DataTypes once #36127 is resolved + DataTypes: []string{"metrics", "logs", "traces"}, + } + telemetryGenObjs, telemetryGenObjInfos := k8stest.CreateTelemetryGenObjects(t, k8sClient, createTeleOpts) + defer func() { + for _, obj := range telemetryGenObjs { + require.NoErrorf(t, k8stest.DeleteObject(k8sClient, obj), "failed to delete object %s", obj.GetName()) + } + }() + + for _, info := range telemetryGenObjInfos { + k8stest.WaitForTelemetryGenToStart(t, k8sClient, info.Namespace, info.PodLabelSelectors, info.Workload, info.DataType) + } + + // start the collector after the telemetry gen objects + collectorObjs := k8stest.CreateCollectorObjects(t, k8sClient, testID, filepath.Join(testDir, "collector")) + defer func() { + for _, obj := range collectorObjs { + require.NoErrorf(t, k8stest.DeleteObject(k8sClient, obj), "failed to delete object %s", obj.GetName()) + } + }() + + wantEntries := 128 // Minimal number of metrics/traces/logs/profiles to wait for. + waitForData(t, wantEntries, metricsConsumer, tracesConsumer, logsConsumer, profilesConsumer) + + tcs := []struct { + name string + dataType pipeline.Signal + service string + attrs map[string]*expectedValue + }{ + { + name: "traces-job", + dataType: pipeline.SignalTraces, + service: "test-traces-job", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-traces-job-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.job.name": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-job"), + "k8s.job.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "job"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-job"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.node.labels.foo": newExpectedValue(equal, "too"), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "traces-statefulset", + dataType: pipeline.SignalTraces, + service: "test-traces-statefulset", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-statefulset-0"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.statefulset.name": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-statefulset"), + "k8s.statefulset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "statefulset"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-statefulset"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.node.labels.foo": newExpectedValue(equal, "too"), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "traces-deployment", + dataType: pipeline.SignalTraces, + service: "test-traces-deployment", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-traces-deployment-[a-z0-9]*-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.deployment.name": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-deployment"), + "k8s.deployment.uid": newExpectedValue(exist, ""), + "k8s.replicaset.name": newExpectedValue(regex, "telemetrygen-"+testID+"-traces-deployment-[a-z0-9]*"), + "k8s.replicaset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "deployment"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-deployment"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "traces-daemonset", + dataType: pipeline.SignalTraces, + service: "test-traces-daemonset", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-traces-daemonset-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.daemonset.name": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-daemonset"), + "k8s.daemonset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "daemonset"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-daemonset"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.node.labels.foo": newExpectedValue(equal, "too"), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "metrics-job", + dataType: pipeline.SignalMetrics, + service: "test-metrics-job", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-metrics-job-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.job.name": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-job"), + "k8s.job.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "job"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-job"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.node.labels.foo": newExpectedValue(equal, "too"), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "metrics-statefulset", + dataType: pipeline.SignalMetrics, + service: "test-metrics-statefulset", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-statefulset-0"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.statefulset.name": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-statefulset"), + "k8s.statefulset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "statefulset"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-statefulset"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.node.labels.foo": newExpectedValue(equal, "too"), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "metrics-deployment", + dataType: pipeline.SignalMetrics, + service: "test-metrics-deployment", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-metrics-deployment-[a-z0-9]*-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.deployment.name": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-deployment"), + "k8s.deployment.uid": newExpectedValue(exist, ""), + "k8s.replicaset.name": newExpectedValue(regex, "telemetrygen-"+testID+"-metrics-deployment-[a-z0-9]*"), + "k8s.replicaset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "deployment"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-deployment"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "metrics-daemonset", + dataType: pipeline.SignalMetrics, + service: "test-metrics-daemonset", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-metrics-daemonset-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.daemonset.name": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-daemonset"), + "k8s.daemonset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "daemonset"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-daemonset"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.node.labels.foo": newExpectedValue(equal, "too"), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "logs-job", + dataType: pipeline.SignalLogs, + service: "test-logs-job", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-logs-job-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.job.name": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-job"), + "k8s.job.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "job"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-job"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.node.labels.foo": newExpectedValue(equal, "too"), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "logs-statefulset", + dataType: pipeline.SignalLogs, + service: "test-logs-statefulset", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-statefulset-0"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.statefulset.name": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-statefulset"), + "k8s.statefulset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "statefulset"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-statefulset"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "logs-deployment", + dataType: pipeline.SignalLogs, + service: "test-logs-deployment", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-logs-deployment-[a-z0-9]*-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.deployment.name": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-deployment"), + "k8s.deployment.uid": newExpectedValue(exist, ""), + "k8s.replicaset.name": newExpectedValue(regex, "telemetrygen-"+testID+"-logs-deployment-[a-z0-9]*"), + "k8s.replicaset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "deployment"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-deployment"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.node.labels.foo": newExpectedValue(equal, "too"), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "logs-daemonset", + dataType: pipeline.SignalLogs, + service: "test-logs-daemonset", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-logs-daemonset-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.daemonset.name": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-daemonset"), + "k8s.daemonset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "daemonset"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-daemonset"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.node.labels.foo": newExpectedValue(equal, "too"), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "profiles-job", + dataType: pipelineprofiles.SignalProfiles, + service: "test-profiles-job", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-profiles-job-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.job.name": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-job"), + "k8s.job.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "job"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-job"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.node.labels.foo": newExpectedValue(equal, "too"), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "profiles-statefulset", + dataType: pipelineprofiles.SignalProfiles, + service: "test-profiles-statefulset", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-statefulset-0"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.statefulset.name": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-statefulset"), + "k8s.statefulset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "statefulset"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-statefulset"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "profiles-deployment", + dataType: pipelineprofiles.SignalProfiles, + service: "test-profiles-deployment", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-profiles-deployment-[a-z0-9]*-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.deployment.name": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-deployment"), + "k8s.deployment.uid": newExpectedValue(exist, ""), + "k8s.replicaset.name": newExpectedValue(regex, "telemetrygen-"+testID+"-profiles-deployment-[a-z0-9]*"), + "k8s.replicaset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "deployment"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-deployment"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.node.labels.foo": newExpectedValue(equal, "too"), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + { + name: "profiles-daemonset", + dataType: pipelineprofiles.SignalProfiles, + service: "test-profiles-daemonset", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-profiles-daemonset-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(regex, uidRe), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, testNs), + "k8s.daemonset.name": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-daemonset"), + "k8s.daemonset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "daemonset"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-profiles-daemonset"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "k8s.cluster.uid": newExpectedValue(regex, uidRe), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.repo_digests": newExpectedValue(regex, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + "k8s.node.labels.foo": newExpectedValue(equal, "too"), + "k8s.namespace.labels.foons": newExpectedValue(equal, "barns"), + }, + }, + } + + for _, tc := range tcs { + t.Run(tc.name, func(t *testing.T) { + switch tc.dataType { + case pipeline.SignalTraces: + scanTracesForAttributes(t, tracesConsumer, tc.service, tc.attrs) + case pipeline.SignalMetrics: + scanMetricsForAttributes(t, metricsConsumer, tc.service, tc.attrs) + case pipeline.SignalLogs: + scanLogsForAttributes(t, logsConsumer, tc.service, tc.attrs) + case pipelineprofiles.SignalProfiles: + scanProfilesForAttributes(t, profilesConsumer, tc.service, tc.attrs) + default: + t.Fatalf("unknown data type %s", tc.dataType) + } + }) + } +} + func scanTracesForAttributes(t *testing.T, ts *consumertest.TracesSink, expectedService string, kvs map[string]*expectedValue, ) { diff --git a/processor/k8sattributesprocessor/internal/kube/client.go b/processor/k8sattributesprocessor/internal/kube/client.go index a984e7f85cbd..a589d5a1c1f5 100644 --- a/processor/k8sattributesprocessor/internal/kube/client.go +++ b/processor/k8sattributesprocessor/internal/kube/client.go @@ -209,6 +209,22 @@ func New( // Start registers pod event handlers and starts watching the kubernetes cluster for pod changes. func (c *WatchClient) Start() error { synced := make([]cache.InformerSynced, 0) + + // start the replicaSet informer first, as the replica sets need to be + // present at the time the pods are handled, to correctly establish the connection between pods and deployments + if c.Rules.DeploymentName || c.Rules.DeploymentUID { + reg, err := c.replicasetInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ + AddFunc: c.handleReplicaSetAdd, + UpdateFunc: c.handleReplicaSetUpdate, + DeleteFunc: c.handleReplicaSetDelete, + }) + if err != nil { + return err + } + synced = append(synced, reg.HasSynced) + go c.replicasetInformer.Run(c.stopCh) + } + reg, err := c.informer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: c.handlePodAdd, UpdateFunc: c.handlePodUpdate, @@ -231,19 +247,6 @@ func (c *WatchClient) Start() error { synced = append(synced, reg.HasSynced) go c.namespaceInformer.Run(c.stopCh) - if c.Rules.DeploymentName || c.Rules.DeploymentUID { - reg, err = c.replicasetInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ - AddFunc: c.handleReplicaSetAdd, - UpdateFunc: c.handleReplicaSetUpdate, - DeleteFunc: c.handleReplicaSetDelete, - }) - if err != nil { - return err - } - synced = append(synced, reg.HasSynced) - go c.replicasetInformer.Run(c.stopCh) - } - if c.nodeInformer != nil { reg, err = c.nodeInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{ AddFunc: c.handleNodeAdd, From 56d636bbbe548e2594375e88bf751366f3ec8457 Mon Sep 17 00:00:00 2001 From: Paulo Janotti Date: Thu, 9 Jan 2025 12:50:25 -0800 Subject: [PATCH 3/8] [chore] Build test tools in scoped tests action (#37120) **Description:** The new GH action is breaking because `gotestsum` is not being built. I guess that in my fork the cache was always available when I tested. Anyway, building the tool to ensure the test works. **Testing:** The same step is already in other actions I will be testing this concurrently in my fork. **Documentation:** N/A --- .github/workflows/scoped-test.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/scoped-test.yaml b/.github/workflows/scoped-test.yaml index 0a525de6d64d..f417839f107b 100644 --- a/.github/workflows/scoped-test.yaml +++ b/.github/workflows/scoped-test.yaml @@ -59,6 +59,9 @@ jobs: ./.tools key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} + - name: Build test tools + run: make "$(${PWD} -replace '\\', '/')/.tools/gotestsum" + - name: Run changed tests if: needs.changedfiles.outputs.go_tests env: From c14c96b32d66d64b86f6887b3b497fea40d638fc Mon Sep 17 00:00:00 2001 From: Romain Dauby Date: Thu, 9 Jan 2025 16:01:31 -0500 Subject: [PATCH 4/8] [pkg/ottl] Add Second converter (#37082) --- .chloggen/add-second-converter.yaml | 27 +++++++++++++ pkg/ottl/ottlfuncs/README.md | 15 +++++++ pkg/ottl/ottlfuncs/func_second.go | 39 +++++++++++++++++++ pkg/ottl/ottlfuncs/func_second_test.go | 54 ++++++++++++++++++++++++++ pkg/ottl/ottlfuncs/functions.go | 1 + 5 files changed, 136 insertions(+) create mode 100644 .chloggen/add-second-converter.yaml create mode 100644 pkg/ottl/ottlfuncs/func_second.go create mode 100644 pkg/ottl/ottlfuncs/func_second_test.go diff --git a/.chloggen/add-second-converter.yaml b/.chloggen/add-second-converter.yaml new file mode 100644 index 000000000000..bdacd0984847 --- /dev/null +++ b/.chloggen/add-second-converter.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: pkg/ottl + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add the `Second` converter to return the second component from the specified time.Time + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [37042] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] \ No newline at end of file diff --git a/pkg/ottl/ottlfuncs/README.md b/pkg/ottl/ottlfuncs/README.md index 8e48eb3083b2..c1bfaf4e1bae 100644 --- a/pkg/ottl/ottlfuncs/README.md +++ b/pkg/ottl/ottlfuncs/README.md @@ -452,6 +452,7 @@ Available Converters: - [ParseSimplifiedXML](#parsesimplifiedxml) - [ParseXML](#parsexml) - [RemoveXML](#removexml) +- [Second](#second) - [Seconds](#seconds) - [SHA1](#sha1) - [SHA256](#sha256) @@ -1611,6 +1612,20 @@ Delete text from nodes that contain the word "sensitive" - `RemoveXML(body, "//*[contains(text(), 'sensitive')]")` +### Second + +`Second(value)` + +The `Second` Converter returns the second component from the specified time using the Go stdlib [`time.Second` function](https://pkg.go.dev/time#Time.Second). + +`value` is a `time.Time`. If `value` is another type, an error is returned. + +The returned type is `int64`. + +Examples: + +- `Second(Now())` + ### Seconds `Seconds(value)` diff --git a/pkg/ottl/ottlfuncs/func_second.go b/pkg/ottl/ottlfuncs/func_second.go new file mode 100644 index 000000000000..1e8306aad5ef --- /dev/null +++ b/pkg/ottl/ottlfuncs/func_second.go @@ -0,0 +1,39 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package ottlfuncs // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs" + +import ( + "context" + "fmt" + + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl" +) + +type SecondArguments[K any] struct { + Time ottl.TimeGetter[K] +} + +func NewSecondFactory[K any]() ottl.Factory[K] { + return ottl.NewFactory("Second", &SecondArguments[K]{}, createSecondFunction[K]) +} + +func createSecondFunction[K any](_ ottl.FunctionContext, oArgs ottl.Arguments) (ottl.ExprFunc[K], error) { + args, ok := oArgs.(*SecondArguments[K]) + + if !ok { + return nil, fmt.Errorf("SecondFactory args must be of type *SecondArguments[K]") + } + + return Second(args.Time) +} + +func Second[K any](time ottl.TimeGetter[K]) (ottl.ExprFunc[K], error) { + return func(ctx context.Context, tCtx K) (any, error) { + t, err := time.Get(ctx, tCtx) + if err != nil { + return nil, err + } + return int64(t.Second()), nil + }, nil +} diff --git a/pkg/ottl/ottlfuncs/func_second_test.go b/pkg/ottl/ottlfuncs/func_second_test.go new file mode 100644 index 000000000000..75e9e3b3438f --- /dev/null +++ b/pkg/ottl/ottlfuncs/func_second_test.go @@ -0,0 +1,54 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package ottlfuncs + +import ( + "context" + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl" +) + +func Test_Second(t *testing.T) { + tests := []struct { + name string + time ottl.TimeGetter[any] + expected int64 + }{ + { + name: "some time", + time: &ottl.StandardTimeGetter[any]{ + Getter: func(_ context.Context, _ any) (any, error) { + return time.Date(2006, time.January, 2, 15, 4, 5, 0, time.UTC), nil + }, + }, + expected: 5, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + exprFunc, err := Second(tt.time) + assert.NoError(t, err) + result, err := exprFunc(nil, nil) + assert.NoError(t, err) + assert.Equal(t, tt.expected, result) + }) + } +} + +func Test_Second_Error(t *testing.T) { + var getter ottl.TimeGetter[any] = &ottl.StandardTimeGetter[any]{ + Getter: func(_ context.Context, _ any) (any, error) { + return "not a time", nil + }, + } + exprFunc, err := Second(getter) + assert.NoError(t, err) + result, err := exprFunc(context.Background(), nil) + assert.Nil(t, result) + assert.Error(t, err) +} diff --git a/pkg/ottl/ottlfuncs/functions.go b/pkg/ottl/ottlfuncs/functions.go index efd8480fc691..f6983cb4b3ba 100644 --- a/pkg/ottl/ottlfuncs/functions.go +++ b/pkg/ottl/ottlfuncs/functions.go @@ -76,6 +76,7 @@ func converters[K any]() []ottl.Factory[K] { NewParseSimplifiedXMLFactory[K](), NewParseXMLFactory[K](), NewRemoveXMLFactory[K](), + NewSecondFactory[K](), NewSecondsFactory[K](), NewSHA1Factory[K](), NewSHA256Factory[K](), From 7865587c95206a84a9a482acb844a668bb238d9e Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Thu, 9 Jan 2025 17:07:20 -0400 Subject: [PATCH 5/8] [jaegerreceiver] Remove unused remote sampling server (#36971) #### Description The RemoteSampling config of the receiver has been disabled in the past (it just logs a warning now), but the code for the actual sampling server was still around. This PR removes that code. While the endpoint is defined in the private config https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/b53b5ad2e857367170c0ba04dfca8ad9886f0a87/receiver/jaegerreceiver/trace_receiver.go#L51 it has been removed from the public config and the private part is never populated https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/b53b5ad2e857367170c0ba04dfca8ad9886f0a87/receiver/jaegerreceiver/factory.go#L107-L109 #### Testing CI Signed-off-by: Yuri Shkuro Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com> --- receiver/jaegerreceiver/config.go | 24 +++--- receiver/jaegerreceiver/config_test.go | 16 ++-- receiver/jaegerreceiver/factory.go | 24 +----- receiver/jaegerreceiver/factory_test.go | 12 +-- receiver/jaegerreceiver/go.sum | 2 - receiver/jaegerreceiver/jaeger_agent_test.go | 83 +++--------------- receiver/jaegerreceiver/trace_receiver.go | 85 ++++--------------- .../jaegerreceiver/trace_receiver_test.go | 26 +++--- 8 files changed, 73 insertions(+), 199 deletions(-) diff --git a/receiver/jaegerreceiver/config.go b/receiver/jaegerreceiver/config.go index bfa43c09e3c8..adb5b087778a 100644 --- a/receiver/jaegerreceiver/config.go +++ b/receiver/jaegerreceiver/config.go @@ -37,10 +37,10 @@ type RemoteSamplingConfig struct { // Protocols is the configuration for the supported protocols. type Protocols struct { - GRPC *configgrpc.ServerConfig `mapstructure:"grpc"` - ThriftHTTP *confighttp.ServerConfig `mapstructure:"thrift_http"` - ThriftBinary *ProtocolUDP `mapstructure:"thrift_binary"` - ThriftCompact *ProtocolUDP `mapstructure:"thrift_compact"` + GRPC *configgrpc.ServerConfig `mapstructure:"grpc"` + ThriftHTTP *confighttp.ServerConfig `mapstructure:"thrift_http"` + ThriftBinaryUDP *ProtocolUDP `mapstructure:"thrift_binary"` + ThriftCompactUDP *ProtocolUDP `mapstructure:"thrift_compact"` } // ProtocolUDP is the configuration for a UDP protocol. @@ -82,8 +82,8 @@ var ( func (cfg *Config) Validate() error { if cfg.GRPC == nil && cfg.ThriftHTTP == nil && - cfg.ThriftBinary == nil && - cfg.ThriftCompact == nil { + cfg.ThriftBinaryUDP == nil && + cfg.ThriftCompactUDP == nil { return errors.New("must specify at least one protocol when using the Jaeger receiver") } @@ -99,14 +99,14 @@ func (cfg *Config) Validate() error { } } - if cfg.ThriftBinary != nil { - if err := checkPortFromEndpoint(cfg.ThriftBinary.Endpoint); err != nil { + if cfg.ThriftBinaryUDP != nil { + if err := checkPortFromEndpoint(cfg.ThriftBinaryUDP.Endpoint); err != nil { return fmt.Errorf("invalid port number for the Thrift UDP Binary endpoint: %w", err) } } - if cfg.ThriftCompact != nil { - if err := checkPortFromEndpoint(cfg.ThriftCompact.Endpoint); err != nil { + if cfg.ThriftCompactUDP != nil { + if err := checkPortFromEndpoint(cfg.ThriftCompactUDP.Endpoint); err != nil { return fmt.Errorf("invalid port number for the Thrift UDP Compact endpoint: %w", err) } } @@ -145,10 +145,10 @@ func (cfg *Config) Unmarshal(componentParser *confmap.Conf) error { cfg.ThriftHTTP = nil } if !protocols.IsSet(protoThriftBinary) { - cfg.ThriftBinary = nil + cfg.ThriftBinaryUDP = nil } if !protocols.IsSet(protoThriftCompact) { - cfg.ThriftCompact = nil + cfg.ThriftCompactUDP = nil } return nil diff --git a/receiver/jaegerreceiver/config_test.go b/receiver/jaegerreceiver/config_test.go index ee9a05b6e23d..e2bcaeb154c6 100644 --- a/receiver/jaegerreceiver/config_test.go +++ b/receiver/jaegerreceiver/config_test.go @@ -42,7 +42,7 @@ func TestLoadConfig(t *testing.T) { ThriftHTTP: &confighttp.ServerConfig{ Endpoint: ":3456", }, - ThriftCompact: &ProtocolUDP{ + ThriftCompactUDP: &ProtocolUDP{ Endpoint: "0.0.0.0:456", ServerConfigUDP: ServerConfigUDP{ QueueSize: 100_000, @@ -51,7 +51,7 @@ func TestLoadConfig(t *testing.T) { SocketBufferSize: 65_536, }, }, - ThriftBinary: &ProtocolUDP{ + ThriftBinaryUDP: &ProtocolUDP{ Endpoint: "0.0.0.0:789", ServerConfigUDP: ServerConfigUDP{ QueueSize: 1_000, @@ -76,11 +76,11 @@ func TestLoadConfig(t *testing.T) { ThriftHTTP: &confighttp.ServerConfig{ Endpoint: "localhost:14268", }, - ThriftCompact: &ProtocolUDP{ + ThriftCompactUDP: &ProtocolUDP{ Endpoint: "localhost:6831", ServerConfigUDP: defaultServerConfigUDP(), }, - ThriftBinary: &ProtocolUDP{ + ThriftBinaryUDP: &ProtocolUDP{ Endpoint: "localhost:6832", ServerConfigUDP: defaultServerConfigUDP(), }, @@ -97,7 +97,7 @@ func TestLoadConfig(t *testing.T) { Transport: confignet.TransportTypeTCP, }, }, - ThriftCompact: &ProtocolUDP{ + ThriftCompactUDP: &ProtocolUDP{ Endpoint: "localhost:6831", ServerConfigUDP: defaultServerConfigUDP(), }, @@ -183,7 +183,7 @@ func TestInvalidConfig(t *testing.T) { { desc: "thrift-udp-compact-no-port", apply: func(cfg *Config) { - cfg.ThriftCompact = &ProtocolUDP{ + cfg.ThriftCompactUDP = &ProtocolUDP{ Endpoint: "localhost:", } }, @@ -192,7 +192,7 @@ func TestInvalidConfig(t *testing.T) { { desc: "thrift-udp-binary-no-port", apply: func(cfg *Config) { - cfg.ThriftBinary = &ProtocolUDP{ + cfg.ThriftBinaryUDP = &ProtocolUDP{ Endpoint: "localhost:", } }, @@ -220,7 +220,7 @@ func TestInvalidConfig(t *testing.T) { { desc: "port-outside-of-range", apply: func(cfg *Config) { - cfg.ThriftBinary = &ProtocolUDP{ + cfg.ThriftBinaryUDP = &ProtocolUDP{ Endpoint: "localhost:65536", } }, diff --git a/receiver/jaegerreceiver/factory.go b/receiver/jaegerreceiver/factory.go index 92d1f0cf5af9..56e4b6084bd4 100644 --- a/receiver/jaegerreceiver/factory.go +++ b/receiver/jaegerreceiver/factory.go @@ -60,11 +60,11 @@ func createDefaultConfig() component.Config { ThriftHTTP: &confighttp.ServerConfig{ Endpoint: defaultHTTPEndpoint, }, - ThriftBinary: &ProtocolUDP{ + ThriftBinaryUDP: &ProtocolUDP{ Endpoint: defaultThriftBinaryEndpoint, ServerConfigUDP: defaultServerConfigUDP(), }, - ThriftCompact: &ProtocolUDP{ + ThriftCompactUDP: &ProtocolUDP{ Endpoint: defaultThriftCompactEndpoint, ServerConfigUDP: defaultServerConfigUDP(), }, @@ -85,28 +85,10 @@ func createTracesReceiver( rCfg := cfg.(*Config) - var config configuration - // Set ports - if rCfg.Protocols.GRPC != nil { - config.GRPCServerConfig = *rCfg.Protocols.GRPC - } - - if rCfg.Protocols.ThriftHTTP != nil { - config.HTTPServerConfig = *rCfg.ThriftHTTP - } - - if rCfg.Protocols.ThriftBinary != nil { - config.AgentBinaryThrift = *rCfg.ThriftBinary - } - - if rCfg.Protocols.ThriftCompact != nil { - config.AgentCompactThrift = *rCfg.ThriftCompact - } - if rCfg.RemoteSampling != nil { set.Logger.Warn("You are using a deprecated no-op `remote_sampling` option which will be removed soon; use a `jaegerremotesampling` extension instead") } // Create the receiver. - return newJaegerReceiver(set.ID, &config, nextConsumer, set) + return newJaegerReceiver(set.ID, rCfg.Protocols, nextConsumer, set) } diff --git a/receiver/jaegerreceiver/factory_test.go b/receiver/jaegerreceiver/factory_test.go index 194a5dcaebcb..6c809c823891 100644 --- a/receiver/jaegerreceiver/factory_test.go +++ b/receiver/jaegerreceiver/factory_test.go @@ -91,7 +91,7 @@ func TestCreateDefaultGRPCEndpoint(t *testing.T) { r, err := factory.CreateTraces(context.Background(), set, cfg, nil) assert.NoError(t, err, "unexpected error creating receiver") - assert.Equal(t, "0.0.0.0:14250", r.(*jReceiver).config.GRPCServerConfig.NetAddr.Endpoint, "grpc port should be default") + assert.Equal(t, "0.0.0.0:14250", r.(*jReceiver).config.GRPC.NetAddr.Endpoint, "grpc port should be default") } func TestCreateTLSGPRCEndpoint(t *testing.T) { @@ -144,33 +144,33 @@ func TestCreateInvalidHTTPEndpoint(t *testing.T) { r, err := factory.CreateTraces(context.Background(), set, cfg, nil) assert.NoError(t, err, "unexpected error creating receiver") - assert.Equal(t, "localhost:14268", r.(*jReceiver).config.HTTPServerConfig.Endpoint, "http port should be default") + assert.Equal(t, "localhost:14268", r.(*jReceiver).config.ThriftHTTP.Endpoint, "http port should be default") } func TestCreateInvalidThriftBinaryEndpoint(t *testing.T) { factory := NewFactory() cfg := factory.CreateDefaultConfig() - cfg.(*Config).Protocols.ThriftBinary = &ProtocolUDP{ + cfg.(*Config).Protocols.ThriftBinaryUDP = &ProtocolUDP{ Endpoint: "0.0.0.0:6832", } set := receivertest.NewNopSettings() r, err := factory.CreateTraces(context.Background(), set, cfg, nil) assert.NoError(t, err, "unexpected error creating receiver") - assert.Equal(t, "0.0.0.0:6832", r.(*jReceiver).config.AgentBinaryThrift.Endpoint, "thrift port should be default") + assert.Equal(t, "0.0.0.0:6832", r.(*jReceiver).config.ThriftBinaryUDP.Endpoint, "thrift port should be default") } func TestCreateInvalidThriftCompactEndpoint(t *testing.T) { factory := NewFactory() cfg := factory.CreateDefaultConfig() - cfg.(*Config).Protocols.ThriftCompact = &ProtocolUDP{ + cfg.(*Config).Protocols.ThriftCompactUDP = &ProtocolUDP{ Endpoint: "0.0.0.0:6831", } set := receivertest.NewNopSettings() r, err := factory.CreateTraces(context.Background(), set, cfg, nil) assert.NoError(t, err, "unexpected error creating receiver") - assert.Equal(t, "0.0.0.0:6831", r.(*jReceiver).config.AgentCompactThrift.Endpoint, "thrift port should be default") + assert.Equal(t, "0.0.0.0:6831", r.(*jReceiver).config.ThriftCompactUDP.Endpoint, "thrift port should be default") } diff --git a/receiver/jaegerreceiver/go.sum b/receiver/jaegerreceiver/go.sum index 3931eafab10b..f07a7fe1dc19 100644 --- a/receiver/jaegerreceiver/go.sum +++ b/receiver/jaegerreceiver/go.sum @@ -189,8 +189,6 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.57.0 h1:DheMAlT go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.57.0/go.mod h1:wZcGmeVO9nzP67aYSLDqXNWK87EZWhi7JWj1v7ZXf94= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= -go.opentelemetry.io/otel/exporters/prometheus v0.54.0 h1:rFwzp68QMgtzu9PgP3jm9XaMICI6TsofWWPcBDKwlsU= -go.opentelemetry.io/otel/exporters/prometheus v0.54.0/go.mod h1:QyjcV9qDP6VeK5qPyKETvNjmaaEc7+gqjh4SS0ZYzDU= go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4= diff --git a/receiver/jaegerreceiver/jaeger_agent_test.go b/receiver/jaegerreceiver/jaeger_agent_test.go index 1c0765052ef1..4e23cbda9696 100644 --- a/receiver/jaegerreceiver/jaeger_agent_test.go +++ b/receiver/jaegerreceiver/jaeger_agent_test.go @@ -5,9 +5,7 @@ package jaegerreceiver import ( "context" - "fmt" "net" - "net/http" "testing" "time" @@ -15,7 +13,6 @@ import ( "github.com/jaegertracing/jaeger/cmd/agent/app/servers/thriftudp" "github.com/jaegertracing/jaeger/model" jaegerconvert "github.com/jaegertracing/jaeger/model/converter/thrift/jaeger" - "github.com/jaegertracing/jaeger/proto-gen/api_v2" "github.com/jaegertracing/jaeger/thrift-gen/agent" jaegerthrift "github.com/jaegertracing/jaeger/thrift-gen/jaeger" "github.com/stretchr/testify/assert" @@ -26,7 +23,6 @@ import ( "go.opentelemetry.io/collector/pdata/ptrace" "go.opentelemetry.io/collector/receiver/receivertest" conventions "go.opentelemetry.io/collector/semconv/v1.27.0" - "google.golang.org/grpc" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger" @@ -37,8 +33,8 @@ var jaegerAgent = component.NewIDWithName(metadata.Type, "agent_test") func TestJaegerAgentUDP_ThriftCompact(t *testing.T) { addr := testutil.GetAvailableLocalAddress(t) - testJaegerAgent(t, addr, &configuration{ - AgentCompactThrift: ProtocolUDP{ + testJaegerAgent(t, addr, Protocols{ + ThriftCompactUDP: &ProtocolUDP{ Endpoint: addr, ServerConfigUDP: defaultServerConfigUDP(), }, @@ -46,8 +42,8 @@ func TestJaegerAgentUDP_ThriftCompact(t *testing.T) { } func TestJaegerAgentUDP_ThriftCompact_InvalidPort(t *testing.T) { - config := &configuration{ - AgentCompactThrift: ProtocolUDP{ + config := Protocols{ + ThriftCompactUDP: &ProtocolUDP{ Endpoint: "0.0.0.0:999999", ServerConfigUDP: defaultServerConfigUDP(), }, @@ -63,8 +59,8 @@ func TestJaegerAgentUDP_ThriftCompact_InvalidPort(t *testing.T) { func TestJaegerAgentUDP_ThriftBinary(t *testing.T) { addr := testutil.GetAvailableLocalAddress(t) - testJaegerAgent(t, addr, &configuration{ - AgentBinaryThrift: ProtocolUDP{ + testJaegerAgent(t, addr, Protocols{ + ThriftBinaryUDP: &ProtocolUDP{ Endpoint: addr, ServerConfigUDP: defaultServerConfigUDP(), }, @@ -75,8 +71,8 @@ func TestJaegerAgentUDP_ThriftBinary_PortInUse(t *testing.T) { // This test confirms that the thrift binary port is opened correctly. This is all we can test at the moment. See above. addr := testutil.GetAvailableLocalAddress(t) - config := &configuration{ - AgentBinaryThrift: ProtocolUDP{ + config := Protocols{ + ThriftBinaryUDP: &ProtocolUDP{ Endpoint: addr, ServerConfigUDP: defaultServerConfigUDP(), }, @@ -85,7 +81,7 @@ func TestJaegerAgentUDP_ThriftBinary_PortInUse(t *testing.T) { jr, err := newJaegerReceiver(jaegerAgent, config, nil, set) require.NoError(t, err) - assert.NoError(t, jr.startAgent(componenttest.NewNopHost()), "Start failed") + assert.NoError(t, jr.startAgent(), "Start failed") t.Cleanup(func() { require.NoError(t, jr.Shutdown(context.Background())) }) l, err := net.Listen("udp", addr) @@ -97,8 +93,8 @@ func TestJaegerAgentUDP_ThriftBinary_PortInUse(t *testing.T) { } func TestJaegerAgentUDP_ThriftBinary_InvalidPort(t *testing.T) { - config := &configuration{ - AgentBinaryThrift: ProtocolUDP{ + config := Protocols{ + ThriftBinaryUDP: &ProtocolUDP{ Endpoint: "0.0.0.0:999999", ServerConfigUDP: defaultServerConfigUDP(), }, @@ -112,60 +108,7 @@ func TestJaegerAgentUDP_ThriftBinary_InvalidPort(t *testing.T) { require.NoError(t, jr.Shutdown(context.Background())) } -func initializeGRPCTestServer(t *testing.T, beforeServe func(server *grpc.Server), opts ...grpc.ServerOption) (*grpc.Server, net.Addr) { - server := grpc.NewServer(opts...) - lis, err := net.Listen("tcp", "localhost:0") - require.NoError(t, err) - beforeServe(server) - go func() { - err := server.Serve(lis) - assert.NoError(t, err) - }() - return server, lis.Addr() -} - -type mockSamplingHandler struct{} - -func (*mockSamplingHandler) GetSamplingStrategy(context.Context, *api_v2.SamplingStrategyParameters) (*api_v2.SamplingStrategyResponse, error) { - return &api_v2.SamplingStrategyResponse{StrategyType: api_v2.SamplingStrategyType_PROBABILISTIC}, nil -} - -func TestJaegerHTTP(t *testing.T) { - s, _ := initializeGRPCTestServer(t, func(s *grpc.Server) { - api_v2.RegisterSamplingManagerServer(s, &mockSamplingHandler{}) - }) - defer s.GracefulStop() - - endpoint := testutil.GetAvailableLocalAddress(t) - config := &configuration{ - AgentHTTPEndpoint: endpoint, - } - set := receivertest.NewNopSettings() - jr, err := newJaegerReceiver(jaegerAgent, config, nil, set) - require.NoError(t, err) - t.Cleanup(func() { require.NoError(t, jr.Shutdown(context.Background())) }) - - assert.NoError(t, jr.Start(context.Background(), componenttest.NewNopHost()), "Start failed") - - // allow http server to start - assert.Eventually(t, func() bool { - var conn net.Conn - conn, err = net.Dial("tcp", endpoint) - if err == nil && conn != nil { - conn.Close() - return true - } - return false - }, 10*time.Second, 5*time.Millisecond, "failed to wait for the port to be open") - - resp, err := http.Get(fmt.Sprintf("http://%s/sampling?service=test", endpoint)) - assert.NoError(t, err, "should not have failed to make request") - assert.NotNil(t, resp) - defer resp.Body.Close() - assert.Equal(t, 500, resp.StatusCode, "should have returned 200") -} - -func testJaegerAgent(t *testing.T, agentEndpoint string, receiverConfig *configuration) { +func testJaegerAgent(t *testing.T, agentEndpoint string, receiverConfig Protocols) { // 1. Create the Jaeger receiver aka "server" sink := new(consumertest.TracesSink) set := receivertest.NewNopSettings() @@ -184,7 +127,7 @@ func testJaegerAgent(t *testing.T, agentEndpoint string, receiverConfig *configu require.NoError(t, err, "Start failed") // 2. Then send spans to the Jaeger receiver. - jexp, err := newClientUDP(agentEndpoint, jr.config.AgentBinaryThrift.Endpoint != "") + jexp, err := newClientUDP(agentEndpoint, jr.config.ThriftBinaryUDP != nil) require.NoError(t, err, "Failed to create the Jaeger OpenTelemetry exporter for the live application") // 3. Now finally send some spans diff --git a/receiver/jaegerreceiver/trace_receiver.go b/receiver/jaegerreceiver/trace_receiver.go index 3e3b44c83e72..af204faa68f0 100644 --- a/receiver/jaegerreceiver/trace_receiver.go +++ b/receiver/jaegerreceiver/trace_receiver.go @@ -15,8 +15,6 @@ import ( apacheThrift "github.com/apache/thrift/lib/go/thrift" "github.com/gorilla/mux" - "github.com/jaegertracing/jaeger/cmd/agent/app/configmanager" - "github.com/jaegertracing/jaeger/cmd/agent/app/httpserver" "github.com/jaegertracing/jaeger/cmd/agent/app/processors" "github.com/jaegertracing/jaeger/cmd/agent/app/servers" "github.com/jaegertracing/jaeger/cmd/agent/app/servers/thriftudp" @@ -24,13 +22,10 @@ import ( "github.com/jaegertracing/jaeger/pkg/metrics" "github.com/jaegertracing/jaeger/proto-gen/api_v2" "github.com/jaegertracing/jaeger/thrift-gen/agent" - "github.com/jaegertracing/jaeger/thrift-gen/baggage" "github.com/jaegertracing/jaeger/thrift-gen/jaeger" "github.com/jaegertracing/jaeger/thrift-gen/zipkincore" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componentstatus" - "go.opentelemetry.io/collector/config/configgrpc" - "go.opentelemetry.io/collector/config/confighttp" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/receiverhelper" @@ -40,24 +35,13 @@ import ( jaegertranslator "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger" ) -// configuration defines the behavior and the ports that -// the Jaeger receiver will use. -type configuration struct { - HTTPServerConfig confighttp.ServerConfig - GRPCServerConfig configgrpc.ServerConfig - - AgentCompactThrift ProtocolUDP - AgentBinaryThrift ProtocolUDP - AgentHTTPEndpoint string -} - // Receiver type is used to receive spans that were originally intended to be sent to Jaeger. // This receiver is basically a Jaeger collector. type jReceiver struct { nextConsumer consumer.Traces id component.ID - config *configuration + config Protocols grpc *grpc.Server collectorServer *http.Server @@ -92,7 +76,7 @@ var acceptedThriftFormats = map[string]struct{}{ // also as a Jaeger agent. func newJaegerReceiver( id component.ID, - config *configuration, + config Protocols, nextConsumer consumer.Traces, set receiver.Settings, ) (*jReceiver, error) { @@ -124,7 +108,7 @@ func newJaegerReceiver( } func (jr *jReceiver) Start(ctx context.Context, host component.Host) error { - if err := jr.startAgent(host); err != nil { + if err := jr.startAgent(); err != nil { return err } @@ -168,23 +152,10 @@ func consumeTraces(ctx context.Context, batch *jaeger.Batch, consumer consumer.T } var ( - _ agent.Agent = (*agentHandler)(nil) - _ api_v2.CollectorServiceServer = (*jReceiver)(nil) - _ configmanager.ClientConfigManager = (*notImplementedConfigManager)(nil) + _ agent.Agent = (*agentHandler)(nil) + _ api_v2.CollectorServiceServer = (*jReceiver)(nil) ) -var errNotImplemented = errors.New("not implemented") - -type notImplementedConfigManager struct{} - -func (notImplementedConfigManager) GetSamplingStrategy(_ context.Context, _ string) (*api_v2.SamplingStrategyResponse, error) { - return nil, errNotImplemented -} - -func (notImplementedConfigManager) GetBaggageRestrictions(_ context.Context, _ string) ([]*baggage.BaggageRestriction, error) { - return nil, errNotImplemented -} - type agentHandler struct { nextConsumer consumer.Traces obsrecv *receiverhelper.ObsReport @@ -223,12 +194,8 @@ func (jr *jReceiver) PostSpans(ctx context.Context, r *api_v2.PostSpansRequest) return &api_v2.PostSpansResponse{}, nil } -func (jr *jReceiver) startAgent(host component.Host) error { - if jr.config == nil { - return nil - } - - if jr.config.AgentBinaryThrift.Endpoint != "" { +func (jr *jReceiver) startAgent() error { + if jr.config.ThriftBinaryUDP != nil { obsrecv, err := receiverhelper.NewObsReport(receiverhelper.ObsReportSettings{ ReceiverID: jr.id, Transport: agentTransportBinary, @@ -242,14 +209,14 @@ func (jr *jReceiver) startAgent(host component.Host) error { nextConsumer: jr.nextConsumer, obsrecv: obsrecv, } - processor, err := jr.buildProcessor(jr.config.AgentBinaryThrift.Endpoint, jr.config.AgentBinaryThrift.ServerConfigUDP, apacheThrift.NewTBinaryProtocolFactoryConf(nil), h) + processor, err := jr.buildProcessor(jr.config.ThriftBinaryUDP.Endpoint, jr.config.ThriftBinaryUDP.ServerConfigUDP, apacheThrift.NewTBinaryProtocolFactoryConf(nil), h) if err != nil { return err } jr.agentProcessors = append(jr.agentProcessors, processor) } - if jr.config.AgentCompactThrift.Endpoint != "" { + if jr.config.ThriftCompactUDP != nil { obsrecv, err := receiverhelper.NewObsReport(receiverhelper.ObsReportSettings{ ReceiverID: jr.id, Transport: agentTransportCompact, @@ -262,7 +229,7 @@ func (jr *jReceiver) startAgent(host component.Host) error { nextConsumer: jr.nextConsumer, obsrecv: obsrecv, } - processor, err := jr.buildProcessor(jr.config.AgentCompactThrift.Endpoint, jr.config.AgentCompactThrift.ServerConfigUDP, apacheThrift.NewTCompactProtocolFactoryConf(nil), h) + processor, err := jr.buildProcessor(jr.config.ThriftCompactUDP.Endpoint, jr.config.ThriftCompactUDP.ServerConfigUDP, apacheThrift.NewTCompactProtocolFactoryConf(nil), h) if err != nil { return err } @@ -277,18 +244,6 @@ func (jr *jReceiver) startAgent(host component.Host) error { }(processor) } - if jr.config.AgentHTTPEndpoint != "" { - jr.agentServer = httpserver.NewHTTPServer(jr.config.AgentHTTPEndpoint, ¬ImplementedConfigManager{}, metrics.NullFactory, jr.settings.Logger) - - jr.goroutines.Add(1) - go func() { - defer jr.goroutines.Done() - if err := jr.agentServer.ListenAndServe(); !errors.Is(err, http.ErrServerClosed) && err != nil { - componentstatus.ReportStatus(host, componentstatus.NewFatalErrorEvent(fmt.Errorf("jaeger agent server error: %w", err))) - } - }() - } - return nil } @@ -370,20 +325,16 @@ func (jr *jReceiver) HandleThriftHTTPBatch(w http.ResponseWriter, r *http.Reques } func (jr *jReceiver) startCollector(ctx context.Context, host component.Host) error { - if jr.config == nil { - return nil - } - - if jr.config.HTTPServerConfig.Endpoint != "" { - cln, err := jr.config.HTTPServerConfig.ToListener(ctx) + if jr.config.ThriftHTTP != nil { + cln, err := jr.config.ThriftHTTP.ToListener(ctx) if err != nil { return fmt.Errorf("failed to bind to Collector address %q: %w", - jr.config.HTTPServerConfig.Endpoint, err) + jr.config.ThriftHTTP.Endpoint, err) } nr := mux.NewRouter() nr.HandleFunc("/api/traces", jr.HandleThriftHTTPBatch).Methods(http.MethodPost) - jr.collectorServer, err = jr.config.HTTPServerConfig.ToServer(ctx, host, jr.settings.TelemetrySettings, nr) + jr.collectorServer, err = jr.config.ThriftHTTP.ToServer(ctx, host, jr.settings.TelemetrySettings, nr) if err != nil { return err } @@ -397,16 +348,16 @@ func (jr *jReceiver) startCollector(ctx context.Context, host component.Host) er }() } - if jr.config.GRPCServerConfig.NetAddr.Endpoint != "" { + if jr.config.GRPC != nil { var err error - jr.grpc, err = jr.config.GRPCServerConfig.ToServer(ctx, host, jr.settings.TelemetrySettings) + jr.grpc, err = jr.config.GRPC.ToServer(ctx, host, jr.settings.TelemetrySettings) if err != nil { return fmt.Errorf("failed to build the options for the Jaeger gRPC Collector: %w", err) } - ln, err := jr.config.GRPCServerConfig.NetAddr.Listen(ctx) + ln, err := jr.config.GRPC.NetAddr.Listen(ctx) if err != nil { - return fmt.Errorf("failed to bind to gRPC address %q: %w", jr.config.GRPCServerConfig.NetAddr, err) + return fmt.Errorf("failed to bind to gRPC address %q: %w", jr.config.GRPC.NetAddr, err) } api_v2.RegisterCollectorServiceServer(jr.grpc, jr) diff --git a/receiver/jaegerreceiver/trace_receiver_test.go b/receiver/jaegerreceiver/trace_receiver_test.go index 31062bf57791..5377850bdc12 100644 --- a/receiver/jaegerreceiver/trace_receiver_test.go +++ b/receiver/jaegerreceiver/trace_receiver_test.go @@ -45,7 +45,7 @@ var jaegerReceiver = component.MustNewIDWithName("jaeger", "receiver_test") func TestTraceSource(t *testing.T) { set := receivertest.NewNopSettings() - jr, err := newJaegerReceiver(jaegerReceiver, &configuration{}, nil, set) + jr, err := newJaegerReceiver(jaegerReceiver, Protocols{}, nil, set) require.NoError(t, err) require.NotNil(t, jr) } @@ -77,8 +77,8 @@ func TestThriftHTTPBodyDecode(t *testing.T) { func TestReception(t *testing.T) { addr := testutil.GetAvailableLocalAddress(t) // 1. Create the Jaeger receiver aka "server" - config := &configuration{ - HTTPServerConfig: confighttp.ServerConfig{ + config := Protocols{ + ThriftHTTP: &confighttp.ServerConfig{ Endpoint: addr, }, } @@ -110,7 +110,7 @@ func TestReception(t *testing.T) { func TestPortsNotOpen(t *testing.T) { // an empty config should result in no open ports - config := &configuration{} + config := Protocols{} sink := new(consumertest.TracesSink) @@ -139,8 +139,8 @@ func TestPortsNotOpen(t *testing.T) { func TestGRPCReception(t *testing.T) { // prepare - config := &configuration{ - GRPCServerConfig: configgrpc.ServerConfig{ + config := Protocols{ + GRPC: &configgrpc.ServerConfig{ NetAddr: confignet.AddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), Transport: confignet.TransportTypeTCP, @@ -156,7 +156,7 @@ func TestGRPCReception(t *testing.T) { require.NoError(t, jr.Start(context.Background(), componenttest.NewNopHost())) t.Cleanup(func() { require.NoError(t, jr.Shutdown(context.Background())) }) - conn, err := grpc.NewClient(config.GRPCServerConfig.NetAddr.Endpoint, grpc.WithTransportCredentials(insecure.NewCredentials())) + conn, err := grpc.NewClient(config.GRPC.NetAddr.Endpoint, grpc.WithTransportCredentials(insecure.NewCredentials())) require.NoError(t, err) defer conn.Close() @@ -194,7 +194,7 @@ func TestGRPCReceptionWithTLS(t *testing.T) { }, } - grpcServerSettings := configgrpc.ServerConfig{ + grpcServerSettings := &configgrpc.ServerConfig{ NetAddr: confignet.AddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), Transport: confignet.TransportTypeTCP, @@ -202,8 +202,8 @@ func TestGRPCReceptionWithTLS(t *testing.T) { TLSSetting: tlsCreds, } - config := &configuration{ - GRPCServerConfig: grpcServerSettings, + config := Protocols{ + GRPC: grpcServerSettings, } sink := new(consumertest.TracesSink) @@ -335,8 +335,8 @@ func grpcFixture(t *testing.T, t1 time.Time, d1, d2 time.Duration) *api_v2.PostS } func TestSampling(t *testing.T) { - config := &configuration{ - GRPCServerConfig: configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{ + config := Protocols{ + GRPC: &configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{ Endpoint: testutil.GetAvailableLocalAddress(t), Transport: confignet.TransportTypeTCP, }}, @@ -350,7 +350,7 @@ func TestSampling(t *testing.T) { require.NoError(t, jr.Start(context.Background(), componenttest.NewNopHost())) t.Cleanup(func() { require.NoError(t, jr.Shutdown(context.Background())) }) - conn, err := grpc.NewClient(config.GRPCServerConfig.NetAddr.Endpoint, grpc.WithTransportCredentials(insecure.NewCredentials())) + conn, err := grpc.NewClient(config.GRPC.NetAddr.Endpoint, grpc.WithTransportCredentials(insecure.NewCredentials())) assert.NoError(t, err) defer conn.Close() From 3ca608c5add3cb4deae4504a91097a319b09ce1a Mon Sep 17 00:00:00 2001 From: Romain Dauby Date: Thu, 9 Jan 2025 16:09:10 -0500 Subject: [PATCH 6/8] [pkg/ottl] Add Nanosecond converter (#37083) Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com> --- .chloggen/add-nanosecond-converter.yaml | 27 +++++++++++ pkg/ottl/ottlfuncs/README.md | 15 ++++++ pkg/ottl/ottlfuncs/func_nanosecond.go | 39 ++++++++++++++++ pkg/ottl/ottlfuncs/func_nanosecond_test.go | 54 ++++++++++++++++++++++ pkg/ottl/ottlfuncs/functions.go | 1 + 5 files changed, 136 insertions(+) create mode 100644 .chloggen/add-nanosecond-converter.yaml create mode 100644 pkg/ottl/ottlfuncs/func_nanosecond.go create mode 100644 pkg/ottl/ottlfuncs/func_nanosecond_test.go diff --git a/.chloggen/add-nanosecond-converter.yaml b/.chloggen/add-nanosecond-converter.yaml new file mode 100644 index 000000000000..03925caa8667 --- /dev/null +++ b/.chloggen/add-nanosecond-converter.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: pkg/ottl + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add the `Nanosecond` converter to return the nanosecond component from the specified time.Time + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [37042] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] \ No newline at end of file diff --git a/pkg/ottl/ottlfuncs/README.md b/pkg/ottl/ottlfuncs/README.md index c1bfaf4e1bae..ac86e36fc297 100644 --- a/pkg/ottl/ottlfuncs/README.md +++ b/pkg/ottl/ottlfuncs/README.md @@ -444,6 +444,7 @@ Available Converters: - [Minute](#minute) - [Minutes](#minutes) - [Month](#month) +- [Nanosecond](#nanosecond) - [Nanoseconds](#nanoseconds) - [Now](#now) - [ParseCSV](#parsecsv) @@ -1238,6 +1239,20 @@ Examples: - `Month(Now())` +### Nanosecond + +`Nanosecond(value)` + +The `Nanosecond` Converter returns the nanosecond component from the specified time using the Go stdlib [`time.Nanosecond` function](https://pkg.go.dev/time#Time.Nanosecond). + +`value` is a `time.Time`. If `value` is another type, an error is returned. + +The returned type is `int64`. + +Examples: + +- `Nanosecond(Now())` + ### Nanoseconds `Nanoseconds(value)` diff --git a/pkg/ottl/ottlfuncs/func_nanosecond.go b/pkg/ottl/ottlfuncs/func_nanosecond.go new file mode 100644 index 000000000000..f35a72e2cfdd --- /dev/null +++ b/pkg/ottl/ottlfuncs/func_nanosecond.go @@ -0,0 +1,39 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package ottlfuncs // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/ottlfuncs" + +import ( + "context" + "fmt" + + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl" +) + +type NanosecondArguments[K any] struct { + Time ottl.TimeGetter[K] +} + +func NewNanosecondFactory[K any]() ottl.Factory[K] { + return ottl.NewFactory("Nanosecond", &NanosecondArguments[K]{}, createNanosecondFunction[K]) +} + +func createNanosecondFunction[K any](_ ottl.FunctionContext, oArgs ottl.Arguments) (ottl.ExprFunc[K], error) { + args, ok := oArgs.(*NanosecondArguments[K]) + + if !ok { + return nil, fmt.Errorf("NanosecondFactory args must be of type *NanosecondArguments[K]") + } + + return Nanosecond(args.Time) +} + +func Nanosecond[K any](time ottl.TimeGetter[K]) (ottl.ExprFunc[K], error) { + return func(ctx context.Context, tCtx K) (any, error) { + t, err := time.Get(ctx, tCtx) + if err != nil { + return nil, err + } + return int64(t.Nanosecond()), nil + }, nil +} diff --git a/pkg/ottl/ottlfuncs/func_nanosecond_test.go b/pkg/ottl/ottlfuncs/func_nanosecond_test.go new file mode 100644 index 000000000000..6383ce89d544 --- /dev/null +++ b/pkg/ottl/ottlfuncs/func_nanosecond_test.go @@ -0,0 +1,54 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package ottlfuncs + +import ( + "context" + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl" +) + +func Test_Nanosecond(t *testing.T) { + tests := []struct { + name string + time ottl.TimeGetter[any] + expected int64 + }{ + { + name: "some time", + time: &ottl.StandardTimeGetter[any]{ + Getter: func(_ context.Context, _ any) (any, error) { + return time.Date(2006, time.January, 2, 15, 4, 5, 197382465, time.UTC), nil + }, + }, + expected: 197382465, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + exprFunc, err := Nanosecond(tt.time) + assert.NoError(t, err) + result, err := exprFunc(nil, nil) + assert.NoError(t, err) + assert.Equal(t, tt.expected, result) + }) + } +} + +func Test_Nanosecond_Error(t *testing.T) { + var getter ottl.TimeGetter[any] = &ottl.StandardTimeGetter[any]{ + Getter: func(_ context.Context, _ any) (any, error) { + return "not a time", nil + }, + } + exprFunc, err := Nanosecond(getter) + assert.NoError(t, err) + result, err := exprFunc(context.Background(), nil) + assert.Nil(t, result) + assert.Error(t, err) +} diff --git a/pkg/ottl/ottlfuncs/functions.go b/pkg/ottl/ottlfuncs/functions.go index f6983cb4b3ba..d00bc578e04b 100644 --- a/pkg/ottl/ottlfuncs/functions.go +++ b/pkg/ottl/ottlfuncs/functions.go @@ -68,6 +68,7 @@ func converters[K any]() []ottl.Factory[K] { NewMinuteFactory[K](), NewMinutesFactory[K](), NewMonthFactory[K](), + NewNanosecondFactory[K](), NewNanosecondsFactory[K](), NewNowFactory[K](), NewParseCSVFactory[K](), From 5f913dbc68ad86bbf3e4614a8537549a1d36cb18 Mon Sep 17 00:00:00 2001 From: Narcis Gemene <7252787+narcis96@users.noreply.github.com> Date: Thu, 9 Jan 2025 23:11:30 +0200 Subject: [PATCH 7/8] [receiver/huaweicloudces] move huaweicloudces receiver to alpha (#36782) Description: Move the huaweicloudces to alpha, as it is feature complete. Add the receiver to the cmd/otelcontribcol binary. Link to tracking issue https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/34953 --- .chloggen/cesreceiver_alpha.yaml | 27 +++++++++++++++++++ cmd/otelcontribcol/builder-config.yaml | 1 + receiver/huaweicloudcesreceiver/README.md | 4 +-- .../internal/metadata/generated_status.go | 2 +- receiver/huaweicloudcesreceiver/metadata.yaml | 2 +- 5 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 .chloggen/cesreceiver_alpha.yaml diff --git a/.chloggen/cesreceiver_alpha.yaml b/.chloggen/cesreceiver_alpha.yaml new file mode 100644 index 000000000000..0258ecd232f2 --- /dev/null +++ b/.chloggen/cesreceiver_alpha.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: huaweicloudces + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Move huaweicloudces receiver to alpha + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34953] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] \ No newline at end of file diff --git a/cmd/otelcontribcol/builder-config.yaml b/cmd/otelcontribcol/builder-config.yaml index eab215d138bc..bff9f514f030 100644 --- a/cmd/otelcontribcol/builder-config.yaml +++ b/cmd/otelcontribcol/builder-config.yaml @@ -164,6 +164,7 @@ receivers: - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/haproxyreceiver v0.117.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver v0.117.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/httpcheckreceiver v0.117.0 + - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/huaweicloudcesreceiver v0.117.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/influxdbreceiver v0.117.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/iisreceiver v0.117.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.117.0 diff --git a/receiver/huaweicloudcesreceiver/README.md b/receiver/huaweicloudcesreceiver/README.md index 9761bb06ba00..28e006ebe991 100644 --- a/receiver/huaweicloudcesreceiver/README.md +++ b/receiver/huaweicloudcesreceiver/README.md @@ -3,12 +3,12 @@ | Status | | | ------------- |-----------| -| Stability | [development]: metrics | +| Stability | [alpha]: metrics | | Distributions | [] | | Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Fhuaweicloudces%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Fhuaweicloudces) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Fhuaweicloudces%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Fhuaweicloudces) | | [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@heitorganzeli](https://www.github.com/heitorganzeli), [@narcis96](https://www.github.com/narcis96), [@mwear](https://www.github.com/mwear) | -[development]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#development +[alpha]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#alpha This receiver contains the implementation of the Huawei Cloud [Cloud Eye Service](https://www.huaweicloud.com/intl/en-us/product/ces.html) (CES) receiver for the OpenTelemetry Collector. The receiver collects metrics from Huawei Cloud's CES service and sends them to the OpenTelemetry Collector for processing and exporting. diff --git a/receiver/huaweicloudcesreceiver/internal/metadata/generated_status.go b/receiver/huaweicloudcesreceiver/internal/metadata/generated_status.go index b91aef665ff8..1c87234f5043 100644 --- a/receiver/huaweicloudcesreceiver/internal/metadata/generated_status.go +++ b/receiver/huaweicloudcesreceiver/internal/metadata/generated_status.go @@ -12,5 +12,5 @@ var ( ) const ( - MetricsStability = component.StabilityLevelDevelopment + MetricsStability = component.StabilityLevelAlpha ) diff --git a/receiver/huaweicloudcesreceiver/metadata.yaml b/receiver/huaweicloudcesreceiver/metadata.yaml index 31b50e271989..8abc5d5c84df 100644 --- a/receiver/huaweicloudcesreceiver/metadata.yaml +++ b/receiver/huaweicloudcesreceiver/metadata.yaml @@ -3,7 +3,7 @@ type: huaweicloudcesreceiver status: class: receiver stability: - development: [metrics] + alpha: [metrics] distributions: [] codeowners: active: [heitorganzeli, narcis96, mwear] From 765ddb72acd2ec5ff9dbe2dc1b88a0b92e196f27 Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Thu, 9 Jan 2025 13:12:34 -0800 Subject: [PATCH 8/8] [cmd/telemetrygen] remove go-grpc-middleware dep (#37103) This PR removes a dependency that needed to be updated anyways. This uses the same method we use in core for setting the grpc logger using grpclog directly. --------- Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com> --- ...grpc-ecosystem-go-grpc-middleware-2.x.yaml | 27 +++++++ cmd/telemetrygen/go.mod | 2 - cmd/telemetrygen/go.sum | 74 ------------------- cmd/telemetrygen/internal/common/log.go | 12 ++- cmd/telemetrygen/internal/e2etest/go.mod | 2 - cmd/telemetrygen/internal/e2etest/go.sum | 74 ------------------- 6 files changed, 35 insertions(+), 156 deletions(-) create mode 100644 .chloggen/renovate_github.com-grpc-ecosystem-go-grpc-middleware-2.x.yaml diff --git a/.chloggen/renovate_github.com-grpc-ecosystem-go-grpc-middleware-2.x.yaml b/.chloggen/renovate_github.com-grpc-ecosystem-go-grpc-middleware-2.x.yaml new file mode 100644 index 000000000000..603900c6e5c6 --- /dev/null +++ b/.chloggen/renovate_github.com-grpc-ecosystem-go-grpc-middleware-2.x.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: telemetrygen + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Remove go-grpc-middleware dependency + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [37103] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/cmd/telemetrygen/go.mod b/cmd/telemetrygen/go.mod index 10b486113c41..e16b7fb5f072 100644 --- a/cmd/telemetrygen/go.mod +++ b/cmd/telemetrygen/go.mod @@ -3,7 +3,6 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/cmd/telemetryge go 1.22.7 require ( - github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.10.0 @@ -36,7 +35,6 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.4 // indirect github.com/google/uuid v1.6.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect diff --git a/cmd/telemetrygen/go.sum b/cmd/telemetrygen/go.sum index 8942218e092d..ea718c318965 100644 --- a/cmd/telemetrygen/go.sum +++ b/cmd/telemetrygen/go.sum @@ -1,44 +1,23 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= -github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 h1:VNqngBF40hVlDloBruUehVYC3ArSgIyScOAyMRqBxRg= github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1/go.mod h1:RBRO7fro65R6tjKzYgLAFo0t1QEXY1Dp+i/bvpRiqiQ= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= @@ -47,12 +26,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -60,25 +35,17 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -121,48 +88,29 @@ go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQD go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4= go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -172,11 +120,6 @@ golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -184,33 +127,16 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto/googleapis/api v0.0.0-20250102185135-69823020774d h1:H8tOf8XM88HvKqLTxe755haY6r1fqqzLbEnfrmLXlSA= google.golang.org/genproto/googleapis/api v0.0.0-20250102185135-69823020774d/go.mod h1:2v7Z7gP2ZUOGsaFyxATQSRoBnKygqVq2Cwnvom7QiqY= google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d h1:xJJRGY7TJcvIlpSrN3K6LAWgNFUILlO+OMAqtg9aqnw= google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d/go.mod h1:3ENsm/5D1mzDyhpzeRi1NR784I0BcofWBoSc5QqqMK4= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.69.2 h1:U3S9QEtbXC0bYNvRtcoklF3xGtLViumSYxWykJS+7AU= google.golang.org/grpc v1.69.2/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= google.golang.org/protobuf v1.36.2 h1:R8FeyR1/eLmkutZOM5CWghmo5itiG9z0ktFlTVLuTmU= google.golang.org/protobuf v1.36.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/cmd/telemetrygen/internal/common/log.go b/cmd/telemetrygen/internal/common/log.go index a2fcd6e8c5b6..78eb20d2c817 100644 --- a/cmd/telemetrygen/internal/common/log.go +++ b/cmd/telemetrygen/internal/common/log.go @@ -6,8 +6,10 @@ package common import ( "fmt" - grpcZap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap" "go.uber.org/zap" + "go.uber.org/zap/zapcore" + "go.uber.org/zap/zapgrpc" + "google.golang.org/grpc/grpclog" ) // CreateLogger creates a logger for use by telemetrygen @@ -16,10 +18,12 @@ func CreateLogger(skipSettingGRPCLogger bool) (*zap.Logger, error) { if err != nil { return nil, fmt.Errorf("failed to obtain logger: %w", err) } + if !skipSettingGRPCLogger { - grpcZap.ReplaceGrpcLoggerV2WithVerbosity(logger.WithOptions( - zap.AddCallerSkip(3), - ), 1) // set to warn verbosity to avoid copious logging from grpc framework + grpcLogger := zapgrpc.NewLogger(logger.WithOptions(zap.WrapCore(func(core zapcore.Core) zapcore.Core { + return core.With([]zapcore.Field{zap.Bool("grpc_log", true)}) + }), zap.AddCallerSkip(3))) + grpclog.SetLoggerV2(grpcLogger) } return logger, err } diff --git a/cmd/telemetrygen/internal/e2etest/go.mod b/cmd/telemetrygen/internal/e2etest/go.mod index 725f55a22526..c1b67290ef48 100644 --- a/cmd/telemetrygen/internal/e2etest/go.mod +++ b/cmd/telemetrygen/internal/e2etest/go.mod @@ -21,10 +21,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/go-viper/mapstructure/v2 v2.2.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 // indirect github.com/hashicorp/go-version v1.7.0 // indirect github.com/json-iterator/go v1.1.12 // indirect diff --git a/cmd/telemetrygen/internal/e2etest/go.sum b/cmd/telemetrygen/internal/e2etest/go.sum index d9b99363c0b6..349375e3f115 100644 --- a/cmd/telemetrygen/internal/e2etest/go.sum +++ b/cmd/telemetrygen/internal/e2etest/go.sum @@ -1,51 +1,30 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= -github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 h1:VNqngBF40hVlDloBruUehVYC3ArSgIyScOAyMRqBxRg= github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1/go.mod h1:RBRO7fro65R6tjKzYgLAFo0t1QEXY1Dp+i/bvpRiqiQ= github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= @@ -62,12 +41,8 @@ github.com/knadh/koanf/providers/confmap v0.1.0 h1:gOkxhHkemwG4LezxxN8DMOFopOPgh github.com/knadh/koanf/providers/confmap v0.1.0/go.mod h1:2uLhxQzJnyHKfxG927awZC7+fyHFdQkd697K4MdLnIU= github.com/knadh/koanf/v2 v2.1.2 h1:I2rtLRqXRy1p01m/utEtpZSSA6dcJbgGVuE27kW2PzQ= github.com/knadh/koanf/v2 v2.1.2/go.mod h1:Gphfaen0q1Fc1HTgJgSTC4oRX9R2R5ErYMZJy8fLJBo= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= @@ -81,26 +56,18 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mostynb/go-grpc-compression v1.2.3 h1:42/BKWMy0KEJGSdWvzqIyOZ95YcR9mLPqKctH7Uo//I= github.com/mostynb/go-grpc-compression v1.2.3/go.mod h1:AghIxF3P57umzqM9yz795+y1Vjs47Km/Y2FE6ouQ7Lg= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU= github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -189,48 +156,29 @@ go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQD go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4= go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -240,11 +188,6 @@ golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -252,33 +195,16 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto/googleapis/api v0.0.0-20250102185135-69823020774d h1:H8tOf8XM88HvKqLTxe755haY6r1fqqzLbEnfrmLXlSA= google.golang.org/genproto/googleapis/api v0.0.0-20250102185135-69823020774d/go.mod h1:2v7Z7gP2ZUOGsaFyxATQSRoBnKygqVq2Cwnvom7QiqY= google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d h1:xJJRGY7TJcvIlpSrN3K6LAWgNFUILlO+OMAqtg9aqnw= google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d/go.mod h1:3ENsm/5D1mzDyhpzeRi1NR784I0BcofWBoSc5QqqMK4= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.69.2 h1:U3S9QEtbXC0bYNvRtcoklF3xGtLViumSYxWykJS+7AU= google.golang.org/grpc v1.69.2/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= google.golang.org/protobuf v1.36.2 h1:R8FeyR1/eLmkutZOM5CWghmo5itiG9z0ktFlTVLuTmU= google.golang.org/protobuf v1.36.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=