diff --git a/.circleci/config.yml b/.circleci/config.yml index 5960e3f557a6b..d733dab5e32df 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,7 @@ experimental: templates: job_template: &job_template docker: - - image: gcr.io/datadoghq/agent-circleci-runner:v45979046-89a73a40 + - image: gcr.io/datadoghq/agent-circleci-runner:v46542806-c7a4a6be environment: USE_SYSTEM_LIBS: "1" working_directory: /go/src/github.com/DataDog/datadog-agent @@ -100,7 +100,7 @@ jobs: - run: name: run unit tests no_output_timeout: 20m - command: inv -e test --rerun-fails=2 --python-runtimes 3 --coverage --race --profile --cpus 8 --build-stdlib --test-washer + command: inv -e test --rerun-fails=2 --coverage --race --profile --cpus 8 --build-stdlib --test-washer environment: GO_TEST_SKIP_FLAKE: "true" diff --git a/.copyright-overrides.yml b/.copyright-overrides.yml index 9fbeffdec2351..8051687b44906 100644 --- a/.copyright-overrides.yml +++ b/.copyright-overrides.yml @@ -373,3 +373,5 @@ github.com/vibrantbyte/go-antpath/extend: vibrantbyte |suchao github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp: Copyright 2024 gRPC authors. github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp/grpc_gcp: Copyright 2024 gRPC authors. github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp/multiendpoint: Copyright 2024 gRPC authors. + +github.com/NVIDIA/go-nvml/*: Copyright 2023 NVIDIA CORPORATION diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5621ceeb722f2..9f3de6186a47d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -131,15 +131,15 @@ /.gitlab/deps_build/ @DataDog/ebpf-platform @DataDog/agent-delivery @DataDog/windows-agent /.gitlab/windows_python_build.yml @DataDog/windows-agent -/.gitlab/kitchen_* @DataDog/agent-delivery -/.gitlab/kitchen_testing/windows.yml @DataDog/agent-delivery @DataDog/windows-agent -/.gitlab/e2e_install_packages/windows.yml @DataDog/agent-delivery @DataDog/windows-agent +/.gitlab/kitchen_* @DataDog/container-ecosystems @DataDog/agent-delivery +/.gitlab/kitchen_testing/windows.yml @DataDog/container-ecosystems @DataDog/agent-delivery @DataDog/windows-agent +/.gitlab/e2e_install_packages/windows.yml @DataDog/container-ecosystems @DataDog/agent-delivery @DataDog/windows-agent /.gitlab/common/ @DataDog/agent-devx-infra /.gitlab/common/test_infra_version.yml @DataDog/agent-devx-loops @DataDog/agent-devx-infra /.gitlab/e2e/e2e.yml @DataDog/container-integrations @DataDog/agent-devx-loops -/.gitlab/e2e/install_packages @DataDog/agent-delivery +/.gitlab/e2e/install_packages @DataDog/container-ecosystems @DataDog/agent-delivery /.gitlab/container_build/fakeintake.yml @DataDog/agent-e2e-testing @DataDog/agent-devx-loops /.gitlab/binary_build/fakeintake.yml @DataDog/agent-e2e-testing @DataDog/agent-devx-loops @@ -221,7 +221,7 @@ /cmd/agent/dist/conf.d/sbom.d/ @DataDog/container-integrations /cmd/agent/dist/conf.d/snmp.d/ @DataDog/network-device-monitoring /cmd/agent/dist/conf.d/win32_event_log.d/ @DataDog/windows-agent -/cmd/agent/install*.sh @DataDog/agent-delivery +/cmd/agent/install*.sh @DataDog/container-ecosystems @DataDog/agent-delivery /cmd/cluster-agent/ @DataDog/container-platform /cmd/cluster-agent/commands/ @DataDog/container-platform /cmd/cluster-agent-cloudfoundry/ @DataDog/platform-integrations @@ -244,7 +244,7 @@ /cmd/system-probe/modules/tcp_queue_tracer* @DataDog/container-integrations /cmd/system-probe/modules/traceroute* @DataDog/network-device-monitoring @Datadog/Networks /cmd/system-probe/modules/ping* @DataDog/network-device-monitoring -/cmd/system-probe/modules/service_discover* @DataDog/apm-onboarding @DataDog/universal-service-monitoring +/cmd/system-probe/modules/service_discover* @DataDog/universal-service-monitoring /cmd/system-probe/modules/language_detection* @DataDog/processes @DataDog/universal-service-monitoring /cmd/system-probe/runtime/ @DataDog/agent-security /cmd/system-probe/modules/dynamic_instrumentation* @DataDog/debugger @@ -270,6 +270,7 @@ /docs/cloud-workload-security/ @DataDog/documentation @DataDog/agent-security /docs/public/components/ @DataDog/documentation @DataDog/agent-shared-components +/docs/public/hostname/ @DataDog/documentation @DataDog/agent-shared-components /docs/public/architecture/dogstatsd/ @DataDog/documentation @DataDog/agent-metrics-logs /docs/public/guidelines/deprecated-components-documentation/ @DataDog/documentation @DataDog/agent-shared-components @@ -334,6 +335,7 @@ /comp/languagedetection/client @DataDog/container-platform /comp/rdnsquerier @DataDog/network-device-monitoring /comp/serializer/compression @DataDog/agent-metrics-logs +/comp/snmpscan @DataDog/network-device-monitoring # END COMPONENTS # pkg @@ -345,7 +347,7 @@ /pkg/cli/ @DataDog/agent-shared-components /pkg/cli/subcommands/clusterchecks @DataDog/container-platform /pkg/dogstatsd/ @DataDog/agent-metrics-logs -/pkg/discovery/ @DataDog/apm-onboarding @DataDog/universal-service-monitoring +/pkg/discovery/ @DataDog/universal-service-monitoring /pkg/errors/ @DataDog/agent-shared-components /pkg/forwarder/ @DataDog/agent-processing-and-routing /pkg/gohai @DataDog/agent-shared-components @@ -370,6 +372,7 @@ /pkg/trace/traceutil/otel*.go @DataDog/opentelemetry /pkg/trace/stats/ @DataDog/agent-apm @DataDog/opentelemetry /pkg/trace/telemetry/ @DataDog/apm-trace-storage +/pkg/trace/transform/ @DataDog/opentelemetry /comp/core/autodiscovery/listeners/ @DataDog/container-platform /comp/core/autodiscovery/listeners/cloudfoundry*.go @DataDog/platform-integrations /comp/core/autodiscovery/listeners/snmp*.go @DataDog/network-device-monitoring @@ -405,7 +408,7 @@ /pkg/collector/corechecks/net/ @DataDog/platform-integrations /pkg/collector/corechecks/oracle @DataDog/database-monitoring /pkg/collector/corechecks/sbom/ @DataDog/container-integrations -/pkg/collector/corechecks/servicediscovery/ @DataDog/apm-onboarding @DataDog/universal-service-monitoring +/pkg/collector/corechecks/servicediscovery/ @DataDog/universal-service-monitoring /pkg/collector/corechecks/snmp/ @DataDog/network-device-monitoring /pkg/collector/corechecks/system/ @DataDog/platform-integrations /pkg/collector/corechecks/system/**/*_windows*.go @DataDog/platform-integrations @DataDog/windows-agent @@ -569,7 +572,6 @@ /comp/core/workloadmeta/collectors/internal/cloudfoundry @DataDog/platform-integrations /pkg/sbom/ @DataDog/container-integrations @DataDog/agent-security /pkg/internaltelemetry @DataDog/windows-kernel-integrations @DataDog/fleet -/pkg-config/ @DataDog/agent-delivery /pkg/networkpath/ @DataDog/network-device-monitoring @DataDog/Networks /pkg/collector/corechecks/networkpath/ @DataDog/network-device-monitoring @DataDog/Networks @@ -614,11 +616,12 @@ /test/benchmarks/ @DataDog/agent-metrics-logs /test/benchmarks/kubernetes_state/ @DataDog/container-integrations /test/integration/ @DataDog/container-integrations +/test/integration/docker/otel_agent_build_tests.py @DataDog/opentelemetry /test/integration/serverless @DataDog/serverless @Datadog/serverless-aws /test/integration/serverless_perf @DataDog/serverless @Datadog/serverless-aws /test/kitchen/ @DataDog/agent-devx-loops -/test/kitchen/test-definitions/ @DataDog/agent-delivery -/test/kitchen/test/integration/ @DataDog/agent-delivery +/test/kitchen/test-definitions/ @DataDog/container-ecosystems @DataDog/agent-delivery +/test/kitchen/test/integration/ @DataDog/container-ecosystems @DataDog/agent-delivery /test/kitchen/kitchen-azure-security-agent-test.yml @DataDog/agent-security /test/kitchen/kitchen-vagrant-security-agent.yml @DataDog/agent-security /test/kitchen/site-cookbooks/dd-security-agent-check/ @DataDog/agent-security @@ -637,18 +640,17 @@ /test/fakeintake/ @DataDog/agent-e2e-testing @DataDog/agent-devx-loops /test/fakeintake/aggregator/ndmflowAggregator.go @DataDog/network-device-monitoring /test/fakeintake/aggregator/ndmflowAggregator_test.go @DataDog/network-device-monitoring -/test/fakeintake/aggregator/servicediscoveryAggregator.go @DataDog/apm-onboarding @DataDog/universal-service-monitoring -/test/fakeintake/aggregator/servicediscoveryAggregator_test.go @DataDog/apm-onboarding @DataDog/universal-service-monitoring +/test/fakeintake/aggregator/servicediscovery* @DataDog/universal-service-monitoring /test/new-e2e/ @DataDog/agent-e2e-testing @DataDog/agent-devx-loops /test/new-e2e/pkg/components/datadog-installer @DataDog/windows-agent /test/new-e2e/test-infra-definition @DataDog/agent-devx-loops /test/new-e2e/system-probe @DataDog/ebpf-platform /test/new-e2e/scenarios/system-probe @DataDog/ebpf-platform -/test/new-e2e/tests/agent-platform @DataDog/agent-delivery @DataDog/agent-devx-loops +/test/new-e2e/tests/agent-platform @DataDog/container-ecosystems @DataDog/agent-delivery @DataDog/agent-devx-loops /test/new-e2e/tests/agent-shared-components @DataDog/agent-shared-components /test/new-e2e/tests/agent-subcommands @DataDog/agent-shared-components /test/new-e2e/tests/containers @DataDog/container-integrations @DataDog/container-platform -/test/new-e2e/tests/discovery @DataDog/apm-onboarding @DataDog/universal-service-monitoring +/test/new-e2e/tests/discovery @DataDog/universal-service-monitoring /test/new-e2e/tests/language-detection @DataDog/processes /test/new-e2e/tests/ndm @DataDog/network-device-monitoring /test/new-e2e/tests/npm @DataDog/Networks @@ -665,6 +667,7 @@ /test/new-e2e/tests/remote-config @DataDog/remote-config /test/new-e2e/tests/updater @DataDog/fleet @DataDog/windows-agent /test/new-e2e/tests/installer @DataDog/fleet @DataDog/windows-agent +/test/new-e2e/tests/gpu @Datadog/ebpf-platform /test/otel/ @DataDog/opentelemetry /test/system/ @DataDog/agent-shared-components /test/system/dogstatsd/ @DataDog/agent-metrics-logs diff --git a/.github/workflows/serverless-binary-size.yml b/.github/workflows/serverless-binary-size.yml index 9240bb666b3f9..4440e2127e3c6 100644 --- a/.github/workflows/serverless-binary-size.yml +++ b/.github/workflows/serverless-binary-size.yml @@ -159,6 +159,5 @@ jobs: if: steps.should.outputs.should_run == 'true' with: header: serverless-binary-size - hide_and_recreate: true - hide_classify: "RESOLVED" + recreate: true path: ${{ steps.write.outputs.filename }} diff --git a/.github/workflows/serverless-integration.yml b/.github/workflows/serverless-integration.yml index c2866e77f69b4..252fc83f78e48 100644 --- a/.github/workflows/serverless-integration.yml +++ b/.github/workflows/serverless-integration.yml @@ -30,7 +30,7 @@ jobs: path: go/src/github.com/DataDog/datadog-agent - name: Set up Node 20 - uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 with: node-version: 20 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2ac6c19deb885..c9cd34dcf8af0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,7 +30,6 @@ include: - .gitlab/integration_test/include.yml - .gitlab/internal_image_deploy/internal_image_deploy.yml - .gitlab/internal_kubernetes_deploy/include.yml - - .gitlab/junit_upload/junit_upload.yml - .gitlab/kitchen_cleanup/include.yml - .gitlab/kitchen_deploy/kitchen_deploy.yml - .gitlab/kitchen_testing/include.yml @@ -96,7 +95,9 @@ stages: - internal_image_deploy - install_script_testing - e2e_pre_test + - e2e_init - e2e + - e2e_cleanup - e2e_k8s - e2e_install_packages - kitchen_cleanup @@ -171,15 +172,15 @@ variables: # To use images from datadog-agent-buildimages dev branches, set the corresponding # SUFFIX variable to _test_only DATADOG_AGENT_BUILDIMAGES_SUFFIX: "" - DATADOG_AGENT_BUILDIMAGES: v45979046-89a73a40 + DATADOG_AGENT_BUILDIMAGES: v46542806-c7a4a6be DATADOG_AGENT_WINBUILDIMAGES_SUFFIX: "" - DATADOG_AGENT_WINBUILDIMAGES: v45979046-89a73a40 + DATADOG_AGENT_WINBUILDIMAGES: v46542806-c7a4a6be DATADOG_AGENT_ARMBUILDIMAGES_SUFFIX: "" - DATADOG_AGENT_ARMBUILDIMAGES: v45979046-89a73a40 + DATADOG_AGENT_ARMBUILDIMAGES: v46542806-c7a4a6be DATADOG_AGENT_SYSPROBE_BUILDIMAGES_SUFFIX: "" - DATADOG_AGENT_SYSPROBE_BUILDIMAGES: v45979046-89a73a40 + DATADOG_AGENT_SYSPROBE_BUILDIMAGES: v46542806-c7a4a6be DATADOG_AGENT_BTF_GEN_BUILDIMAGES_SUFFIX: "" - DATADOG_AGENT_BTF_GEN_BUILDIMAGES: v45979046-89a73a40 + DATADOG_AGENT_BTF_GEN_BUILDIMAGES: v46542806-c7a4a6be DATADOG_AGENT_EMBEDDED_PATH: /opt/datadog-agent/embedded DEB_GPG_KEY_ID: c0962c7d @@ -218,6 +219,7 @@ variables: E2E_TESTS_AZURE_TENANT_ID: ci.datadog-agent.e2e_tests_azure_tenant_id # agent-devx-loops E2E_TESTS_AZURE_SUBSCRIPTION_ID: ci.datadog-agent.e2e_tests_azure_subscription_id # agent-devx-loops E2E_TESTS_GCP_CREDENTIALS: ci.datadog-agent.e2e_tests_gcp_credentials # agent-devx-loops + E2E_PULUMI_CONFIG_PASSPHRASE: ci.datadog-agent.pulumi_password # agent-devx-loops KITCHEN_EC2_SSH_KEY: ci.datadog-agent.aws_ec2_kitchen_ssh_key # agent-devx-loops KITCHEN_AZURE_CLIENT_ID: ci.datadog-agent.azure_kitchen_client_id # agent-devx-loops KITCHEN_AZURE_CLIENT_SECRET: ci.datadog-agent.azure_kitchen_client_secret # agent-devx-loops @@ -254,15 +256,21 @@ variables: VCPKG_BLOB_SAS_URL: ci.datadog-agent-buildimages.vcpkg_blob_sas_url # windows-agent WINGET_PAT: ci.datadog-agent.winget_pat # windows-agent # End aws ssm variables + # Start vault variables + AGENT_API_KEY_ORG2: agent-api-key-org-2 # agent-devx-infra + AGENT_APP_KEY_ORG2: agent-ci-app-key-org-2 # agent-devx-infra + AGENT_GITHUB_APP: agent-github-app # agent-devx-infra + AGENT_QA_E2E: agent-qa-e2e # agent-devx-loops + ATLASSIAN_WRITE: atlassian-write # agent-devx-infra + DOCKER_REGISTRY_RO: dockerhub-readonly # agent-delivery + GITLAB_TOKEN: gitlab-token # agent-devx-infra + INSTALL_SCRIPT_API_KEY_ORG2: install-script-api-key-org-2 # agent-devx-infra + MACOS_GITHUB_APP_1: macos-github-app-one # agent-devx-infra + MACOS_GITHUB_APP_2: macos-github-app-two # agent-devx-infra + SLACK_AGENT: slack-agent-ci # agent-devx-infra # End vault variables - ATLASSIAN_WRITE: atlassian-write - AGENT_GITHUB_APP: agent-github-app - MACOS_GITHUB_APP_1: macos-github-app-one - MACOS_GITHUB_APP_2: macos-github-app-two - DOCKER_REGISTRY_RO: dockerhub-readonly - DD_PKG_VERSION: "latest" # Job stage attempts (see https://docs.gitlab.com/ee/ci/runners/configure_runners.html#job-stages-attempts) @@ -768,19 +776,6 @@ workflow: paths: *system_probe_change_paths compare_to: main # TODO: use a variable, when this is supported https://gitlab.com/gitlab-org/gitlab/-/issues/369916 -.on_e2e_changes_or_manual: - - <<: *if_main_branch - - !reference [.except_mergequeue] - - changes: - paths: - - test/new-e2e/pkg/**/* - - test/new-e2e/test-infra-definition/* - - test/new-e2e/go.mod - compare_to: main # TODO: use a variable, when this is supported https://gitlab.com/gitlab-org/gitlab/-/issues/369916 - when: on_success - - when: manual - allow_failure: true - # New E2E related rules .on_e2e_main_release_or_rc: # This rule is used as a base for all new-e2e rules @@ -797,6 +792,7 @@ workflow: when: on_success - changes: paths: + - .gitlab/e2e/e2e.yml - test/new-e2e/pkg/**/* - test/new-e2e/go.mod - flakes.yaml @@ -892,6 +888,7 @@ workflow: - changes: paths: # TODO: Add paths that should trigger tests for npm + - pkg/network/**/* - test/new-e2e/tests/npm/**/* compare_to: main # TODO: use a variable, when this is supported https://gitlab.com/gitlab-org/gitlab/-/issues/369916 @@ -1192,3 +1189,12 @@ workflow: compare_to: main # TODO: use a variable, when this is supported https://gitlab.com/gitlab-org/gitlab/-/issues/369916 - when: manual allow_failure: true + +.on_gpu_or_e2e_changes: + - !reference [.on_e2e_main_release_or_rc] + - changes: + paths: + - pkg/gpu/**/* + - test/new-e2e/tests/gpu/**/* + - pkg/collector/corechecks/gpu/**/* + compare_to: main # TODO: use a variable, when this is supported https://gitlab.com/gitlab-org/gitlab/-/issues/369916 diff --git a/.gitlab/.ci-linters.yml b/.gitlab/.ci-linters.yml index 4848af1e13d53..b888dff051b73 100644 --- a/.gitlab/.ci-linters.yml +++ b/.gitlab/.ci-linters.yml @@ -16,6 +16,7 @@ needs-rules: - build_processed_btfhub_archive - check_already_deployed_version_7 - cleanup_kitchen_functional_test + - compute_gitlab_ci_config - deploy_containers-cws-instrumentation-final-versioned - deploy_containers-cws-instrumentation-latest - deploy_containers-cws-instrumentation-rc-mutable @@ -26,9 +27,12 @@ needs-rules: - lint_flavor_dogstatsd_linux-x64 - lint_flavor_heroku_linux-x64 - lint_flavor_iot_linux-x64 + - lint_gitlab_ci + - lint_gitlab_ci_jobs_codeowners - lint_linux-arm64 - lint_linux-x64 - lint_macos_gitlab_amd64 + - new-e2e-eks-cleanup-on-failure - periodic_kitchen_cleanup_azure - periodic_kitchen_cleanup_ec2 - periodic_kitchen_cleanup_s3 @@ -105,7 +109,6 @@ job-owners: - trace-agent-v05-2cpus-normal_load-fixed_sps - trace-agent-v05-2cpus-stress_load-fixed_sps - trigger-flakes-finder - - unit_tests_arm64_junit_upload - unit_tests_notify - update_rc_build_links - validate_modules diff --git a/.gitlab/.pre/cancel-prev-pipelines.yml b/.gitlab/.pre/cancel-prev-pipelines.yml index 48b5170248759..9a23b472e6bfa 100644 --- a/.gitlab/.pre/cancel-prev-pipelines.yml +++ b/.gitlab/.pre/cancel-prev-pipelines.yml @@ -14,5 +14,5 @@ cancel-prev-pipelines: when: never - when: on_success script: - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_SCHEDULER_TOKEN) || exit $?; export GITLAB_TOKEN + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN write_api) || exit $?; export GITLAB_TOKEN - inv pipeline.auto-cancel-previous-pipelines diff --git a/.gitlab/.pre/gitlab_configuration.yml b/.gitlab/.pre/gitlab_configuration.yml index de70688431253..3aea26e5dfb2b 100644 --- a/.gitlab/.pre/gitlab_configuration.yml +++ b/.gitlab/.pre/gitlab_configuration.yml @@ -6,7 +6,7 @@ test_gitlab_configuration: - !reference [.except_mergequeue] - !reference [.on_gitlab_changes] script: - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_FULL_API_TOKEN) || exit $?; export GITLAB_TOKEN + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN write_api) || exit $?; export GITLAB_TOKEN - inv -e linter.gitlab-ci - inv -e linter.job-change-path - inv -e linter.gitlab-change-paths @@ -20,31 +20,24 @@ test_gitlab_compare_to: - !reference [.except_mergequeue] - !reference [.on_gitlab_changes] script: - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_FULL_API_TOKEN) || exit $?; export GITLAB_TOKEN + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN write_api) || exit $?; export GITLAB_TOKEN - !reference [.setup_agent_github_app] - pip install -r tasks/requirements.txt - inv pipeline.compare-to-itself -.compute_gitlab_ci_config_rules: - - if: $CI_PIPELINE_SOURCE != "push" - when: never - # Computes and uploads the GitLab CI configuration diff as an artifact compute_gitlab_ci_config: image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_arm64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES stage: .pre needs: [] tags: ["arch:arm64"] - rules: - - !reference [.compute_gitlab_ci_config_rules] - - when: on_success before_script: # Get main history - git fetch origin main - git checkout main - git checkout - script: - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_FULL_API_TOKEN) || exit $?; export GITLAB_TOKEN + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN write_api) || exit $?; export GITLAB_TOKEN - mkdir -p artifacts - inv -e gitlab.compute-gitlab-ci-config --before-file artifacts/before.gitlab-ci.yml --after-file artifacts/after.gitlab-ci.yml --diff-file artifacts/diff.gitlab-ci.yml artifacts: @@ -58,9 +51,6 @@ lint_gitlab_ci: image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES tags: ["arch:amd64"] needs: [compute_gitlab_ci_config] - rules: - - !reference [.compute_gitlab_ci_config_rules] - - !reference [.on_gitlab_changes_or_mergequeue_or_main] script: - status=0 - inv -e linter.gitlab-ci-jobs-needs-rules --config-file artifacts/after.gitlab-ci.yml || status=1 @@ -76,7 +66,5 @@ lint_gitlab_ci_jobs_codeowners: image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_arm64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES tags: ["arch:arm64"] needs: [] - rules: - - !reference [.on_gitlab_changes] script: - inv -e linter.gitlab-ci-jobs-codeowners --all-files diff --git a/.gitlab/JOBOWNERS b/.gitlab/JOBOWNERS index e905e6b39393b..4cd44753a62dd 100644 --- a/.gitlab/JOBOWNERS +++ b/.gitlab/JOBOWNERS @@ -130,6 +130,8 @@ trigger_auto_staging_release @DataDog/agent-delivery # Integration test integration_tests_windows* @DataDog/windows-agent +integration_tests_otel @DataDog/opentelemetry +docker_image_build_otel @DataDog/opentelemetry # Functional test kitchen_*_system_probe_windows* @DataDog/windows-kernel-integrations @@ -150,7 +152,7 @@ new-e2e-agent-subcommands* @DataDog/agent-shared-components new-e2e-agent-shared-components* @DataDog/agent-shared-components new-e2e-language-detection* @DataDog/processes new-e2e-process* @DataDog/processes -new-e2e-agent-platform* @DataDog/agent-delivery +new-e2e-agent-platform* @DataDog/container-ecosystems @DataDog/agent-delivery new-e2e-platform-integrations* @DataDog/agent-delivery @DataDog/platform-integrations new-e2e-aml* @DataDog/agent-metrics-logs new-e2e-apm* @DataDog/agent-apm @@ -159,6 +161,7 @@ new-e2e-ndm* @DataDog/network-device-monitoring new-e2e-npm* @DataDog/Networks new-e2e-cws* @DataDog/agent-security new-e2e-orchestrator* @DataDog/container-app +new-e2e-otel* @DataDog/opentelemetry e2e_pre_test* @DataDog/agent-devx-loops new-e2e-remote-config* @DataDog/remote-config new-e2e-installer* @DataDog/fleet @@ -167,6 +170,8 @@ new-e2e-windows* @DataDog/windows-agent new-e2e-windows-systemprobe @DataDog/windows-kernel-integrations new-e2e-windows-security-agent @DataDog/windows-kernel-integrations new-e2e_windows_powershell_module_test @DataDog/windows-kernel-integrations +new-e2e-eks-cleanup-on-failure @DataDog/agent-devx-loops +new-e2e-gpu* @DataDog/ebpf-platform # Kernel matrix testing upload_dependencies* @DataDog/ebpf-platform diff --git a/.gitlab/choco_deploy/choco_deploy.yml b/.gitlab/choco_deploy/choco_deploy.yml index 56e66603fe9af..6d7f8959a554d 100644 --- a/.gitlab/choco_deploy/choco_deploy.yml +++ b/.gitlab/choco_deploy/choco_deploy.yml @@ -12,7 +12,7 @@ publish_choco_7_x64: before_script: - $tmpfile = [System.IO.Path]::GetTempFileName() - (& "$CI_PROJECT_DIR\tools\ci\fetch_secret.ps1" -parameterName "$Env:CHOCOLATEY_API_KEY" -tempFile "$tmpfile") - - If ($lastExitCode -ne "0") { throw "Previous command returned $lastExitCode" } + - If ($lastExitCode -ne "0") { exit "$lastExitCode" } - $chocolateyApiKey=$(cat "$tmpfile") - Remove-Item "$tmpfile" script: diff --git a/.gitlab/common/container_publish_job_templates.yml b/.gitlab/common/container_publish_job_templates.yml index 19786f15fa81d..1472699787add 100644 --- a/.gitlab/common/container_publish_job_templates.yml +++ b/.gitlab/common/container_publish_job_templates.yml @@ -13,7 +13,7 @@ IMG_VARIABLES: "" IMG_SIGNING: "" script: # We can't use the 'trigger' keyword on manual jobs, otherwise they can't be run if the pipeline fails and is retried - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_SCHEDULER_TOKEN) || exit $?; export GITLAB_TOKEN + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN write_api) || exit $?; export GITLAB_TOKEN - | if [[ "$BUCKET_BRANCH" == "nightly" && ( "$IMG_SOURCES" =~ "$SRC_AGENT" || "$IMG_SOURCES" =~ "$SRC_DCA" || "$IMG_SOURCES" =~ "$SRC_CWS_INSTRUMENTATION" || "$IMG_VARIABLES" =~ "$SRC_AGENT" || "$IMG_VARIABLES" =~ "$SRC_DCA" || "$IMG_VARIABLES" =~ "$SRC_CWS_INSTRUMENTATION" ) ]]; then export ECR_RELEASE_SUFFIX="-nightly" diff --git a/.gitlab/common/macos.yml b/.gitlab/common/macos.yml index 580384caaf894..a2c206115df54 100644 --- a/.gitlab/common/macos.yml +++ b/.gitlab/common/macos.yml @@ -27,6 +27,6 @@ # Installing the job dependencies - python3 -m pip install -r requirements.txt -r tasks/libs/requirements-github.txt - pyenv rehash - - inv -e rtloader.make --python-runtimes $PYTHON_RUNTIMES + - inv -e rtloader.make - inv -e rtloader.install - inv -e install-tools diff --git a/.gitlab/common/test_infra_version.yml b/.gitlab/common/test_infra_version.yml index 31e364287c40c..7d5f9c920d275 100644 --- a/.gitlab/common/test_infra_version.yml +++ b/.gitlab/common/test_infra_version.yml @@ -4,4 +4,4 @@ variables: # and check the job creating the image to make sure you have the right SHA prefix TEST_INFRA_DEFINITIONS_BUILDIMAGES_SUFFIX: "" # Make sure to update test-infra-definitions version in go.mod as well - TEST_INFRA_DEFINITIONS_BUILDIMAGES: 08b9d8e048c1 + TEST_INFRA_DEFINITIONS_BUILDIMAGES: 15203a025239 diff --git a/.gitlab/container_build/docker_linux.yml b/.gitlab/container_build/docker_linux.yml index 4b0ff59a4369b..99bec497d7b18 100644 --- a/.gitlab/container_build/docker_linux.yml +++ b/.gitlab/container_build/docker_linux.yml @@ -2,7 +2,6 @@ .docker_build_job_definition: stage: container_build script: - - aws s3 sync --only-show-errors $S3_ARTIFACTS_URI $BUILD_CONTEXT - TAG_SUFFIX=${TAG_SUFFIX:-} - BUILD_ARG=${BUILD_ARG:-} - | @@ -24,6 +23,18 @@ retry: 2 timeout: 30m +# Base template for jobs that don't rely on the packaging job artifacts but +# rather from binaries stored in the 'dd-ci-artefacts-build-stable' bucket +.docker_build_s3: + before_script: + - aws s3 sync --only-show-errors $S3_ARTIFACTS_URI $BUILD_CONTEXT + +# Base template to move the packaged artifact from gitlab into the build +# context +.docker_build_artifact: + before_script: + - mv $OMNIBUS_PACKAGE_DIR/*.deb $BUILD_CONTEXT + .docker_build_job_definition_amd64: extends: .docker_build_job_definition image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/docker_x64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES @@ -40,13 +51,12 @@ # build agent7 image docker_build_agent7: - extends: .docker_build_job_definition_amd64 + extends: [.docker_build_job_definition_amd64, .docker_build_artifact] rules: - !reference [.except_mergequeue] - when: on_success needs: - job: agent_deb-x64-a7 - artifacts: false variables: IMAGE: registry.ddbuild.io/ci/datadog-agent/agent BUILD_CONTEXT: Dockerfiles/agent @@ -67,13 +77,12 @@ single_machine_performance-amd64-a7: IMG_DESTINATIONS: 08450328-agent:${CI_COMMIT_SHA}-7-amd64 docker_build_agent7_arm64: - extends: .docker_build_job_definition_arm64 + extends: [.docker_build_job_definition_arm64, .docker_build_artifact] rules: - !reference [.except_mergequeue] - when: on_success needs: - job: agent_deb-arm64-a7 - artifacts: false variables: IMAGE: registry.ddbuild.io/ci/datadog-agent/agent BUILD_CONTEXT: Dockerfiles/agent @@ -82,13 +91,12 @@ docker_build_agent7_arm64: # build agent7 jmx image docker_build_agent7_jmx: - extends: .docker_build_job_definition_amd64 + extends: [.docker_build_job_definition_amd64, .docker_build_artifact] rules: - !reference [.except_mergequeue] - when: on_success needs: - job: agent_deb-x64-a7 - artifacts: false variables: IMAGE: registry.ddbuild.io/ci/datadog-agent/agent BUILD_CONTEXT: Dockerfiles/agent @@ -96,13 +104,12 @@ docker_build_agent7_jmx: BUILD_ARG: --target test --build-arg WITH_JMX=true --build-arg PYTHON_VERSION=3 --build-arg DD_AGENT_ARTIFACT=datadog-agent_7*_amd64.deb docker_build_agent7_jmx_arm64: - extends: .docker_build_job_definition_arm64 + extends: [.docker_build_job_definition_arm64, .docker_build_artifact] rules: - !reference [.except_mergequeue] - when: on_success needs: - job: agent_deb-arm64-a7 - artifacts: false variables: IMAGE: registry.ddbuild.io/ci/datadog-agent/agent BUILD_CONTEXT: Dockerfiles/agent @@ -111,13 +118,12 @@ docker_build_agent7_jmx_arm64: # build agent7 UA image docker_build_ot_agent7: - extends: .docker_build_job_definition_amd64 + extends: [.docker_build_job_definition_amd64, .docker_build_artifact] rules: - !reference [.except_mergequeue] - when: on_success needs: - job: ot_agent_deb-x64-a7 - artifacts: false variables: IMAGE: registry.ddbuild.io/ci/datadog-agent/agent BUILD_CONTEXT: Dockerfiles/agent @@ -125,13 +131,12 @@ docker_build_ot_agent7: BUILD_ARG: --target test --build-arg PYTHON_VERSION=3 --build-arg DD_AGENT_ARTIFACT=datadog-ot-agent_7*_amd64.deb docker_build_ot_agent7_arm64: - extends: .docker_build_job_definition_arm64 + extends: [.docker_build_job_definition_arm64, .docker_build_artifact] rules: - !reference [.except_mergequeue] - when: on_success needs: - job: ot_agent_deb-arm64-a7 - artifacts: false variables: IMAGE: registry.ddbuild.io/ci/datadog-agent/agent BUILD_CONTEXT: Dockerfiles/agent @@ -140,13 +145,12 @@ docker_build_ot_agent7_arm64: # build agent7 jmx image docker_build_ot_agent7_jmx: - extends: .docker_build_job_definition_amd64 + extends: [.docker_build_job_definition_amd64, .docker_build_artifact] rules: - !reference [.except_mergequeue] - when: on_success needs: - job: ot_agent_deb-x64-a7 - artifacts: false variables: IMAGE: registry.ddbuild.io/ci/datadog-agent/agent BUILD_CONTEXT: Dockerfiles/agent @@ -154,13 +158,12 @@ docker_build_ot_agent7_jmx: BUILD_ARG: --target test --build-arg WITH_JMX=true --build-arg PYTHON_VERSION=3 --build-arg DD_AGENT_ARTIFACT=datadog-ot-agent_7*_amd64.deb docker_build_ot_agent7_jmx_arm64: - extends: .docker_build_job_definition_arm64 + extends: [.docker_build_job_definition_arm64, .docker_build_artifact] rules: - !reference [.except_mergequeue] - when: on_success needs: - job: ot_agent_deb-arm64-a7 - artifacts: false variables: IMAGE: registry.ddbuild.io/ci/datadog-agent/agent BUILD_CONTEXT: Dockerfiles/agent @@ -169,7 +172,7 @@ docker_build_ot_agent7_jmx_arm64: # build the cluster-agent image docker_build_cluster_agent_amd64: - extends: .docker_build_job_definition_amd64 + extends: [.docker_build_job_definition_amd64, .docker_build_s3] rules: !reference [.on_tag_or_a7] needs: - job: cluster_agent-build_amd64 @@ -182,10 +185,11 @@ docker_build_cluster_agent_amd64: IMAGE: registry.ddbuild.io/ci/datadog-agent/cluster-agent BUILD_CONTEXT: Dockerfiles/cluster-agent before_script: + - !reference [.docker_build_s3, before_script] - cp -Rvf Dockerfiles/agent/nosys-seccomp Dockerfiles/cluster-agent/ docker_build_cluster_agent_arm64: - extends: .docker_build_job_definition_arm64 + extends: [.docker_build_job_definition_arm64, .docker_build_s3] rules: !reference [.on_tag_or_a7] needs: - job: cluster_agent-build_arm64 @@ -198,11 +202,12 @@ docker_build_cluster_agent_arm64: IMAGE: registry.ddbuild.io/ci/datadog-agent/cluster-agent BUILD_CONTEXT: Dockerfiles/cluster-agent before_script: + - !reference [.docker_build_s3, before_script] - cp -Rvf Dockerfiles/agent/nosys-seccomp Dockerfiles/cluster-agent/ # build the cws-instrumentation image docker_build_cws_instrumentation_amd64: - extends: .docker_build_job_definition_amd64 + extends: [.docker_build_job_definition_amd64, .docker_build_s3] rules: !reference [.on_tag_or_a7] needs: - job: cws_instrumentation-build_amd64 @@ -212,7 +217,7 @@ docker_build_cws_instrumentation_amd64: BUILD_CONTEXT: Dockerfiles/cws-instrumentation docker_build_cws_instrumentation_arm64: - extends: .docker_build_job_definition_arm64 + extends: [.docker_build_job_definition_arm64, .docker_build_s3] rules: !reference [.on_tag_or_a7] needs: - job: cws_instrumentation-build_arm64 @@ -223,7 +228,7 @@ docker_build_cws_instrumentation_arm64: # build the dogstatsd image docker_build_dogstatsd_amd64: - extends: .docker_build_job_definition_amd64 + extends: [.docker_build_job_definition_amd64, .docker_build_s3] rules: - !reference [.except_mergequeue] - when: on_success @@ -237,7 +242,7 @@ docker_build_dogstatsd_amd64: # build the dogstatsd image docker_build_dogstatsd_arm64: - extends: .docker_build_job_definition_arm64 + extends: [.docker_build_job_definition_arm64, .docker_build_s3] rules: - !reference [.except_mergequeue] - when: on_success diff --git a/.gitlab/container_build/docker_windows.yml b/.gitlab/container_build/docker_windows.yml index dada869f2a0d3..c9b67e24ef86b 100644 --- a/.gitlab/container_build/docker_windows.yml +++ b/.gitlab/container_build/docker_windows.yml @@ -34,8 +34,8 @@ -v "$(Get-Location):C:\mnt" -v \\.\pipe\docker_engine:\\.\pipe\docker_engine 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/windows_${Env:VARIANT}_x64${Env:DATADOG_AGENT_WINBUILDIMAGES_SUFFIX}:${Env:DATADOG_AGENT_WINBUILDIMAGES} powershell - -C C:\mnt\tools\ci\docker-login.ps1 - - If ($lastExitCode -ne "0") { throw "Previous command returned $lastExitCode" } + -File C:\mnt\tools\ci\docker-login.ps1 + - If ($lastExitCode -ne "0") { exit "$lastExitCode" } - powershell -Command "$(Get-Location)\tools\ci\retry.ps1 docker build --no-cache --build-arg GENERAL_ARTIFACTS_CACHE_BUCKET_URL=${GENERAL_ARTIFACTS_CACHE_BUCKET_URL} ${BUILD_ARG} --pull --file ${BUILD_CONTEXT}/windows/amd64/Dockerfile --tag ${TARGET_TAG} ${BUILD_CONTEXT}" - If ($lastExitCode -ne "0") { throw "Previous command returned $lastExitCode" } - powershell -Command "$(Get-Location)\tools\ci\retry.ps1 docker push ${TARGET_TAG}" diff --git a/.gitlab/deploy_packages/winget.yml b/.gitlab/deploy_packages/winget.yml index f28f946b1fb0c..54261a8d1a867 100644 --- a/.gitlab/deploy_packages/winget.yml +++ b/.gitlab/deploy_packages/winget.yml @@ -12,7 +12,7 @@ publish_winget_7_x64: before_script: - $tmpfile = [System.IO.Path]::GetTempFileName() - (& "$CI_PROJECT_DIR\tools\ci\fetch_secret.ps1" -parameterName "$Env:WINGET_PAT" -tempFile "$tmpfile") - - If ($lastExitCode -ne "0") { throw "Previous command returned $lastExitCode" } + - If ($lastExitCode -ne "0") { exit "$lastExitCode" } - $wingetPat=$(cat "$tmpfile") - Remove-Item "$tmpfile" script: diff --git a/.gitlab/e2e/e2e.yml b/.gitlab/e2e/e2e.yml index f760a056b2739..145e18aff5e75 100644 --- a/.gitlab/e2e/e2e.yml +++ b/.gitlab/e2e/e2e.yml @@ -11,11 +11,11 @@ - !reference [.retrieve_linux_go_e2e_deps] # Setup AWS Credentials - mkdir -p ~/.aws - - $CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_QA_PROFILE >> ~/.aws/config || exit $? + - $CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_QA_E2E profile >> ~/.aws/config || exit $? - export AWS_PROFILE=agent-qa-ci # Now all `aws` commands target the agent-qa profile - - $CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SSH_PUBLIC_KEY_RSA > $E2E_PUBLIC_KEY_PATH || exit $? - - touch $E2E_PRIVATE_KEY_PATH && chmod 600 $E2E_PRIVATE_KEY_PATH && $CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SSH_KEY_RSA > $E2E_PRIVATE_KEY_PATH || exit $? + - $CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_QA_E2E ssh_public_key_rsa > $E2E_PUBLIC_KEY_PATH || exit $? + - touch $E2E_PRIVATE_KEY_PATH && chmod 600 $E2E_PRIVATE_KEY_PATH && $CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_QA_E2E ssh_key_rsa > $E2E_PRIVATE_KEY_PATH || exit $? # Use S3 backend - pulumi login "s3://dd-pulumi-state?region=us-east-1&awssdk=v2&profile=$AWS_PROFILE" # Setup Azure credentials. https://www.pulumi.com/registry/packages/azure-native/installation-configuration/#set-configuration-using-pulumi-config @@ -103,11 +103,42 @@ new-e2e-containers: - EXTRA_PARAMS: "--run TestKindSuite -c ddinfra:kubernetesVersion=1.29" - EXTRA_PARAMS: "--run TestKindSuite -c ddinfra:osDescriptor=ubuntu:20.04" - EXTRA_PARAMS: "--run TestKindSuite -c ddinfra:osDescriptor=ubuntu:22.04" - - EXTRA_PARAMS: --run TestEKSSuite - EXTRA_PARAMS: --run TestECSSuite - EXTRA_PARAMS: --run TestDockerSuite - EXTRA_PARAMS: --skip "Test(Kind|EKS|ECS|Docker)Suite" +new-e2e-containers-eks-init: + stage: e2e_init + extends: .new_e2e_template + needs: + - !reference [.needs_new_e2e_template] + rules: + - !reference [.on_container_or_e2e_changes] + - !reference [.manual] + variables: + TARGETS: ./tests/containers + TEAM: container-integrations + EXTRA_PARAMS: --run TestEKSSuite + E2E_INIT_ONLY: "true" + SHOULD_RUN_IN_FLAKES_FINDER: "false" + allow_failure: true + +new-e2e-containers-eks: + extends: .new_e2e_template + rules: + - !reference [.on_container_or_e2e_changes] + - !reference [.manual] + needs: + - !reference [.needs_new_e2e_template] + - new-e2e-containers-eks-init + - qa_agent + - qa_dca + variables: + TARGETS: ./tests/containers + TEAM: container-integrations + EXTRA_PARAMS: --run TestEKSSuite + E2E_PRE_INITIALIZED: "true" + new-e2e-remote-config: extends: .new_e2e_template_needs_deb_x64 rules: @@ -210,7 +241,40 @@ new-e2e-npm-docker: variables: TARGETS: ./tests/npm TEAM: network-performance-monitoring - EXTRA_PARAMS: --run "Test(ECSVM|EC2VMContainerized|EKSVM)Suite" + EXTRA_PARAMS: --run "Test(ECSVM|EC2VMContainerized)Suite" + + +new-e2e-npm-eks-init: + stage: e2e_init + extends: .new_e2e_template + needs: + - !reference [.needs_new_e2e_template] + rules: + - !reference [.on_npm_or_e2e_changes] + - !reference [.manual] + variables: + TARGETS: ./tests/npm + TEAM: network-performance-monitoring + EXTRA_PARAMS: --run "TestEKSVMSuite" + E2E_INIT_ONLY: "true" + SHOULD_RUN_IN_FLAKES_FINDER: "false" + allow_failure: true + +new-e2e-npm-eks: + extends: .new_e2e_template + rules: + - !reference [.on_npm_or_e2e_changes] + - !reference [.manual] + needs: + - !reference [.needs_new_e2e_template] + - new-e2e-npm-eks-init + - qa_agent + - qa_dca + variables: + TARGETS: ./tests/npm + TEAM: network-performance-monitoring + EXTRA_PARAMS: --run "TestEKSVMSuite" + E2E_PRE_INITIALIZED: "true" new-e2e-aml: extends: .new_e2e_template @@ -240,6 +304,7 @@ new-e2e-cws: - qa_agent - qa_dca variables: + SHOULD_RUN_IN_FLAKES_FINDER: "false" # Currently broken in flake finder ADXT-687 TARGETS: ./tests/cws TEAM: csm-threats-agent CWS_INSTRUMENTATION_FULLIMAGEPATH: 669783387624.dkr.ecr.us-east-1.amazonaws.com/cws-instrumentation:${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA} @@ -409,6 +474,7 @@ new-e2e-windows-systemprobe: variables: TARGETS: ./tests/sysprobe-functional TEAM: windows-kernel-integrations + SHOULD_RUN_IN_FLAKES_FINDER: "false" # Currently broken in flake finder ADXT-687 new-e2e-windows-security-agent: extends: .new_e2e_template @@ -423,6 +489,40 @@ new-e2e-windows-security-agent: TARGETS: ./tests/security-agent-functional TEAM: windows-kernel-integrations +new-e2e-otel-eks-init: + stage: e2e_init + extends: .new_e2e_template + rules: + - !reference [.on_otel_or_e2e_changes] + - !reference [.manual] + needs: + - !reference [.needs_new_e2e_template] + variables: + TARGETS: ./tests/otel + TEAM: otel + EXTRA_PARAMS: --run TestOTelAgentIAEKS + E2E_INIT_ONLY: "true" + SHOULD_RUN_IN_FLAKES_FINDER: "false" + + allow_failure: true + +new-e2e-otel-eks: + extends: .new_e2e_template + rules: + - !reference [.on_otel_or_e2e_changes] + - !reference [.manual] + needs: + - !reference [.needs_new_e2e_template] + - qa_dca + - qa_agent + - qa_agent_ot + - new-e2e-otel-eks-init + variables: + TARGETS: ./tests/otel + EXTRA_PARAMS: --run TestOTelAgentIAEKS + TEAM: otel + E2E_PRE_INITIALIZED: "true" + new-e2e-otel: extends: .new_e2e_template rules: @@ -435,6 +535,7 @@ new-e2e-otel: - qa_agent_ot variables: TARGETS: ./tests/otel + EXTRA_PARAMS: --skip TestOTelAgentIAEKS TEAM: otel .new-e2e_package_signing: @@ -471,6 +572,19 @@ new-e2e-cspm: TEAM: cspm timeout: 35m +new-e2e-gpu: + extends: .new_e2e_template + rules: + - !reference [.on_gpu_or_e2e_changes] + - !reference [.manual] + variables: + TARGETS: ./tests/gpu # the target path where tests are + TEAM: ebpf-platform + needs: # list of required jobs. By default gitlab waits for any previous jobs. + - !reference [.needs_new_e2e_template] + - deploy_deb_testing-a7_x64 # agent 7 debian package + + generate-flakes-finder-pipeline: image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES stage: e2e @@ -479,6 +593,7 @@ generate-flakes-finder-pipeline: - !reference [.on_deploy_nightly_repo_branch] - !reference [.manual] needs: + - compute_gitlab_ci_config - deploy_deb_testing-a7_arm64 - deploy_deb_testing-a7_x64 - deploy_rpm_testing-a7_arm64 @@ -495,7 +610,6 @@ generate-flakes-finder-pipeline: - qa_agent_ot tags: ["arch:amd64"] script: - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_FULL_API_TOKEN) || exit $?; export GITLAB_TOKEN - inv -e testwasher.generate-flake-finder-pipeline artifacts: paths: @@ -516,3 +630,30 @@ trigger-flakes-finder: - artifact: flake-finder-gitlab-ci.yml job: generate-flakes-finder-pipeline allow_failure: true + +new-e2e-eks-cleanup-on-failure: + image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/test-infra-definitions/runner$TEST_INFRA_DEFINITIONS_BUILDIMAGES_SUFFIX:$TEST_INFRA_DEFINITIONS_BUILDIMAGES + tags: ["arch:amd64"] + stage: e2e_cleanup + dependencies: [go_e2e_deps] + script: + # Setup AWS Credentials + - mkdir -p ~/.aws + - $CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_QA_E2E profile >> ~/.aws/config || exit $? + - export AWS_PROFILE=agent-qa-ci + # Now all `aws` commands target the agent-qa profile + - $CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_QA_E2E ssh_public_key_rsa > $E2E_PUBLIC_KEY_PATH || exit $? + - touch $E2E_PRIVATE_KEY_PATH && chmod 600 $E2E_PRIVATE_KEY_PATH && $CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_QA_E2E ssh_key_rsa > $E2E_PRIVATE_KEY_PATH || exit $? + # Use S3 backend + - PULUMI_CONFIG_PASSPHRASE=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $E2E_PULUMI_CONFIG_PASSPHRASE) || exit $?; export PULUMI_CONFIG_PASSPHRASE + - pulumi login "s3://dd-pulumi-state?region=us-east-1&awssdk=v2&profile=$AWS_PROFILE" + - inv -e new-e2e-tests.cleanup-remote-stacks --stack-regex "ci-$CI_PIPELINE_ID.*eks.*" --pulumi-backend=dd-pulumi-state + variables: + E2E_PUBLIC_KEY_PATH: /tmp/agent-qa-ssh-key.pub + E2E_PRIVATE_KEY_PATH: /tmp/agent-qa-ssh-key + E2E_PIPELINE_ID: $CI_PIPELINE_ID + rules: + - !reference [.except_mergequeue] + - when: always + allow_failure: true + diff --git a/.gitlab/e2e_install_packages/common.yml b/.gitlab/e2e_install_packages/common.yml index 1bb6c813d84cc..64abe046a1135 100644 --- a/.gitlab/e2e_install_packages/common.yml +++ b/.gitlab/e2e_install_packages/common.yml @@ -28,7 +28,7 @@ - START_MAJOR_VERSION: [5, 6, 7] END_MAJOR_VERSION: [7] script: - - DATADOG_AGENT_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $INSTALL_SCRIPT_API_KEY ) || exit $?; export DATADOG_AGENT_API_KEY + - DATADOG_AGENT_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $INSTALL_SCRIPT_API_KEY_ORG2 token ) || exit $?; export DATADOG_AGENT_API_KEY - inv -e new-e2e-tests.run --targets $TARGETS --junit-tar "junit-${CI_JOB_ID}.tgz" ${EXTRA_PARAMS} --src-agent-version $START_MAJOR_VERSION --dest-agent-version $END_MAJOR_VERSION --test-washer .new-e2e_script_upgrade_persisting_integrations: @@ -38,7 +38,7 @@ TEAM: agent-delivery EXTRA_PARAMS: --osversion $E2E_OSVERS --platform $E2E_PLATFORM --arch $E2E_ARCH --flavor $FLAVOR script: - - DATADOG_AGENT_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $INSTALL_SCRIPT_API_KEY ) || exit $?; export DATADOG_AGENT_API_KEY + - DATADOG_AGENT_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $INSTALL_SCRIPT_API_KEY_ORG2 token) || exit $?; export DATADOG_AGENT_API_KEY - inv -e new-e2e-tests.run --targets $TARGETS --junit-tar "junit-${CI_JOB_ID}.tgz" ${EXTRA_PARAMS} --src-agent-version 7 --test-washer .new-e2e_rpm: @@ -48,5 +48,5 @@ TEAM: agent-delivery EXTRA_PARAMS: --osversion $E2E_OSVERS --platform $E2E_PLATFORM --arch $E2E_ARCH script: - - DATADOG_AGENT_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $INSTALL_SCRIPT_API_KEY) || exit $?; export DATADOG_AGENT_API_KEY + - DATADOG_AGENT_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $INSTALL_SCRIPT_API_KEY_ORG2 token) || exit $?; export DATADOG_AGENT_API_KEY - inv -e new-e2e-tests.run --targets $TARGETS --junit-tar "junit-${CI_JOB_ID}.tgz" ${EXTRA_PARAMS} --test-washer diff --git a/.gitlab/functional_test/regression_detector.yml b/.gitlab/functional_test/regression_detector.yml index c288fe0824f42..ec44f3d9fc9ed 100644 --- a/.gitlab/functional_test/regression_detector.yml +++ b/.gitlab/functional_test/regression_detector.yml @@ -128,7 +128,7 @@ single-machine-performance-regression_detector: # invoke task has additional logic that does not seem to apply well to SMP's # JUnit XML. Agent CI seems to use `datadog-agent` as the service name when # uploading JUnit XML, so the upload command below respects that convention. - - DATADOG_API_KEY="$("$CI_PROJECT_DIR"/tools/ci/fetch_secret.sh "$API_KEY_ORG2")" || exit $?; export DATADOG_API_KEY + - DATADOG_API_KEY="$("$CI_PROJECT_DIR"/tools/ci/fetch_secret.sh "$AGENT_API_KEY_ORG2" token)" || exit $?; export DATADOG_API_KEY - datadog-ci junit upload --service datadog-agent outputs/junit.xml # Finally, exit 1 if the job signals a regression else 0. - RUST_LOG="${RUST_LOG}" ./smp --team-id ${SMP_AGENT_TEAM_ID} --api-base ${SMP_API} --aws-named-profile ${AWS_NAMED_PROFILE} diff --git a/.gitlab/install_script_testing/install_script_testing.yml b/.gitlab/install_script_testing/install_script_testing.yml index 8578cba0e42a1..53ee9c17d1335 100644 --- a/.gitlab/install_script_testing/install_script_testing.yml +++ b/.gitlab/install_script_testing/install_script_testing.yml @@ -5,7 +5,7 @@ test_install_script: tags: ["arch:amd64"] script: - set +x - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_SCHEDULER_TOKEN) || exit $?; export GITLAB_TOKEN + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN write_api) || exit $?; export GITLAB_TOKEN - export TESTING_APT_URL=$DEB_TESTING_S3_BUCKET - export TESTING_YUM_URL=$RPM_TESTING_S3_BUCKET - export TEST_PIPELINE_ID=$CI_PIPELINE_ID diff --git a/.gitlab/integration_test/otel.yml b/.gitlab/integration_test/otel.yml index d9d3c71e73510..9b372bc8f6766 100644 --- a/.gitlab/integration_test/otel.yml +++ b/.gitlab/integration_test/otel.yml @@ -21,3 +21,36 @@ integration_tests_otel: - if: $CI_COMMIT_REF_NAME =~ /.*-skip-cancel$/ when: never - when: always + + +docker_image_build_otel: + stage: integration_test + image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/docker_x64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES + needs: ["go_deps","integration_tests_otel"] + tags: ["runner:docker"] + before_script: + - !reference [.retrieve_linux_go_deps] + - mkdir -p /tmp/otel-ci + - cp comp/otelcol/collector-contrib/impl/manifest.yaml /tmp/otel-ci/ + - cp Dockerfiles/agent-ot/Dockerfile.agent-otel /tmp/otel-ci/ + - cp test/integration/docker/otel_agent_build_tests.py /tmp/otel-ci/ + - wget https://github.com/mikefarah/yq/releases/download/3.4.1/yq_linux_amd64 -O + /usr/bin/yq && chmod +x /usr/bin/yq + - export OTELCOL_VERSION=v$(/usr/bin/yq r /tmp/otel-ci/manifest.yaml dist.otelcol_version) + - yq w -i /tmp/otel-ci/manifest.yaml "receivers[+] gomod" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sobjectsreceiver ${OTELCOL_VERSION}" + - yq w -i /tmp/otel-ci/manifest.yaml "processors[+] gomod" + "github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor ${OTELCOL_VERSION}" + script: + - docker build -t agent-byoc:latest -f /tmp/otel-ci/Dockerfile.agent-otel /tmp/otel-ci + - OT_AGENT_IMAGE_NAME=agent-byoc OT_AGENT_TAG=latest python3 /tmp/otel-ci/otel_agent_build_tests.py + rules: + - if: $CI_PIPELINE_SOURCE =~ /^schedule.*$/ + when: never + - if: $CI_COMMIT_TAG + when: never + - if: $CI_COMMIT_MESSAGE =~ /.*\[skip cancel\].*/ + when: never + - if: $CI_COMMIT_REF_NAME =~ /.*-skip-cancel$/ + when: never + - when: always diff --git a/.gitlab/integration_test/windows.yml b/.gitlab/integration_test/windows.yml index 2ddf04fddb997..39e24c348f56e 100644 --- a/.gitlab/integration_test/windows.yml +++ b/.gitlab/integration_test/windows.yml @@ -9,7 +9,7 @@ before_script: - $tmpfile = [System.IO.Path]::GetTempFileName() - (& "$CI_PROJECT_DIR\tools\ci\fetch_secret.ps1" -parameterName "$Env:VCPKG_BLOB_SAS_URL" -tempFile "$tmpfile") - - If ($lastExitCode -ne "0") { throw "Previous command returned $lastExitCode" } + - If ($lastExitCode -ne "0") { exit "$lastExitCode" } - $vcpkgBlobSaSUrl=$(cat "$tmpfile") - Remove-Item "$tmpfile" script: diff --git a/.gitlab/internal_image_deploy/internal_image_deploy.yml b/.gitlab/internal_image_deploy/internal_image_deploy.yml index 6d0cc3245e3b5..58bfebfa2bd87 100644 --- a/.gitlab/internal_image_deploy/internal_image_deploy.yml +++ b/.gitlab/internal_image_deploy/internal_image_deploy.yml @@ -22,7 +22,7 @@ docker_trigger_internal: TMPL_SRC_REPO: ci/datadog-agent/agent RELEASE_STAGING: "true" script: - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_SCHEDULER_TOKEN) || exit $?; export GITLAB_TOKEN + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN write_api) || exit $?; export GITLAB_TOKEN - if [ "$BUCKET_BRANCH" = "beta" ] || [ "$BUCKET_BRANCH" = "stable" ]; then TMPL_SRC_REPO="${TMPL_SRC_REPO}-release"; fi - | if [ "$BUCKET_BRANCH" = "nightly" ]; then @@ -67,7 +67,7 @@ docker_trigger_internal-ot: TMPL_SRC_REPO: ci/datadog-agent/agent RELEASE_STAGING: "true" script: - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_SCHEDULER_TOKEN) || exit $?; export GITLAB_TOKEN + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN write_api) || exit $?; export GITLAB_TOKEN - if [ "$BUCKET_BRANCH" = "beta" ] || [ "$BUCKET_BRANCH" = "stable" ]; then TMPL_SRC_REPO="${TMPL_SRC_REPO}-release"; fi - | if [ "$BUCKET_BRANCH" = "nightly" ]; then @@ -113,7 +113,7 @@ docker_trigger_cluster_agent_internal: RELEASE_STAGING: "true" RELEASE_PROD: "true" script: - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_SCHEDULER_TOKEN) || exit $?; export GITLAB_TOKEN + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN write_api) || exit $?; export GITLAB_TOKEN - if [ "$BUCKET_BRANCH" = "beta" ] || [ "$BUCKET_BRANCH" = "stable" ]; then TMPL_SRC_REPO="${TMPL_SRC_REPO}-release"; fi - | if [ "$BUCKET_BRANCH" = "nightly" ]; then @@ -159,7 +159,7 @@ docker_trigger_cws_instrumentation_internal: RELEASE_STAGING: "true" RELEASE_PROD: "true" script: - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_SCHEDULER_TOKEN) || exit $?; export GITLAB_TOKEN + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN write_api) || exit $?; export GITLAB_TOKEN - if [ "$BUCKET_BRANCH" = "beta" ] || [ "$BUCKET_BRANCH" = "stable" ]; then TMPL_SRC_REPO="${TMPL_SRC_REPO}-release"; fi - | if [ "$BUCKET_BRANCH" = "nightly" ]; then diff --git a/.gitlab/internal_kubernetes_deploy/internal_kubernetes_deploy.yml b/.gitlab/internal_kubernetes_deploy/internal_kubernetes_deploy.yml index 605ac0def4114..792b7e727b537 100644 --- a/.gitlab/internal_kubernetes_deploy/internal_kubernetes_deploy.yml +++ b/.gitlab/internal_kubernetes_deploy/internal_kubernetes_deploy.yml @@ -36,7 +36,7 @@ internal_kubernetes_deploy_experimental: EXPLICIT_WORKFLOWS: "//workflows:beta_builds.agents_nightly.staging-deploy.publish,//workflows:beta_builds.agents_nightly.staging-validate.publish,//workflows:beta_builds.agents_nightly.prod-wait-business-hours.publish,//workflows:beta_builds.agents_nightly.prod-deploy.publish,//workflows:beta_builds.agents_nightly.prod-validate.publish,//workflows:beta_builds.agents_nightly.publish-image-confirmation.publish" BUNDLE_VERSION_OVERRIDE: "v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}" script: - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_SCHEDULER_TOKEN) || exit $?; export GITLAB_TOKEN + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN write_api) || exit $?; export GITLAB_TOKEN - "inv pipeline.trigger-child-pipeline --project-name DataDog/k8s-datadog-agent-ops --git-ref main --variable OPTION_AUTOMATIC_ROLLOUT --variable EXPLICIT_WORKFLOWS diff --git a/.gitlab/internal_kubernetes_deploy/rc_kubernetes_deploy.yml b/.gitlab/internal_kubernetes_deploy/rc_kubernetes_deploy.yml index 067ca517fdba9..3f880e8cb0ac6 100644 --- a/.gitlab/internal_kubernetes_deploy/rc_kubernetes_deploy.yml +++ b/.gitlab/internal_kubernetes_deploy/rc_kubernetes_deploy.yml @@ -22,7 +22,7 @@ rc_kubernetes_deploy: EXPLICIT_WORKFLOWS: "//workflows:deploy_rc.agents_rc" AGENT_IMAGE_TAG: $CI_COMMIT_REF_NAME script: - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_SCHEDULER_TOKEN) || exit $?; export GITLAB_TOKEN + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN write_api) || exit $?; export GITLAB_TOKEN - "inv pipeline.trigger-child-pipeline --project-name DataDog/k8s-datadog-agent-ops --git-ref main --variable OPTION_AUTOMATIC_ROLLOUT --variable EXPLICIT_WORKFLOWS diff --git a/.gitlab/junit_upload/junit_upload.yml b/.gitlab/junit_upload/junit_upload.yml deleted file mode 100644 index 3ec6b8b35e709..0000000000000 --- a/.gitlab/junit_upload/junit_upload.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -unit_tests_arm64_junit_upload: - stage: junit_upload - rules: - - !reference [.except_mergequeue] - - when: always - image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES - tags: ["arch:amd64"] - allow_failure: true - needs: - - tests_deb-arm64-py3 - - tests_rpm-arm64-py3 - script: - - $CI_PROJECT_DIR/tools/ci/junit_upload.sh - -# The corresponding upload for the x86 tests is in the test jobs themselves, we have to upload -# the ARM64 test results here as we need an x86 image to run the upload. -kmt_arm64_junit_upload: - stage: junit_upload - rules: - - !reference [.except_mergequeue] - - when: always - image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_x64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES - tags: ["arch:amd64"] - allow_failure: true - needs: - - job: kmt_run_sysprobe_tests_arm64 - optional: true - - job: kmt_run_secagent_tests_arm64 - optional: true - script: - - $CI_PROJECT_DIR/tools/ci/junit_upload.sh "$DD_AGENT_TESTING_DIR/junit-*.tar.gz" diff --git a/.gitlab/kernel_matrix_testing/common.yml b/.gitlab/kernel_matrix_testing/common.yml index b2acf5a35d422..9768897240102 100644 --- a/.gitlab/kernel_matrix_testing/common.yml +++ b/.gitlab/kernel_matrix_testing/common.yml @@ -29,7 +29,7 @@ .write_ssh_key_file: - touch $AWS_EC2_SSH_KEY_FILE && chmod 600 $AWS_EC2_SSH_KEY_FILE - - $CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SSH_KEY > $AWS_EC2_SSH_KEY_FILE || exit $? + - $CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_QA_E2E ssh_key > $AWS_EC2_SSH_KEY_FILE || exit $? # Without the newline ssh silently fails and moves on to try other auth methods - echo "" >> $AWS_EC2_SSH_KEY_FILE - chmod 600 $AWS_EC2_SSH_KEY_FILE @@ -47,7 +47,7 @@ .kmt_new_profile: - mkdir -p ~/.aws - - $CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_QA_PROFILE >> ~/.aws/config || exit $? + - $CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_QA_E2E profile >> ~/.aws/config || exit $? - export AWS_PROFILE=agent-qa-ci .define_if_collect_complexity: @@ -60,7 +60,7 @@ - echo "COLLECT_COMPLEXITY=${COLLECT_COMPLEXITY}" .collect_outcomes_kmt: - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY - export MICRO_VM_IP=$(jq --exit-status --arg TAG $TAG --arg ARCH $ARCH --arg TEST_SET $TEST_SET -r '.[$ARCH].microvms | map(select(."vmset-tags"| index($TEST_SET))) | map(select(.tag==$TAG)) | .[].ip' $CI_PROJECT_DIR/stack.output) # Collect setup-ddvm systemd service logs - mkdir -p $CI_PROJECT_DIR/logs @@ -114,7 +114,7 @@ scp $DD_AGENT_TESTING_DIR/kmt-dockers-$ARCH.tar.gz metal_instance:/opt/kernel-version-testing fi after_script: - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY - !reference [.tag_kmt_ci_job] variables: AWS_EC2_SSH_KEY_FILE: $CI_PROJECT_DIR/ssh_key @@ -144,7 +144,7 @@ VMCONFIG_FILE: "${CI_PROJECT_DIR}/vmconfig-${CI_PIPELINE_ID}-${ARCH}.json" EXTERNAL_LINKS_PATH: external_links_$CI_JOB_ID.json before_script: - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY - !reference [.retrieve_linux_go_deps] - !reference [.kmt_new_profile] - !reference [.write_ssh_key_file] @@ -159,7 +159,7 @@ - jq "." $CI_PROJECT_DIR/stack.output - pulumi logout after_script: - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY - export AWS_PROFILE=agent-qa-ci - !reference [.shared_filters_and_queries] - mkdir -p $CI_PROJECT_DIR/libvirt/log/$ARCH $CI_PROJECT_DIR/libvirt/xml $CI_PROJECT_DIR/libvirt/qemu $CI_PROJECT_DIR/libvirt/dnsmasq @@ -200,7 +200,7 @@ image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/test-infra-definitions/runner$TEST_INFRA_DEFINITIONS_BUILDIMAGES_SUFFIX:$TEST_INFRA_DEFINITIONS_BUILDIMAGES tags: ["arch:amd64"] before_script: - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_SCHEDULER_TOKEN) || exit $?; export GITLAB_TOKEN + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN read_api) || exit $?; export GITLAB_TOKEN - !reference [.kmt_new_profile] script: - !reference [.shared_filters_and_queries] @@ -217,7 +217,7 @@ aws ec2 terminate-instances --instance-ids "${INSTANCE_ID}" fi after_script: - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY - !reference [.tag_kmt_ci_job] # Manual cleanup jobs, these will be used to cleanup the instances after the tests @@ -247,7 +247,7 @@ RETRY: 2 EXTERNAL_LINKS_PATH: external_links_$CI_JOB_ID.json before_script: - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY - !reference [.kmt_new_profile] - !reference [.write_ssh_key_file] - echo "CI_JOB_URL=${CI_JOB_URL}" >> $DD_AGENT_TESTING_DIR/job_env.txt @@ -335,6 +335,6 @@ notify_ebpf_complexity_changes: - python3 -m pip install tabulate # Required for printing the tables - python3 -m pip install -r tasks/libs/requirements-github.txt - !reference [.setup_agent_github_app] - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_FULL_API_TOKEN) || exit $?; export GITLAB_TOKEN + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN read_api) || exit $?; export GITLAB_TOKEN script: - inv -e ebpf.generate-complexity-summary-for-pr diff --git a/.gitlab/kernel_matrix_testing/security_agent.yml b/.gitlab/kernel_matrix_testing/security_agent.yml index 48a2f9de606a9..6846a15f4a0a4 100644 --- a/.gitlab/kernel_matrix_testing/security_agent.yml +++ b/.gitlab/kernel_matrix_testing/security_agent.yml @@ -32,7 +32,7 @@ kmt_setup_env_secagent_arm64: AMI_ID_ARG: "--arm-ami-id=$KERNEL_MATRIX_TESTING_ARM_AMI_ID" LibvirtSSHKey: $CI_PROJECT_DIR/libvirt_rsa-arm TEST_COMPONENT: security-agent - TEST_SETS: all_tests + TEST_SETS: cws_host,cws_docker kmt_setup_env_secagent_x64: extends: @@ -45,7 +45,7 @@ kmt_setup_env_secagent_x64: AMI_ID_ARG: "--x86-ami-id=$KERNEL_MATRIX_TESTING_X86_AMI_ID" LibvirtSSHKey: $CI_PROJECT_DIR/libvirt_rsa-x86 TEST_COMPONENT: security-agent - TEST_SETS: all_tests + TEST_SETS: cws_host,cws_docker .upload_secagent_tests: stage: kernel_matrix_testing_prepare @@ -72,7 +72,7 @@ kmt_setup_env_secagent_x64: # upload connector to metal instance - scp $CI_PROJECT_DIR/connector-${ARCH} metal_instance:/home/ubuntu/connector after_script: - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY - !reference [.tag_kmt_ci_job] variables: AWS_EC2_SSH_KEY_FILE: $CI_PROJECT_DIR/ssh_key @@ -148,11 +148,48 @@ kmt_run_secagent_tests_x64: - "opensuse_15.3" - "opensuse_15.5" - "suse_12.5" - TEST_SET: [all_tests] + TEST_SET: [cws_host] after_script: - !reference [.collect_outcomes_kmt] - !reference [.upload_junit_kmt] +kmt_run_secagent_tests_x64_docker: + extends: + - .kmt_run_secagent_tests + image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/system-probe_x64$DATADOG_AGENT_SYSPROBE_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_SYSPROBE_BUILDIMAGES + tags: ["arch:amd64"] + needs: + - kmt_setup_env_secagent_x64 + - upload_dependencies_secagent_x64 + - upload_secagent_tests_x64 + variables: + ARCH: "x86_64" + parallel: + matrix: + - TAG: + - "ubuntu_18.04" + - "ubuntu_20.04" + - "ubuntu_22.04" + - "ubuntu_23.10" + - "ubuntu_24.04" + - "amazon_4.14" + - "amazon_5.4" + - "amazon_5.10" + - "amazon_2023" + - "fedora_37" + - "fedora_38" + - "debian_10" + - "debian_11" + - "debian_12" + - "centos_7.9" + - "oracle_8.9" + - "oracle_9.3" + - "rocky_8.5" + - "rocky_9.3" + TEST_SET: [cws_docker] + after_script: + - !reference [.collect_outcomes_kmt] + - !reference [.upload_junit_kmt] kmt_run_secagent_tests_arm64: extends: @@ -182,10 +219,44 @@ kmt_run_secagent_tests_arm64: - "oracle_9.3" - "rocky_8.5" - "rocky_9.3" - # - "opensuse_15.5" - TEST_SET: ["all_tests"] + - "opensuse_15.5" + TEST_SET: ["cws_host"] + after_script: + - !reference [.collect_outcomes_kmt] + - !reference [.upload_junit_kmt] + +kmt_run_secagent_tests_arm64_docker: + extends: + - .kmt_run_secagent_tests + image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/system-probe_arm64$DATADOG_AGENT_SYSPROBE_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_SYSPROBE_BUILDIMAGES + tags: ["arch:arm64"] + needs: + - kmt_setup_env_secagent_arm64 + - upload_dependencies_secagent_arm64 + - upload_secagent_tests_arm64 + variables: + ARCH: "arm64" + parallel: + matrix: + - TAG: + - "ubuntu_22.04" + - "ubuntu_23.10" + - "ubuntu_24.04" + - "amazon_5.4" + - "amazon_5.10" + - "amazon_2023" + - "fedora_37" + - "fedora_38" + - "debian_11" + - "debian_12" + - "oracle_8.9" + - "oracle_9.3" + - "rocky_8.5" + - "rocky_9.3" + TEST_SET: ["cws_docker"] after_script: - !reference [.collect_outcomes_kmt] + - !reference [.upload_junit_kmt] .kmt_secagent_cleanup: extends: diff --git a/.gitlab/kernel_matrix_testing/system_probe.yml b/.gitlab/kernel_matrix_testing/system_probe.yml index da9c47e167702..7b16017409d4b 100644 --- a/.gitlab/kernel_matrix_testing/system_probe.yml +++ b/.gitlab/kernel_matrix_testing/system_probe.yml @@ -35,7 +35,7 @@ upload_dependencies_sysprobe_arm64: - mkdir $KMT_DOCKERS - inv -e system-probe.save-test-dockers --use-crane --output-dir $KMT_DOCKERS --arch $ARCH after_script: - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY - !reference [.tag_kmt_ci_job] artifacts: expire_in: 1 day @@ -82,7 +82,7 @@ pull_test_dockers_arm64: - !reference [.setup_ssh_config] - scp $CI_PROJECT_DIR/kmt-deps/ci/$ARCH/$ARCHIVE_NAME metal_instance:/opt/kernel-version-testing/ after_script: - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY - !reference [.tag_kmt_ci_job] variables: DEPENDENCIES: $CI_PROJECT_DIR/kmt-deps/ci/$ARCH/btfs @@ -161,7 +161,7 @@ kmt_setup_env_sysprobe_x64: # upload connector to metal instance - scp $CI_PROJECT_DIR/connector-${ARCH} metal_instance:/home/ubuntu/connector after_script: - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY - !reference [.tag_kmt_ci_job] variables: AWS_EC2_SSH_KEY_FILE: $CI_PROJECT_DIR/ssh_key @@ -270,6 +270,7 @@ kmt_run_sysprobe_tests_arm64: TEST_SET: ["only_usm", "no_usm"] after_script: - !reference [.collect_outcomes_kmt] + - !reference [.upload_junit_kmt] .kmt_sysprobe_cleanup: extends: diff --git a/.gitlab/lint/linux.yml b/.gitlab/lint/linux.yml index 9f85e2c6d851a..dcdd772fca2db 100644 --- a/.gitlab/lint/linux.yml +++ b/.gitlab/lint/linux.yml @@ -10,7 +10,7 @@ script: - !reference [.retrieve_linux_go_deps] - !reference [.retrieve_linux_go_tools_deps] - - inv -e rtloader.make --install-prefix=$CI_PROJECT_DIR/dev --python-runtimes "3" + - inv -e rtloader.make --install-prefix=$CI_PROJECT_DIR/dev - inv -e rtloader.install - inv -e install-tools - inv -e linter.go --cpus $KUBERNETES_CPU_REQUEST --debug $FLAVORS $EXTRA_OPTS diff --git a/.gitlab/notify/notify.yml b/.gitlab/notify/notify.yml index ac45f8ca6c4cc..1feadeb33e838 100644 --- a/.gitlab/notify/notify.yml +++ b/.gitlab/notify/notify.yml @@ -25,8 +25,8 @@ notify: resource_group: notification timeout: 15 minutes # Added to prevent a stuck job blocking the resource_group defined above script: - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_READ_API_TOKEN) || exit $?; export GITLAB_TOKEN - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN read_api) || exit $?; export GITLAB_TOKEN + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY - python3 -m pip install -r requirements.txt -r tasks/libs/requirements-notifications.txt - | # Do not send notifications if this is a child pipeline of another repo @@ -53,8 +53,8 @@ send_pipeline_stats: when: always dependencies: [] script: - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_READ_API_TOKEN) || exit $?; export GITLAB_TOKEN - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN read_api) || exit $?; export GITLAB_TOKEN + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY - invoke -e notify.send-stats notify_github: @@ -95,7 +95,6 @@ notify_gitlab_ci_changes: needs: [compute_gitlab_ci_config] tags: ["arch:amd64"] rules: - - !reference [.compute_gitlab_ci_config_rules] - changes: paths: - .gitlab-ci.yml @@ -115,9 +114,9 @@ notify_gitlab_ci_changes: timeout: 15 minutes # Added to prevent a stuck job blocking the resource_group defined above .failure_summary_setup: - - SLACK_API_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SLACK_AGENT_CI_TOKEN) || exit $?; export SLACK_API_TOKEN - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_READ_API_TOKEN) || exit $?; export GITLAB_TOKEN - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - SLACK_API_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SLACK_AGENT token) || exit $?; export SLACK_API_TOKEN + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN read_api) || exit $?; export GITLAB_TOKEN + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY - python3 -m pip install -r requirements.txt -r tasks/libs/requirements-notifications.txt # Upload failure summary data to S3 at the end of each main pipeline @@ -173,8 +172,8 @@ close_failing_tests_stale_issues: echo "This script is run weekly on Fridays" exit fi - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY - - DD_APP_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $APP_KEY_ORG2) || exit $?; export DD_APP_KEY + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY + - DD_APP_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_APP_KEY_ORG2 token) || exit $?; export DD_APP_KEY - ATLASSIAN_PASSWORD=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $ATLASSIAN_WRITE token) || exit $?; export ATLASSIAN_PASSWORD - ATLASSIAN_USERNAME=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $ATLASSIAN_WRITE user) || exit $?; export ATLASSIAN_USERNAME - python3 -m pip install -r requirements.txt -r tasks/requirements_release_tasks.txt # For Atlassian / Jira dependencies diff --git a/.gitlab/package_build/dmg.yml b/.gitlab/package_build/dmg.yml index 02d0b830cc910..0ac48bda37ff7 100644 --- a/.gitlab/package_build/dmg.yml +++ b/.gitlab/package_build/dmg.yml @@ -9,7 +9,7 @@ - $S3_CP_CMD $S3_ARTIFACTS_URI/agent-version.cache . - export VERSION_CACHE_CONTENT=$(cat agent-version.cache | base64 -) - python3 -m pip install -r tasks/libs/requirements-github.txt - - inv -e github.trigger-macos --workflow-type "build" --datadog-agent-ref "$CI_COMMIT_SHA" --release-version "$RELEASE_VERSION" --major-version "$AGENT_MAJOR_VERSION" --python-runtimes "$PYTHON_RUNTIMES" --destination "$OMNIBUS_PACKAGE_DIR" --version-cache "$VERSION_CACHE_CONTENT" --integrations-core-ref "$INTEGRATIONS_CORE_VERSION" + - inv -e github.trigger-macos --workflow-type "build" --datadog-agent-ref "$CI_COMMIT_SHA" --release-version "$RELEASE_VERSION" --major-version "$AGENT_MAJOR_VERSION" --destination "$OMNIBUS_PACKAGE_DIR" --version-cache "$VERSION_CACHE_CONTENT" --integrations-core-ref "$INTEGRATIONS_CORE_VERSION" - !reference [.upload_sbom_artifacts] timeout: 3h # MacOS builds can take 1h~2h, increase the timeout to avoid timeout flakes artifacts: diff --git a/.gitlab/package_build/heroku.yml b/.gitlab/package_build/heroku.yml index 0b06b6317fa7e..a0244f105c80b 100644 --- a/.gitlab/package_build/heroku.yml +++ b/.gitlab/package_build/heroku.yml @@ -28,11 +28,9 @@ - $S3_CP_CMD $S3_PERMANENT_ARTIFACTS_URI/llc-$CLANG_LLVM_VER.${PACKAGE_ARCH} /tmp/system-probe/llc-bpf - cp $CI_PROJECT_DIR/minimized-btfs.tar.xz /tmp/system-probe/minimized-btfs.tar.xz - chmod 0744 /tmp/system-probe/clang-bpf /tmp/system-probe/llc-bpf - - inv -e omnibus.build --release-version "$RELEASE_VERSION" --major-version "$AGENT_MAJOR_VERSION" --python-runtimes "$PYTHON_RUNTIMES" --base-dir $OMNIBUS_BASE_DIR ${USE_S3_CACHING} --skip-deps --go-mod-cache="$GOPATH/pkg/mod" --system-probe-bin=/tmp/system-probe --flavor heroku + - inv -e omnibus.build --release-version "$RELEASE_VERSION" --major-version "$AGENT_MAJOR_VERSION" --base-dir $OMNIBUS_BASE_DIR ${USE_S3_CACHING} --skip-deps --go-mod-cache="$GOPATH/pkg/mod" --system-probe-bin=/tmp/system-probe --flavor heroku - ls -la $OMNIBUS_PACKAGE_DIR - !reference [.lint_linux_packages] - - $S3_CP_CMD $OMNIBUS_PACKAGE_DIR/datadog-heroku-agent_*_${PACKAGE_ARCH}.deb $S3_ARTIFACTS_URI/$DESTINATION_DEB - - $S3_CP_CMD $OMNIBUS_PACKAGE_DIR/datadog-heroku-agent-dbg_*_${PACKAGE_ARCH}.deb $S3_ARTIFACTS_URI/$DESTINATION_DBG_DEB - !reference [.upload_sbom_artifacts] variables: KUBERNETES_MEMORY_REQUEST: "32Gi" diff --git a/.gitlab/package_build/installer.yml b/.gitlab/package_build/installer.yml index 182b649974878..3798374c71dd5 100644 --- a/.gitlab/package_build/installer.yml +++ b/.gitlab/package_build/installer.yml @@ -21,7 +21,7 @@ - chmod 0744 /tmp/system-probe/clang-bpf /tmp/system-probe/llc-bpf # NOTE: for now, we consider "ociru" to be a "redhat_target" in omnibus/lib/ostools.rb # if we ever start building on a different platform, that might need to change - - inv -e omnibus.build --release-version "$RELEASE_VERSION" --major-version "$AGENT_MAJOR_VERSION" --python-runtimes "$PYTHON_RUNTIMES" --base-dir $OMNIBUS_BASE_DIR ${USE_S3_CACHING} --skip-deps --go-mod-cache="$GOPATH/pkg/mod" --system-probe-bin=/tmp/system-probe --host-distribution=ociru --install-directory="$INSTALL_DIR" + - inv -e omnibus.build --release-version "$RELEASE_VERSION" --major-version "$AGENT_MAJOR_VERSION" --base-dir $OMNIBUS_BASE_DIR ${USE_S3_CACHING} --skip-deps --go-mod-cache="$GOPATH/pkg/mod" --system-probe-bin=/tmp/system-probe --host-distribution=ociru --install-directory="$INSTALL_DIR" - ls -la $OMNIBUS_PACKAGE_DIR - !reference [.upload_sbom_artifacts] variables: diff --git a/.gitlab/package_build/linux.yml b/.gitlab/package_build/linux.yml index e261e31399f13..568ff1a24f7dd 100644 --- a/.gitlab/package_build/linux.yml +++ b/.gitlab/package_build/linux.yml @@ -12,7 +12,7 @@ - $S3_CP_CMD $S3_PERMANENT_ARTIFACTS_URI/llc-$CLANG_LLVM_VER.${PACKAGE_ARCH} /tmp/system-probe/llc-bpf - cp $CI_PROJECT_DIR/minimized-btfs.tar.xz /tmp/system-probe/minimized-btfs.tar.xz - chmod 0744 /tmp/system-probe/clang-bpf /tmp/system-probe/llc-bpf - - inv -e omnibus.build --release-version "$RELEASE_VERSION" --major-version "$AGENT_MAJOR_VERSION" --python-runtimes "$PYTHON_RUNTIMES" --base-dir $OMNIBUS_BASE_DIR ${USE_S3_CACHING} --skip-deps --go-mod-cache="$GOPATH/pkg/mod" --system-probe-bin=/tmp/system-probe --flavor "$FLAVOR" --config-directory "$CONFIG_DIR" --install-directory "$INSTALL_DIR" + - inv -e omnibus.build --release-version "$RELEASE_VERSION" --major-version "$AGENT_MAJOR_VERSION" --base-dir $OMNIBUS_BASE_DIR ${USE_S3_CACHING} --skip-deps --go-mod-cache="$GOPATH/pkg/mod" --system-probe-bin=/tmp/system-probe --flavor "$FLAVOR" --config-directory "$CONFIG_DIR" --install-directory "$INSTALL_DIR" - ls -la $OMNIBUS_PACKAGE_DIR - !reference [.upload_sbom_artifacts] @@ -181,7 +181,7 @@ iot-agent-armhf: - !reference [.cache_omnibus_ruby_deps, setup] # remove artifacts from previous pipelines that may come from the cache - rm -rf $OMNIBUS_PACKAGE_DIR/* - - inv -e omnibus.build --release-version $RELEASE_VERSION_7 --major-version 7 --python-runtimes 3 --base-dir $OMNIBUS_BASE_DIR ${USE_S3_CACHING} --skip-deps --go-mod-cache="$GOPATH/pkg/mod" --target-project dogstatsd + - inv -e omnibus.build --release-version $RELEASE_VERSION_7 --major-version 7 --base-dir $OMNIBUS_BASE_DIR ${USE_S3_CACHING} --skip-deps --go-mod-cache="$GOPATH/pkg/mod" --target-project dogstatsd - ls -la $OMNIBUS_PACKAGE_DIR - !reference [.upload_sbom_artifacts] variables: diff --git a/.gitlab/packaging/deb.yml b/.gitlab/packaging/deb.yml index 1bed3c58a89cc..1e672a00de1e4 100644 --- a/.gitlab/packaging/deb.yml +++ b/.gitlab/packaging/deb.yml @@ -7,7 +7,6 @@ - !reference [.setup_deb_signing_key] - inv -e omnibus.build --release-version "$RELEASE_VERSION" --major-version "$AGENT_MAJOR_VERSION" --base-dir $OMNIBUS_BASE_DIR --skip-deps --target-project ${DD_PROJECT} ${OMNIBUS_EXTRA_ARGS} - !reference [.lint_linux_packages] - - $S3_CP_CMD $OMNIBUS_PACKAGE_DIR/datadog-${DD_PROJECT}_*_${PACKAGE_ARCH}.deb $S3_ARTIFACTS_URI/$DESTINATION_DEB artifacts: expire_in: 2 weeks paths: @@ -68,7 +67,6 @@ agent_deb-arm64-a7: - !reference [.setup_deb_signing_key] - inv -e omnibus.build --release-version "$RELEASE_VERSION" --major-version "$AGENT_MAJOR_VERSION" --base-dir $OMNIBUS_BASE_DIR --skip-deps --target-project ${DD_PROJECT} --flavor ot ${OMNIBUS_EXTRA_ARGS} - !reference [.lint_linux_packages] - - $S3_CP_CMD $OMNIBUS_PACKAGE_DIR/datadog-ot-agent_*_${PACKAGE_ARCH}.deb $S3_ARTIFACTS_URI/$DESTINATION_DEB ot_agent_deb-x64-a7: extends: [.package_ot_deb_common, .package_deb_x86, .package_deb_agent_7] @@ -126,7 +124,6 @@ installer_deb-arm64: - !reference [.setup_deb_signing_key] - inv -e omnibus.build --release-version "$RELEASE_VERSION" --base-dir $OMNIBUS_BASE_DIR --skip-deps --flavor iot - !reference [.lint_linux_packages] - - $S3_CP_CMD $OMNIBUS_PACKAGE_DIR/datadog-*_${PACKAGE_ARCH}.deb $S3_ARTIFACTS_URI/$DESTINATION_DEB artifacts: expire_in: 2 weeks paths: diff --git a/.gitlab/packaging/oci.yml b/.gitlab/packaging/oci.yml index 0efb48a3e6e0e..62519011d319b 100644 --- a/.gitlab/packaging/oci.yml +++ b/.gitlab/packaging/oci.yml @@ -59,9 +59,7 @@ - ls -l ${OUTPUT_DIR}/ - datadog-package merge ${OUTPUT_DIR}/*.tar # We need to propagate the exact version in the pipeline artifact - - cp merged.tar ${OMNIBUS_PACKAGE_DIR}/${MERGED_FILE} - # Only the major version is needed in the S3 bucket - - $S3_CP_CMD merged.tar $S3_ARTIFACTS_URI/${OCI_PRODUCT}_7_oci.tar + - mv merged.tar ${OMNIBUS_PACKAGE_DIR}/${MERGED_FILE} artifacts: paths: - ${OMNIBUS_PACKAGE_DIR} diff --git a/.gitlab/pkg_metrics/pkg_metrics.yml b/.gitlab/pkg_metrics/pkg_metrics.yml index 7001321d669c4..c2927f8e4ac27 100644 --- a/.gitlab/pkg_metrics/pkg_metrics.yml +++ b/.gitlab/pkg_metrics/pkg_metrics.yml @@ -45,7 +45,7 @@ send_pkg_size: optional: true script: # Get API key to send metrics - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY # Allow failures: some packages are not always built, and therefore stats cannot be sent for them - set +e diff --git a/.gitlab/setup/setup.yml b/.gitlab/setup/setup.yml index 28779481845c8..8321782a850ea 100644 --- a/.gitlab/setup/setup.yml +++ b/.gitlab/setup/setup.yml @@ -21,12 +21,12 @@ github_rate_limit_info: - GITHUB_KEY_B64=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $MACOS_GITHUB_APP_1 key_b64) || exit $?; export GITHUB_KEY_B64 - GITHUB_APP_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $MACOS_GITHUB_APP_1 app_id) || exit $?; export GITHUB_APP_ID - GITHUB_INSTALLATION_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $MACOS_GITHUB_APP_1 installation_id) || exit $?; export GITHUB_INSTALLATION_ID - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY - inv github.send-rate-limit-info-datadog --pipeline-id $CI_PIPELINE_ID --app-instance 1 # Send stats for app 2 - GITHUB_KEY_B64=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $MACOS_GITHUB_APP_2 key_b64) || exit $?; export GITHUB_KEY_B64 - GITHUB_APP_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $MACOS_GITHUB_APP_2 app_id) || exit $?; export GITHUB_APP_ID - GITHUB_INSTALLATION_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $MACOS_GITHUB_APP_2 installation_id) || exit $?; export GITHUB_INSTALLATION_ID - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY - inv github.send-rate-limit-info-datadog --pipeline-id $CI_PIPELINE_ID --app-instance 2 allow_failure: true diff --git a/.gitlab/source_test/golang_deps_diff.yml b/.gitlab/source_test/golang_deps_diff.yml index 6d156dd6f4963..b12d9b3ee1e2d 100644 --- a/.gitlab/source_test/golang_deps_diff.yml +++ b/.gitlab/source_test/golang_deps_diff.yml @@ -15,7 +15,7 @@ golang_deps_diff: - !reference [.retrieve_linux_go_deps] script: # Get API key to send metrics - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY - inv -e diff.go-deps --report-file=deps-report.md --report-metrics --git-ref "${CI_COMMIT_REF_NAME}" artifacts: paths: @@ -64,7 +64,7 @@ golang_deps_send_count_metrics: - !reference [.retrieve_linux_go_deps] script: # Get API key to send metrics - - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $API_KEY_ORG2) || exit $?; export DD_API_KEY + - DD_API_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_API_KEY_ORG2 token) || exit $?; export DD_API_KEY - inv -e go-deps.send-count-metrics --git-sha "${CI_COMMIT_SHA}" --git-ref "${CI_COMMIT_REF_NAME}" golang_deps_test: diff --git a/.gitlab/source_test/linux.yml b/.gitlab/source_test/linux.yml index 731630dd74842..50e121aea3f7b 100644 --- a/.gitlab/source_test/linux.yml +++ b/.gitlab/source_test/linux.yml @@ -5,7 +5,7 @@ before_script: - source /root/.bashrc && conda activate $CONDA_ENV - !reference [.retrieve_linux_go_deps] - - inv -e rtloader.make --install-prefix=$CI_PROJECT_DIR/dev --python-runtimes "$PYTHON_RUNTIMES" + - inv -e rtloader.make --install-prefix=$CI_PROJECT_DIR/dev - inv -e rtloader.install - inv -e rtloader.format --raise-if-changed - inv -e rtloader.test @@ -33,7 +33,7 @@ - if [[ "$FAST_TESTS" == "true" ]]; then FAST_TESTS_FLAG="--only-impacted-packages"; fi - inv -e sds.build-library - inv -e agent.build - - inv -e test $FLAVORS --include-sds --race --profile --rerun-fails=2 --python-runtimes "$PYTHON_RUNTIMES" --coverage --cpus $KUBERNETES_CPU_REQUEST $EXTRA_OPTS --save-result-json $TEST_OUTPUT_FILE --junit-tar "junit-${CI_JOB_NAME}.tgz" --build-stdlib $FAST_TESTS_FLAG --test-washer + - inv -e test $FLAVORS --include-sds --race --profile --rerun-fails=2 --coverage --cpus $KUBERNETES_CPU_REQUEST $EXTRA_OPTS --save-result-json $TEST_OUTPUT_FILE --junit-tar "junit-${CI_JOB_NAME}.tgz" --build-stdlib $FAST_TESTS_FLAG --test-washer artifacts: expire_in: 2 weeks when: always @@ -124,6 +124,7 @@ tests_deb-arm64-py3: - .rtloader_tests - .linux_tests after_script: + - !reference [.upload_junit_source] - !reference [.upload_coverage] image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/deb_arm64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES tags: ["arch:arm64"] @@ -136,6 +137,7 @@ tests_rpm-arm64-py3: - .rtloader_tests - .linux_tests after_script: + - !reference [.upload_junit_source] - !reference [.upload_coverage] image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/rpm_arm64$DATADOG_AGENT_BUILDIMAGES_SUFFIX:$DATADOG_AGENT_BUILDIMAGES tags: ["arch:arm64"] @@ -172,7 +174,7 @@ new-e2e-unit-tests: - !reference [.retrieve_linux_go_e2e_deps] # Setup AWS Credentials - mkdir -p ~/.aws - - $CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_QA_PROFILE >> ~/.aws/config || exit $? + - $CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_QA_E2E profile >> ~/.aws/config || exit $? - export AWS_PROFILE=agent-qa-ci # Use S3 backend - pulumi login "s3://dd-pulumi-state?region=us-east-1&awssdk=v2&profile=$AWS_PROFILE" diff --git a/.gitlab/source_test/macos.yml b/.gitlab/source_test/macos.yml index cb8efadf9b518..a1bfc84392158 100644 --- a/.gitlab/source_test/macos.yml +++ b/.gitlab/source_test/macos.yml @@ -21,7 +21,7 @@ tests_macos: - python3 -m pip install -r tasks/libs/requirements-github.txt - FAST_TESTS_FLAG="" - if [[ "$FAST_TESTS" = "true" ]]; then FAST_TESTS_FLAG="--fast-tests true"; fi - - inv -e github.trigger-macos --workflow-type "test" --datadog-agent-ref "$CI_COMMIT_SHA" --python-runtimes "$PYTHON_RUNTIMES" --version-cache "$VERSION_CACHE_CONTENT" $FAST_TESTS_FLAG --test-washer $COVERAGE_CACHE_FLAG + - inv -e github.trigger-macos --workflow-type "test" --datadog-agent-ref "$CI_COMMIT_SHA" --version-cache "$VERSION_CACHE_CONTENT" $FAST_TESTS_FLAG --test-washer $COVERAGE_CACHE_FLAG timeout: 6h after_script: - $CI_PROJECT_DIR/tools/ci/junit_upload.sh "junit-*-repacked.tgz" @@ -50,7 +50,7 @@ tests_macos: - inv -e gitlab.generate-ci-visibility-links --output=$EXTERNAL_LINKS_PATH - FAST_TESTS_FLAG="" - if [[ "$FAST_TESTS" == "true" ]]; then FAST_TESTS_FLAG="--only-impacted-packages"; fi - - inv -e test --rerun-fails=2 --python-runtimes $PYTHON_RUNTIMES --race --profile --cpus 12 --save-result-json $TEST_OUTPUT_FILE --junit-tar "junit-${CI_JOB_NAME}.tgz" $FAST_TESTS_FLAG --test-washer + - inv -e test --rerun-fails=2 --race --profile --cpus 12 --save-result-json $TEST_OUTPUT_FILE --junit-tar "junit-${CI_JOB_NAME}.tgz" $FAST_TESTS_FLAG --test-washer - inv -e invoke-unit-tests artifacts: expire_in: 2 weeks diff --git a/.gitlab/source_test/windows.yml b/.gitlab/source_test/windows.yml index fa4b857241a24..96f3fa43806e6 100644 --- a/.gitlab/source_test/windows.yml +++ b/.gitlab/source_test/windows.yml @@ -46,7 +46,7 @@ -e COVERAGE_CACHE_FLAG="${COVERAGE_CACHE_FLAG}" 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-buildimages/windows_1809_${ARCH}${Env:DATADOG_AGENT_WINBUILDIMAGES_SUFFIX}:${Env:DATADOG_AGENT_WINBUILDIMAGES} c:\mnt\tasks\winbuildscripts\unittests.bat - - If ($lastExitCode -ne "0") { throw "Previous command returned $lastExitCode" } + - If ($lastExitCode -ne "0") { exit "$lastExitCode" } variables: TEST_OUTPUT_FILE: test_output.json artifacts: diff --git a/.gitlab/trigger_release/trigger_release.yml b/.gitlab/trigger_release/trigger_release.yml index c0c67e2d50d49..1993d598ff476 100644 --- a/.gitlab/trigger_release/trigger_release.yml +++ b/.gitlab/trigger_release/trigger_release.yml @@ -19,7 +19,7 @@ # agent-release-management creates pipeline for both Agent 6 and Agent 7 # when triggered with major version 7 - RELEASE_VERSION="$(inv agent.version --major-version 7 --url-safe --omnibus-format)-1" || exit $?; export RELEASE_VERSION - - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_SCHEDULER_TOKEN) || exit $?; export GITLAB_TOKEN + - GITLAB_TOKEN=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $GITLAB_TOKEN write_api) || exit $?; export GITLAB_TOKEN - 'inv pipeline.trigger-child-pipeline --project-name "DataDog/agent-release-management" --git-ref "main" --variable ACTION --variable AUTO_RELEASE diff --git a/.golangci.yml b/.golangci.yml index a5860decf1f76..3fd4e9d35e2b5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -18,6 +18,8 @@ issues: exclude: - "Error return value of `io.WriteString` is not checked" # 'errcheck' errors in tools/dep_tree_resolver/go_deps.go - "Error return value of `pem.Encode` is not checked" # 'errcheck' errors in test/integration/utils/certificates.go + - "Error return value of `c.logErrorNotImplemented` is not checked" # 'errcheck' errors in pkg/config/nodetreemodel/config.go + - "Error return value of `n.logErrorNotImplemented` is not checked" # 'errcheck' errors in pkg/config/nodetreemodel/config.go - "exported: exported const Exec should have comment \\(or a comment on this block\\) or be unexported" # 'revive' errors in pkg/process/events/model/model_common.go - "exported: exported const APIName should have comment \\(or a comment on this block\\) or be unexported" # 'revive' errors in pkg/serverless/trace/inferredspan/constants.go - "unnecessary conversion" # 'unconvert' errors in test/integration/utils/certificates_test.go @@ -582,6 +584,7 @@ linters: - gosimple # Linter for Go source code that specializes in simplifying code. - gocheckcompilerdirectives # Checks Go compiler directives syntax - pkgconfigusage # Linter for checking usage of pkgconfig inside components folder + - forbidigo # prevent usage of unwanted/deprecated symbol in the code base linters-settings: depguard: @@ -711,6 +714,18 @@ linters-settings: - name: var-naming # non-default rules: - name: duplicated-imports + forbidigo: + forbid: + - p: ^model.NewConfig.*$ + pkg: ^github.com/DataDog/datadog-agent/pkg/config/model$ + msg: use pkg/config/mock instead in tests or the config component + - p: ^setup.SetDatadog.*$ + pkg: ^github.com/DataDog/datadog-agent/pkg/config/setup$ + msg: use pkg/config/mock instead for tests or the config component + - p: ^setup.SetSystemProbe.*$ + pkg: ^github.com/DataDog/datadog-agent/pkg/config/setup$ + msg: use pkg/config/mock instead for tests or the config component + analyze-types: true custom: pkgconfigusage: type: "module" diff --git a/.mockery.yaml b/.mockery.yaml index 9135bad6ef9c3..50c2336b1f844 100644 --- a/.mockery.yaml +++ b/.mockery.yaml @@ -29,6 +29,8 @@ packages: github.com/DataDog/datadog-agent/pkg/process/net: interfaces: SysProbeUtil: + config: + with-expecter: true github.com/DataDog/datadog-agent/pkg/process/procutil: interfaces: Probe: @@ -40,5 +42,5 @@ packages: config: mock-build-tags: test replace-type: - # https://github.com/vektra/mockery/issues/331 - - github.com/DataDog/datadog-agent/pkg/serializer/types.stubMessageBody=github.com/DataDog/datadog-agent/pkg/serializer/types.ProcessMessageBody + # https://github.com/vektra/mockery/issues/331 + - github.com/DataDog/datadog-agent/pkg/serializer/types.stubMessageBody=github.com/DataDog/datadog-agent/pkg/serializer/types.ProcessMessageBody diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fc452249df5e4..27f0cdfa3dec2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -116,6 +116,14 @@ repos: files: .*gitlab.*\.yml$ pass_filenames: false stages: [pre-push] + - id: gitlab-lint-jobs-codeowners + name: gitlab-lint-jobs-codeowners + description: lint the gitlab configuration to verify jobs codeowners + entry: 'inv linter.gitlab-ci-jobs-codeowners' + language: system + require_serial: true + files: .*gitlab.*\.yml$ + pass_filenames: false - id: update-go name: update-go description: test formatting of files will allow go update diff --git a/Dockerfiles/agent/entrypoint.d/otel-agent b/Dockerfiles/agent/entrypoint.d/otel-agent index ed58d8b7f6fdc..f3f0809ef3195 100755 --- a/Dockerfiles/agent/entrypoint.d/otel-agent +++ b/Dockerfiles/agent/entrypoint.d/otel-agent @@ -1,4 +1,6 @@ #!/usr/bin/env bash set -euo pipefail +if [[ -x /opt/datadog-agent/embedded/bin/otel-agent ]]; then exec /opt/datadog-agent/embedded/bin/otel-agent --config /etc/datadog-agent/otel-config.yaml +fi diff --git a/LICENSE-3rdparty.csv b/LICENSE-3rdparty.csv index 20bf49bdccb73..bf3e57830b446 100644 --- a/LICENSE-3rdparty.csv +++ b/LICENSE-3rdparty.csv @@ -6,7 +6,6 @@ core,cloud.google.com/go/auth/credentials/internal/externalaccountuser,Apache-2. core,cloud.google.com/go/auth/credentials/internal/gdch,Apache-2.0,Copyright 2019 Google LLC core,cloud.google.com/go/auth/credentials/internal/impersonate,Apache-2.0,Copyright 2019 Google LLC core,cloud.google.com/go/auth/credentials/internal/stsexchange,Apache-2.0,Copyright 2019 Google LLC -core,cloud.google.com/go/auth/grpctransport,Apache-2.0,Copyright 2019 Google LLC core,cloud.google.com/go/auth/httptransport,Apache-2.0,Copyright 2019 Google LLC core,cloud.google.com/go/auth/internal,Apache-2.0,Copyright 2019 Google LLC core,cloud.google.com/go/auth/internal/credsfile,Apache-2.0,Copyright 2019 Google LLC @@ -15,16 +14,6 @@ core,cloud.google.com/go/auth/internal/transport,Apache-2.0,Copyright 2019 Googl core,cloud.google.com/go/auth/internal/transport/cert,Apache-2.0,Copyright 2019 Google LLC core,cloud.google.com/go/auth/oauth2adapt,Apache-2.0,Copyright 2019 Google LLC core,cloud.google.com/go/compute/metadata,Apache-2.0,Copyright 2019 Google LLC -core,cloud.google.com/go/iam,Apache-2.0,Copyright 2019 Google LLC -core,cloud.google.com/go/iam/apiv1/iampb,Apache-2.0,Copyright 2019 Google LLC -core,cloud.google.com/go/internal,Apache-2.0,Copyright 2019 Google LLC -core,cloud.google.com/go/internal/optional,Apache-2.0,Copyright 2019 Google LLC -core,cloud.google.com/go/internal/trace,Apache-2.0,Copyright 2019 Google LLC -core,cloud.google.com/go/internal/version,Apache-2.0,Copyright 2019 Google LLC -core,cloud.google.com/go/storage,Apache-2.0,Copyright 2019 Google LLC -core,cloud.google.com/go/storage/internal,Apache-2.0,Copyright 2019 Google LLC -core,cloud.google.com/go/storage/internal/apiv2,Apache-2.0,Copyright 2019 Google LLC -core,cloud.google.com/go/storage/internal/apiv2/storagepb,Apache-2.0,Copyright 2019 Google LLC core,code.cloudfoundry.org/bbs,Apache-2.0,"Copyright (c) 2016-Present CloudFoundry.org Foundation, Inc. All Rights Reserved." core,code.cloudfoundry.org/bbs/encryption,Apache-2.0,"Copyright (c) 2016-Present CloudFoundry.org Foundation, Inc. All Rights Reserved." core,code.cloudfoundry.org/bbs/events,Apache-2.0,"Copyright (c) 2016-Present CloudFoundry.org Foundation, Inc. All Rights Reserved." @@ -254,6 +243,9 @@ core,github.com/Microsoft/hcsshim/internal/wclayer,MIT,Copyright (c) 2015 Micros core,github.com/Microsoft/hcsshim/internal/winapi,MIT,Copyright (c) 2015 Microsoft | Copyright (c) 2018 Microsoft Corp. All rights reserved core,github.com/Microsoft/hcsshim/osversion,MIT,Copyright (c) 2015 Microsoft | Copyright (c) 2018 Microsoft Corp. All rights reserved core,github.com/Microsoft/hcsshim/pkg/ociwclayer,MIT,Copyright (c) 2015 Microsoft | Copyright (c) 2018 Microsoft Corp. All rights reserved +core,github.com/NVIDIA/go-nvml/pkg/dl,Apache-2.0,Copyright 2023 NVIDIA CORPORATION +core,github.com/NVIDIA/go-nvml/pkg/nvml,Apache-2.0,Copyright 2023 NVIDIA CORPORATION +core,github.com/NVIDIA/go-nvml/pkg/nvml/mock,Apache-2.0,Copyright 2023 NVIDIA CORPORATION core,github.com/NYTimes/gziphandler,Apache-2.0,Copyright 2016-2017 The New York Times Company core,github.com/OneOfOne/xxhash,Apache-2.0,Copyright (c) 2014 Ahmed W. (OneOfOne) core,github.com/ProtonMail/go-crypto/bitcurves,BSD-3-Clause,Copyright (c) 2009 The Go Authors. All rights reserved @@ -2291,7 +2283,6 @@ core,go.opencensus.io/internal,Apache-2.0,"Copyright 2018, OpenCensus Authors" core,go.opencensus.io/internal/tagencoding,Apache-2.0,"Copyright 2018, OpenCensus Authors" core,go.opencensus.io/metric/metricdata,Apache-2.0,"Copyright 2018, OpenCensus Authors" core,go.opencensus.io/metric/metricproducer,Apache-2.0,"Copyright 2018, OpenCensus Authors" -core,go.opencensus.io/plugin/ocgrpc,Apache-2.0,"Copyright 2018, OpenCensus Authors" core,go.opencensus.io/plugin/ochttp,Apache-2.0,"Copyright 2018, OpenCensus Authors" core,go.opencensus.io/plugin/ochttp/propagation/b3,Apache-2.0,"Copyright 2018, OpenCensus Authors" core,go.opencensus.io/resource,Apache-2.0,"Copyright 2018, OpenCensus Authors" @@ -2712,18 +2703,13 @@ core,gonum.org/v1/gonum/mat,BSD-3-Clause,Alexander Egurnov 0 { + q := url.Query() + q.Set("provider_timeout", strconv.FormatInt(int64(providerTimeout), 10)) + url.RawQuery = q.Encode() + } + + urlstr := url.String() // Set session token if err = util.SetAuthToken(pkgconfigsetup.Datadog()); err != nil { fmt.Fprintln(color.Output, color.RedString(fmt.Sprintf("Error: %s", err))) - return createArchive(flareComp, pdata, err) + return createArchive(flareComp, pdata, providerTimeout, err) } p, err := json.Marshal(pdata) @@ -414,15 +431,15 @@ func requestArchive(flareComp flare.Component, pdata flare.ProfileData) (string, fmt.Fprintln(color.Output, color.RedString("The agent was unable to make the flare. (is it running?)")) err = fmt.Errorf("Error getting flare from running agent: %w", err) } - return createArchive(flareComp, pdata, err) + return createArchive(flareComp, pdata, providerTimeout, err) } return string(r), nil } -func createArchive(flareComp flare.Component, pdata flare.ProfileData, ipcError error) (string, error) { +func createArchive(flareComp flare.Component, pdata flare.ProfileData, providerTimeout time.Duration, ipcError error) (string, error) { fmt.Fprintln(color.Output, color.YellowString("Initiating flare locally.")) - filePath, err := flareComp.Create(pdata, ipcError) + filePath, err := flareComp.Create(pdata, providerTimeout, ipcError) if err != nil { fmt.Printf("The flare zipfile failed to be created: %s\n", err) return "", err diff --git a/cmd/agent/subcommands/run/command.go b/cmd/agent/subcommands/run/command.go index c1cf43618fe79..261cb79e7a72e 100644 --- a/cmd/agent/subcommands/run/command.go +++ b/cmd/agent/subcommands/run/command.go @@ -478,7 +478,7 @@ func startAgent( _ sysprobeconfig.Component, server dogstatsdServer.Component, wmeta workloadmeta.Component, - _ tagger.Component, + tagger tagger.Component, ac autodiscovery.Component, rcclient rcclient.Component, _ optional.Option[logsAgent.Component], @@ -579,7 +579,7 @@ func startAgent( jmxfetch.RegisterWith(ac) // Set up check collector - commonchecks.RegisterChecks(wmeta, cfg, telemetry) + commonchecks.RegisterChecks(wmeta, tagger, cfg, telemetry) ac.AddScheduler("check", pkgcollector.InitCheckScheduler(optional.NewOption(collector), demultiplexer, logReceiver), true) demultiplexer.AddAgentStartupTelemetry(version.AgentVersion) diff --git a/cmd/agent/subcommands/snmp/command.go b/cmd/agent/subcommands/snmp/command.go index 4aa75df6821fb..49e56e1248d1b 100644 --- a/cmd/agent/subcommands/snmp/command.go +++ b/cmd/agent/subcommands/snmp/command.go @@ -7,25 +7,15 @@ package snmp import ( - "encoding/hex" - "encoding/json" "errors" "fmt" "net" "os" "strconv" - "strings" "time" - "github.com/DataDog/datadog-agent/comp/serializer/compression/compressionimpl" - - "github.com/gosnmp/gosnmp" - "github.com/spf13/cobra" - "go.uber.org/fx" - "github.com/DataDog/datadog-agent/cmd/agent/command" "github.com/DataDog/datadog-agent/comp/aggregator" - "github.com/DataDog/datadog-agent/comp/aggregator/demultiplexer" "github.com/DataDog/datadog-agent/comp/aggregator/demultiplexer/demultiplexerimpl" "github.com/DataDog/datadog-agent/comp/core" "github.com/DataDog/datadog-agent/comp/core/config" @@ -33,16 +23,19 @@ import ( "github.com/DataDog/datadog-agent/comp/core/secrets" "github.com/DataDog/datadog-agent/comp/forwarder" "github.com/DataDog/datadog-agent/comp/forwarder/defaultforwarder" - "github.com/DataDog/datadog-agent/comp/forwarder/eventplatform" "github.com/DataDog/datadog-agent/comp/forwarder/eventplatform/eventplatformimpl" "github.com/DataDog/datadog-agent/comp/forwarder/eventplatformreceiver/eventplatformreceiverimpl" "github.com/DataDog/datadog-agent/comp/forwarder/orchestrator/orchestratorimpl" + "github.com/DataDog/datadog-agent/comp/serializer/compression/compressionimpl" + snmpscan "github.com/DataDog/datadog-agent/comp/snmpscan/def" + snmpscanfx "github.com/DataDog/datadog-agent/comp/snmpscan/fx" "github.com/DataDog/datadog-agent/comp/snmptraps/snmplog" - "github.com/DataDog/datadog-agent/pkg/logs/message" - "github.com/DataDog/datadog-agent/pkg/networkdevice/metadata" - "github.com/DataDog/datadog-agent/pkg/snmp/gosnmplib" - parse "github.com/DataDog/datadog-agent/pkg/snmp/snmpparse" + "github.com/DataDog/datadog-agent/pkg/snmp/snmpparse" "github.com/DataDog/datadog-agent/pkg/util/fxutil" + + "github.com/gosnmp/gosnmp" + "github.com/spf13/cobra" + "go.uber.org/fx" ) const ( @@ -53,15 +46,6 @@ const ( defaultUseUnconnectedUDPSocket = false ) -// // connectionParams are the data needed to connect to an SNMP instance. -type connectionParams struct { - // embed a SNMPConfig because it's all the same fields anyway - parse.SNMPConfig - // fields that aren't part of parse.SNMPConfig - SecurityLevel string - UseUnconnectedUDPSocket bool -} - var authOpts = NewOptions(OptPairs[gosnmp.SnmpV3AuthProtocol]{ {"", gosnmp.NoAuth}, {"MD5", gosnmp.MD5}, @@ -97,6 +81,14 @@ var levelOpts = NewOptions(OptPairs[gosnmp.SnmpV3MsgFlags]{ // argsType is an alias so we can inject the args via fx. type argsType []string +type snmpConnectionParams struct { + // embed a SNMPConfig because it's all the same fields anyway + snmpparse.SNMPConfig + // fields that aren't part of snmpparse.SNMPConfig + SecurityLevel string + UseUnconnectedUDPSocket bool +} + // configErr wraps any error caused by invalid configuration. // If the main script returns a configErr it will print the usage string along // with the error message. @@ -122,7 +114,7 @@ func confErrf(msg string, args ...any) configErr { // Commands returns a slice of subcommands for the 'agent' command. func Commands(globalParams *command.GlobalParams) []*cobra.Command { - connParams := &connectionParams{} + connParams := &snmpConnectionParams{} snmpCmd := &cobra.Command{ Use: "snmp", Short: "Snmp tools", @@ -136,14 +128,21 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command { Flags that aren't specified will be pulled from the agent SNMP config if possible.`, RunE: func(cmd *cobra.Command, args []string) error { - err := fxutil.OneShot(snmpwalk, - fx.Supply(connParams, globalParams, cmd), + err := fxutil.OneShot(snmpWalk, + fx.Supply(connParams), fx.Provide(func() argsType { return args }), fx.Supply(core.BundleParams{ ConfigParams: config.NewAgentParams(globalParams.ConfFilePath, config.WithExtraConfFiles(globalParams.ExtraConfFilePath), config.WithFleetPoliciesDirPath(globalParams.FleetPoliciesDirPath)), SecretParams: secrets.NewEnabledParams(), - LogParams: log.ForOneShot(command.LoggerName, "off", true)}), + LogParams: log.ForOneShot(command.LoggerName, "info", true)}), core.Bundle(), + snmpscanfx.Module(), + demultiplexerimpl.Module(demultiplexerimpl.NewDefaultParams()), + forwarder.Bundle(defaultforwarder.NewParams(defaultforwarder.WithFeatures(defaultforwarder.CoreFeatures))), + orchestratorimpl.Module(orchestratorimpl.NewDefaultParams()), + eventplatformimpl.Module(eventplatformimpl.NewDefaultParams()), + compressionimpl.Module(), + eventplatformreceiverimpl.Module(), ) if err != nil { var ue configErr @@ -176,9 +175,11 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command { snmpCmd.AddCommand(snmpWalkCmd) + // This command does nothing until the backend supports it, so it isn't visible yet. snmpScanCmd := &cobra.Command{ - Use: "scan [:port]", - Short: "Scan a device for the profile editor.", + Hidden: true, + Use: "scan [:port]", + Short: "Scan a device for the profile editor.", Long: `Walk the SNMP tree for a device, collecting available OIDs. Flags that aren't specified will be pulled from the agent SNMP config if possible.`, RunE: func(cmd *cobra.Command, args []string) error { @@ -186,17 +187,18 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command { err := fxutil.OneShot(scanDevice, fx.Supply(connParams, globalParams, cmd), fx.Provide(func() argsType { return args }), - compressionimpl.Module(), fx.Supply(core.BundleParams{ ConfigParams: config.NewAgentParams(globalParams.ConfFilePath, config.WithExtraConfFiles(globalParams.ExtraConfFilePath), config.WithFleetPoliciesDirPath(globalParams.FleetPoliciesDirPath)), SecretParams: secrets.NewEnabledParams(), LogParams: log.ForOneShot(command.LoggerName, "off", true)}), core.Bundle(), aggregator.Bundle(demultiplexerimpl.NewDefaultParams()), - forwarder.Bundle(defaultforwarder.NewParams()), + orchestratorimpl.Module(orchestratorimpl.NewDefaultParams()), + forwarder.Bundle(defaultforwarder.NewParams(defaultforwarder.WithFeatures(defaultforwarder.CoreFeatures))), eventplatformimpl.Module(eventplatformimpl.NewDefaultParams()), eventplatformreceiverimpl.Module(), - orchestratorimpl.Module(orchestratorimpl.NewDefaultParams()), + compressionimpl.Module(), + snmpscanfx.Module(), ) if err != nil { var ue configErr @@ -229,7 +231,7 @@ func Commands(globalParams *command.GlobalParams) []*cobra.Command { snmpScanCmd.Flags().BoolVar(&connParams.UseUnconnectedUDPSocket, "use-unconnected-udp-socket", defaultUseUnconnectedUDPSocket, "If specified, changes net connection to be unconnected UDP socket") // This command does nothing until the backend supports it, so it isn't enabled yet. - // snmpCmd.AddCommand(snmpScanCmd) + snmpCmd.AddCommand(snmpScanCmd) return []*cobra.Command{snmpCmd} } @@ -250,12 +252,12 @@ func maybeSplitIP(address string) (string, uint16, bool) { return host, uint16(pnum), true } -func getParamsFromAgent(deviceIP string, conf config.Component) (*parse.SNMPConfig, error) { - snmpConfigList, err := parse.GetConfigCheckSnmp(conf) +func getParamsFromAgent(deviceIP string, conf config.Component) (*snmpparse.SNMPConfig, error) { + snmpConfigList, err := snmpparse.GetConfigCheckSnmp(conf) if err != nil { return nil, fmt.Errorf("unable to load SNMP config from agent: %w", err) } - instance := parse.GetIPConfig(deviceIP, snmpConfigList) + instance := snmpparse.GetIPConfig(deviceIP, snmpConfigList) if instance.IPAddress != "" { instance.IPAddress = deviceIP return &instance, nil @@ -263,7 +265,7 @@ func getParamsFromAgent(deviceIP string, conf config.Component) (*parse.SNMPConf return nil, fmt.Errorf("agent has no SNMP config for IP %s", deviceIP) } -func setDefaultsFromAgent(connParams *connectionParams, conf config.Component) error { +func setDefaultsFromAgent(connParams *snmpConnectionParams, conf config.Component) error { agentParams, agentError := getParamsFromAgent(connParams.IPAddress, conf) if agentError != nil { return agentError @@ -305,7 +307,7 @@ func setDefaultsFromAgent(connParams *connectionParams, conf config.Component) e } // newSNMP validates connection parameters and builds a GoSNMP from them. -func newSNMP(connParams *connectionParams, logger log.Component) (*gosnmp.GoSNMP, error) { +func newSNMP(connParams *snmpConnectionParams, logger log.Component) (*gosnmp.GoSNMP, error) { // Communication options check if connParams.Timeout == 0 { return nil, fmt.Errorf("timeout cannot be 0") @@ -386,7 +388,7 @@ func newSNMP(connParams *connectionParams, logger log.Component) (*gosnmp.GoSNMP }, nil } -func scanDevice(connParams *connectionParams, args argsType, conf config.Component, logger log.Component, demux demultiplexer.Component) error { +func scanDevice(connParams *snmpConnectionParams, args argsType, snmpScanner snmpscan.Component, conf config.Component, logger log.Component) error { // Parse args if len(args) == 0 { return confErrf("missing argument: IP address") @@ -412,61 +414,18 @@ func scanDevice(connParams *connectionParams, args argsType, conf config.Compone if err := snmp.Connect(); err != nil { return fmt.Errorf("unable to connect to SNMP agent on %s:%d: %w", snmp.LocalAddr, snmp.Port, err) } - defer snmp.Conn.Close() - pdus, err := gatherPDUs(snmp) - if err != nil { - return err - } namespace := conf.GetString("network_devices.namespace") - deviceID := namespace + ":" + deviceAddr - var deviceOids []*metadata.DeviceOID - for _, pdu := range pdus { - record, err := metadata.DeviceOIDFromPDU(deviceID, pdu) - if err != nil { - logger.Warnf("PDU parsing error: %v", err) - continue - } - deviceOids = append(deviceOids, record) - } - forwarder, err := demux.GetEventPlatformForwarder() - if err != nil { - return fmt.Errorf("unable to get sender: %w", err) - } - metadataPayloads := metadata.BatchDeviceScan(namespace, time.Now(), metadata.PayloadMetadataBatchSize, deviceOids) - for _, payload := range metadataPayloads { - payloadBytes, err := json.Marshal(payload) - if err != nil { - logger.Errorf("Error marshalling device metadata: %v", err) - continue - } - m := message.NewMessage(payloadBytes, nil, "", 0) - logger.Debugf("Device OID metadata payload is %d bytes", len(payloadBytes)) - logger.Tracef("Device OID metadata payload: %s", string(payloadBytes)) - if err := forwarder.SendEventPlatformEventBlocking(m, eventplatform.EventTypeNetworkDevicesMetadata); err != nil { - return err - } - } - - return nil -} -// gatherPDUs returns PDUs from the given SNMP device that should cover ever -// scalar value and at least one row of every table. -func gatherPDUs(snmp *gosnmp.GoSNMP) ([]*gosnmp.SnmpPDU, error) { - var pdus []*gosnmp.SnmpPDU - err := gosnmplib.ConditionalWalk(snmp, "", false, func(dataUnit gosnmp.SnmpPDU) (string, error) { - pdus = append(pdus, &dataUnit) - return gosnmplib.SkipOIDRowsNaive(dataUnit.Name), nil - }) + err = snmpScanner.RunDeviceScan(snmp, namespace, connParams.IPAddress) if err != nil { - return nil, err + return fmt.Errorf("unable to perform device scan: %v", err) } - return pdus, nil + return nil } -// snmpwalk prints every SNMP value, in the style of the unix snmpwalk command. -func snmpwalk(connParams *connectionParams, args argsType, conf config.Component, logger log.Component) error { +// snmpWalk prints every SNMP value, in the style of the unix snmpwalk command. +func snmpWalk(connParams *snmpConnectionParams, args argsType, snmpScanner snmpscan.Component, conf config.Component, logger log.Component) error { // Parse args if len(args) == 0 { return confErrf("missing argument: IP address") @@ -498,46 +457,10 @@ func snmpwalk(connParams *connectionParams, args argsType, conf config.Component } defer snmp.Conn.Close() - // Perform a snmpwalk using Walk for all versions - if err := snmp.Walk(oid, printValue); err != nil { - return fmt.Errorf("unable to walk SNMP agent on %s:%d: %w", snmp.Target, snmp.Port, err) - } + err = snmpScanner.RunSnmpWalk(snmp, oid) - return nil -} - -// printValue prints a PDU in a similar style to snmpwalk -Ont -func printValue(pdu gosnmp.SnmpPDU) error { - fmt.Printf("%s = ", pdu.Name) - - switch pdu.Type { - case gosnmp.OctetString: - b := pdu.Value.([]byte) - if !gosnmplib.IsStringPrintable(b) { - var strBytes []string - for _, bt := range b { - strBytes = append(strBytes, strings.ToUpper(hex.EncodeToString([]byte{bt}))) - } - fmt.Print("Hex-STRING: " + strings.Join(strBytes, " ") + "\n") - } else { - fmt.Printf("STRING: %s\n", string(b)) - } - case gosnmp.ObjectIdentifier: - fmt.Printf("OID: %s\n", pdu.Value) - case gosnmp.TimeTicks: - fmt.Print(pdu.Value, "\n") - case gosnmp.Counter32: - fmt.Printf("Counter32: %d\n", pdu.Value.(uint)) - case gosnmp.Counter64: - fmt.Printf("Counter64: %d\n", pdu.Value.(uint64)) - case gosnmp.Integer: - fmt.Printf("INTEGER: %d\n", pdu.Value.(int)) - case gosnmp.Gauge32: - fmt.Printf("Gauge32: %d\n", pdu.Value.(uint)) - case gosnmp.IPAddress: - fmt.Printf("IpAddress: %s\n", pdu.Value.(string)) - default: - fmt.Printf("TYPE %d: %d\n", pdu.Type, gosnmp.ToBigInt(pdu.Value)) + if err != nil { + return fmt.Errorf("unable to walk SNMP agent on %s:%d: %w", connParams.IPAddress, connParams.Port, err) } return nil diff --git a/cmd/agent/subcommands/snmp/command_test.go b/cmd/agent/subcommands/snmp/command_test.go index 2e127cc68e508..38ed621ddef5d 100644 --- a/cmd/agent/subcommands/snmp/command_test.go +++ b/cmd/agent/subcommands/snmp/command_test.go @@ -15,13 +15,13 @@ import ( "github.com/DataDog/datadog-agent/pkg/util/fxutil" ) -func TestCommand(t *testing.T) { +func TestWalkCommand(t *testing.T) { // this command has _lots_ of options, so the test just exercises a few fxutil.TestOneShotSubcommand(t, Commands(&command.GlobalParams{}), []string{"snmp", "walk", "1.2.3.4", "10.9.8.7", "-v", "3", "-r", "10"}, - snmpwalk, - func(cliParams *connectionParams, args argsType) { + snmpWalk, + func(cliParams *snmpConnectionParams, args argsType) { require.Equal(t, argsType{"1.2.3.4", "10.9.8.7"}, args) require.Equal(t, "3", cliParams.Version) require.Equal(t, 10, cliParams.Retries) @@ -31,13 +31,36 @@ func TestCommand(t *testing.T) { fxutil.TestOneShotSubcommand(t, Commands(&command.GlobalParams{}), []string{"snmp", "walk", "1.2.3.4", "10.9.8.7", "--use-unconnected-udp-socket"}, - snmpwalk, - func(cliParams *connectionParams, args argsType) { + snmpWalk, + func(cliParams *snmpConnectionParams, args argsType) { require.Equal(t, argsType{"1.2.3.4", "10.9.8.7"}, args) require.True(t, cliParams.UseUnconnectedUDPSocket) }) } +func TestScanCommand(t *testing.T) { + // this command has _lots_ of options, so the test just exercises a few + fxutil.TestOneShotSubcommand(t, + Commands(&command.GlobalParams{}), + []string{"snmp", "scan", "1.2.3.4", "-v", "3", "-r", "10"}, + scanDevice, + func(cliParams *snmpConnectionParams, args argsType) { + require.Equal(t, argsType{"1.2.3.4"}, args) + require.Equal(t, "3", cliParams.Version) + require.Equal(t, 10, cliParams.Retries) + require.False(t, cliParams.UseUnconnectedUDPSocket) + }) + + fxutil.TestOneShotSubcommand(t, + Commands(&command.GlobalParams{}), + []string{"snmp", "scan", "1.2.3.4", "--use-unconnected-udp-socket"}, + scanDevice, + func(cliParams *snmpConnectionParams, args argsType) { + require.Equal(t, argsType{"1.2.3.4"}, args) + require.True(t, cliParams.UseUnconnectedUDPSocket) + }) +} + func TestSplitIP(t *testing.T) { for _, tc := range []struct { addr string diff --git a/cmd/cluster-agent/subcommands/start/command.go b/cmd/cluster-agent/subcommands/start/command.go index 37b1305a9ec9d..b768b277fce03 100644 --- a/cmd/cluster-agent/subcommands/start/command.go +++ b/cmd/cluster-agent/subcommands/start/command.go @@ -372,7 +372,7 @@ func start(log log.Component, common.LoadComponents(secretResolver, wmeta, ac, config.GetString("confd_path")) // Set up check collector - registerChecks(wmeta, config) + registerChecks(wmeta, taggerComp, config) ac.AddScheduler("check", pkgcollector.InitCheckScheduler(optional.NewOption(collector), demultiplexer, logReceiver), true) // start the autoconfig, this will immediately run any configured check @@ -577,7 +577,7 @@ func initializeRemoteConfigClient(rcService rccomp.Component, config config.Comp return rcClient, nil } -func registerChecks(wlm workloadmeta.Component, cfg config.Component) { +func registerChecks(wlm workloadmeta.Component, tagger tagger.Component, cfg config.Component) { // Required checks corecheckLoader.RegisterCheck(cpu.CheckName, cpu.Factory()) corecheckLoader.RegisterCheck(memory.CheckName, memory.Factory()) @@ -586,7 +586,7 @@ func registerChecks(wlm workloadmeta.Component, cfg config.Component) { corecheckLoader.RegisterCheck(filehandles.CheckName, filehandles.Factory()) // Flavor specific checks - corecheckLoader.RegisterCheck(kubernetesapiserver.CheckName, kubernetesapiserver.Factory()) + corecheckLoader.RegisterCheck(kubernetesapiserver.CheckName, kubernetesapiserver.Factory(tagger)) corecheckLoader.RegisterCheck(ksm.CheckName, ksm.Factory()) corecheckLoader.RegisterCheck(helm.CheckName, helm.Factory()) corecheckLoader.RegisterCheck(disk.CheckName, disk.Factory()) diff --git a/cmd/installer/subcommands/installer/command.go b/cmd/installer/subcommands/installer/command.go index ae281fbeddc83..2a612cfe1750c 100644 --- a/cmd/installer/subcommands/installer/command.go +++ b/cmd/installer/subcommands/installer/command.go @@ -259,7 +259,7 @@ func bootstrapCommand() *cobra.Command { return bootstrapper.Bootstrap(ctx, b.env) }, } - cmd.Flags().DurationVarP(&timeout, "timeout", "T", 3*time.Minute, "timeout to bootstrap with") + cmd.Flags().DurationVarP(&timeout, "timeout", "T", 10*time.Minute, "timeout to bootstrap with") return cmd } @@ -277,7 +277,7 @@ func setupCommand() *cobra.Command { return installer.Setup(ctx, cmd.env) }, } - cmd.Flags().DurationVarP(&timeout, "timeout", "T", 3*time.Minute, "timeout to install with") + cmd.Flags().DurationVarP(&timeout, "timeout", "T", 10*time.Minute, "timeout to install with") return cmd } diff --git a/cmd/otel-agent/config/agent_config_test.go b/cmd/otel-agent/config/agent_config_test.go index 65a94236cf789..c9f742b3406e8 100644 --- a/cmd/otel-agent/config/agent_config_test.go +++ b/cmd/otel-agent/config/agent_config_test.go @@ -10,10 +10,9 @@ import ( "fmt" "io/fs" "os" - "strings" "testing" - pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" "github.com/stretchr/testify/assert" @@ -25,8 +24,7 @@ type ConfigTestSuite struct { } func (suite *ConfigTestSuite) SetupTest() { - datadog := pkgconfigmodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) - pkgconfigsetup.SetDatadog(datadog) + configmock.New(suite.T()) } func TestNoURIsProvided(t *testing.T) { diff --git a/cmd/security-agent/subcommands/runtime/command.go b/cmd/security-agent/subcommands/runtime/command.go index ec5196e7aab12..2b1865ef24b1e 100644 --- a/cmd/security-agent/subcommands/runtime/command.go +++ b/cmd/security-agent/subcommands/runtime/command.go @@ -551,6 +551,16 @@ func eventDataFromJSON(file string) (eval.Event, error) { if err := event.SetFieldValue(k, int(value)); err != nil { return nil, err } + case []any: + if stringSlice, ok := anySliceToStringSlice(v); ok { + if err := event.SetFieldValue(k, stringSlice); err != nil { + return nil, err + } + } else { + if err := event.SetFieldValue(k, v); err != nil { + return nil, err + } + } default: if err := event.SetFieldValue(k, v); err != nil { return nil, err @@ -561,6 +571,18 @@ func eventDataFromJSON(file string) (eval.Event, error) { return event, nil } +func anySliceToStringSlice(in []any) ([]string, bool) { + out := make([]string, len(in)) + for i, v := range in { + val, ok := v.(string) + if !ok { + return nil, false + } + out[i] = val + } + return out, true +} + func evalRule(_ log.Component, _ config.Component, _ secrets.Component, evalArgs *evalCliParams) error { policiesDir := evalArgs.dir diff --git a/cmd/serverless-init/log/log.go b/cmd/serverless-init/log/log.go index 1e1d42eb0ce87..66f03129e4e8c 100644 --- a/cmd/serverless-init/log/log.go +++ b/cmd/serverless-init/log/log.go @@ -58,19 +58,20 @@ func SetupLogAgent(conf *Config, tags map[string]string, tagger tagger.Component tagsArray := serverlessTag.MapToArray(tags) - addFileTailing(logsAgent, tagsArray) + addFileTailing(logsAgent, conf.source, tagsArray) serverlessLogs.SetLogsTags(tagsArray) return logsAgent } -func addFileTailing(logsAgent logsAgent.ServerlessLogsAgent, tags []string) { +func addFileTailing(logsAgent logsAgent.ServerlessLogsAgent, source string, tags []string) { if filePath, set := os.LookupEnv(envVarTailFilePath); set { src := sources.NewLogSource("serverless-file-tail", &logConfig.LogsConfig{ Type: logConfig.FileType, Path: filePath, Service: os.Getenv("DD_SERVICE"), Tags: tags, + Source: source, }) logsAgent.GetSources().AddSource(src) } diff --git a/cmd/system-probe/config/config.go b/cmd/system-probe/config/config.go index 1ae05b24a411b..60fd9b679609b 100644 --- a/cmd/system-probe/config/config.go +++ b/cmd/system-probe/config/config.go @@ -148,7 +148,7 @@ func load() (*types.Config, error) { if cfg.GetBool(diNS("enabled")) { c.EnabledModules[DynamicInstrumentationModule] = struct{}{} } - if cfg.GetBool(nskey("ebpf_check", "enabled")) { + if cfg.GetBool(NSkey("ebpf_check", "enabled")) { c.EnabledModules[EBPFModule] = struct{}{} } if cfg.GetBool("system_probe_config.language_detection.enabled") { diff --git a/cmd/system-probe/config/ns.go b/cmd/system-probe/config/ns.go index 913b86b7915f5..59f519ddb26d9 100644 --- a/cmd/system-probe/config/ns.go +++ b/cmd/system-probe/config/ns.go @@ -9,64 +9,70 @@ import "strings" // spNS adds `system_probe_config` namespace to configuration key func spNS(k ...string) string { - return nskey("system_probe_config", k...) + return NSkey("system_probe_config", k...) } // netNS adds `network_config` namespace to configuration key func netNS(k ...string) string { - return nskey("network_config", k...) + return NSkey("network_config", k...) } // smNS adds `service_monitoring_config` namespace to configuration key func smNS(k ...string) string { - return nskey("service_monitoring_config", k...) + return NSkey("service_monitoring_config", k...) } // ccmNS adds `ccm_network_config` namespace to a configuration key func ccmNS(k ...string) string { - return nskey("ccm_network_config", k...) + return NSkey("ccm_network_config", k...) } // diNS adds `dynamic_instrumentation` namespace to configuration key func diNS(k ...string) string { - return nskey("dynamic_instrumentation", k...) + return NSkey("dynamic_instrumentation", k...) } // secNS adds `runtime_security_config` namespace to configuration key func secNS(k ...string) string { - return nskey("runtime_security_config", k...) + return NSkey("runtime_security_config", k...) } // evNS adds `event_monitoring_config` namespace to configuration key func evNS(k ...string) string { - return nskey("event_monitoring_config", k...) + return NSkey("event_monitoring_config", k...) } -func nskey(ns string, pieces ...string) string { +// NSkey returns a full key path in the config file by joining the given namespace and the rest of the path fragments +func NSkey(ns string, pieces ...string) string { return strings.Join(append([]string{ns}, pieces...), ".") } +// FullKeyPath returns a full key path in the config file by joining multiple path fragments +func FullKeyPath(pieces ...string) string { + return strings.Join(pieces, ".") +} + // wcdNS addes 'windows_crash_detection' namespace to config key func wcdNS(k ...string) string { - return nskey("windows_crash_detection", k...) + return NSkey("windows_crash_detection", k...) } // pngNS adds `ping` namespace to config key func pngNS(k ...string) string { - return nskey("ping", k...) + return NSkey("ping", k...) } // tracerouteNS adds `traceroute` namespace to config key func tracerouteNS(k ...string) string { - return nskey("traceroute", k...) + return NSkey("traceroute", k...) } // discoveryNS adds `discovery` namespace to config key func discoveryNS(k ...string) string { - return nskey("discovery", k...) + return NSkey("discovery", k...) } // gpuNS adds `gpu_monitoring` namespace to config key func gpuNS(k ...string) string { - return nskey("gpu_monitoring", k...) + return NSkey("gpu_monitoring", k...) } diff --git a/cmd/system-probe/modules/gpu_monitoring.go b/cmd/system-probe/modules/gpu.go similarity index 72% rename from cmd/system-probe/modules/gpu_monitoring.go rename to cmd/system-probe/modules/gpu.go index 5db344197a37a..3cd54e27293e5 100644 --- a/cmd/system-probe/modules/gpu_monitoring.go +++ b/cmd/system-probe/modules/gpu.go @@ -12,6 +12,7 @@ import ( "net/http" "time" + "github.com/NVIDIA/go-nvml/pkg/nvml" "go.uber.org/atomic" "github.com/DataDog/datadog-agent/cmd/system-probe/api/module" @@ -23,14 +24,28 @@ import ( ) var _ module.Module = &GPUMonitoringModule{} -var gpuMonitoringConfigNamespaces = []string{gpu.GPUConfigNS} +var gpuMonitoringConfigNamespaces = []string{gpu.GPUNS} // GPUMonitoring Factory var GPUMonitoring = module.Factory{ Name: config.GPUMonitoringModule, ConfigNamespaces: gpuMonitoringConfigNamespaces, - Fn: func(_ *sysconfigtypes.Config, _ module.FactoryDependencies) (module.Module, error) { - t, err := gpu.NewProbe(gpu.NewConfig(), nil) + Fn: func(_ *sysconfigtypes.Config, deps module.FactoryDependencies) (module.Module, error) { + + c := gpu.NewConfig() + probeDeps := gpu.ProbeDependencies{ + Telemetry: deps.Telemetry, + //if the config parameter doesn't exist or is empty string, the default value is used as defined in go-nvml library + //(https://github.com/NVIDIA/go-nvml/blob/main/pkg/nvml/lib.go#L30) + NvmlLib: nvml.New(nvml.WithLibraryPath(c.NVMLLibraryPath)), + } + + ret := probeDeps.NvmlLib.Init() + if ret != nvml.SUCCESS && ret != nvml.ERROR_ALREADY_INITIALIZED { + return nil, fmt.Errorf("unable to initialize NVML library: %v", ret) + } + + t, err := gpu.NewProbe(c, probeDeps) if err != nil { return nil, fmt.Errorf("unable to start GPU monitoring: %w", err) } diff --git a/comp/README.md b/comp/README.md index 5c6b4887087f5..d500299327f9f 100644 --- a/comp/README.md +++ b/comp/README.md @@ -611,3 +611,9 @@ Package rdnsquerier provides the reverse DNS querier component. *Datadog Team*: agent-metrics-logs Package compression provides a compression implementation based on the configuration or available build tags. + +### [comp/snmpscan](https://pkg.go.dev/github.com/DataDog/datadog-agent/comp/snmpscan) + +*Datadog Team*: network-device-monitoring + +Package snmpscan is a light component that can be used to perform a scan or a walk of a particular device diff --git a/comp/api/api/def/go.mod b/comp/api/api/def/go.mod index 3dc7234aeb00f..b9e2b0d5c558b 100644 --- a/comp/api/api/def/go.mod +++ b/comp/api/api/def/go.mod @@ -8,5 +8,5 @@ require ( go.uber.org/dig v1.18.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/sys v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect ) diff --git a/comp/api/api/def/go.sum b/comp/api/api/def/go.sum index e3997e581d5b4..7fa8dd3f70492 100644 --- a/comp/api/api/def/go.sum +++ b/comp/api/api/def/go.sum @@ -14,7 +14,7 @@ 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.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/comp/api/authtoken/go.mod b/comp/api/authtoken/go.mod index 2999282aa6d21..b2da3c5bcf6f5 100644 --- a/comp/api/authtoken/go.mod +++ b/comp/api/authtoken/go.mod @@ -45,7 +45,7 @@ require ( github.com/DataDog/datadog-agent/comp/core/log/mock v0.58.0-devel github.com/DataDog/datadog-agent/pkg/api v0.56.0 github.com/DataDog/datadog-agent/pkg/util/fxutil v0.56.0 - github.com/DataDog/datadog-agent/pkg/util/optional v0.56.0 + github.com/DataDog/datadog-agent/pkg/util/optional v0.57.1 github.com/stretchr/testify v1.9.0 go.uber.org/fx v1.22.2 ) @@ -53,25 +53,25 @@ require ( require ( github.com/DataDog/datadog-agent/comp/core/flare/builder v0.56.0 // indirect github.com/DataDog/datadog-agent/comp/core/flare/types v0.56.0 // indirect - github.com/DataDog/datadog-agent/comp/core/secrets v0.56.0 // indirect + github.com/DataDog/datadog-agent/comp/core/secrets v0.57.1 // indirect github.com/DataDog/datadog-agent/comp/def v0.56.0 // indirect - github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.56.0 // indirect - github.com/DataDog/datadog-agent/pkg/config/env v0.56.0 // indirect + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/env v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel // indirect - github.com/DataDog/datadog-agent/pkg/config/model v0.56.0 // indirect - github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/pkg/config/setup v0.56.0 // indirect - github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.60.0-devel // indirect + github.com/DataDog/datadog-agent/pkg/config/setup v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.60.0-devel // indirect github.com/DataDog/datadog-agent/pkg/config/utils v0.56.0 // indirect github.com/DataDog/datadog-agent/pkg/util/executable v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/filesystem v0.56.0 // indirect - github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.56.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/log v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/log/setup v0.58.0-devel // indirect - github.com/DataDog/datadog-agent/pkg/util/pointer v0.56.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/system v0.56.0 // indirect - github.com/DataDog/datadog-agent/pkg/util/system/socket v0.56.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/system v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/winutil v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/version v0.56.0 // indirect github.com/DataDog/viper v1.13.5 // indirect @@ -105,12 +105,12 @@ require ( go.uber.org/dig v1.18.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/comp/api/authtoken/go.sum b/comp/api/authtoken/go.sum index c4df7b42ad5d0..42636c1b8bc19 100644 --- a/comp/api/authtoken/go.sum +++ b/comp/api/authtoken/go.sum @@ -256,8 +256,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -300,11 +300,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -317,8 +317,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/comp/core/autodiscovery/providers/kube_endpoints_test.go b/comp/core/autodiscovery/providers/kube_endpoints_test.go index d3891c5a65da0..a571018d37832 100644 --- a/comp/core/autodiscovery/providers/kube_endpoints_test.go +++ b/comp/core/autodiscovery/providers/kube_endpoints_test.go @@ -9,7 +9,6 @@ package providers import ( "context" - "strings" "testing" "time" @@ -26,7 +25,7 @@ import ( acTelemetry "github.com/DataDog/datadog-agent/comp/core/autodiscovery/telemetry" "github.com/DataDog/datadog-agent/comp/core/telemetry" "github.com/DataDog/datadog-agent/comp/core/telemetry/telemetryimpl" - "github.com/DataDog/datadog-agent/pkg/config/model" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" "github.com/DataDog/datadog-agent/pkg/util/fxutil" "github.com/DataDog/datadog-agent/pkg/util/kubernetes" "github.com/DataDog/datadog-agent/pkg/util/kubernetes/apiserver" @@ -271,7 +270,7 @@ func TestParseKubeServiceAnnotationsForEndpoints(t *testing.T) { }, } { t.Run(tc.name, func(t *testing.T) { - cfg := model.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + cfg := configmock.New(t) if tc.hybrid { cfg.SetWithoutSource("cluster_checks.support_hybrid_ignore_ad_tags", true) } diff --git a/comp/core/autodiscovery/providers/kube_services_test.go b/comp/core/autodiscovery/providers/kube_services_test.go index 1d395d937c163..9c2112bf92a83 100644 --- a/comp/core/autodiscovery/providers/kube_services_test.go +++ b/comp/core/autodiscovery/providers/kube_services_test.go @@ -9,7 +9,6 @@ package providers import ( "context" - "strings" "testing" "time" @@ -26,7 +25,7 @@ import ( acTelemetry "github.com/DataDog/datadog-agent/comp/core/autodiscovery/telemetry" "github.com/DataDog/datadog-agent/comp/core/telemetry" "github.com/DataDog/datadog-agent/comp/core/telemetry/telemetryimpl" - "github.com/DataDog/datadog-agent/pkg/config/model" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" "github.com/DataDog/datadog-agent/pkg/util/fxutil" "github.com/DataDog/datadog-agent/pkg/util/kubernetes" ) @@ -241,7 +240,7 @@ func TestParseKubeServiceAnnotations(t *testing.T) { }, } { t.Run(tc.name, func(t *testing.T) { - cfg := model.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + cfg := configmock.New(t) if tc.hybrid { cfg.SetWithoutSource("cluster_checks.support_hybrid_ignore_ad_tags", true) } diff --git a/comp/core/config/go.mod b/comp/core/config/go.mod index b5520c11cb099..4d2254a6bc873 100644 --- a/comp/core/config/go.mod +++ b/comp/core/config/go.mod @@ -109,12 +109,12 @@ require ( go.uber.org/dig v1.18.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/comp/core/config/go.sum b/comp/core/config/go.sum index 93cf35c08cc1f..7c71a52f0e030 100644 --- a/comp/core/config/go.sum +++ b/comp/core/config/go.sum @@ -262,8 +262,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -306,11 +306,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -323,8 +323,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/comp/core/configsync/configsyncimpl/sync_integration_test.go b/comp/core/configsync/configsyncimpl/sync_integration_test.go index 0ff2519ff7e85..50c7e3680ed0d 100644 --- a/comp/core/configsync/configsyncimpl/sync_integration_test.go +++ b/comp/core/configsync/configsyncimpl/sync_integration_test.go @@ -88,7 +88,8 @@ func TestRunWithChan(t *testing.T) { } func TestRunWithInterval(t *testing.T) { - configCore := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + // Legitimate use for NewConfig case where we want to have 2 independent config object mimicing 2 process communicating + configCore := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo configCore.Set("api_key", "api_key_core1", pkgconfigmodel.SourceFile) handler := http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { diff --git a/comp/core/configsync/configsyncimpl/sync_test.go b/comp/core/configsync/configsyncimpl/sync_test.go index e2132eaac8cd4..2038e2add03ef 100644 --- a/comp/core/configsync/configsyncimpl/sync_test.go +++ b/comp/core/configsync/configsyncimpl/sync_test.go @@ -13,6 +13,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model" ) @@ -63,7 +64,7 @@ func TestFetchConfig(t *testing.T) { } func TestUpdateConfig(t *testing.T) { - cfg := pkgconfigmodel.NewConfig("test", "DD", nil) + cfg := configmock.New(t) cfg.Set("key1", "value1", pkgconfigmodel.SourceFile) cfg.Set("key3", "set-with-cli", pkgconfigmodel.SourceCLI) diff --git a/comp/core/flare/component.go b/comp/core/flare/component.go index 0ac0ef51c87a5..9921e8e32d766 100644 --- a/comp/core/flare/component.go +++ b/comp/core/flare/component.go @@ -10,9 +10,12 @@ package flare import ( + "time" + + "go.uber.org/fx" + "github.com/DataDog/datadog-agent/comp/core/flare/helpers" "github.com/DataDog/datadog-agent/pkg/util/fxutil" - "go.uber.org/fx" ) // team: agent-shared-components @@ -20,7 +23,9 @@ import ( // Component is the component type. type Component interface { // Create creates a new flare locally and returns the path to the flare file. - Create(pdata ProfileData, ipcError error) (string, error) + // + // If providerTimeout is 0 or negative, the timeout from the configuration will be used. + Create(pdata ProfileData, providerTimeout time.Duration, ipcError error) (string, error) // Send sends a flare archive to Datadog. Send(flarePath string, caseID string, email string, source helpers.FlareSource) (string, error) } diff --git a/comp/core/flare/flare.go b/comp/core/flare/flare.go index b142c143770dd..6983272a95137 100644 --- a/comp/core/flare/flare.go +++ b/comp/core/flare/flare.go @@ -13,6 +13,7 @@ import ( "path/filepath" "reflect" "runtime" + "strconv" "time" "go.uber.org/fx" @@ -113,7 +114,7 @@ func (f *flare) onAgentTaskEvent(taskType rcclienttypes.TaskType, task rcclientt return true, fmt.Errorf("User handle was not provided in the flare agent task") } - filePath, err := f.Create(nil, nil) + filePath, err := f.Create(nil, 0, nil) if err != nil { return true, err } @@ -140,14 +141,25 @@ func (f *flare) createAndReturnFlarePath(w http.ResponseWriter, r *http.Request) } } + var providerTimeout time.Duration + + queryProviderTimeout := r.URL.Query().Get("provider_timeout") + if queryProviderTimeout != "" { + givenTimeout, err := strconv.ParseInt(queryProviderTimeout, 10, 64) + if err == nil && givenTimeout > 0 { + providerTimeout = time.Duration(givenTimeout) + } else { + f.log.Warnf("provider_timeout query parameter must be a positive integer, but was %s, using configuration value", queryProviderTimeout) + } + } + // Reset the `server_timeout` deadline for this connection as creating a flare can take some time conn := apiutils.GetConnection(r) _ = conn.SetDeadline(time.Time{}) var filePath string - var err error f.log.Infof("Making a flare") - filePath, err = f.Create(profile, nil) + filePath, err := f.Create(profile, providerTimeout, nil) if err != nil || filePath == "" { if err != nil { @@ -168,7 +180,13 @@ func (f *flare) Send(flarePath string, caseID string, email string, source helpe } // Create creates a new flare and returns the path to the final archive file. -func (f *flare) Create(pdata ProfileData, ipcError error) (string, error) { +// +// If providerTimeout is 0 or negative, the timeout from the configuration will be used. +func (f *flare) Create(pdata ProfileData, providerTimeout time.Duration, ipcError error) (string, error) { + if providerTimeout <= 0 { + providerTimeout = f.config.GetDuration("flare_provider_timeout") + } + fb, err := helpers.NewFlareBuilder(f.params.local) if err != nil { return "", err @@ -189,14 +207,13 @@ func (f *flare) Create(pdata ProfileData, ipcError error) (string, error) { fb.AddFileWithoutScrubbing(filepath.Join("profiles", name), data) //nolint:errcheck } - f.runProviders(fb) + f.runProviders(fb, providerTimeout) return fb.Save() } -func (f *flare) runProviders(fb types.FlareBuilder) { - flareStepTimeout := f.config.GetDuration("flare_provider_timeout") * time.Second - timer := time.NewTimer(flareStepTimeout) +func (f *flare) runProviders(fb types.FlareBuilder, providerTimeout time.Duration) { + timer := time.NewTimer(providerTimeout) defer timer.Stop() for _, p := range f.providers { @@ -226,10 +243,10 @@ func (f *flare) runProviders(fb types.FlareBuilder) { <-timer.C } case <-timer.C: - err := f.log.Warnf("flare provider '%s' skipped after %s", providerName, flareStepTimeout) + err := f.log.Warnf("flare provider '%s' skipped after %s", providerName, providerTimeout) _ = fb.Logf("%s", err.Error()) } - timer.Reset(flareStepTimeout) + timer.Reset(providerTimeout) } f.log.Info("All flare providers have been run, creating archive...") diff --git a/comp/core/flare/flare_test.go b/comp/core/flare/flare_test.go index 4ffe83274c8cd..b85b9de27311d 100644 --- a/comp/core/flare/flare_test.go +++ b/comp/core/flare/flare_test.go @@ -25,7 +25,6 @@ import ( "github.com/DataDog/datadog-agent/comp/core/secrets/secretsimpl" nooptelemetry "github.com/DataDog/datadog-agent/comp/core/telemetry/noopsimpl" workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def" - "github.com/DataDog/datadog-agent/pkg/config/model" "github.com/DataDog/datadog-agent/pkg/util/fxutil" "github.com/DataDog/datadog-agent/pkg/util/optional" ) @@ -104,14 +103,14 @@ func TestRunProviders(t *testing.T) { fx.ResultTags(`group:"flare"`), )), ) - deps.Config.Set("flare_provider_timeout", 1, model.SourceAgentRuntime) + + cliProviderTimeout := time.Nanosecond f := newFlare(deps) fb, err := helpers.NewFlareBuilder(false) require.NoError(t, err) - flare := f.Comp.(*flare) - flare.runProviders(fb) + f.Comp.(*flare).runProviders(fb, cliProviderTimeout) require.True(t, firstRan.Load()) require.True(t, secondRan.Load()) diff --git a/comp/core/flare/flareimpl/mock.go b/comp/core/flare/flareimpl/mock.go index 906dfe77dd333..1bf408abf69df 100644 --- a/comp/core/flare/flareimpl/mock.go +++ b/comp/core/flare/flareimpl/mock.go @@ -10,12 +10,14 @@ package flareimpl import ( "net/http" + "time" + + "go.uber.org/fx" api "github.com/DataDog/datadog-agent/comp/api/api/def" "github.com/DataDog/datadog-agent/comp/core/flare" "github.com/DataDog/datadog-agent/comp/core/flare/helpers" "github.com/DataDog/datadog-agent/pkg/util/fxutil" - "go.uber.org/fx" ) // MockModule defines the fx options for the mock component. @@ -42,7 +44,7 @@ func (fc *MockFlare) handlerFunc(w http.ResponseWriter, _ *http.Request) { } // Create mocks the flare create function -func (fc *MockFlare) Create(_ flare.ProfileData, _ error) (string, error) { +func (fc *MockFlare) Create(_ flare.ProfileData, _ time.Duration, _ error) (string, error) { return "a string", nil } diff --git a/comp/core/flare/helpers/send_flare.go b/comp/core/flare/helpers/send_flare.go index 5246ee5306469..c5854529d17a1 100644 --- a/comp/core/flare/helpers/send_flare.go +++ b/comp/core/flare/helpers/send_flare.go @@ -34,8 +34,9 @@ var ( // any modification to this struct should also be applied to datadog-agent/test/fakeintake/server/body.go type flareResponse struct { - CaseID int `json:"case_id,omitempty"` - Error string `json:"error,omitempty"` + CaseID int `json:"case_id,omitempty"` + Error string `json:"error,omitempty"` + RequestUUID string `json:"request_uuid,omitempty"` } // FlareSource has metadata about why the flare was sent @@ -184,7 +185,11 @@ func analyzeResponse(r *http.Response, apiKey string) (string, error) { } if res.Error != "" { - response := fmt.Sprintf("An error occurred while uploading the flare: %s. Please contact support by email.", res.Error) + var uuidReport string + if res.RequestUUID != "" { + uuidReport = fmt.Sprintf(" and facilitate the request uuid: `%s`", res.RequestUUID) + } + response := fmt.Sprintf("An error occurred while uploading the flare: %s. Please contact support by email%s.", res.Error, uuidReport) return response, errors.New(res.Error) } diff --git a/comp/core/flare/helpers/send_flare_test.go b/comp/core/flare/helpers/send_flare_test.go index 759971ad5d0d2..9e6d373f64bac 100644 --- a/comp/core/flare/helpers/send_flare_test.go +++ b/comp/core/flare/helpers/send_flare_test.go @@ -127,6 +127,19 @@ func TestAnalyzeResponse(t *testing.T) { }) t.Run("error-from-server", func(t *testing.T) { + r := &http.Response{ + StatusCode: 200, + Header: http.Header{"Content-Type": []string{"application/json; charset=UTF-8"}}, + Body: io.NopCloser(bytes.NewBuffer([]byte("{\"case_id\": 1234, \"error\": \"uhoh\", \"request_uuid\": \"1dd9a912-843f-4987-9007-b915edb3d047\"}"))), + } + resstr, reserr := analyzeResponse(r, "abcdef") + require.Equal(t, errors.New("uhoh"), reserr) + require.Equal(t, + "An error occurred while uploading the flare: uhoh. Please contact support by email and facilitate the request uuid: `1dd9a912-843f-4987-9007-b915edb3d047`.", + resstr) + }) + + t.Run("error-from-server-with-no-request_uuid", func(t *testing.T) { r := &http.Response{ StatusCode: 200, Header: http.Header{"Content-Type": []string{"application/json; charset=UTF-8"}}, diff --git a/comp/core/flare/types/go.mod b/comp/core/flare/types/go.mod index 1f34101f013a4..ae07eeadcb8b2 100644 --- a/comp/core/flare/types/go.mod +++ b/comp/core/flare/types/go.mod @@ -20,6 +20,6 @@ require ( go.uber.org/dig v1.18.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/sys v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/comp/core/flare/types/go.sum b/comp/core/flare/types/go.sum index e1193f2357d30..0decbc5c7524d 100644 --- a/comp/core/flare/types/go.sum +++ b/comp/core/flare/types/go.sum @@ -14,8 +14,8 @@ 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.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/comp/core/gui/guiimpl/agent.go b/comp/core/gui/guiimpl/agent.go index 222697759a122..eedbd1a374e84 100644 --- a/comp/core/gui/guiimpl/agent.go +++ b/comp/core/gui/guiimpl/agent.go @@ -149,7 +149,7 @@ func makeFlare(w http.ResponseWriter, r *http.Request, flare flare.Component) { return } - filePath, e := flare.Create(nil, nil) + filePath, e := flare.Create(nil, 0, nil) if e != nil { w.Write([]byte("Error creating flare zipfile: " + e.Error())) log.Errorf("Error creating flare zipfile: %s", e.Error()) diff --git a/comp/core/hostname/hostnameinterface/go.mod b/comp/core/hostname/hostnameinterface/go.mod index 55876b6bf65ea..23081fc91a636 100644 --- a/comp/core/hostname/hostnameinterface/go.mod +++ b/comp/core/hostname/hostnameinterface/go.mod @@ -25,6 +25,6 @@ require ( go.uber.org/dig v1.18.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/sys v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/comp/core/hostname/hostnameinterface/go.sum b/comp/core/hostname/hostnameinterface/go.sum index 10ac030dc336f..8cb3943af281f 100644 --- a/comp/core/hostname/hostnameinterface/go.sum +++ b/comp/core/hostname/hostnameinterface/go.sum @@ -22,8 +22,8 @@ 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.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/comp/core/log/impl-trace/go.mod b/comp/core/log/impl-trace/go.mod index 510f2eca02898..87232a6b219f4 100644 --- a/comp/core/log/impl-trace/go.mod +++ b/comp/core/log/impl-trace/go.mod @@ -42,7 +42,7 @@ replace ( require ( github.com/DataDog/datadog-agent/comp/core/config v0.56.0-rc.3 github.com/DataDog/datadog-agent/comp/core/log/def v0.0.0-00010101000000-000000000000 - github.com/DataDog/datadog-agent/pkg/config/env v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/config/env v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/trace v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/fxutil v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/log v0.57.1 @@ -60,20 +60,20 @@ require ( require ( github.com/DataDog/datadog-agent/comp/core/flare/builder v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/core/flare/types v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/comp/core/secrets v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/comp/core/secrets v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/pkg/config/setup v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/config/setup v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect github.com/DataDog/datadog-agent/pkg/util/executable v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/filesystem v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/optional v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/pointer v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/optional v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/system v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system/socket v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/system v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/winutil v0.57.1 // indirect github.com/DataDog/viper v1.13.5 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect @@ -106,12 +106,12 @@ require ( go.uber.org/dig v1.18.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/comp/core/log/impl-trace/go.sum b/comp/core/log/impl-trace/go.sum index 0d19fd69b98f6..dcb66361555ea 100644 --- a/comp/core/log/impl-trace/go.sum +++ b/comp/core/log/impl-trace/go.sum @@ -223,16 +223,16 @@ github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1: github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= -go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= -go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= -go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kTWmI= go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A= go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2NemcCrOL8gI= go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= -go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= -go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= @@ -256,8 +256,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -300,11 +300,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -317,8 +317,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/comp/core/log/impl/go.mod b/comp/core/log/impl/go.mod index 47007a77d0f94..145854d411192 100644 --- a/comp/core/log/impl/go.mod +++ b/comp/core/log/impl/go.mod @@ -47,22 +47,22 @@ require ( require ( github.com/DataDog/datadog-agent/comp/core/flare/builder v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/core/flare/types v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/comp/core/secrets v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/env v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/comp/core/secrets v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/env v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/pkg/config/setup v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/config/setup v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect github.com/DataDog/datadog-agent/pkg/util/executable v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/filesystem v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/fxutil v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/optional v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/pointer v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/optional v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/system v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system/socket v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/system v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/winutil v0.57.1 // indirect github.com/DataDog/viper v1.13.5 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect @@ -96,12 +96,12 @@ require ( go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/comp/core/log/impl/go.sum b/comp/core/log/impl/go.sum index c4df7b42ad5d0..42636c1b8bc19 100644 --- a/comp/core/log/impl/go.sum +++ b/comp/core/log/impl/go.sum @@ -256,8 +256,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -300,11 +300,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -317,8 +317,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/comp/core/log/mock/go.mod b/comp/core/log/mock/go.mod index d08d11ac2b36b..ea55efdb1d26c 100644 --- a/comp/core/log/mock/go.mod +++ b/comp/core/log/mock/go.mod @@ -9,8 +9,11 @@ replace ( github.com/DataDog/datadog-agent/comp/def => ../../../def/ github.com/DataDog/datadog-agent/pkg/collector/check/defaults => ../../../../pkg/collector/check/defaults github.com/DataDog/datadog-agent/pkg/config/env => ../../../../pkg/config/env + github.com/DataDog/datadog-agent/pkg/config/mock => ../../../../pkg/config/mock github.com/DataDog/datadog-agent/pkg/config/model => ../../../../pkg/config/model + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel => ../../../../pkg/config/nodetreemodel github.com/DataDog/datadog-agent/pkg/config/setup => ../../../../pkg/config/setup + github.com/DataDog/datadog-agent/pkg/config/teeconfig => ../../../../pkg/config/teeconfig github.com/DataDog/datadog-agent/pkg/util/executable => ../../../../pkg/util/executable github.com/DataDog/datadog-agent/pkg/util/filesystem => ../../../../pkg/util/filesystem github.com/DataDog/datadog-agent/pkg/util/fxutil => ../../../../pkg/util/fxutil @@ -23,18 +26,21 @@ replace ( github.com/DataDog/datadog-agent/pkg/util/system => ../../../../pkg/util/system github.com/DataDog/datadog-agent/pkg/util/system/socket => ../../../../pkg/util/system/socket github.com/DataDog/datadog-agent/pkg/util/winutil => ../../../../pkg/util/winutil + ) require ( github.com/DataDog/datadog-agent/comp/core/log/def v0.0.0-00010101000000-000000000000 - github.com/DataDog/datadog-agent/pkg/util/log v0.56.0-rc.3 + github.com/DataDog/datadog-agent/pkg/util/log v0.57.1 github.com/DataDog/datadog-agent/pkg/util/log/setup v0.0.0-00010101000000-000000000000 github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 ) require ( - github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/scrubber v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.60.0-devel // indirect + github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.60.0-devel // indirect + github.com/DataDog/datadog-agent/pkg/util/scrubber v0.57.1 // indirect github.com/DataDog/viper v1.13.5 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect @@ -42,13 +48,13 @@ require ( github.com/mitchellh/mapstructure v1.1.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.2.0 // indirect - github.com/spf13/afero v1.1.2 // indirect + github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.5.1 // indirect github.com/spf13/jwalterweatherman v1.0.0 // indirect github.com/spf13/pflag v1.0.5 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/comp/core/log/mock/go.sum b/comp/core/log/mock/go.sum index cc381167ecd6d..6783592e46584 100644 --- a/comp/core/log/mock/go.sum +++ b/comp/core/log/mock/go.sum @@ -3,6 +3,8 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/viper v1.13.5 h1:SZMcyMknYQN2jRY/40A16gUXexlNJOI8sDs1cWZnI64= github.com/DataDog/viper v1.13.5/go.mod h1:wDdUVJ2SHaMaPrCZrlRCObwkubsX8j5sme3LaR/SGTc= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -44,6 +46,8 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= @@ -73,11 +77,15 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/grpc-ecosystem/grpc-gateway v1.13.0/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95 h1:S4qyfL2sEm5Budr4KVMyEniCy+PbS55651I/a+Kn/NQ= +github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95/go.mod h1:QiyDdbZLaJ/mZP4Zwc9g2QsfaEA4o7XvvgZegSci5/E= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA= +github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -90,6 +98,8 @@ 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/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -110,6 +120,8 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE 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/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= @@ -132,14 +144,19 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/shirou/gopsutil/v3 v3.23.12 h1:z90NtUkp3bMtmICZKpC4+WaknU1eXtp5vtbQ11DgpE4= +github.com/shirou/gopsutil/v3 v3.23.12/go.mod h1:1FrWgea594Jp7qmjHUUPlJDTPgcsb9mGnXDxavtikzM= +github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= +github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= @@ -157,6 +174,10 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= @@ -164,6 +185,8 @@ github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVM github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= +github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -178,13 +201,15 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= 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-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -203,6 +228,8 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/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.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -212,11 +239,11 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -229,6 +256,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/comp/core/secrets/go.mod b/comp/core/secrets/go.mod index d15a7c579be2b..d2b13b0b61fee 100644 --- a/comp/core/secrets/go.mod +++ b/comp/core/secrets/go.mod @@ -27,8 +27,8 @@ require ( github.com/benbjohnson/clock v1.3.0 github.com/stretchr/testify v1.9.0 go.uber.org/fx v1.22.2 - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 - golang.org/x/sys v0.25.0 + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 + golang.org/x/sys v0.26.0 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/comp/core/secrets/go.sum b/comp/core/secrets/go.sum index 9df05bcc9294a..a7dce31046299 100644 --- a/comp/core/secrets/go.sum +++ b/comp/core/secrets/go.sum @@ -72,11 +72,11 @@ 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.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/comp/core/status/go.mod b/comp/core/status/go.mod index fb43e991c613b..760d7a0c59eed 100644 --- a/comp/core/status/go.mod +++ b/comp/core/status/go.mod @@ -8,7 +8,7 @@ require ( github.com/spf13/cast v1.6.0 github.com/stretchr/testify v1.9.0 go.uber.org/fx v1.22.2 - golang.org/x/text v0.18.0 + golang.org/x/text v0.19.0 ) require ( @@ -20,6 +20,6 @@ require ( go.uber.org/dig v1.18.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/sys v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/comp/core/status/go.sum b/comp/core/status/go.sum index 88695248934e0..7052bb5fba664 100644 --- a/comp/core/status/go.sum +++ b/comp/core/status/go.sum @@ -37,10 +37,10 @@ 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/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/comp/core/status/statusimpl/go.mod b/comp/core/status/statusimpl/go.mod index 049706fa2fa1c..ab1836b963877 100644 --- a/comp/core/status/statusimpl/go.mod +++ b/comp/core/status/statusimpl/go.mod @@ -46,36 +46,36 @@ require ( github.com/DataDog/datadog-agent/comp/core/log/def v0.0.0-00010101000000-000000000000 github.com/DataDog/datadog-agent/comp/core/log/mock v0.0.0-00010101000000-000000000000 github.com/DataDog/datadog-agent/comp/core/status v0.56.0-rc.3 - github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.3 - github.com/DataDog/datadog-agent/pkg/config/setup v0.56.0-rc.3 + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 + github.com/DataDog/datadog-agent/pkg/config/setup v0.57.1 github.com/DataDog/datadog-agent/pkg/util/flavor v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/fxutil v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/version v0.56.0-rc.3 github.com/gorilla/mux v1.8.1 github.com/stretchr/testify v1.9.0 go.uber.org/fx v1.22.2 - golang.org/x/text v0.18.0 + golang.org/x/text v0.19.0 ) require ( github.com/DataDog/datadog-agent/comp/core/flare/builder v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/comp/core/secrets v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/comp/core/secrets v0.57.1 // indirect github.com/DataDog/datadog-agent/comp/def v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/env v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/env v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel // indirect - github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.60.0-devel // indirect + github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.60.0-devel // indirect github.com/DataDog/datadog-agent/pkg/util/executable v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/filesystem v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/log v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/log/setup v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/optional v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/pointer v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/optional v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/system v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system/socket v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/system v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/winutil v0.57.1 // indirect github.com/DataDog/viper v1.13.5 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect @@ -113,8 +113,8 @@ require ( go.uber.org/dig v1.18.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/sys v0.25.0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect + golang.org/x/sys v0.26.0 // indirect google.golang.org/protobuf v1.34.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/comp/core/status/statusimpl/go.sum b/comp/core/status/statusimpl/go.sum index deebd179e8bae..49a72ced8846b 100644 --- a/comp/core/status/statusimpl/go.sum +++ b/comp/core/status/statusimpl/go.sum @@ -266,8 +266,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -305,11 +305,11 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/comp/core/sysprobeconfig/sysprobeconfigimpl/config_mock.go b/comp/core/sysprobeconfig/sysprobeconfigimpl/config_mock.go index 27e54be0467c1..76df1240c50ac 100644 --- a/comp/core/sysprobeconfig/sysprobeconfigimpl/config_mock.go +++ b/comp/core/sysprobeconfig/sysprobeconfigimpl/config_mock.go @@ -13,6 +13,7 @@ import ( "testing" "github.com/DataDog/datadog-agent/comp/core/sysprobeconfig" + "github.com/DataDog/datadog-agent/pkg/config/mock" "github.com/DataDog/datadog-agent/pkg/config/model" "github.com/DataDog/datadog-agent/pkg/config/setup" "github.com/DataDog/datadog-agent/pkg/util/fxutil" @@ -51,16 +52,12 @@ func NewMock(t *testing.T) sysprobeconfig.Component { } func newMock(deps mockDependencies, t testing.TB) sysprobeconfig.Component { - old := setup.SystemProbe() - setup.SetSystemProbe(model.NewConfig("mock", "XXXX", strings.NewReplacer())) + mock.NewSystemProbe(t) c := &cfg{ warnings: &model.Warnings{}, Config: setup.SystemProbe(), } - // call InitSystemProbeConfig to set defaults. - setup.InitSystemProbeConfig(setup.SystemProbe()) - // Viper's `GetXxx` methods read environment variables at the time they are // called, if those names were passed explicitly to BindEnv*(), so we must // also strip all `DD_` environment variables for the duration of the test. @@ -84,9 +81,6 @@ func newMock(deps mockDependencies, t testing.TB) sysprobeconfig.Component { setup.SystemProbe().SetWithoutSource(k, v) } - // swap the existing config back at the end of the test. - t.Cleanup(func() { setup.SetSystemProbe(old) }) - syscfg, err := setupConfig(deps) if err != nil { t.Fatalf("sysprobe config create: %s", err) diff --git a/comp/core/tagger/global.go b/comp/core/tagger/global.go index d807a67edd837..87fd6a1884734 100644 --- a/comp/core/tagger/global.go +++ b/comp/core/tagger/global.go @@ -60,14 +60,6 @@ func GetEntityHash(entityID string, cardinality types.TagCardinality) string { return "" } -// StandardTags is an interface function that queries taggerclient singleton -func StandardTags(entityID string) ([]string, error) { - if globalTagger == nil { - return nil, fmt.Errorf("a global tagger must be set before calling StandardTags") - } - return globalTagger.Standard(entityID) -} - // AgentTags is an interface function that queries taggerclient singleton func AgentTags(cardinality types.TagCardinality) ([]string, error) { if globalTagger == nil { @@ -92,11 +84,6 @@ func List() types.TaggerListResponse { return types.TaggerListResponse{} } -// GetTaggerInstance returns the global Tagger instance -func GetTaggerInstance() Component { - return globalTagger -} - // SetNewCaptureTagger will set capture tagger in global tagger instance by using provided capture tagger func SetNewCaptureTagger(newCaptureTagger Component) { if globalTagger != nil { diff --git a/comp/core/tagger/taggerimpl/collectors/workloadmeta_extract.go b/comp/core/tagger/taggerimpl/collectors/workloadmeta_extract.go index d291d5228767a..dcbba45836ccf 100644 --- a/comp/core/tagger/taggerimpl/collectors/workloadmeta_extract.go +++ b/comp/core/tagger/taggerimpl/collectors/workloadmeta_extract.go @@ -199,7 +199,6 @@ func (c *WorkloadMetaCollector) handleContainer(ev workloadmeta.Event) []*types. tagList.AddLow(tags.ShortImage, image.ShortName) tagList.AddLow(tags.ImageTag, image.Tag) tagList.AddLow(tags.ImageID, image.ID) - tagList.AddLow(tags.KubeGPUType, container.Resources.GPUType) if container.Runtime == workloadmeta.ContainerRuntimeDocker { if image.Tag != "" { @@ -231,6 +230,11 @@ func (c *WorkloadMetaCollector) handleContainer(ev workloadmeta.Event) []*types. tagList.AddLow(tag, value) } + // gpu tags from container resource requests + for _, gpuVendor := range container.Resources.GPUVendorList { + tagList.AddLow(tags.KubeGPUVendor, gpuVendor) + } + low, orch, high, standard := tagList.Compute() return []*types.TagInfo{ { @@ -357,6 +361,11 @@ func (c *WorkloadMetaCollector) extractTagsFromPodEntity(pod *workloadmeta.Kuber k8smetadata.AddMetadataAsTags(name, value, c.k8sResourcesAnnotationsAsTags["namespaces"], c.globK8sResourcesAnnotations["namespaces"], tagList) } + // gpu requested vendor as tags + for _, gpuVendor := range pod.GPUVendorList { + tagList.AddLow(tags.KubeGPUVendor, gpuVendor) + } + kubeServiceDisabled := false for _, disabledTag := range pkgconfigsetup.Datadog().GetStringSlice("kubernetes_ad_tags_disabled") { if disabledTag == "kube_service" { diff --git a/comp/core/tagger/taggerimpl/collectors/workloadmeta_test.go b/comp/core/tagger/taggerimpl/collectors/workloadmeta_test.go index 49078f94ac2c7..830176d4abbc7 100644 --- a/comp/core/tagger/taggerimpl/collectors/workloadmeta_test.go +++ b/comp/core/tagger/taggerimpl/collectors/workloadmeta_test.go @@ -844,6 +844,60 @@ func TestHandleKubePod(t *testing.T) { }, }, }, + { + name: "pod with containers requesting gpu resources", + pod: workloadmeta.KubernetesPod{ + EntityID: podEntityID, + EntityMeta: workloadmeta.EntityMeta{ + Name: podName, + Namespace: podNamespace, + }, + GPUVendorList: []string{"nvidia"}, + Containers: []workloadmeta.OrchestratorContainer{ + { + ID: fullyFleshedContainerID, + Name: containerName, + Image: image, + }, + }, + }, + expected: []*types.TagInfo{ + { + Source: podSource, + EntityID: podTaggerEntityID, + HighCardTags: []string{}, + OrchestratorCardTags: []string{ + fmt.Sprintf("pod_name:%s", podName), + }, + LowCardTags: []string{ + fmt.Sprintf("kube_namespace:%s", podNamespace), + "gpu_vendor:nvidia", + }, + StandardTags: []string{}, + }, + { + Source: podSource, + EntityID: fullyFleshedContainerTaggerEntityID, + HighCardTags: []string{ + fmt.Sprintf("container_id:%s", fullyFleshedContainerID), + fmt.Sprintf("display_container_name:%s_%s", runtimeContainerName, podName), + }, + OrchestratorCardTags: []string{ + fmt.Sprintf("pod_name:%s", podName), + }, + LowCardTags: append([]string{ + fmt.Sprintf("kube_namespace:%s", podNamespace), + fmt.Sprintf("kube_container_name:%s", containerName), + "image_id:datadog/agent@sha256:a63d3f66fb2f69d955d4f2ca0b229385537a77872ffc04290acae65aed5317d2", + "image_name:datadog/agent", + "image_tag:latest", + "short_image:agent", + "gpu_vendor:nvidia", + }, standardTags...), + StandardTags: standardTags, + }, + }, + }, } for _, tt := range tests { @@ -2072,7 +2126,7 @@ func TestHandleContainer(t *testing.T) { Name: containerName, }, Resources: workloadmeta.ContainerResources{ - GPUType: "nvidia", + GPUVendorList: []string{"nvidia"}, }, }, expected: []*types.TagInfo{ @@ -2085,7 +2139,7 @@ func TestHandleContainer(t *testing.T) { }, OrchestratorCardTags: []string{}, LowCardTags: []string{ - "kube_gpu_type:nvidia", + "gpu_vendor:nvidia", }, StandardTags: []string{}, }, diff --git a/comp/core/tagger/taggerimpl/remote/tagger.go b/comp/core/tagger/taggerimpl/remote/tagger.go index c0af4b6059b17..6b540d4bb05d1 100644 --- a/comp/core/tagger/taggerimpl/remote/tagger.go +++ b/comp/core/tagger/taggerimpl/remote/tagger.go @@ -15,6 +15,7 @@ import ( "time" "github.com/cenkalti/backoff" + "github.com/google/uuid" "github.com/pkg/errors" "google.golang.org/grpc" "google.golang.org/grpc/credentials" @@ -56,6 +57,7 @@ type Tagger struct { streamCtx context.Context streamCancel context.CancelFunc + filter *types.Filter ctx context.Context cancel context.CancelFunc @@ -112,12 +114,13 @@ func CLCRunnerOptions(config config.Component) (Options, error) { // NewTagger returns an allocated tagger. You still have to run Init() // once the config package is ready. -func NewTagger(options Options, cfg config.Component, telemetryStore *telemetry.Store) *Tagger { +func NewTagger(options Options, cfg config.Component, telemetryStore *telemetry.Store, filter *types.Filter) *Tagger { return &Tagger{ options: options, cfg: cfg, store: newTagStore(cfg, telemetryStore), telemetryStore: telemetryStore, + filter: filter, } } @@ -392,8 +395,15 @@ func (t *Tagger) startTaggerStream(maxElapsed time.Duration) error { }), ) + prefixes := make([]string, 0) + for prefix := range t.filter.GetPrefixes() { + prefixes = append(prefixes, string(prefix)) + } + t.stream, err = t.client.TaggerStreamEntities(t.streamCtx, &pb.StreamTagsRequest{ - Cardinality: pb.TagCardinality_HIGH, + Cardinality: pb.TagCardinality(t.filter.GetCardinality()), + StreamingID: uuid.New().String(), + Prefixes: prefixes, }) if err != nil { log.Infof("unable to establish stream, will possibly retry: %s", err) diff --git a/comp/core/tagger/taggerimpl/server/server.go b/comp/core/tagger/taggerimpl/server/server.go index c614878f5fa54..0542973b1074c 100644 --- a/comp/core/tagger/taggerimpl/server/server.go +++ b/comp/core/tagger/taggerimpl/server/server.go @@ -9,7 +9,6 @@ package server import ( "context" "fmt" - "sync/atomic" "time" "google.golang.org/grpc/codes" @@ -28,31 +27,15 @@ const ( streamKeepAliveInterval = 9 * time.Minute ) -// streamIDManager is used to generate unique ID's for incoming streaming requests -// This unique ID is used to subscribe to the tagger -// TODO: remove this struct when the protobuf of the stream request is updated to use filters. -type streamIDManager struct { - atomic.Int32 -} - -func (s *streamIDManager) getNextUniqueID() string { - id := fmt.Sprintf("stream-client-%d", s.Add(1)) - return id -} - -var sharedIDManager streamIDManager - // Server is a grpc server that streams tagger entities type Server struct { taggerComponent tagger.Component - manager *streamIDManager } // NewServer returns a new Server func NewServer(t tagger.Component) *Server { return &Server{ taggerComponent: t, - manager: &sharedIDManager, } } @@ -65,14 +48,14 @@ func (s *Server) TaggerStreamEntities(in *pb.StreamTagsRequest, out pb.AgentSecu return err } - // NOTE: StreamTagsRequest can specify filters, but they cannot be - // implemented since the tagger has no concept of container metadata. - // these filters will be introduced when we implement a container - // metadata service that can receive them as is from the tagger. + filterBuilder := types.NewFilterBuilder() + for _, prefix := range in.GetPrefixes() { + filterBuilder = filterBuilder.Include(types.EntityIDPrefix(prefix)) + } - filter := types.NewFilterBuilder().Build(cardinality) + filter := filterBuilder.Build(cardinality) - subscriptionID := s.manager.getNextUniqueID() + subscriptionID := fmt.Sprintf("streaming-client-%s", in.GetStreamingID()) subscription, err := s.taggerComponent.Subscribe(subscriptionID, filter) if err != nil { return err diff --git a/comp/core/tagger/taggerimpl/tagger.go b/comp/core/tagger/taggerimpl/tagger.go index a0b40abca7a0c..2fb661469c18d 100644 --- a/comp/core/tagger/taggerimpl/tagger.go +++ b/comp/core/tagger/taggerimpl/tagger.go @@ -114,10 +114,9 @@ type TaggerClient struct { log log.Component } -func createTaggerClient(defaultTagger taggerComp.Component, captureTagger taggerComp.Component, l log.Component) *TaggerClient { +func createTaggerClient(defaultTagger taggerComp.Component, l log.Component) *TaggerClient { return &TaggerClient{ defaultTagger: defaultTagger, - captureTagger: captureTagger, log: l, } } @@ -135,23 +134,24 @@ func newTaggerClient(deps dependencies) provides { if err != nil { deps.Log.Errorf("unable to deps.Configure the remote tagger: %s", err) - taggerClient = createTaggerClient(local.NewFakeTagger(deps.Config, telemetryStore), nil, deps.Log) + taggerClient = createTaggerClient(local.NewFakeTagger(deps.Config, telemetryStore), deps.Log) } else if options.Disabled { deps.Log.Errorf("remote tagger is disabled in clc runner.") - taggerClient = createTaggerClient(local.NewFakeTagger(deps.Config, telemetryStore), nil, deps.Log) + taggerClient = createTaggerClient(local.NewFakeTagger(deps.Config, telemetryStore), deps.Log) } else { - taggerClient = createTaggerClient(remote.NewTagger(options, deps.Config, telemetryStore), nil, deps.Log) + filter := types.NewFilterBuilder().Exclude(types.KubernetesPodUID).Build(types.HighCardinality) + taggerClient = createTaggerClient(remote.NewTagger(options, deps.Config, telemetryStore, filter), deps.Log) } case taggerComp.NodeRemoteTaggerAgent: options, _ := remote.NodeAgentOptions(deps.Config) - taggerClient = createTaggerClient(remote.NewTagger(options, deps.Config, telemetryStore), nil, deps.Log) + taggerClient = createTaggerClient(remote.NewTagger(options, deps.Config, telemetryStore, types.NewMatchAllFilter()), deps.Log) case taggerComp.LocalTaggerAgent: - taggerClient = createTaggerClient(local.NewTagger(deps.Config, deps.Wmeta, telemetryStore), nil, deps.Log) + taggerClient = createTaggerClient(local.NewTagger(deps.Config, deps.Wmeta, telemetryStore), deps.Log) case taggerComp.FakeTagger: // all binaries are expected to provide their own tagger at startup. we // provide a fake tagger for testing purposes, as calling the global // tagger without proper initialization is very common there. - taggerClient = createTaggerClient(local.NewFakeTagger(deps.Config, telemetryStore), nil, deps.Log) + taggerClient = createTaggerClient(local.NewFakeTagger(deps.Config, telemetryStore), deps.Log) } if taggerClient != nil { diff --git a/comp/core/tagger/tags/tags.go b/comp/core/tagger/tags/tags.go index 0889fbece7f41..68418bd7887c3 100644 --- a/comp/core/tagger/tags/tags.go +++ b/comp/core/tagger/tags/tags.go @@ -52,8 +52,6 @@ const ( KubeContainerName = "kube_container_name" // KubeOwnerRefKind is the tag for the Kubernetes owner reference kind KubeOwnerRefKind = "kube_ownerref_kind" - // KubeGPUType is the tag for the Kubernetes Resource GPU type - KubeGPUType = "kube_gpu_type" // KubePod is the tag for the pod name KubePod = "pod_name" @@ -91,6 +89,11 @@ const ( // KubeAppManagedBy is the tag for the "app.kubernetes.io/managed-by" Kubernetes label KubeAppManagedBy = "kube_app_managed_by" + // GPU related tags + + // KubeGPUVendor the tag for the Kubernetes Resource GPU vendor + KubeGPUVendor = "gpu_vendor" + // OpenshiftDeploymentConfig is the tag for the OpenShift deployment config name OpenshiftDeploymentConfig = "oshift_deployment_config" diff --git a/comp/core/tagger/types/go.mod b/comp/core/tagger/types/go.mod index 1bcaf2789b0c1..905abcea7c384 100644 --- a/comp/core/tagger/types/go.mod +++ b/comp/core/tagger/types/go.mod @@ -81,12 +81,12 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/comp/core/tagger/types/go.sum b/comp/core/tagger/types/go.sum index e92309f06689e..fcbe4c21f6c43 100644 --- a/comp/core/tagger/types/go.sum +++ b/comp/core/tagger/types/go.sum @@ -252,8 +252,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -296,11 +296,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -313,8 +313,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/comp/core/telemetry/go.mod b/comp/core/telemetry/go.mod index 2e8e4c62ea5cd..86aa58e9b00e6 100644 --- a/comp/core/telemetry/go.mod +++ b/comp/core/telemetry/go.mod @@ -41,7 +41,7 @@ require ( go.uber.org/dig v1.18.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/sys v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/comp/core/telemetry/go.sum b/comp/core/telemetry/go.sum index 69e5d7e7f25c9..5f4a0afebda40 100644 --- a/comp/core/telemetry/go.sum +++ b/comp/core/telemetry/go.sum @@ -67,8 +67,8 @@ go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN8 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/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/comp/core/workloadmeta/collectors/internal/kubelet/kubelet.go b/comp/core/workloadmeta/collectors/internal/kubelet/kubelet.go index 183865742fdd5..a57a8d5674498 100644 --- a/comp/core/workloadmeta/collectors/internal/kubelet/kubelet.go +++ b/comp/core/workloadmeta/collectors/internal/kubelet/kubelet.go @@ -145,6 +145,8 @@ func (c *collector) parsePods(pods []*kubelet.Pod) []workloadmeta.CollectorEvent &podID, ) + GPUVendors := getGPUVendorsFromContainers(initContainerEvents, containerEvents) + podOwners := pod.Owners() owners := make([]workloadmeta.KubernetesPodOwner, 0, len(podOwners)) for _, o := range podOwners { @@ -175,6 +177,7 @@ func (c *collector) parsePods(pods []*kubelet.Pod) []workloadmeta.CollectorEvent IP: pod.Status.PodIP, PriorityClass: pod.Spec.PriorityClassName, QOSClass: pod.Status.QOSClass, + GPUVendorList: GPUVendors, RuntimeClass: RuntimeClassName, SecurityContext: PodSecurityContext, } @@ -313,6 +316,23 @@ func (c *collector) parsePodContainers( return podContainers, events } +func getGPUVendorsFromContainers(initContainerEvents, containerEvents []workloadmeta.CollectorEvent) []string { + gpuUniqueTypes := make(map[string]bool) + for _, event := range append(initContainerEvents, containerEvents...) { + container := event.Entity.(*workloadmeta.Container) + for _, GPUVendor := range container.Resources.GPUVendorList { + gpuUniqueTypes[GPUVendor] = true + } + } + + GPUVendors := make([]string, 0, len(gpuUniqueTypes)) + for GPUVendor := range gpuUniqueTypes { + GPUVendors = append(GPUVendors, GPUVendor) + } + + return GPUVendors +} + func extractPodRuntimeClassName(spec *kubelet.Spec) string { if spec.RuntimeClassName == nil { return "" @@ -425,13 +445,18 @@ func extractResources(spec *kubelet.ContainerSpec) workloadmeta.ContainerResourc } // extract GPU resource info from the possible GPU sources + uniqueGPUVendor := make(map[string]bool) for _, gpuResource := range kubelet.GetGPUResourceNames() { if gpuReq, found := spec.Resources.Requests[gpuResource]; found { resources.GPURequest = pointer.Ptr(uint64(gpuReq.Value())) - resources.GPUType = extractSimpleGPUName(gpuResource) - break + uniqueGPUVendor[extractSimpleGPUName(gpuResource)] = true } } + gpuVendorList := make([]string, 0, len(uniqueGPUVendor)) + for GPUVendor := range uniqueGPUVendor { + gpuVendorList = append(gpuVendorList, GPUVendor) + } + resources.GPUVendorList = gpuVendorList return resources } diff --git a/comp/core/workloadmeta/collectors/internal/remote/processcollector/process_collector_test.go b/comp/core/workloadmeta/collectors/internal/remote/processcollector/process_collector_test.go index 71e47ded6be31..f8d639ad39298 100644 --- a/comp/core/workloadmeta/collectors/internal/remote/processcollector/process_collector_test.go +++ b/comp/core/workloadmeta/collectors/internal/remote/processcollector/process_collector_test.go @@ -38,13 +38,28 @@ import ( const dummySubscriber = "dummy-subscriber" +func newMockServer(ctx context.Context, responses []*pbgo.ProcessStreamResponse, errorResponse bool) *mockServer { + ctx, cancelFunc := context.WithCancel(ctx) + return &mockServer{ + ctx: ctx, + cancelFunc: cancelFunc, + responses: responses, + errorResponse: errorResponse, + } +} + type mockServer struct { pbgo.UnimplementedProcessEntityStreamServer - + ctx context.Context + cancelFunc context.CancelFunc responses []*pbgo.ProcessStreamResponse errorResponse bool // first response is an error } +func (s *mockServer) stop() { + s.cancelFunc() +} + // StreamEntities sends the responses back to the client func (s *mockServer) StreamEntities(_ *pbgo.ProcessStreamEntitiesRequest, out pbgo.ProcessEntityStream_StreamEntitiesServer) error { // Handle error response for the first request @@ -60,6 +75,7 @@ func (s *mockServer) StreamEntities(_ *pbgo.ProcessStreamEntitiesRequest, out pb } } + <-s.ctx.Done() return nil } @@ -254,11 +270,12 @@ func TestCollection(t *testing.T) { time.Sleep(time.Second) + ctx := context.Background() + // remote process collector server (process agent) - server := &mockServer{ - responses: test.serverResponses, - errorResponse: test.errorResponse, - } + server := newMockServer(ctx, test.serverResponses, test.errorResponse) + defer server.stop() + grpcServer := grpc.NewServer() pbgo.RegisterProcessEntityStreamServer(grpcServer, server) @@ -286,13 +303,12 @@ func TestCollection(t *testing.T) { mockStore.Notify(test.preEvents) - ctx, cancel := context.WithCancel(context.TODO()) - // Subscribe to the mockStore ch := mockStore.Subscribe(dummySubscriber, workloadmeta.NormalPriority, nil) + collectorCtx, cancelCollectorCtxFunc := context.WithCancel(ctx) // Collect process data - err = collector.Start(ctx, mockStore) + err = collector.Start(collectorCtx, mockStore) require.NoError(t, err) // Number of events expected. Each response can hold multiple events, either Set or Unset @@ -319,7 +335,7 @@ func TestCollection(t *testing.T) { mockStore.Unsubscribe(ch) grpcServer.Stop() - cancel() + cancelCollectorCtxFunc() // Verify final state for i := range test.expectedProcesses { diff --git a/comp/core/workloadmeta/def/types.go b/comp/core/workloadmeta/def/types.go index d266ce6073bdb..5bef5126a10b5 100644 --- a/comp/core/workloadmeta/def/types.go +++ b/comp/core/workloadmeta/def/types.go @@ -422,7 +422,7 @@ func (c ContainerHealthStatus) String(verbose bool) string { type ContainerResources struct { GPURequest *uint64 // Number of GPUs GPULimit *uint64 - GPUType string // The type of GPU requested (eg. nvidia, amd, intel) + GPUVendorList []string // The type of GPU requested (eg. nvidia, amd, intel) CPURequest *float64 // Percentage 0-100*numCPU (aligned with CPU Limit from metrics provider) CPULimit *float64 MemoryRequest *uint64 // Bytes @@ -444,8 +444,8 @@ func (cr ContainerResources) String(bool) string { if cr.MemoryLimit != nil { _, _ = fmt.Fprintln(&sb, "TargetMemoryLimit:", *cr.MemoryLimit) } - if cr.GPUType != "" { - _, _ = fmt.Fprintln(&sb, "GPUType:", cr.GPUType) + if cr.GPUVendorList != nil { + _, _ = fmt.Fprintln(&sb, "GPUVendor:", cr.GPUVendorList) } return sb.String() } @@ -678,6 +678,7 @@ type KubernetesPod struct { IP string PriorityClass string QOSClass string + GPUVendorList []string RuntimeClass string KubeServices []string NamespaceLabels map[string]string @@ -745,6 +746,7 @@ func (p KubernetesPod) String(verbose bool) string { if verbose { _, _ = fmt.Fprintln(&sb, "Priority Class:", p.PriorityClass) _, _ = fmt.Fprintln(&sb, "QOS Class:", p.QOSClass) + _, _ = fmt.Fprintln(&sb, "GPU Vendor:", p.GPUVendorList) _, _ = fmt.Fprintln(&sb, "Runtime Class:", p.RuntimeClass) _, _ = fmt.Fprintln(&sb, "PVCs:", sliceToString(p.PersistentVolumeClaimNames)) _, _ = fmt.Fprintln(&sb, "Kube Services:", sliceToString(p.KubeServices)) diff --git a/comp/core/workloadmeta/impl/dump_test.go b/comp/core/workloadmeta/impl/dump_test.go index 13cdae7309aa6..67f13f174e346 100644 --- a/comp/core/workloadmeta/impl/dump_test.go +++ b/comp/core/workloadmeta/impl/dump_test.go @@ -28,7 +28,7 @@ func TestDump(t *testing.T) { Name: "ctr-image", }, Resources: wmdef.ContainerResources{ - GPUType: "nvidia", + GPUVendorList: []string{"nvidia"}, }, Runtime: wmdef.ContainerRuntimeDocker, RuntimeFlavor: wmdef.ContainerRuntimeFlavorKata, @@ -53,9 +53,6 @@ func TestDump(t *testing.T) { }, PID: 1, CgroupPath: "/default/ctr-id", - Resources: wmdef.ContainerResources{ - GPUType: "nvidia", - }, } s.handleEvents([]wmdef.CollectorEvent{ @@ -89,7 +86,7 @@ Runtime: docker RuntimeFlavor: kata Running: false ----------- Resources ----------- -GPUType: nvidia +GPUVendor: [nvidia] `, }, }, @@ -127,7 +124,7 @@ Created At: 0001-01-01 00:00:00 +0000 UTC Started At: 0001-01-01 00:00:00 +0000 UTC Finished At: 0001-01-01 00:00:00 +0000 UTC ----------- Resources ----------- -GPUType: nvidia +GPUVendor: [nvidia] Hostname: Network IPs: PID: 0 @@ -157,7 +154,6 @@ Created At: 0001-01-01 00:00:00 +0000 UTC Started At: 0001-01-01 00:00:00 +0000 UTC Finished At: 0001-01-01 00:00:00 +0000 UTC ----------- Resources ----------- -GPUType: nvidia Hostname: Network IPs: PID: 1 @@ -187,7 +183,7 @@ Created At: 0001-01-01 00:00:00 +0000 UTC Started At: 0001-01-01 00:00:00 +0000 UTC Finished At: 0001-01-01 00:00:00 +0000 UTC ----------- Resources ----------- -GPUType: nvidia +GPUVendor: [nvidia] Hostname: Network IPs: PID: 1 diff --git a/comp/forwarder/defaultforwarder/go.mod b/comp/forwarder/defaultforwarder/go.mod index 2ef744a994c31..f537057c1b663 100644 --- a/comp/forwarder/defaultforwarder/go.mod +++ b/comp/forwarder/defaultforwarder/go.mod @@ -56,18 +56,18 @@ require ( github.com/DataDog/datadog-agent/comp/core/log/mock v0.0.0-00010101000000-000000000000 github.com/DataDog/datadog-agent/comp/core/status v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel - github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.3 - github.com/DataDog/datadog-agent/pkg/config/setup v0.56.0-rc.3 + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 + github.com/DataDog/datadog-agent/pkg/config/setup v0.57.1 github.com/DataDog/datadog-agent/pkg/config/utils v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/orchestrator/model v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/status/health v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/telemetry v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/backoff v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/common v0.56.0-rc.3 - github.com/DataDog/datadog-agent/pkg/util/filesystem v0.56.0-rc.3 + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.1 github.com/DataDog/datadog-agent/pkg/util/fxutil v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/http v0.56.0-rc.3 - github.com/DataDog/datadog-agent/pkg/util/optional v0.56.0-rc.3 + github.com/DataDog/datadog-agent/pkg/util/optional v0.57.1 github.com/DataDog/datadog-agent/pkg/util/scrubber v0.57.1 github.com/DataDog/datadog-agent/pkg/version v0.56.0-rc.3 github.com/golang/protobuf v1.5.3 @@ -75,26 +75,26 @@ require ( github.com/stretchr/testify v1.9.0 go.uber.org/atomic v1.11.0 go.uber.org/fx v1.22.2 - golang.org/x/text v0.18.0 + golang.org/x/text v0.19.0 ) require ( github.com/DataDog/datadog-agent/comp/core/flare/builder v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/core/flare/types v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/comp/core/secrets v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/comp/core/secrets v0.57.1 // indirect github.com/DataDog/datadog-agent/comp/core/telemetry v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/def v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/env v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/env v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.60.0-devel // indirect + github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.60.0-devel // indirect github.com/DataDog/datadog-agent/pkg/util/executable v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/log v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/log/setup v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/pointer v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system/socket v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/winutil v0.57.1 // indirect github.com/DataDog/viper v1.13.5 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect @@ -147,12 +147,12 @@ require ( go.uber.org/dig v1.18.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/comp/forwarder/defaultforwarder/go.sum b/comp/forwarder/defaultforwarder/go.sum index bb4c7a3f4b025..6e508ad7dbab2 100644 --- a/comp/forwarder/defaultforwarder/go.sum +++ b/comp/forwarder/defaultforwarder/go.sum @@ -284,8 +284,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -305,8 +305,8 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/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.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -332,11 +332,11 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -349,8 +349,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/comp/forwarder/defaultforwarder/transaction/transaction_test.go b/comp/forwarder/defaultforwarder/transaction/transaction_test.go index 894ecae4b9248..73d7529f8b980 100644 --- a/comp/forwarder/defaultforwarder/transaction/transaction_test.go +++ b/comp/forwarder/defaultforwarder/transaction/transaction_test.go @@ -17,7 +17,7 @@ import ( "github.com/stretchr/testify/assert" logmock "github.com/DataDog/datadog-agent/comp/core/log/mock" - pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" ) func TestNewHTTPTransaction(t *testing.T) { @@ -52,7 +52,7 @@ func TestProcess(t *testing.T) { client := &http.Client{} - mockConfig := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + mockConfig := configmock.New(t) log := logmock.New(t) err := transaction.Process(context.Background(), mockConfig, log, client) assert.NoError(t, err) @@ -67,7 +67,7 @@ func TestProcessInvalidDomain(t *testing.T) { client := &http.Client{} - mockConfig := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + mockConfig := configmock.New(t) log := logmock.New(t) err := transaction.Process(context.Background(), mockConfig, log, client) assert.NoError(t, err) @@ -82,7 +82,7 @@ func TestProcessNetworkError(t *testing.T) { client := &http.Client{} - mockConfig := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + mockConfig := configmock.New(t) log := logmock.New(t) err := transaction.Process(context.Background(), mockConfig, log, client) assert.NotNil(t, err) @@ -104,7 +104,7 @@ func TestProcessHTTPError(t *testing.T) { client := &http.Client{} - mockConfig := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + mockConfig := configmock.New(t) log := logmock.New(t) err := transaction.Process(context.Background(), mockConfig, log, client) assert.NotNil(t, err) @@ -136,7 +136,7 @@ func TestProcessCancel(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) cancel() - mockConfig := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + mockConfig := configmock.New(t) log := logmock.New(t) err := transaction.Process(ctx, mockConfig, log, client) assert.NoError(t, err) diff --git a/comp/forwarder/orchestrator/orchestratorinterface/go.mod b/comp/forwarder/orchestrator/orchestratorinterface/go.mod index 387c3efd071cc..43eaf8ff9461d 100644 --- a/comp/forwarder/orchestrator/orchestratorinterface/go.mod +++ b/comp/forwarder/orchestrator/orchestratorinterface/go.mod @@ -68,17 +68,17 @@ require ( github.com/DataDog/datadog-agent/comp/core/flare/builder v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/core/flare/types v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/core/log/def v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/comp/core/secrets v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/comp/core/secrets v0.57.1 // indirect github.com/DataDog/datadog-agent/comp/core/status v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/core/telemetry v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/def v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/env v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/env v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel // indirect - github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/pkg/config/setup v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.60.0-devel // indirect + github.com/DataDog/datadog-agent/pkg/config/setup v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.60.0-devel // indirect github.com/DataDog/datadog-agent/pkg/config/utils v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/orchestrator/model v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/status/health v0.56.0-rc.3 // indirect @@ -86,16 +86,16 @@ require ( github.com/DataDog/datadog-agent/pkg/util/backoff v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/common v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/executable v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/filesystem v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/fxutil v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/http v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/log v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/optional v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/pointer v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/optional v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/system v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system/socket v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/system v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/winutil v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/version v0.56.0-rc.3 // indirect github.com/DataDog/viper v1.13.5 // indirect @@ -154,13 +154,13 @@ require ( go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/comp/forwarder/orchestrator/orchestratorinterface/go.sum b/comp/forwarder/orchestrator/orchestratorinterface/go.sum index b62c122e6e64d..b2bcc2daeeb65 100644 --- a/comp/forwarder/orchestrator/orchestratorinterface/go.sum +++ b/comp/forwarder/orchestrator/orchestratorinterface/go.sum @@ -280,8 +280,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -301,8 +301,8 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/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.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -328,11 +328,11 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -345,8 +345,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/comp/logs/agent/config/go.mod b/comp/logs/agent/config/go.mod index 7a626f1fd4a1c..a848412709392 100644 --- a/comp/logs/agent/config/go.mod +++ b/comp/logs/agent/config/go.mod @@ -99,12 +99,12 @@ require ( go.uber.org/dig v1.18.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/comp/logs/agent/config/go.sum b/comp/logs/agent/config/go.sum index c4df7b42ad5d0..42636c1b8bc19 100644 --- a/comp/logs/agent/config/go.sum +++ b/comp/logs/agent/config/go.sum @@ -256,8 +256,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -300,11 +300,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -317,8 +317,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/comp/metadata/inventoryagent/README.md b/comp/metadata/inventoryagent/README.md index 07afed9f121b7..8d542dfa36eeb 100644 --- a/comp/metadata/inventoryagent/README.md +++ b/comp/metadata/inventoryagent/README.md @@ -83,7 +83,6 @@ The payload is a JSON dict with the following fields - `feature_usm_kafka_enabled` - **bool**: True if Kafka monitoring is enabled for Universal Service Monitoring (see: `service_monitoring_config.enable_kafka_monitoring` config option in `system-probe.yaml`) - `feature_usm_postgres_enabled` - **bool**: True if Postgres monitoring is enabled for Universal Service Monitoring (see: `service_monitoring_config.enable_postgres_monitoring` config option in `system-probe.yaml`) - `feature_usm_redis_enabled` - **bool**: True if Redis monitoring is enabled for Universal Service Monitoring (see: `service_monitoring_config.enable_redis_monitoring` config option in `system-probe.yaml`) - - `feature_usm_java_tls_enabled` - **bool**: True if HTTPS monitoring through java TLS is enabled for Universal Service Monitoring (see: `service_monitoring_config.tls.java.enabled` config option in `system-probe.yaml`). - `feature_usm_go_tls_enabled` - **bool**: True if HTTPS monitoring through GoTLS is enabled for Universal Service Monitoring (see: `service_monitoring_config.tls.go.enabled` config option in `system-probe.yaml`). - `feature_discovery_enabled` - **bool**: True if discovery module is enabled (see: `discovery.enabled` config option). - `feature_dynamic_instrumentation_enabled` - **bool**: True if dynamic instrumentation module is enabled (see: `dynamic_instrumentation.enabled` config option). diff --git a/comp/metadata/inventoryagent/inventoryagentimpl/inventoryagent.go b/comp/metadata/inventoryagent/inventoryagentimpl/inventoryagent.go index 72e94be45a615..095c6e9effce9 100644 --- a/comp/metadata/inventoryagent/inventoryagentimpl/inventoryagent.go +++ b/comp/metadata/inventoryagent/inventoryagentimpl/inventoryagent.go @@ -299,7 +299,6 @@ func (ia *inventoryagent) fetchSystemProbeMetadata() { ia.data["feature_usm_kafka_enabled"] = sysProbeConf.GetBool("service_monitoring_config.enable_kafka_monitoring") ia.data["feature_usm_postgres_enabled"] = sysProbeConf.GetBool("service_monitoring_config.enable_postgres_monitoring") ia.data["feature_usm_redis_enabled"] = sysProbeConf.GetBool("service_monitoring_config.enable_redis_monitoring") - ia.data["feature_usm_java_tls_enabled"] = sysProbeConf.GetBool("service_monitoring_config.tls.java.enabled") ia.data["feature_usm_http2_enabled"] = sysProbeConf.GetBool("service_monitoring_config.enable_http2_monitoring") ia.data["feature_usm_istio_enabled"] = sysProbeConf.GetBool("service_monitoring_config.tls.istio.enabled") ia.data["feature_usm_http_by_status_code_enabled"] = sysProbeConf.GetBool("service_monitoring_config.enable_http_stats_by_status_code") diff --git a/comp/metadata/inventoryagent/inventoryagentimpl/inventoryagent_test.go b/comp/metadata/inventoryagent/inventoryagentimpl/inventoryagent_test.go index 3a3b279ae777a..3038e093ff093 100644 --- a/comp/metadata/inventoryagent/inventoryagentimpl/inventoryagent_test.go +++ b/comp/metadata/inventoryagent/inventoryagentimpl/inventoryagent_test.go @@ -216,7 +216,6 @@ func TestInitData(t *testing.T) { "feature_usm_kafka_enabled": true, "feature_usm_postgres_enabled": true, "feature_usm_redis_enabled": true, - "feature_usm_java_tls_enabled": true, "feature_usm_http2_enabled": true, "feature_usm_istio_enabled": true, "feature_usm_http_by_status_code_enabled": true, @@ -490,7 +489,6 @@ func TestFetchSystemProbeAgent(t *testing.T) { assert.False(t, ia.data["feature_usm_kafka_enabled"].(bool)) assert.False(t, ia.data["feature_usm_postgres_enabled"].(bool)) assert.False(t, ia.data["feature_usm_redis_enabled"].(bool)) - assert.False(t, ia.data["feature_usm_java_tls_enabled"].(bool)) assert.False(t, ia.data["feature_usm_http2_enabled"].(bool)) assert.False(t, ia.data["feature_usm_istio_enabled"].(bool)) assert.True(t, ia.data["feature_usm_http_by_status_code_enabled"].(bool)) @@ -543,7 +541,6 @@ func TestFetchSystemProbeAgent(t *testing.T) { assert.False(t, ia.data["feature_usm_enabled"].(bool)) assert.False(t, ia.data["feature_usm_kafka_enabled"].(bool)) assert.False(t, ia.data["feature_usm_postgres_enabled"].(bool)) - assert.False(t, ia.data["feature_usm_java_tls_enabled"].(bool)) assert.False(t, ia.data["feature_usm_http2_enabled"].(bool)) assert.False(t, ia.data["feature_usm_istio_enabled"].(bool)) assert.False(t, ia.data["feature_usm_http_by_status_code_enabled"].(bool)) @@ -644,7 +641,6 @@ dynamic_instrumentation: assert.True(t, ia.data["feature_usm_kafka_enabled"].(bool)) assert.True(t, ia.data["feature_usm_postgres_enabled"].(bool)) assert.True(t, ia.data["feature_usm_redis_enabled"].(bool)) - assert.True(t, ia.data["feature_usm_java_tls_enabled"].(bool)) assert.True(t, ia.data["feature_usm_http2_enabled"].(bool)) assert.True(t, ia.data["feature_usm_istio_enabled"].(bool)) assert.True(t, ia.data["feature_usm_http_by_status_code_enabled"].(bool)) diff --git a/comp/otelcol/collector-contrib/def/go.mod b/comp/otelcol/collector-contrib/def/go.mod index 8ecb5f33ca8d2..f41592f0fbcad 100644 --- a/comp/otelcol/collector-contrib/def/go.mod +++ b/comp/otelcol/collector-contrib/def/go.mod @@ -73,10 +73,10 @@ require ( go.opentelemetry.io/proto/otlp v1.2.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/net v0.29.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect + golang.org/x/net v0.30.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect gonum.org/v1/gonum v0.15.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect diff --git a/comp/otelcol/collector-contrib/def/go.sum b/comp/otelcol/collector-contrib/def/go.sum index 4b243874a14aa..69854854e9d2e 100644 --- a/comp/otelcol/collector-contrib/def/go.sum +++ b/comp/otelcol/collector-contrib/def/go.sum @@ -239,8 +239,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk 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/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -255,8 +255,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL 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.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -271,12 +271,12 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= 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= diff --git a/comp/otelcol/collector-contrib/impl/go.mod b/comp/otelcol/collector-contrib/impl/go.mod index 13073bf3c5965..e7241e4472351 100644 --- a/comp/otelcol/collector-contrib/impl/go.mod +++ b/comp/otelcol/collector-contrib/impl/go.mod @@ -267,17 +267,17 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/crypto v0.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/crypto v0.28.0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/oauth2 v0.20.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/term v0.24.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/time v0.6.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/term v0.25.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/time v0.7.0 // indirect + golang.org/x/tools v0.26.0 // indirect gonum.org/v1/gonum v0.15.0 // indirect google.golang.org/api v0.169.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5 // indirect diff --git a/comp/otelcol/collector-contrib/impl/go.sum b/comp/otelcol/collector-contrib/impl/go.sum index 35301133ce53e..e4fda8b1f2d37 100644 --- a/comp/otelcol/collector-contrib/impl/go.sum +++ b/comp/otelcol/collector-contrib/impl/go.sum @@ -1033,8 +1033,8 @@ golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1045,8 +1045,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1131,8 +1131,8 @@ golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1232,8 +1232,8 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1247,8 +1247,8 @@ golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= -golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= -golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1264,16 +1264,16 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= -golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= -golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= +golang.org/x/time v0.7.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= @@ -1327,8 +1327,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= diff --git a/comp/otelcol/converter/impl/go.mod b/comp/otelcol/converter/impl/go.mod index 11ce8150078db..ff63bc44e507a 100644 --- a/comp/otelcol/converter/impl/go.mod +++ b/comp/otelcol/converter/impl/go.mod @@ -122,9 +122,9 @@ require ( go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/comp/otelcol/converter/impl/go.sum b/comp/otelcol/converter/impl/go.sum index b2d389ba80705..d330fb70a5d3f 100644 --- a/comp/otelcol/converter/impl/go.sum +++ b/comp/otelcol/converter/impl/go.sum @@ -289,8 +289,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -327,11 +327,11 @@ golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/comp/otelcol/ddflareextension/def/go.mod b/comp/otelcol/ddflareextension/def/go.mod index 0a43054d486a3..8631115835e38 100644 --- a/comp/otelcol/ddflareextension/def/go.mod +++ b/comp/otelcol/ddflareextension/def/go.mod @@ -23,9 +23,9 @@ require ( go.opentelemetry.io/otel/trace v1.27.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/net v0.29.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/net v0.30.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.2 // indirect diff --git a/comp/otelcol/ddflareextension/def/go.sum b/comp/otelcol/ddflareextension/def/go.sum index 6e21ab1e8af4b..7993069b8b6ad 100644 --- a/comp/otelcol/ddflareextension/def/go.sum +++ b/comp/otelcol/ddflareextension/def/go.sum @@ -87,20 +87,20 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn 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.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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-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-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 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= diff --git a/comp/otelcol/ddflareextension/impl/extension_test.go b/comp/otelcol/ddflareextension/impl/extension_test.go index 5690a829a96d2..af6875be73398 100644 --- a/comp/otelcol/ddflareextension/impl/extension_test.go +++ b/comp/otelcol/ddflareextension/impl/extension_test.go @@ -11,13 +11,11 @@ import ( "encoding/json" "net/http" "net/http/httptest" - "strings" "testing" ddflareextension "github.com/DataDog/datadog-agent/comp/otelcol/ddflareextension/def" apiutil "github.com/DataDog/datadog-agent/pkg/api/util" - pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model" - pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" "github.com/open-telemetry/opentelemetry-collector-contrib/connector/spanmetricsconnector" "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension" @@ -121,13 +119,7 @@ func TestNewExtension(t *testing.T) { } func TestExtensionHTTPHandler(t *testing.T) { - oldConfig := pkgconfigsetup.Datadog() - defer func() { - pkgconfigsetup.SetDatadog(oldConfig) - }() - - conf := pkgconfigmodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) - pkgconfigsetup.SetDatadog(conf) + conf := configmock.New(t) err := apiutil.CreateAndSetAuthToken(conf) if err != nil { t.Fatal(err) @@ -162,13 +154,7 @@ func TestExtensionHTTPHandler(t *testing.T) { } func TestExtensionHTTPHandlerBadToken(t *testing.T) { - oldConfig := pkgconfigsetup.Datadog() - defer func() { - pkgconfigsetup.SetDatadog(oldConfig) - }() - - conf := pkgconfigmodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) - pkgconfigsetup.SetDatadog(conf) + conf := configmock.New(t) err := apiutil.CreateAndSetAuthToken(conf) if err != nil { t.Fatal(err) diff --git a/comp/otelcol/ddflareextension/impl/go.mod b/comp/otelcol/ddflareextension/impl/go.mod index 60a9a73c8577b..4280cf75bd9d5 100644 --- a/comp/otelcol/ddflareextension/impl/go.mod +++ b/comp/otelcol/ddflareextension/impl/go.mod @@ -110,8 +110,7 @@ require ( github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/exporter/datadogexporter v0.0.0-00010101000000-000000000000 github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/processor/infraattributesprocessor v0.0.0-00010101000000-000000000000 github.com/DataDog/datadog-agent/pkg/api v0.56.2 - github.com/DataDog/datadog-agent/pkg/config/model v0.57.0 - github.com/DataDog/datadog-agent/pkg/config/setup v0.57.0 + github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel github.com/DataDog/datadog-agent/pkg/version v0.57.0 github.com/gorilla/mux v1.8.1 github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector v0.104.0 @@ -144,7 +143,7 @@ require ( go.opentelemetry.io/collector/receiver/otlpreceiver v0.104.0 go.opentelemetry.io/collector/service v0.104.0 go.uber.org/zap v1.27.0 - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 gopkg.in/yaml.v2 v2.4.0 ) @@ -166,12 +165,12 @@ require ( github.com/DataDog/datadog-agent/comp/core/hostname/hostnameinterface v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/core/log/def v0.58.0-devel // indirect github.com/DataDog/datadog-agent/comp/core/log/mock v0.58.0-devel // indirect - github.com/DataDog/datadog-agent/comp/core/secrets v0.57.0 // indirect + github.com/DataDog/datadog-agent/comp/core/secrets v0.57.1 // indirect github.com/DataDog/datadog-agent/comp/core/status v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/core/tagger/types v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/core/tagger/utils v0.56.2 // indirect - github.com/DataDog/datadog-agent/comp/core/telemetry v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/comp/def v0.56.2 // indirect + github.com/DataDog/datadog-agent/comp/core/telemetry v0.57.1 // indirect + github.com/DataDog/datadog-agent/comp/def v0.57.1 // indirect github.com/DataDog/datadog-agent/comp/forwarder/defaultforwarder v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/forwarder/orchestrator/orchestratorinterface v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/logs/agent/config v0.56.0-rc.3 // indirect @@ -186,12 +185,13 @@ require ( github.com/DataDog/datadog-agent/comp/trace/compression/def v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/trace/compression/impl-gzip v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/aggregator/ckey v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/config/env v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel // indirect - github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/env v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.60.0-devel // indirect + github.com/DataDog/datadog-agent/pkg/config/setup v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/config/structure v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.60.0-devel // indirect github.com/DataDog/datadog-agent/pkg/config/utils v0.56.2 // indirect github.com/DataDog/datadog-agent/pkg/logs/auditor v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/logs/client v0.56.0-rc.3 // indirect @@ -222,27 +222,27 @@ require ( github.com/DataDog/datadog-agent/pkg/util/cgroups v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/common v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/executable v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/util/fxutil v0.56.2 // indirect - github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/fxutil v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/http v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/json v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/log v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/log/setup v0.58.0-devel // indirect - github.com/DataDog/datadog-agent/pkg/util/optional v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/optional v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/sort v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/startstop v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/statstracker v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/system v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/tagger v0.56.2 // indirect github.com/DataDog/datadog-agent/pkg/util/winutil v0.57.1 // indirect github.com/DataDog/datadog-api-client-go/v2 v2.26.0 // indirect github.com/DataDog/datadog-go/v5 v5.5.0 // indirect github.com/DataDog/dd-sensitive-data-scanner/sds-go/go v0.0.0-20240816154533-f7f9beb53a42 // indirect - github.com/DataDog/go-sqllexer v0.0.15 // indirect + github.com/DataDog/go-sqllexer v0.0.16 // indirect github.com/DataDog/go-tuf v1.1.0-0.5.2 // indirect github.com/DataDog/mmh3 v0.0.0-20210722141835-012dc69a9e49 // indirect github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.20.0 // indirect @@ -440,7 +440,7 @@ require ( go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 // indirect go.opentelemetry.io/contrib/propagators/b3 v1.27.0 // indirect go.opentelemetry.io/contrib/zpages v0.52.0 // indirect - go.opentelemetry.io/otel v1.30.0 // indirect + go.opentelemetry.io/otel v1.31.0 // indirect go.opentelemetry.io/otel/bridge/opencensus v1.27.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.27.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.27.0 // indirect @@ -450,25 +450,25 @@ require ( go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.27.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.27.0 // indirect - go.opentelemetry.io/otel/metric v1.30.0 // indirect + go.opentelemetry.io/otel/metric v1.31.0 // indirect go.opentelemetry.io/otel/sdk v1.28.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.27.0 // indirect - go.opentelemetry.io/otel/trace v1.30.0 // indirect + go.opentelemetry.io/otel/trace v1.31.0 // indirect go.opentelemetry.io/proto/otlp v1.2.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.18.0 // indirect go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.27.0 // indirect + golang.org/x/crypto v0.28.0 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/oauth2 v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/term v0.24.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/time v0.6.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/term v0.25.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/time v0.7.0 // indirect + golang.org/x/tools v0.26.0 // indirect gonum.org/v1/gonum v0.15.0 // indirect google.golang.org/api v0.169.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect diff --git a/comp/otelcol/ddflareextension/impl/go.sum b/comp/otelcol/ddflareextension/impl/go.sum index 03f1ee9ab1363..7a284d7db11ec 100644 --- a/comp/otelcol/ddflareextension/impl/go.sum +++ b/comp/otelcol/ddflareextension/impl/go.sum @@ -66,8 +66,8 @@ github.com/DataDog/datadog-go/v5 v5.5.0 h1:G5KHeB8pWBNXT4Jtw0zAkhdxEAWSpWH00geHI github.com/DataDog/datadog-go/v5 v5.5.0/go.mod h1:K9kcYBlxkcPP8tvvjZZKs/m1edNAUFzBbdpTUKfCsuw= github.com/DataDog/dd-sensitive-data-scanner/sds-go/go v0.0.0-20240816154533-f7f9beb53a42 h1:RoH7VLzTnxHEugRPIgnGlxwDFszFGI7b3WZZUtWuPRM= github.com/DataDog/dd-sensitive-data-scanner/sds-go/go v0.0.0-20240816154533-f7f9beb53a42/go.mod h1:TX7CTOQ3LbQjfAi4SwqUoR5gY1zfUk7VRBDTuArjaDc= -github.com/DataDog/go-sqllexer v0.0.15 h1:rUUu52dP8EQhJLnUw0MIAxZp0BQx2fOTuMztr3vtHUU= -github.com/DataDog/go-sqllexer v0.0.15/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc= +github.com/DataDog/go-sqllexer v0.0.16 h1:RoSUMS6MECyB3gTUIdydzXwK5NhEhv6GMJkS7ptsgRA= +github.com/DataDog/go-sqllexer v0.0.16/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc= github.com/DataDog/go-tuf v1.1.0-0.5.2 h1:4CagiIekonLSfL8GMHRHcHudo1fQnxELS9g4tiAupQ4= github.com/DataDog/go-tuf v1.1.0-0.5.2/go.mod h1:zBcq6f654iVqmkk8n2Cx81E1JnNTMOAx1UEO/wZR+P0= github.com/DataDog/gohai v0.0.0-20230524154621-4316413895ee h1:tXibLZk3G6HncIFJKaNItsdzcrk4YqILNDZlXPTNt4k= @@ -911,8 +911,8 @@ go.opentelemetry.io/contrib/propagators/b3 v1.27.0 h1:IjgxbomVrV9za6bRi8fWCNXENs go.opentelemetry.io/contrib/propagators/b3 v1.27.0/go.mod h1:Dv9obQz25lCisDvvs4dy28UPh974CxkahRDUPsY7y9E= go.opentelemetry.io/contrib/zpages v0.52.0 h1:MPgkMy0Cp3O5EdfVXP0ss3ujhEibysTM4eszx7E7d+E= go.opentelemetry.io/contrib/zpages v0.52.0/go.mod h1:fqG5AFdoYru3A3DnhibVuaaEfQV2WKxE7fYE1jgDRwk= -go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= -go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= go.opentelemetry.io/otel/bridge/opencensus v1.27.0 h1:ao9aGGHd+G4YfjBpGs6vbkvt5hoC67STlJA9fCnOAcs= go.opentelemetry.io/otel/bridge/opencensus v1.27.0/go.mod h1:uRvWtAAXzyVOST0WMPX5JHGBaAvBws+2F8PcC5gMnTk= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.27.0 h1:bFgvUr3/O4PHj3VQcFEuYKvRZJX1SJDQ+11JXuSB3/w= @@ -931,14 +931,14 @@ go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.27.0 h1:/jlt1Y8gXWiHG9 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.27.0/go.mod h1:bmToOGOBZ4hA9ghphIc1PAf66VA8KOtsuy3+ScStG20= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.27.0 h1:/0YaXu3755A/cFbtXp+21lkXgI0QE5avTWA2HjU9/WE= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.27.0/go.mod h1:m7SFxp0/7IxmJPLIY3JhOcU9CoFzDaCPL6xxQIxhA+o= -go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= -go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2NemcCrOL8gI= go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= -go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= -go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= go.opentelemetry.io/proto/otlp v1.2.0 h1:pVeZGk7nXDC9O2hncA6nHldxEjm6LByfA2aN8IOkz94= go.opentelemetry.io/proto/otlp v1.2.0/go.mod h1:gGpR8txAl5M03pDhMC79G6SdqNV26naRm/KDsgaHD8A= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -972,8 +972,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -984,8 +984,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1055,8 +1055,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1147,16 +1147,16 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= -golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= -golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1167,14 +1167,14 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= -golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= -golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= +golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1227,8 +1227,8 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= diff --git a/comp/otelcol/logsagentpipeline/go.mod b/comp/otelcol/logsagentpipeline/go.mod index 5cfd5062adfdb..1859b4075ba35 100644 --- a/comp/otelcol/logsagentpipeline/go.mod +++ b/comp/otelcol/logsagentpipeline/go.mod @@ -159,13 +159,13 @@ require ( go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/comp/otelcol/logsagentpipeline/go.sum b/comp/otelcol/logsagentpipeline/go.sum index d47dfc5263745..a50ab5d93f4e3 100644 --- a/comp/otelcol/logsagentpipeline/go.sum +++ b/comp/otelcol/logsagentpipeline/go.sum @@ -280,8 +280,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U 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/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -304,8 +304,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/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.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -331,12 +331,12 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -353,8 +353,8 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn 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= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= diff --git a/comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.mod b/comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.mod index 9e6766aeb3fdb..a39b31a1e35e8 100644 --- a/comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.mod +++ b/comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.mod @@ -67,8 +67,8 @@ require ( github.com/DataDog/datadog-agent/comp/core/log/mock v0.0.0-00010101000000-000000000000 github.com/DataDog/datadog-agent/comp/logs/agent/config v0.56.0-rc.3 github.com/DataDog/datadog-agent/comp/otelcol/logsagentpipeline v0.56.0-rc.3 - github.com/DataDog/datadog-agent/pkg/config/model v0.57.0 - github.com/DataDog/datadog-agent/pkg/config/setup v0.57.0 + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 + github.com/DataDog/datadog-agent/pkg/config/setup v0.57.1 github.com/DataDog/datadog-agent/pkg/logs/auditor v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/logs/client v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/logs/diagnostic v0.56.0-rc.3 @@ -79,7 +79,7 @@ require ( github.com/DataDog/datadog-agent/pkg/logs/status/statusinterface v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/status/health v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/fxutil v0.56.0-rc.3 - github.com/DataDog/datadog-agent/pkg/util/optional v0.57.0 + github.com/DataDog/datadog-agent/pkg/util/optional v0.57.1 github.com/DataDog/datadog-agent/pkg/util/startstop v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/testutil v0.56.0-rc.3 github.com/stretchr/testify v1.9.0 @@ -91,15 +91,15 @@ require ( github.com/DataDog/agent-payload/v5 v5.0.106 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/core/flare/types v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/comp/core/secrets v0.57.0 // indirect + github.com/DataDog/datadog-agent/comp/core/secrets v0.57.1 // indirect github.com/DataDog/datadog-agent/comp/core/telemetry v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/def v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/config/env v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/env v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel // indirect - github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.60.0-devel // indirect github.com/DataDog/datadog-agent/pkg/config/structure v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.60.0-devel // indirect github.com/DataDog/datadog-agent/pkg/config/utils v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/logs/processor v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/logs/sds v0.56.0-rc.3 // indirect @@ -108,16 +108,16 @@ require ( github.com/DataDog/datadog-agent/pkg/telemetry v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/backoff v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/executable v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/http v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/log v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/log/setup v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/statstracker v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/system v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/winutil v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/version v0.56.0-rc.3 // indirect github.com/DataDog/dd-sensitive-data-scanner/sds-go/go v0.0.0-20240816154533-f7f9beb53a42 // indirect @@ -171,13 +171,13 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.18.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.sum b/comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.sum index b9b676e0052a4..00c129876e86d 100644 --- a/comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.sum +++ b/comp/otelcol/logsagentpipeline/logsagentpipelineimpl/go.sum @@ -281,8 +281,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U 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/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -305,8 +305,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/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.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -332,12 +332,12 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -354,8 +354,8 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn 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= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= diff --git a/comp/otelcol/otlp/collector_test.go b/comp/otelcol/otlp/collector_test.go index 1ab4038d61da2..4368afb1bb218 100644 --- a/comp/otelcol/otlp/collector_test.go +++ b/comp/otelcol/otlp/collector_test.go @@ -99,7 +99,7 @@ func TestStartPipelineFromConfig(t *testing.T) { for _, testInstance := range tests { t.Run(testInstance.path, func(t *testing.T) { - cfg, err := testutil.LoadConfig("./testdata/" + testInstance.path) + cfg, err := testutil.LoadConfig(t, "./testdata/"+testInstance.path) require.NoError(t, err) pcfg, err := FromAgentConfig(cfg) require.NoError(t, err) diff --git a/comp/otelcol/otlp/components/exporter/datadogexporter/go.mod b/comp/otelcol/otlp/components/exporter/datadogexporter/go.mod index 188449908fceb..344dedb5abddc 100644 --- a/comp/otelcol/otlp/components/exporter/datadogexporter/go.mod +++ b/comp/otelcol/otlp/components/exporter/datadogexporter/go.mod @@ -100,7 +100,7 @@ require ( github.com/DataDog/datadog-agent/pkg/proto v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/serializer v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/trace v0.56.0-rc.3 - github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.0 + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.1 github.com/DataDog/datadog-go/v5 v5.5.0 github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.20.0 github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.20.0 @@ -117,8 +117,8 @@ require ( go.opentelemetry.io/collector/exporter v0.104.0 go.opentelemetry.io/collector/featuregate v1.11.0 go.opentelemetry.io/collector/pdata v1.11.0 - go.opentelemetry.io/otel/metric v1.30.0 - go.opentelemetry.io/otel/trace v1.30.0 + go.opentelemetry.io/otel/metric v1.31.0 + go.opentelemetry.io/otel/trace v1.31.0 go.uber.org/zap v1.27.0 google.golang.org/protobuf v1.34.2 ) @@ -130,24 +130,24 @@ require ( github.com/DataDog/datadog-agent/comp/core/flare/types v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/core/hostname/hostnameinterface v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/core/log/def v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/comp/core/secrets v0.57.0 // indirect + github.com/DataDog/datadog-agent/comp/core/secrets v0.57.1 // indirect github.com/DataDog/datadog-agent/comp/core/status v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/comp/core/telemetry v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/comp/def v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/comp/core/telemetry v0.57.1 // indirect + github.com/DataDog/datadog-agent/comp/def v0.57.1 // indirect github.com/DataDog/datadog-agent/comp/forwarder/defaultforwarder v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/forwarder/orchestrator/orchestratorinterface v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/logs/agent/config v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/serializer/compression v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/trace/compression/def v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/aggregator/ckey v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/config/env v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/env v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel // indirect - github.com/DataDog/datadog-agent/pkg/config/model v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/pkg/config/setup v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.60.0-devel // indirect + github.com/DataDog/datadog-agent/pkg/config/setup v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/config/structure v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.60.0-devel // indirect github.com/DataDog/datadog-agent/pkg/config/utils v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/logs/auditor v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/logs/client v0.56.0-rc.3 // indirect @@ -174,24 +174,24 @@ require ( github.com/DataDog/datadog-agent/pkg/util/cgroups v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/common v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/executable v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/util/fxutil v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/fxutil v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/http v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/json v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/log v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/optional v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/optional v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/sort v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/startstop v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/statstracker v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/system v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/winutil v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/version v0.56.0-rc.3 // indirect github.com/DataDog/datadog-api-client-go/v2 v2.26.0 // indirect github.com/DataDog/dd-sensitive-data-scanner/sds-go/go v0.0.0-20240816154533-f7f9beb53a42 // indirect - github.com/DataDog/go-sqllexer v0.0.15 // indirect + github.com/DataDog/go-sqllexer v0.0.16 // indirect github.com/DataDog/go-tuf v1.1.0-0.5.2 // indirect github.com/DataDog/mmh3 v0.0.0-20210722141835-012dc69a9e49 // indirect github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/logs v0.20.0 // indirect @@ -288,7 +288,7 @@ require ( go.opentelemetry.io/collector/receiver v0.104.0 // indirect go.opentelemetry.io/collector/semconv v0.104.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 // indirect - go.opentelemetry.io/otel v1.30.0 // indirect + go.opentelemetry.io/otel v1.31.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect go.opentelemetry.io/otel/sdk v1.27.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.27.0 // indirect @@ -296,13 +296,13 @@ require ( go.uber.org/dig v1.18.0 // indirect go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/oauth2 v0.20.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/term v0.24.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/time v0.6.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/term v0.25.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/time v0.7.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e // indirect google.golang.org/grpc v1.64.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/comp/otelcol/otlp/components/exporter/datadogexporter/go.sum b/comp/otelcol/otlp/components/exporter/datadogexporter/go.sum index ae3f18370fe46..71a0a814b244b 100644 --- a/comp/otelcol/otlp/components/exporter/datadogexporter/go.sum +++ b/comp/otelcol/otlp/components/exporter/datadogexporter/go.sum @@ -8,8 +8,8 @@ github.com/DataDog/datadog-go/v5 v5.5.0 h1:G5KHeB8pWBNXT4Jtw0zAkhdxEAWSpWH00geHI github.com/DataDog/datadog-go/v5 v5.5.0/go.mod h1:K9kcYBlxkcPP8tvvjZZKs/m1edNAUFzBbdpTUKfCsuw= github.com/DataDog/dd-sensitive-data-scanner/sds-go/go v0.0.0-20240816154533-f7f9beb53a42 h1:RoH7VLzTnxHEugRPIgnGlxwDFszFGI7b3WZZUtWuPRM= github.com/DataDog/dd-sensitive-data-scanner/sds-go/go v0.0.0-20240816154533-f7f9beb53a42/go.mod h1:TX7CTOQ3LbQjfAi4SwqUoR5gY1zfUk7VRBDTuArjaDc= -github.com/DataDog/go-sqllexer v0.0.15 h1:rUUu52dP8EQhJLnUw0MIAxZp0BQx2fOTuMztr3vtHUU= -github.com/DataDog/go-sqllexer v0.0.15/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc= +github.com/DataDog/go-sqllexer v0.0.16 h1:RoSUMS6MECyB3gTUIdydzXwK5NhEhv6GMJkS7ptsgRA= +github.com/DataDog/go-sqllexer v0.0.16/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc= github.com/DataDog/go-tuf v1.1.0-0.5.2 h1:4CagiIekonLSfL8GMHRHcHudo1fQnxELS9g4tiAupQ4= github.com/DataDog/go-tuf v1.1.0-0.5.2/go.mod h1:zBcq6f654iVqmkk8n2Cx81E1JnNTMOAx1UEO/wZR+P0= github.com/DataDog/mmh3 v0.0.0-20210722141835-012dc69a9e49 h1:EbzDX8HPk5uE2FsJYxD74QmMw0/3CqSKhEr6teh0ncQ= @@ -433,18 +433,18 @@ go.opentelemetry.io/collector/semconv v0.104.0 h1:dUvajnh+AYJLEW/XOPk0T0BlwltSdi go.opentelemetry.io/collector/semconv v0.104.0/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 h1:9l89oX4ba9kHbBol3Xin3leYJ+252h0zszDtBwyKe2A= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0/go.mod h1:XLZfZboOJWHNKUv7eH0inh0E9VV6eWDFB/9yJyTLPp0= -go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= -go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0/go.mod h1:KfQ1wpjf3zsHjzP149P4LyAwWRupc6c7t1ZJ9eXpKQM= -go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= -go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kTWmI= go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A= go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2NemcCrOL8gI= go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= -go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= -go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= @@ -470,11 +470,11 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 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/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -497,8 +497,8 @@ golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLL 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.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= @@ -530,19 +530,19 @@ golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= -golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= -golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= +golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/comp/otelcol/otlp/components/exporter/logsagentexporter/go.mod b/comp/otelcol/otlp/components/exporter/logsagentexporter/go.mod index 23de2584987fe..e7ec654cc191a 100644 --- a/comp/otelcol/otlp/components/exporter/logsagentexporter/go.mod +++ b/comp/otelcol/otlp/components/exporter/logsagentexporter/go.mod @@ -58,26 +58,27 @@ require ( ) require ( - github.com/DataDog/datadog-agent/comp/core/secrets v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/config/env v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/config/model v0.57.0 // indirect + github.com/DataDog/datadog-agent/comp/core/secrets v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/env v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel // indirect + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/pkg/config/setup v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/config/setup v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/config/structure v0.0.0-00010101000000-000000000000 // indirect github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect github.com/DataDog/datadog-agent/pkg/config/utils v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/logs/status/utils v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/proto v0.55.0 // indirect github.com/DataDog/datadog-agent/pkg/util/executable v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/log v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/optional v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/optional v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/statstracker v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/system v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/winutil v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/version v0.56.0-rc.3 // indirect github.com/DataDog/datadog-api-client-go/v2 v2.13.0 // indirect @@ -155,12 +156,12 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/oauth2 v0.20.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/term v0.24.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/term v0.25.0 // indirect + golang.org/x/text v0.19.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.2 // indirect diff --git a/comp/otelcol/otlp/components/exporter/logsagentexporter/go.sum b/comp/otelcol/otlp/components/exporter/logsagentexporter/go.sum index b6afd1a7ed92d..50928e828aede 100644 --- a/comp/otelcol/otlp/components/exporter/logsagentexporter/go.sum +++ b/comp/otelcol/otlp/components/exporter/logsagentexporter/go.sum @@ -351,8 +351,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -378,8 +378,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= @@ -414,19 +414,19 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= -golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= -golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/comp/otelcol/otlp/components/exporter/serializerexporter/go.mod b/comp/otelcol/otlp/components/exporter/serializerexporter/go.mod index 7853c785bd358..8de00dc5f4ef9 100644 --- a/comp/otelcol/otlp/components/exporter/serializerexporter/go.mod +++ b/comp/otelcol/otlp/components/exporter/serializerexporter/go.mod @@ -23,6 +23,7 @@ replace ( github.com/DataDog/datadog-agent/pkg/config/model => ../../../../../../pkg/config/model github.com/DataDog/datadog-agent/pkg/config/nodetreemodel => ../../../../../../pkg/config/nodetreemodel github.com/DataDog/datadog-agent/pkg/config/setup => ../../../../../../pkg/config/setup + github.com/DataDog/datadog-agent/pkg/config/structure => ../../../../../../pkg/config/structure github.com/DataDog/datadog-agent/pkg/config/teeconfig => ../../../../../../pkg/config/teeconfig github.com/DataDog/datadog-agent/pkg/config/utils => ../../../../../../pkg/config/utils github.com/DataDog/datadog-agent/pkg/metrics => ../../../../../../pkg/metrics @@ -94,21 +95,22 @@ require ( github.com/DataDog/datadog-agent/comp/core/flare/builder v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/core/flare/types v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/core/log/def v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/comp/core/secrets v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/comp/core/secrets v0.57.1 // indirect github.com/DataDog/datadog-agent/comp/core/status v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/comp/core/telemetry v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/comp/def v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/comp/core/telemetry v0.57.1 // indirect + github.com/DataDog/datadog-agent/comp/def v0.57.1 // indirect github.com/DataDog/datadog-agent/comp/forwarder/defaultforwarder v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/forwarder/orchestrator/orchestratorinterface v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/serializer/compression v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/aggregator/ckey v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/env v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/env v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel // indirect - github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/pkg/config/setup v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.60.0-devel // indirect + github.com/DataDog/datadog-agent/pkg/config/setup v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/structure v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.60.0-devel // indirect github.com/DataDog/datadog-agent/pkg/config/utils v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/orchestrator/model v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/process/util/api v0.56.0-rc.3 // indirect @@ -119,17 +121,17 @@ require ( github.com/DataDog/datadog-agent/pkg/util/buf v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/common v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/executable v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/filesystem v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/fxutil v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/fxutil v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/http v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/json v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/optional v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/pointer v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/optional v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/sort v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system/socket v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/system v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/winutil v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/version v0.56.0-rc.3 // indirect github.com/DataDog/mmh3 v0.0.0-20210722141835-012dc69a9e49 // indirect @@ -207,13 +209,13 @@ require ( go.uber.org/dig v1.18.0 // indirect go.uber.org/fx v1.22.2 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.2 // indirect diff --git a/comp/otelcol/otlp/components/exporter/serializerexporter/go.sum b/comp/otelcol/otlp/components/exporter/serializerexporter/go.sum index ae83dc26999cd..e429bddca4394 100644 --- a/comp/otelcol/otlp/components/exporter/serializerexporter/go.sum +++ b/comp/otelcol/otlp/components/exporter/serializerexporter/go.sum @@ -394,8 +394,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -423,8 +423,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -459,8 +459,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= @@ -468,8 +468,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -488,8 +488,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= diff --git a/comp/otelcol/otlp/components/metricsclient/go.mod b/comp/otelcol/otlp/components/metricsclient/go.mod index d76b4b71961f7..334fd4792cf43 100644 --- a/comp/otelcol/otlp/components/metricsclient/go.mod +++ b/comp/otelcol/otlp/components/metricsclient/go.mod @@ -8,8 +8,8 @@ require ( github.com/DataDog/datadog-agent/pkg/trace v0.56.0-rc.3 github.com/DataDog/datadog-go/v5 v5.5.0 github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/otel v1.30.0 - go.opentelemetry.io/otel/metric v1.30.0 + go.opentelemetry.io/otel v1.31.0 + go.opentelemetry.io/otel/metric v1.31.0 go.opentelemetry.io/otel/sdk/metric v1.27.0 ) @@ -20,11 +20,11 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/sdk v1.27.0 // indirect - go.opentelemetry.io/otel/trace v1.30.0 // indirect + go.opentelemetry.io/otel/trace v1.31.0 // indirect go.uber.org/atomic v1.11.0 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/comp/otelcol/otlp/components/metricsclient/go.sum b/comp/otelcol/otlp/components/metricsclient/go.sum index 20c86106ac0b3..18f900c41cc26 100644 --- a/comp/otelcol/otlp/components/metricsclient/go.sum +++ b/comp/otelcol/otlp/components/metricsclient/go.sum @@ -30,16 +30,16 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= -go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= -go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= -go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kTWmI= go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A= go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2NemcCrOL8gI= go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= -go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= -go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -50,8 +50,8 @@ golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= 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-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= @@ -63,16 +63,16 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/comp/otelcol/otlp/components/processor/infraattributesprocessor/go.mod b/comp/otelcol/otlp/components/processor/infraattributesprocessor/go.mod index 9a09207d51ca7..b6e50cf4f67e0 100644 --- a/comp/otelcol/otlp/components/processor/infraattributesprocessor/go.mod +++ b/comp/otelcol/otlp/components/processor/infraattributesprocessor/go.mod @@ -123,13 +123,13 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.27.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect google.golang.org/grpc v1.65.0 // indirect google.golang.org/protobuf v1.34.2 // indirect diff --git a/comp/otelcol/otlp/components/processor/infraattributesprocessor/go.sum b/comp/otelcol/otlp/components/processor/infraattributesprocessor/go.sum index 4fe7706439056..406b9ac8402f7 100644 --- a/comp/otelcol/otlp/components/processor/infraattributesprocessor/go.sum +++ b/comp/otelcol/otlp/components/processor/infraattributesprocessor/go.sum @@ -303,8 +303,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U 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/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -327,8 +327,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/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.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -354,12 +354,12 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -376,8 +376,8 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn 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= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= diff --git a/comp/otelcol/otlp/components/statsprocessor/go.mod b/comp/otelcol/otlp/components/statsprocessor/go.mod index 0c2aa487ade9a..65b3c209ef8d5 100644 --- a/comp/otelcol/otlp/components/statsprocessor/go.mod +++ b/comp/otelcol/otlp/components/statsprocessor/go.mod @@ -38,7 +38,7 @@ require ( github.com/DataDog/datadog-agent/pkg/util/log v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/pointer v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.56.0-rc.3 // indirect - github.com/DataDog/go-sqllexer v0.0.15 // indirect + github.com/DataDog/go-sqllexer v0.0.16 // indirect github.com/DataDog/go-tuf v1.1.0-0.5.2 // indirect github.com/DataDog/sketches-go v1.4.2 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect @@ -82,21 +82,21 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.104.0 // indirect go.opentelemetry.io/collector/semconv v0.104.0 // indirect - go.opentelemetry.io/otel v1.30.0 // indirect + go.opentelemetry.io/otel v1.31.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect - go.opentelemetry.io/otel/metric v1.30.0 // indirect + go.opentelemetry.io/otel/metric v1.31.0 // indirect go.opentelemetry.io/otel/sdk v1.27.0 // indirect - go.opentelemetry.io/otel/trace v1.30.0 // indirect + go.opentelemetry.io/otel/trace v1.31.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/time v0.6.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/time v0.7.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.2 // indirect diff --git a/comp/otelcol/otlp/components/statsprocessor/go.sum b/comp/otelcol/otlp/components/statsprocessor/go.sum index 1242d1a48363c..a201b6217a5a0 100644 --- a/comp/otelcol/otlp/components/statsprocessor/go.sum +++ b/comp/otelcol/otlp/components/statsprocessor/go.sum @@ -1,7 +1,7 @@ github.com/DataDog/datadog-go/v5 v5.5.0 h1:G5KHeB8pWBNXT4Jtw0zAkhdxEAWSpWH00geHI6LDrKU= github.com/DataDog/datadog-go/v5 v5.5.0/go.mod h1:K9kcYBlxkcPP8tvvjZZKs/m1edNAUFzBbdpTUKfCsuw= -github.com/DataDog/go-sqllexer v0.0.15 h1:rUUu52dP8EQhJLnUw0MIAxZp0BQx2fOTuMztr3vtHUU= -github.com/DataDog/go-sqllexer v0.0.15/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc= +github.com/DataDog/go-sqllexer v0.0.16 h1:RoSUMS6MECyB3gTUIdydzXwK5NhEhv6GMJkS7ptsgRA= +github.com/DataDog/go-sqllexer v0.0.16/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc= github.com/DataDog/go-tuf v1.1.0-0.5.2 h1:4CagiIekonLSfL8GMHRHcHudo1fQnxELS9g4tiAupQ4= github.com/DataDog/go-tuf v1.1.0-0.5.2/go.mod h1:zBcq6f654iVqmkk8n2Cx81E1JnNTMOAx1UEO/wZR+P0= github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.20.0 h1:fKv05WFWHCXQmUTehW1eEZvXJP65Qv00W4V01B1EqSA= @@ -168,18 +168,18 @@ go.opentelemetry.io/collector/processor v0.104.0 h1:KSvMDu4DWmK1/k2z2rOzMtTvAa00 go.opentelemetry.io/collector/processor v0.104.0/go.mod h1:qU2/xCCYdvVORkN6aq0H/WUWkvo505VGYg2eOwPvaTg= go.opentelemetry.io/collector/semconv v0.104.0 h1:dUvajnh+AYJLEW/XOPk0T0BlwltSdi3vrjO7nSOos3k= go.opentelemetry.io/collector/semconv v0.104.0/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= -go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= -go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0/go.mod h1:KfQ1wpjf3zsHjzP149P4LyAwWRupc6c7t1ZJ9eXpKQM= -go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= -go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kTWmI= go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A= go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2NemcCrOL8gI= go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= -go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= -go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= @@ -193,8 +193,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk 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/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= 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/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -210,8 +210,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -238,8 +238,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= @@ -247,10 +247,10 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= -golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= +golang.org/x/time v0.7.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-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -258,8 +258,8 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= diff --git a/comp/otelcol/otlp/config_test.go b/comp/otelcol/otlp/config_test.go index faa2223c8c661..7ca677892b15b 100644 --- a/comp/otelcol/otlp/config_test.go +++ b/comp/otelcol/otlp/config_test.go @@ -30,7 +30,7 @@ func TestIsEnabled(t *testing.T) { for _, testInstance := range tests { t.Run(testInstance.path, func(t *testing.T) { - cfg, err := testutil.LoadConfig("./testdata/" + testInstance.path) + cfg, err := testutil.LoadConfig(t, "./testdata/"+testInstance.path) require.NoError(t, err) assert.Equal(t, testInstance.enabled, IsEnabled(cfg)) }) @@ -39,7 +39,7 @@ func TestIsEnabled(t *testing.T) { func TestIsEnabledEnv(t *testing.T) { t.Setenv("DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_GRPC_ENDPOINT", "0.0.0.0:9993") - cfg, err := testutil.LoadConfig("./testdata/empty.yaml") + cfg, err := testutil.LoadConfig(t, "./testdata/empty.yaml") require.NoError(t, err) assert.True(t, IsEnabled(cfg)) } @@ -186,7 +186,7 @@ func TestFromAgentConfigReceiver(t *testing.T) { for _, testInstance := range tests { t.Run(testInstance.path, func(t *testing.T) { - cfg, err := testutil.LoadConfig("./testdata/" + testInstance.path) + cfg, err := testutil.LoadConfig(t, "./testdata/"+testInstance.path) require.NoError(t, err) pcfg, err := FromAgentConfig(cfg) if err != nil || testInstance.err != "" { @@ -432,7 +432,7 @@ func TestFromEnvironmentVariables(t *testing.T) { for env, val := range testInstance.env { t.Setenv(env, val) } - cfg, err := testutil.LoadConfig("./testdata/empty.yaml") + cfg, err := testutil.LoadConfig(t, "./testdata/empty.yaml") require.NoError(t, err) pcfg, err := FromAgentConfig(cfg) if err != nil || testInstance.err != "" { @@ -483,7 +483,7 @@ func TestFromAgentConfigMetrics(t *testing.T) { for _, testInstance := range tests { t.Run(testInstance.path, func(t *testing.T) { - cfg, err := testutil.LoadConfig("./testdata/" + testInstance.path) + cfg, err := testutil.LoadConfig(t, "./testdata/"+testInstance.path) require.NoError(t, err) pcfg, err := FromAgentConfig(cfg) if err != nil || testInstance.err != "" { @@ -577,7 +577,7 @@ func TestFromAgentConfigDebug(t *testing.T) { for _, testInstance := range tests { t.Run(testInstance.path, func(t *testing.T) { - cfg, err := testutil.LoadConfig("./testdata/" + testInstance.path) + cfg, err := testutil.LoadConfig(t, "./testdata/"+testInstance.path) require.NoError(t, err) pcfg, err := FromAgentConfig(cfg) if err != nil || testInstance.err != "" { diff --git a/comp/otelcol/otlp/integrationtest/integration_test.go b/comp/otelcol/otlp/integrationtest/integration_test.go index d80e75f2ad6d7..659025608087a 100644 --- a/comp/otelcol/otlp/integrationtest/integration_test.go +++ b/comp/otelcol/otlp/integrationtest/integration_test.go @@ -103,6 +103,7 @@ func runTestOTelAgent(ctx context.Context, params *subcommands.GlobalParams) err pkgconfigenv.DetectFeatures(c) return c, nil }), + fxutil.ProvideOptional[coreconfig.Component](), fx.Provide(func() []string { return append(params.ConfPaths, params.Sets...) }), diff --git a/comp/otelcol/otlp/testutil/go.mod b/comp/otelcol/otlp/testutil/go.mod index 9bc21ad11451d..a9306ba814215 100644 --- a/comp/otelcol/otlp/testutil/go.mod +++ b/comp/otelcol/otlp/testutil/go.mod @@ -11,6 +11,7 @@ replace ( github.com/DataDog/datadog-agent/comp/def => ../../../../comp/def github.com/DataDog/datadog-agent/pkg/collector/check/defaults => ../../../../pkg/collector/check/defaults github.com/DataDog/datadog-agent/pkg/config/env => ../../../../pkg/config/env + github.com/DataDog/datadog-agent/pkg/config/mock => ../../../../pkg/config/mock github.com/DataDog/datadog-agent/pkg/config/model => ../../../../pkg/config/model github.com/DataDog/datadog-agent/pkg/config/nodetreemodel => ../../../../pkg/config/nodetreemodel github.com/DataDog/datadog-agent/pkg/config/setup => ../../../../pkg/config/setup @@ -32,8 +33,9 @@ replace ( ) require ( - github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.3 - github.com/DataDog/datadog-agent/pkg/config/setup v0.56.0-rc.3 + github.com/DataDog/datadog-agent/pkg/config/mock v0.57.1 + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 + github.com/DataDog/datadog-agent/pkg/config/setup v0.57.1 github.com/DataDog/datadog-agent/pkg/proto v0.55.0 github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata v0.20.0 github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.20.0 @@ -44,21 +46,21 @@ require ( ) require ( - github.com/DataDog/datadog-agent/comp/core/secrets v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/env v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/comp/core/secrets v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/env v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/pkg/util/executable v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/filesystem v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/log v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/optional v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/pointer v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/scrubber v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system/socket v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/winutil v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/executable v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/log v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/optional v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/scrubber v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/winutil v0.57.1 // indirect github.com/DataDog/viper v1.13.5 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect @@ -98,10 +100,10 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/net v0.29.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect + golang.org/x/net v0.30.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/comp/otelcol/otlp/testutil/go.sum b/comp/otelcol/otlp/testutil/go.sum index 998e3174bbd15..e302dbab5aa16 100644 --- a/comp/otelcol/otlp/testutil/go.sum +++ b/comp/otelcol/otlp/testutil/go.sum @@ -287,8 +287,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -314,8 +314,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -346,8 +346,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= @@ -355,8 +355,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/comp/otelcol/otlp/testutil/testutil.go b/comp/otelcol/otlp/testutil/testutil.go index 6d47275d84fec..c3782ebe6a9fc 100644 --- a/comp/otelcol/otlp/testutil/testutil.go +++ b/comp/otelcol/otlp/testutil/testutil.go @@ -14,7 +14,7 @@ import ( "log" "net/http" "net/http/httptest" - "strings" + "testing" "time" "github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata/payload" @@ -26,6 +26,7 @@ import ( "go.opentelemetry.io/collector/pdata/ptrace" "google.golang.org/protobuf/proto" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" pkgConfigModel "github.com/DataDog/datadog-agent/pkg/config/model" pkgConfigSetup "github.com/DataDog/datadog-agent/pkg/config/setup" pb "github.com/DataDog/datadog-agent/pkg/proto/pbgo/trace" @@ -49,8 +50,8 @@ func OTLPConfigFromPorts(bindHost string, gRPCPort uint, httpPort uint) map[stri } // LoadConfig from a given path. -func LoadConfig(path string) (pkgConfigModel.Reader, error) { - cfg := pkgConfigModel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) +func LoadConfig(t *testing.T, path string) (pkgConfigModel.Reader, error) { + cfg := configmock.New(t) pkgConfigSetup.OTLP(cfg) cfg.SetConfigFile(path) err := cfg.ReadInConfig() diff --git a/comp/serializer/compression/go.mod b/comp/serializer/compression/go.mod index b32eef1d18b4e..15e07aa1ca835 100644 --- a/comp/serializer/compression/go.mod +++ b/comp/serializer/compression/go.mod @@ -94,12 +94,12 @@ require ( go.uber.org/dig v1.18.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/comp/serializer/compression/go.sum b/comp/serializer/compression/go.sum index 83d4c8ea0521f..2cd2467966877 100644 --- a/comp/serializer/compression/go.sum +++ b/comp/serializer/compression/go.sum @@ -258,8 +258,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -302,11 +302,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -319,8 +319,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/comp/snmpscan/def/component.go b/comp/snmpscan/def/component.go new file mode 100644 index 0000000000000..b81d86b2ea28f --- /dev/null +++ b/comp/snmpscan/def/component.go @@ -0,0 +1,20 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +// Package snmpscan is a light component that can be used to perform a scan or a walk of a particular device +package snmpscan + +import ( + "github.com/gosnmp/gosnmp" +) + +// team: network-device-monitoring + +// Component is the component type. +type Component interface { + // Triggers a device scan + RunDeviceScan(snmpConection *gosnmp.GoSNMP, deviceNamespace string, deviceIPAddress string) error + RunSnmpWalk(snmpConection *gosnmp.GoSNMP, firstOid string) error +} diff --git a/comp/snmpscan/fx/fx.go b/comp/snmpscan/fx/fx.go new file mode 100644 index 0000000000000..5e925c13d837f --- /dev/null +++ b/comp/snmpscan/fx/fx.go @@ -0,0 +1,23 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +// Package fx provides the fx module for the snmpscan component +package fx + +import ( + snmpscan "github.com/DataDog/datadog-agent/comp/snmpscan/def" + snmpscanimpl "github.com/DataDog/datadog-agent/comp/snmpscan/impl" + "github.com/DataDog/datadog-agent/pkg/util/fxutil" +) + +// Module defines the fx options for this component +func Module() fxutil.Module { + return fxutil.Component( + fxutil.ProvideComponentConstructor( + snmpscanimpl.NewComponent, + ), + fxutil.ProvideOptional[snmpscan.Component](), + ) +} diff --git a/comp/snmpscan/impl/devicescan.go b/comp/snmpscan/impl/devicescan.go new file mode 100644 index 0000000000000..cef73d6aee845 --- /dev/null +++ b/comp/snmpscan/impl/devicescan.go @@ -0,0 +1,66 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +package snmpscanimpl + +import ( + "encoding/json" + "time" + + "github.com/DataDog/datadog-agent/comp/forwarder/eventplatform" + "github.com/DataDog/datadog-agent/pkg/logs/message" + "github.com/DataDog/datadog-agent/pkg/networkdevice/metadata" + "github.com/DataDog/datadog-agent/pkg/snmp/gosnmplib" + "github.com/gosnmp/gosnmp" +) + +func (s snmpScannerImpl) RunDeviceScan(snmpConnection *gosnmp.GoSNMP, deviceNamespace string, deviceIPAddress string) error { + pdus, err := gatherPDUs(snmpConnection) + if err != nil { + return err + } + + deviceID := deviceNamespace + ":" + deviceIPAddress + var deviceOids []*metadata.DeviceOID + for _, pdu := range pdus { + record, err := metadata.DeviceOIDFromPDU(deviceID, pdu) + if err != nil { + s.log.Warnf("PDU parsing error: %v", err) + continue + } + deviceOids = append(deviceOids, record) + } + + metadataPayloads := metadata.BatchDeviceScan(deviceNamespace, time.Now(), metadata.PayloadMetadataBatchSize, deviceOids) + for _, payload := range metadataPayloads { + payloadBytes, err := json.Marshal(payload) + if err != nil { + s.log.Errorf("Error marshalling device metadata: %v", err) + continue + } + m := message.NewMessage(payloadBytes, nil, "", 0) + s.log.Debugf("Device OID metadata payload is %d bytes", len(payloadBytes)) + s.log.Tracef("Device OID metadata payload: %s", string(payloadBytes)) + if err := s.epforwarder.SendEventPlatformEventBlocking(m, eventplatform.EventTypeNetworkDevicesMetadata); err != nil { + return err + } + } + + return nil +} + +// gatherPDUs returns PDUs from the given SNMP device that should cover ever +// scalar value and at least one row of every table. +func gatherPDUs(snmp *gosnmp.GoSNMP) ([]*gosnmp.SnmpPDU, error) { + var pdus []*gosnmp.SnmpPDU + err := gosnmplib.ConditionalWalk(snmp, "", false, func(dataUnit gosnmp.SnmpPDU) (string, error) { + pdus = append(pdus, &dataUnit) + return gosnmplib.SkipOIDRowsNaive(dataUnit.Name), nil + }) + if err != nil { + return nil, err + } + return pdus, nil +} diff --git a/comp/snmpscan/impl/snmpscan.go b/comp/snmpscan/impl/snmpscan.go new file mode 100644 index 0000000000000..1beb572ac27c0 --- /dev/null +++ b/comp/snmpscan/impl/snmpscan.go @@ -0,0 +1,50 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +// Package snmpscanimpl implements the snmpscan component interface +package snmpscanimpl + +import ( + "github.com/DataDog/datadog-agent/comp/aggregator/demultiplexer" + log "github.com/DataDog/datadog-agent/comp/core/log/def" + compdef "github.com/DataDog/datadog-agent/comp/def" + "github.com/DataDog/datadog-agent/comp/forwarder/eventplatform" + rcclienttypes "github.com/DataDog/datadog-agent/comp/remote-config/rcclient/types" + snmpscan "github.com/DataDog/datadog-agent/comp/snmpscan/def" +) + +// Requires defines the dependencies for the snmpscan component +type Requires struct { + compdef.In + Logger log.Component + Demultiplexer demultiplexer.Component +} + +// Provides defines the output of the snmpscan component +type Provides struct { + Comp snmpscan.Component + RCListener rcclienttypes.TaskListenerProvider +} + +// NewComponent creates a new snmpscan component +func NewComponent(reqs Requires) (Provides, error) { + forwarder, err := reqs.Demultiplexer.GetEventPlatformForwarder() + if err != nil { + return Provides{}, err + } + scanner := snmpScannerImpl{ + log: reqs.Logger, + epforwarder: forwarder, + } + provides := Provides{ + Comp: scanner, + } + return provides, nil +} + +type snmpScannerImpl struct { + log log.Component + epforwarder eventplatform.Forwarder +} diff --git a/comp/snmpscan/impl/snmpscan_test.go b/comp/snmpscan/impl/snmpscan_test.go new file mode 100644 index 0000000000000..5f14967a1012c --- /dev/null +++ b/comp/snmpscan/impl/snmpscan_test.go @@ -0,0 +1,48 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +//go:build test + +package snmpscanimpl + +import ( + "testing" + + "github.com/DataDog/datadog-agent/comp/aggregator/demultiplexer" + "github.com/DataDog/datadog-agent/comp/aggregator/demultiplexer/demultiplexerimpl" + "github.com/DataDog/datadog-agent/comp/core" + logmock "github.com/DataDog/datadog-agent/comp/core/log/mock" + "github.com/DataDog/datadog-agent/comp/forwarder/defaultforwarder" + "go.uber.org/fx" + + "github.com/DataDog/datadog-agent/pkg/util/fxutil" + "github.com/gosnmp/gosnmp" + "github.com/stretchr/testify/assert" +) + +type deps struct { + fx.In + Demultiplexer demultiplexer.Mock +} + +func TestSnmpScanComp(t *testing.T) { + testDeps := fxutil.Test[deps](t, demultiplexerimpl.MockModule(), defaultforwarder.MockModule(), core.MockBundle()) + deps := Requires{ + Logger: logmock.New(t), + Demultiplexer: testDeps.Demultiplexer, + } + snmpScanner, err := NewComponent(deps) + assert.NoError(t, err) + + snmpConnection := gosnmp.Default + snmpConnection.LocalAddr = "127.0.0.1" + snmpConnection.Port = 0 + + err = snmpScanner.Comp.RunDeviceScan(snmpConnection, "default", "127.0.0.1") + assert.ErrorContains(t, err, "&GoSNMP.Conn is missing. Provide a connection or use Connect()") + + err = snmpScanner.Comp.RunDeviceScan(snmpConnection, "default", "127.0.0.1") + assert.ErrorContains(t, err, "&GoSNMP.Conn is missing. Provide a connection or use Connect()") +} diff --git a/comp/snmpscan/impl/walkdevice.go b/comp/snmpscan/impl/walkdevice.go new file mode 100644 index 0000000000000..45a4754c625ea --- /dev/null +++ b/comp/snmpscan/impl/walkdevice.go @@ -0,0 +1,62 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +package snmpscanimpl + +import ( + "encoding/hex" + "fmt" + "strings" + + "github.com/DataDog/datadog-agent/pkg/snmp/gosnmplib" + "github.com/gosnmp/gosnmp" +) + +// RunSnmpWalk prints every SNMP value, in the style of the unix snmpwalk command. +func (s snmpScannerImpl) RunSnmpWalk(snmpConnection *gosnmp.GoSNMP, firstOid string) error { + // Perform a snmpwalk using Walk for all versions + if err := snmpConnection.Walk(firstOid, printValue); err != nil { + return fmt.Errorf("unable to walk SNMP agent on %s:%d: %w", snmpConnection.Target, snmpConnection.Port, err) + } + + return nil +} + +// printValue prints a PDU in a similar style to snmpwalk -Ont +func printValue(pdu gosnmp.SnmpPDU) error { + fmt.Printf("%s = ", pdu.Name) + + switch pdu.Type { + case gosnmp.OctetString: + b := pdu.Value.([]byte) + if !gosnmplib.IsStringPrintable(b) { + var strBytes []string + for _, bt := range b { + strBytes = append(strBytes, strings.ToUpper(hex.EncodeToString([]byte{bt}))) + } + fmt.Print("Hex-STRING: " + strings.Join(strBytes, " ") + "\n") + } else { + fmt.Printf("STRING: %s\n", string(b)) + } + case gosnmp.ObjectIdentifier: + fmt.Printf("OID: %s\n", pdu.Value) + case gosnmp.TimeTicks: + fmt.Print(pdu.Value, "\n") + case gosnmp.Counter32: + fmt.Printf("Counter32: %d\n", pdu.Value.(uint)) + case gosnmp.Counter64: + fmt.Printf("Counter64: %d\n", pdu.Value.(uint64)) + case gosnmp.Integer: + fmt.Printf("INTEGER: %d\n", pdu.Value.(int)) + case gosnmp.Gauge32: + fmt.Printf("Gauge32: %d\n", pdu.Value.(uint)) + case gosnmp.IPAddress: + fmt.Printf("IpAddress: %s\n", pdu.Value.(string)) + default: + fmt.Printf("TYPE %d: %d\n", pdu.Type, gosnmp.ToBigInt(pdu.Value)) + } + + return nil +} diff --git a/comp/snmpscan/mock/mock.go b/comp/snmpscan/mock/mock.go new file mode 100644 index 0000000000000..3804870a33f40 --- /dev/null +++ b/comp/snmpscan/mock/mock.go @@ -0,0 +1,40 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +//go:build test + +// Package mock provides a mock for the snmpscan component +package mock + +import ( + "testing" + + log "github.com/DataDog/datadog-agent/comp/core/log/def" + snmpscan "github.com/DataDog/datadog-agent/comp/snmpscan/def" + "github.com/gosnmp/gosnmp" +) + +type mock struct { + Logger log.Component +} + +// Provides that defines the output of mocked snmpscan component +type Provides struct { + comp snmpscan.Component +} + +// New returns a mock snmpscanner +func New(*testing.T) Provides { + return Provides{ + comp: mock{}, + } +} + +func (m mock) RunDeviceScan(_ *gosnmp.GoSNMP, _ string, _ string) error { + return nil +} +func (m mock) RunSnmpWalk(_ *gosnmp.GoSNMP, _ string) error { + return nil +} diff --git a/comp/systray/systray/systrayimpl/doflare.go b/comp/systray/systray/systrayimpl/doflare.go index 229f1f113f71c..b6748933c5dde 100644 --- a/comp/systray/systray/systrayimpl/doflare.go +++ b/comp/systray/systray/systrayimpl/doflare.go @@ -196,7 +196,7 @@ func requestFlare(s *systrayImpl, caseID, customerEmail string) (response string } s.log.Debug("Initiating flare locally.") - filePath, e = s.flare.Create(nil, e) + filePath, e = s.flare.Create(nil, 0, e) if e != nil { s.log.Errorf("The flare zipfile failed to be created: %s\n", e) return diff --git a/comp/trace/agent/def/go.mod b/comp/trace/agent/def/go.mod index 5e0ce7c470abd..8004b4e612734 100644 --- a/comp/trace/agent/def/go.mod +++ b/comp/trace/agent/def/go.mod @@ -33,9 +33,9 @@ require ( go.opentelemetry.io/otel/trace v1.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/net v0.29.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/net v0.30.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.1 // indirect diff --git a/comp/trace/agent/def/go.sum b/comp/trace/agent/def/go.sum index f19708bda48f5..6b6e99b6f6347 100644 --- a/comp/trace/agent/def/go.sum +++ b/comp/trace/agent/def/go.sum @@ -111,8 +111,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -126,8 +126,8 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= @@ -135,8 +135,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 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= diff --git a/docs/cloud-workload-security/linux_expressions.md b/docs/cloud-workload-security/linux_expressions.md index 196c1c8ecfa7c..51fa104e4c68a 100644 --- a/docs/cloud-workload-security/linux_expressions.md +++ b/docs/cloud-workload-security/linux_expressions.md @@ -166,12 +166,12 @@ The *file.rights* attribute can now be used in addition to *file.mode*. *file.mo | [`process.ancestors.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`process.ancestors.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`process.ancestors.file.name`](#common-fileevent-name-doc) | File's basename | -| [`process.ancestors.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.ancestors.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.ancestors.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`process.ancestors.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`process.ancestors.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`process.ancestors.file.path`](#common-fileevent-path-doc) | File's path | -| [`process.ancestors.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.ancestors.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.ancestors.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`process.ancestors.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`process.ancestors.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -192,17 +192,18 @@ The *file.rights* attribute can now be used in addition to *file.mode*. *file.mo | [`process.ancestors.interpreter.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`process.ancestors.interpreter.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`process.ancestors.interpreter.file.name`](#common-fileevent-name-doc) | File's basename | -| [`process.ancestors.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.ancestors.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.ancestors.interpreter.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`process.ancestors.interpreter.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`process.ancestors.interpreter.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`process.ancestors.interpreter.file.path`](#common-fileevent-path-doc) | File's path | -| [`process.ancestors.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.ancestors.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.ancestors.interpreter.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`process.ancestors.interpreter.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`process.ancestors.interpreter.file.user`](#common-filefields-user-doc) | User of the file's owner | | [`process.ancestors.is_kworker`](#common-pidcontext-is_kworker-doc) | Indicates whether the process is a kworker | | [`process.ancestors.is_thread`](#common-process-is_thread-doc) | Indicates whether the process is considered a thread (that is, a child process that hasn't executed another program) | +| [`process.ancestors.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.ancestors.pid`](#common-pidcontext-pid-doc) | Process ID of the process (also called thread group ID) | | [`process.ancestors.ppid`](#common-process-ppid-doc) | Parent process ID | | [`process.ancestors.tid`](#common-pidcontext-tid-doc) | Thread ID of the thread | @@ -246,12 +247,12 @@ The *file.rights* attribute can now be used in addition to *file.mode*. *file.mo | [`process.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`process.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`process.file.name`](#common-fileevent-name-doc) | File's basename | -| [`process.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`process.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`process.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`process.file.path`](#common-fileevent-path-doc) | File's path | -| [`process.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`process.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`process.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -272,12 +273,12 @@ The *file.rights* attribute can now be used in addition to *file.mode*. *file.mo | [`process.interpreter.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`process.interpreter.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`process.interpreter.file.name`](#common-fileevent-name-doc) | File's basename | -| [`process.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.interpreter.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`process.interpreter.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`process.interpreter.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`process.interpreter.file.path`](#common-fileevent-path-doc) | File's path | -| [`process.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.interpreter.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`process.interpreter.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`process.interpreter.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -317,12 +318,12 @@ The *file.rights* attribute can now be used in addition to *file.mode*. *file.mo | [`process.parent.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`process.parent.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`process.parent.file.name`](#common-fileevent-name-doc) | File's basename | -| [`process.parent.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.parent.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.parent.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`process.parent.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`process.parent.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`process.parent.file.path`](#common-fileevent-path-doc) | File's path | -| [`process.parent.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.parent.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.parent.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`process.parent.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`process.parent.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -343,12 +344,12 @@ The *file.rights* attribute can now be used in addition to *file.mode*. *file.mo | [`process.parent.interpreter.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`process.parent.interpreter.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`process.parent.interpreter.file.name`](#common-fileevent-name-doc) | File's basename | -| [`process.parent.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.parent.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.parent.interpreter.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`process.parent.interpreter.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`process.parent.interpreter.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`process.parent.interpreter.file.path`](#common-fileevent-path-doc) | File's path | -| [`process.parent.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.parent.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.parent.interpreter.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`process.parent.interpreter.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`process.parent.interpreter.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -428,12 +429,12 @@ A process changed the current directory | [`chdir.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`chdir.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`chdir.file.name`](#common-fileevent-name-doc) | File's basename | -| [`chdir.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`chdir.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`chdir.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`chdir.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`chdir.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`chdir.file.path`](#common-fileevent-path-doc) | File's path | -| [`chdir.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`chdir.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`chdir.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`chdir.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`chdir.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -459,12 +460,12 @@ A file’s permissions were changed | [`chmod.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`chmod.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`chmod.file.name`](#common-fileevent-name-doc) | File's basename | -| [`chmod.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`chmod.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`chmod.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`chmod.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`chmod.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`chmod.file.path`](#common-fileevent-path-doc) | File's path | -| [`chmod.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`chmod.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`chmod.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`chmod.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`chmod.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -493,12 +494,12 @@ A file’s owner was changed | [`chown.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`chown.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`chown.file.name`](#common-fileevent-name-doc) | File's basename | -| [`chown.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`chown.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`chown.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`chown.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`chown.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`chown.file.path`](#common-fileevent-path-doc) | File's path | -| [`chown.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`chown.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`chown.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`chown.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`chown.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -518,7 +519,7 @@ A DNS request was sent | [`dns.question.count`](#dns-question-count-doc) | the total count of questions in the DNS request | | [`dns.question.length`](#dns-question-length-doc) | the total DNS request size in bytes | | [`dns.question.name`](#dns-question-name-doc) | the queried domain name | -| [`dns.question.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`dns.question.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`dns.question.type`](#dns-question-type-doc) | a two octet code which specifies the DNS question type | | [`network.destination.ip`](#common-ipportcontext-ip-doc) | IP address | | [`network.destination.port`](#common-ipportcontext-port-doc) | Port number | @@ -569,12 +570,12 @@ A process was executed or forked | [`exec.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`exec.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`exec.file.name`](#common-fileevent-name-doc) | File's basename | -| [`exec.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`exec.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`exec.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`exec.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`exec.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`exec.file.path`](#common-fileevent-path-doc) | File's path | -| [`exec.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`exec.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`exec.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`exec.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`exec.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -595,12 +596,12 @@ A process was executed or forked | [`exec.interpreter.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`exec.interpreter.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`exec.interpreter.file.name`](#common-fileevent-name-doc) | File's basename | -| [`exec.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`exec.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`exec.interpreter.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`exec.interpreter.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`exec.interpreter.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`exec.interpreter.file.path`](#common-fileevent-path-doc) | File's path | -| [`exec.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`exec.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`exec.interpreter.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`exec.interpreter.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`exec.interpreter.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -659,12 +660,12 @@ A process was terminated | [`exit.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`exit.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`exit.file.name`](#common-fileevent-name-doc) | File's basename | -| [`exit.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`exit.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`exit.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`exit.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`exit.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`exit.file.path`](#common-fileevent-path-doc) | File's path | -| [`exit.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`exit.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`exit.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`exit.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`exit.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -685,12 +686,12 @@ A process was terminated | [`exit.interpreter.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`exit.interpreter.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`exit.interpreter.file.name`](#common-fileevent-name-doc) | File's basename | -| [`exit.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`exit.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`exit.interpreter.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`exit.interpreter.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`exit.interpreter.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`exit.interpreter.file.path`](#common-fileevent-path-doc) | File's path | -| [`exit.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`exit.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`exit.interpreter.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`exit.interpreter.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`exit.interpreter.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -747,12 +748,12 @@ Create a new name/alias for a file | [`link.file.destination.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`link.file.destination.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`link.file.destination.name`](#common-fileevent-name-doc) | File's basename | -| [`link.file.destination.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`link.file.destination.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`link.file.destination.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`link.file.destination.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`link.file.destination.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`link.file.destination.path`](#common-fileevent-path-doc) | File's path | -| [`link.file.destination.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`link.file.destination.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`link.file.destination.rights`](#common-filefields-rights-doc) | Rights of the file | | [`link.file.destination.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`link.file.destination.user`](#common-filefields-user-doc) | User of the file's owner | @@ -766,12 +767,12 @@ Create a new name/alias for a file | [`link.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`link.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`link.file.name`](#common-fileevent-name-doc) | File's basename | -| [`link.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`link.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`link.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`link.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`link.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`link.file.path`](#common-fileevent-path-doc) | File's path | -| [`link.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`link.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`link.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`link.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`link.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -799,12 +800,12 @@ A new kernel module was loaded | [`load_module.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`load_module.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`load_module.file.name`](#common-fileevent-name-doc) | File's basename | -| [`load_module.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`load_module.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`load_module.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`load_module.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`load_module.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`load_module.file.path`](#common-fileevent-path-doc) | File's path | -| [`load_module.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`load_module.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`load_module.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`load_module.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`load_module.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -831,12 +832,12 @@ A directory was created | [`mkdir.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`mkdir.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`mkdir.file.name`](#common-fileevent-name-doc) | File's basename | -| [`mkdir.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`mkdir.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`mkdir.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`mkdir.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`mkdir.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`mkdir.file.path`](#common-fileevent-path-doc) | File's path | -| [`mkdir.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`mkdir.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`mkdir.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`mkdir.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`mkdir.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -859,12 +860,12 @@ A mmap command was executed | [`mmap.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`mmap.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`mmap.file.name`](#common-fileevent-name-doc) | File's basename | -| [`mmap.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`mmap.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`mmap.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`mmap.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`mmap.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`mmap.file.path`](#common-fileevent-path-doc) | File's path | -| [`mmap.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`mmap.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`mmap.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`mmap.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`mmap.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -917,12 +918,12 @@ A file was opened | [`open.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`open.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`open.file.name`](#common-fileevent-name-doc) | File's basename | -| [`open.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`open.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`open.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`open.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`open.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`open.file.path`](#common-fileevent-path-doc) | File's path | -| [`open.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`open.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`open.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`open.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`open.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -990,12 +991,12 @@ A ptrace command was executed | [`ptrace.tracee.ancestors.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`ptrace.tracee.ancestors.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`ptrace.tracee.ancestors.file.name`](#common-fileevent-name-doc) | File's basename | -| [`ptrace.tracee.ancestors.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`ptrace.tracee.ancestors.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`ptrace.tracee.ancestors.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`ptrace.tracee.ancestors.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`ptrace.tracee.ancestors.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`ptrace.tracee.ancestors.file.path`](#common-fileevent-path-doc) | File's path | -| [`ptrace.tracee.ancestors.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`ptrace.tracee.ancestors.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`ptrace.tracee.ancestors.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`ptrace.tracee.ancestors.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`ptrace.tracee.ancestors.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -1016,17 +1017,18 @@ A ptrace command was executed | [`ptrace.tracee.ancestors.interpreter.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`ptrace.tracee.ancestors.interpreter.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`ptrace.tracee.ancestors.interpreter.file.name`](#common-fileevent-name-doc) | File's basename | -| [`ptrace.tracee.ancestors.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`ptrace.tracee.ancestors.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`ptrace.tracee.ancestors.interpreter.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`ptrace.tracee.ancestors.interpreter.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`ptrace.tracee.ancestors.interpreter.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`ptrace.tracee.ancestors.interpreter.file.path`](#common-fileevent-path-doc) | File's path | -| [`ptrace.tracee.ancestors.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`ptrace.tracee.ancestors.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`ptrace.tracee.ancestors.interpreter.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`ptrace.tracee.ancestors.interpreter.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`ptrace.tracee.ancestors.interpreter.file.user`](#common-filefields-user-doc) | User of the file's owner | | [`ptrace.tracee.ancestors.is_kworker`](#common-pidcontext-is_kworker-doc) | Indicates whether the process is a kworker | | [`ptrace.tracee.ancestors.is_thread`](#common-process-is_thread-doc) | Indicates whether the process is considered a thread (that is, a child process that hasn't executed another program) | +| [`ptrace.tracee.ancestors.length`](#common-string-length-doc) | Length of the corresponding element | | [`ptrace.tracee.ancestors.pid`](#common-pidcontext-pid-doc) | Process ID of the process (also called thread group ID) | | [`ptrace.tracee.ancestors.ppid`](#common-process-ppid-doc) | Parent process ID | | [`ptrace.tracee.ancestors.tid`](#common-pidcontext-tid-doc) | Thread ID of the thread | @@ -1070,12 +1072,12 @@ A ptrace command was executed | [`ptrace.tracee.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`ptrace.tracee.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`ptrace.tracee.file.name`](#common-fileevent-name-doc) | File's basename | -| [`ptrace.tracee.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`ptrace.tracee.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`ptrace.tracee.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`ptrace.tracee.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`ptrace.tracee.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`ptrace.tracee.file.path`](#common-fileevent-path-doc) | File's path | -| [`ptrace.tracee.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`ptrace.tracee.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`ptrace.tracee.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`ptrace.tracee.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`ptrace.tracee.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -1096,12 +1098,12 @@ A ptrace command was executed | [`ptrace.tracee.interpreter.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`ptrace.tracee.interpreter.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`ptrace.tracee.interpreter.file.name`](#common-fileevent-name-doc) | File's basename | -| [`ptrace.tracee.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`ptrace.tracee.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`ptrace.tracee.interpreter.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`ptrace.tracee.interpreter.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`ptrace.tracee.interpreter.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`ptrace.tracee.interpreter.file.path`](#common-fileevent-path-doc) | File's path | -| [`ptrace.tracee.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`ptrace.tracee.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`ptrace.tracee.interpreter.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`ptrace.tracee.interpreter.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`ptrace.tracee.interpreter.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -1141,12 +1143,12 @@ A ptrace command was executed | [`ptrace.tracee.parent.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`ptrace.tracee.parent.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`ptrace.tracee.parent.file.name`](#common-fileevent-name-doc) | File's basename | -| [`ptrace.tracee.parent.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`ptrace.tracee.parent.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`ptrace.tracee.parent.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`ptrace.tracee.parent.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`ptrace.tracee.parent.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`ptrace.tracee.parent.file.path`](#common-fileevent-path-doc) | File's path | -| [`ptrace.tracee.parent.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`ptrace.tracee.parent.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`ptrace.tracee.parent.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`ptrace.tracee.parent.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`ptrace.tracee.parent.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -1167,12 +1169,12 @@ A ptrace command was executed | [`ptrace.tracee.parent.interpreter.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`ptrace.tracee.parent.interpreter.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`ptrace.tracee.parent.interpreter.file.name`](#common-fileevent-name-doc) | File's basename | -| [`ptrace.tracee.parent.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`ptrace.tracee.parent.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`ptrace.tracee.parent.interpreter.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`ptrace.tracee.parent.interpreter.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`ptrace.tracee.parent.interpreter.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`ptrace.tracee.parent.interpreter.file.path`](#common-fileevent-path-doc) | File's path | -| [`ptrace.tracee.parent.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`ptrace.tracee.parent.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`ptrace.tracee.parent.interpreter.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`ptrace.tracee.parent.interpreter.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`ptrace.tracee.parent.interpreter.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -1216,12 +1218,12 @@ Remove extended attributes | [`removexattr.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`removexattr.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`removexattr.file.name`](#common-fileevent-name-doc) | File's basename | -| [`removexattr.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`removexattr.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`removexattr.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`removexattr.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`removexattr.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`removexattr.file.path`](#common-fileevent-path-doc) | File's path | -| [`removexattr.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`removexattr.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`removexattr.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`removexattr.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`removexattr.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -1245,12 +1247,12 @@ A file/directory was renamed | [`rename.file.destination.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`rename.file.destination.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`rename.file.destination.name`](#common-fileevent-name-doc) | File's basename | -| [`rename.file.destination.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`rename.file.destination.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`rename.file.destination.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`rename.file.destination.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`rename.file.destination.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`rename.file.destination.path`](#common-fileevent-path-doc) | File's path | -| [`rename.file.destination.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`rename.file.destination.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`rename.file.destination.rights`](#common-filefields-rights-doc) | Rights of the file | | [`rename.file.destination.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`rename.file.destination.user`](#common-filefields-user-doc) | User of the file's owner | @@ -1264,12 +1266,12 @@ A file/directory was renamed | [`rename.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`rename.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`rename.file.name`](#common-fileevent-name-doc) | File's basename | -| [`rename.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`rename.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`rename.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`rename.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`rename.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`rename.file.path`](#common-fileevent-path-doc) | File's path | -| [`rename.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`rename.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`rename.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`rename.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`rename.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -1294,12 +1296,12 @@ A directory was removed | [`rmdir.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`rmdir.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`rmdir.file.name`](#common-fileevent-name-doc) | File's basename | -| [`rmdir.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`rmdir.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`rmdir.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`rmdir.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`rmdir.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`rmdir.file.path`](#common-fileevent-path-doc) | File's path | -| [`rmdir.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`rmdir.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`rmdir.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`rmdir.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`rmdir.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -1361,12 +1363,12 @@ Set exteneded attributes | [`setxattr.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`setxattr.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`setxattr.file.name`](#common-fileevent-name-doc) | File's basename | -| [`setxattr.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`setxattr.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`setxattr.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`setxattr.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`setxattr.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`setxattr.file.path`](#common-fileevent-path-doc) | File's path | -| [`setxattr.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`setxattr.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`setxattr.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`setxattr.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`setxattr.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -1414,12 +1416,12 @@ A signal was sent | [`signal.target.ancestors.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`signal.target.ancestors.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`signal.target.ancestors.file.name`](#common-fileevent-name-doc) | File's basename | -| [`signal.target.ancestors.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`signal.target.ancestors.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`signal.target.ancestors.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`signal.target.ancestors.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`signal.target.ancestors.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`signal.target.ancestors.file.path`](#common-fileevent-path-doc) | File's path | -| [`signal.target.ancestors.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`signal.target.ancestors.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`signal.target.ancestors.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`signal.target.ancestors.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`signal.target.ancestors.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -1440,17 +1442,18 @@ A signal was sent | [`signal.target.ancestors.interpreter.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`signal.target.ancestors.interpreter.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`signal.target.ancestors.interpreter.file.name`](#common-fileevent-name-doc) | File's basename | -| [`signal.target.ancestors.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`signal.target.ancestors.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`signal.target.ancestors.interpreter.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`signal.target.ancestors.interpreter.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`signal.target.ancestors.interpreter.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`signal.target.ancestors.interpreter.file.path`](#common-fileevent-path-doc) | File's path | -| [`signal.target.ancestors.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`signal.target.ancestors.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`signal.target.ancestors.interpreter.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`signal.target.ancestors.interpreter.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`signal.target.ancestors.interpreter.file.user`](#common-filefields-user-doc) | User of the file's owner | | [`signal.target.ancestors.is_kworker`](#common-pidcontext-is_kworker-doc) | Indicates whether the process is a kworker | | [`signal.target.ancestors.is_thread`](#common-process-is_thread-doc) | Indicates whether the process is considered a thread (that is, a child process that hasn't executed another program) | +| [`signal.target.ancestors.length`](#common-string-length-doc) | Length of the corresponding element | | [`signal.target.ancestors.pid`](#common-pidcontext-pid-doc) | Process ID of the process (also called thread group ID) | | [`signal.target.ancestors.ppid`](#common-process-ppid-doc) | Parent process ID | | [`signal.target.ancestors.tid`](#common-pidcontext-tid-doc) | Thread ID of the thread | @@ -1494,12 +1497,12 @@ A signal was sent | [`signal.target.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`signal.target.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`signal.target.file.name`](#common-fileevent-name-doc) | File's basename | -| [`signal.target.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`signal.target.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`signal.target.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`signal.target.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`signal.target.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`signal.target.file.path`](#common-fileevent-path-doc) | File's path | -| [`signal.target.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`signal.target.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`signal.target.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`signal.target.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`signal.target.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -1520,12 +1523,12 @@ A signal was sent | [`signal.target.interpreter.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`signal.target.interpreter.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`signal.target.interpreter.file.name`](#common-fileevent-name-doc) | File's basename | -| [`signal.target.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`signal.target.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`signal.target.interpreter.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`signal.target.interpreter.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`signal.target.interpreter.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`signal.target.interpreter.file.path`](#common-fileevent-path-doc) | File's path | -| [`signal.target.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`signal.target.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`signal.target.interpreter.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`signal.target.interpreter.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`signal.target.interpreter.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -1565,12 +1568,12 @@ A signal was sent | [`signal.target.parent.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`signal.target.parent.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`signal.target.parent.file.name`](#common-fileevent-name-doc) | File's basename | -| [`signal.target.parent.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`signal.target.parent.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`signal.target.parent.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`signal.target.parent.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`signal.target.parent.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`signal.target.parent.file.path`](#common-fileevent-path-doc) | File's path | -| [`signal.target.parent.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`signal.target.parent.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`signal.target.parent.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`signal.target.parent.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`signal.target.parent.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -1591,12 +1594,12 @@ A signal was sent | [`signal.target.parent.interpreter.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`signal.target.parent.interpreter.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`signal.target.parent.interpreter.file.name`](#common-fileevent-name-doc) | File's basename | -| [`signal.target.parent.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`signal.target.parent.interpreter.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`signal.target.parent.interpreter.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`signal.target.parent.interpreter.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`signal.target.parent.interpreter.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`signal.target.parent.interpreter.file.path`](#common-fileevent-path-doc) | File's path | -| [`signal.target.parent.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`signal.target.parent.interpreter.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`signal.target.parent.interpreter.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`signal.target.parent.interpreter.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`signal.target.parent.interpreter.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -1639,12 +1642,12 @@ A splice command was executed | [`splice.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`splice.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`splice.file.name`](#common-fileevent-name-doc) | File's basename | -| [`splice.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`splice.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`splice.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`splice.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`splice.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`splice.file.path`](#common-fileevent-path-doc) | File's path | -| [`splice.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`splice.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`splice.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`splice.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`splice.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -1669,12 +1672,12 @@ A file was deleted | [`unlink.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`unlink.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`unlink.file.name`](#common-fileevent-name-doc) | File's basename | -| [`unlink.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`unlink.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`unlink.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`unlink.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`unlink.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`unlink.file.path`](#common-fileevent-path-doc) | File's path | -| [`unlink.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`unlink.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`unlink.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`unlink.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`unlink.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -1710,12 +1713,12 @@ Change file access/modification times | [`utimes.file.modification_time`](#common-filefields-modification_time-doc) | Modification time (mtime) of the file | | [`utimes.file.mount_id`](#common-pathkey-mount_id-doc) | Mount ID of the file | | [`utimes.file.name`](#common-fileevent-name-doc) | File's basename | -| [`utimes.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`utimes.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`utimes.file.package.name`](#common-fileevent-package-name-doc) | [Experimental] Name of the package that provided this file | | [`utimes.file.package.source_version`](#common-fileevent-package-source_version-doc) | [Experimental] Full version of the source package of the package that provided this file | | [`utimes.file.package.version`](#common-fileevent-package-version-doc) | [Experimental] Full version of the package that provided this file | | [`utimes.file.path`](#common-fileevent-path-doc) | File's path | -| [`utimes.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`utimes.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`utimes.file.rights`](#common-filefields-rights-doc) | Rights of the file | | [`utimes.file.uid`](#common-filefields-uid-doc) | UID of the file's owner | | [`utimes.file.user`](#common-filefields-user-doc) | User of the file's owner | @@ -2181,10 +2184,10 @@ Constants: [L4 protocols](#l4-protocols) ### `*.length` {#common-string-length-doc} Type: int -Definition: Length of the corresponding string +Definition: Length of the corresponding element -`*.length` has 79 possible prefixes: -`chdir.file.name` `chdir.file.path` `chmod.file.name` `chmod.file.path` `chown.file.name` `chown.file.path` `dns.question.name` `exec.file.name` `exec.file.path` `exec.interpreter.file.name` `exec.interpreter.file.path` `exit.file.name` `exit.file.path` `exit.interpreter.file.name` `exit.interpreter.file.path` `link.file.destination.name` `link.file.destination.path` `link.file.name` `link.file.path` `load_module.file.name` `load_module.file.path` `mkdir.file.name` `mkdir.file.path` `mmap.file.name` `mmap.file.path` `open.file.name` `open.file.path` `process.ancestors.file.name` `process.ancestors.file.path` `process.ancestors.interpreter.file.name` `process.ancestors.interpreter.file.path` `process.file.name` `process.file.path` `process.interpreter.file.name` `process.interpreter.file.path` `process.parent.file.name` `process.parent.file.path` `process.parent.interpreter.file.name` `process.parent.interpreter.file.path` `ptrace.tracee.ancestors.file.name` `ptrace.tracee.ancestors.file.path` `ptrace.tracee.ancestors.interpreter.file.name` `ptrace.tracee.ancestors.interpreter.file.path` `ptrace.tracee.file.name` `ptrace.tracee.file.path` `ptrace.tracee.interpreter.file.name` `ptrace.tracee.interpreter.file.path` `ptrace.tracee.parent.file.name` `ptrace.tracee.parent.file.path` `ptrace.tracee.parent.interpreter.file.name` `ptrace.tracee.parent.interpreter.file.path` `removexattr.file.name` `removexattr.file.path` `rename.file.destination.name` `rename.file.destination.path` `rename.file.name` `rename.file.path` `rmdir.file.name` `rmdir.file.path` `setxattr.file.name` `setxattr.file.path` `signal.target.ancestors.file.name` `signal.target.ancestors.file.path` `signal.target.ancestors.interpreter.file.name` `signal.target.ancestors.interpreter.file.path` `signal.target.file.name` `signal.target.file.path` `signal.target.interpreter.file.name` `signal.target.interpreter.file.path` `signal.target.parent.file.name` `signal.target.parent.file.path` `signal.target.parent.interpreter.file.name` `signal.target.parent.interpreter.file.path` `splice.file.name` `splice.file.path` `unlink.file.name` `unlink.file.path` `utimes.file.name` `utimes.file.path` +`*.length` has 82 possible prefixes: +`chdir.file.name` `chdir.file.path` `chmod.file.name` `chmod.file.path` `chown.file.name` `chown.file.path` `dns.question.name` `exec.file.name` `exec.file.path` `exec.interpreter.file.name` `exec.interpreter.file.path` `exit.file.name` `exit.file.path` `exit.interpreter.file.name` `exit.interpreter.file.path` `link.file.destination.name` `link.file.destination.path` `link.file.name` `link.file.path` `load_module.file.name` `load_module.file.path` `mkdir.file.name` `mkdir.file.path` `mmap.file.name` `mmap.file.path` `open.file.name` `open.file.path` `process.ancestors` `process.ancestors.file.name` `process.ancestors.file.path` `process.ancestors.interpreter.file.name` `process.ancestors.interpreter.file.path` `process.file.name` `process.file.path` `process.interpreter.file.name` `process.interpreter.file.path` `process.parent.file.name` `process.parent.file.path` `process.parent.interpreter.file.name` `process.parent.interpreter.file.path` `ptrace.tracee.ancestors` `ptrace.tracee.ancestors.file.name` `ptrace.tracee.ancestors.file.path` `ptrace.tracee.ancestors.interpreter.file.name` `ptrace.tracee.ancestors.interpreter.file.path` `ptrace.tracee.file.name` `ptrace.tracee.file.path` `ptrace.tracee.interpreter.file.name` `ptrace.tracee.interpreter.file.path` `ptrace.tracee.parent.file.name` `ptrace.tracee.parent.file.path` `ptrace.tracee.parent.interpreter.file.name` `ptrace.tracee.parent.interpreter.file.path` `removexattr.file.name` `removexattr.file.path` `rename.file.destination.name` `rename.file.destination.path` `rename.file.name` `rename.file.path` `rmdir.file.name` `rmdir.file.path` `setxattr.file.name` `setxattr.file.path` `signal.target.ancestors` `signal.target.ancestors.file.name` `signal.target.ancestors.file.path` `signal.target.ancestors.interpreter.file.name` `signal.target.ancestors.interpreter.file.path` `signal.target.file.name` `signal.target.file.path` `signal.target.interpreter.file.name` `signal.target.interpreter.file.path` `signal.target.parent.file.name` `signal.target.parent.file.path` `signal.target.parent.interpreter.file.name` `signal.target.parent.interpreter.file.path` `splice.file.name` `splice.file.path` `unlink.file.name` `unlink.file.path` `utimes.file.name` `utimes.file.path` ### `*.manager` {#common-cgroupcontext-manager-doc} diff --git a/docs/cloud-workload-security/secl_linux.json b/docs/cloud-workload-security/secl_linux.json index 8ff7c26142565..8e98f4ff09763 100644 --- a/docs/cloud-workload-security/secl_linux.json +++ b/docs/cloud-workload-security/secl_linux.json @@ -249,7 +249,7 @@ }, { "name": "process.ancestors.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -274,7 +274,7 @@ }, { "name": "process.ancestors.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -379,7 +379,7 @@ }, { "name": "process.ancestors.interpreter.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -404,7 +404,7 @@ }, { "name": "process.ancestors.interpreter.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -432,6 +432,11 @@ "definition": "Indicates whether the process is considered a thread (that is, a child process that hasn't executed another program)", "property_doc_link": "common-process-is_thread-doc" }, + { + "name": "process.ancestors.length", + "definition": "Length of the corresponding element", + "property_doc_link": "common-string-length-doc" + }, { "name": "process.ancestors.pid", "definition": "Process ID of the process (also called thread group ID)", @@ -649,7 +654,7 @@ }, { "name": "process.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -674,7 +679,7 @@ }, { "name": "process.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -779,7 +784,7 @@ }, { "name": "process.interpreter.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -804,7 +809,7 @@ }, { "name": "process.interpreter.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -1004,7 +1009,7 @@ }, { "name": "process.parent.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -1029,7 +1034,7 @@ }, { "name": "process.parent.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -1134,7 +1139,7 @@ }, { "name": "process.parent.interpreter.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -1159,7 +1164,7 @@ }, { "name": "process.parent.interpreter.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -1445,7 +1450,7 @@ }, { "name": "chdir.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -1470,7 +1475,7 @@ }, { "name": "chdir.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -1574,7 +1579,7 @@ }, { "name": "chmod.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -1599,7 +1604,7 @@ }, { "name": "chmod.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -1718,7 +1723,7 @@ }, { "name": "chown.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -1743,7 +1748,7 @@ }, { "name": "chown.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -1817,7 +1822,7 @@ }, { "name": "dns.question.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -2046,7 +2051,7 @@ }, { "name": "exec.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -2071,7 +2076,7 @@ }, { "name": "exec.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -2176,7 +2181,7 @@ }, { "name": "exec.interpreter.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -2201,7 +2206,7 @@ }, { "name": "exec.interpreter.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -2470,7 +2475,7 @@ }, { "name": "exit.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -2495,7 +2500,7 @@ }, { "name": "exit.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -2600,7 +2605,7 @@ }, { "name": "exit.interpreter.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -2625,7 +2630,7 @@ }, { "name": "exit.interpreter.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -2858,7 +2863,7 @@ }, { "name": "link.file.destination.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -2883,7 +2888,7 @@ }, { "name": "link.file.destination.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -2953,7 +2958,7 @@ }, { "name": "link.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -2978,7 +2983,7 @@ }, { "name": "link.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -3092,7 +3097,7 @@ }, { "name": "load_module.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -3117,7 +3122,7 @@ }, { "name": "load_module.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -3226,7 +3231,7 @@ }, { "name": "mkdir.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -3251,7 +3256,7 @@ }, { "name": "mkdir.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -3340,7 +3345,7 @@ }, { "name": "mmap.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -3365,7 +3370,7 @@ }, { "name": "mmap.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -3542,7 +3547,7 @@ }, { "name": "open.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -3567,7 +3572,7 @@ }, { "name": "open.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -3855,7 +3860,7 @@ }, { "name": "ptrace.tracee.ancestors.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -3880,7 +3885,7 @@ }, { "name": "ptrace.tracee.ancestors.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -3985,7 +3990,7 @@ }, { "name": "ptrace.tracee.ancestors.interpreter.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -4010,7 +4015,7 @@ }, { "name": "ptrace.tracee.ancestors.interpreter.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -4038,6 +4043,11 @@ "definition": "Indicates whether the process is considered a thread (that is, a child process that hasn't executed another program)", "property_doc_link": "common-process-is_thread-doc" }, + { + "name": "ptrace.tracee.ancestors.length", + "definition": "Length of the corresponding element", + "property_doc_link": "common-string-length-doc" + }, { "name": "ptrace.tracee.ancestors.pid", "definition": "Process ID of the process (also called thread group ID)", @@ -4255,7 +4265,7 @@ }, { "name": "ptrace.tracee.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -4280,7 +4290,7 @@ }, { "name": "ptrace.tracee.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -4385,7 +4395,7 @@ }, { "name": "ptrace.tracee.interpreter.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -4410,7 +4420,7 @@ }, { "name": "ptrace.tracee.interpreter.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -4610,7 +4620,7 @@ }, { "name": "ptrace.tracee.parent.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -4635,7 +4645,7 @@ }, { "name": "ptrace.tracee.parent.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -4740,7 +4750,7 @@ }, { "name": "ptrace.tracee.parent.interpreter.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -4765,7 +4775,7 @@ }, { "name": "ptrace.tracee.parent.interpreter.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -4959,7 +4969,7 @@ }, { "name": "removexattr.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -4984,7 +4994,7 @@ }, { "name": "removexattr.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -5078,7 +5088,7 @@ }, { "name": "rename.file.destination.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -5103,7 +5113,7 @@ }, { "name": "rename.file.destination.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -5173,7 +5183,7 @@ }, { "name": "rename.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -5198,7 +5208,7 @@ }, { "name": "rename.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -5297,7 +5307,7 @@ }, { "name": "rmdir.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -5322,7 +5332,7 @@ }, { "name": "rmdir.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -5528,7 +5538,7 @@ }, { "name": "setxattr.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -5553,7 +5563,7 @@ }, { "name": "setxattr.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -5767,7 +5777,7 @@ }, { "name": "signal.target.ancestors.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -5792,7 +5802,7 @@ }, { "name": "signal.target.ancestors.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -5897,7 +5907,7 @@ }, { "name": "signal.target.ancestors.interpreter.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -5922,7 +5932,7 @@ }, { "name": "signal.target.ancestors.interpreter.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -5950,6 +5960,11 @@ "definition": "Indicates whether the process is considered a thread (that is, a child process that hasn't executed another program)", "property_doc_link": "common-process-is_thread-doc" }, + { + "name": "signal.target.ancestors.length", + "definition": "Length of the corresponding element", + "property_doc_link": "common-string-length-doc" + }, { "name": "signal.target.ancestors.pid", "definition": "Process ID of the process (also called thread group ID)", @@ -6167,7 +6182,7 @@ }, { "name": "signal.target.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -6192,7 +6207,7 @@ }, { "name": "signal.target.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -6297,7 +6312,7 @@ }, { "name": "signal.target.interpreter.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -6322,7 +6337,7 @@ }, { "name": "signal.target.interpreter.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -6522,7 +6537,7 @@ }, { "name": "signal.target.parent.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -6547,7 +6562,7 @@ }, { "name": "signal.target.parent.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -6652,7 +6667,7 @@ }, { "name": "signal.target.parent.interpreter.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -6677,7 +6692,7 @@ }, { "name": "signal.target.parent.interpreter.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -6866,7 +6881,7 @@ }, { "name": "splice.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -6891,7 +6906,7 @@ }, { "name": "splice.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -6990,7 +7005,7 @@ }, { "name": "unlink.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -7015,7 +7030,7 @@ }, { "name": "unlink.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -7143,7 +7158,7 @@ }, { "name": "utimes.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -7168,7 +7183,7 @@ }, { "name": "utimes.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -8354,7 +8369,7 @@ "name": "*.length", "link": "common-string-length-doc", "type": "int", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "prefixes": [ "chdir.file.name", "chdir.file.path", @@ -8383,6 +8398,7 @@ "mmap.file.path", "open.file.name", "open.file.path", + "process.ancestors", "process.ancestors.file.name", "process.ancestors.file.path", "process.ancestors.interpreter.file.name", @@ -8395,6 +8411,7 @@ "process.parent.file.path", "process.parent.interpreter.file.name", "process.parent.interpreter.file.path", + "ptrace.tracee.ancestors", "ptrace.tracee.ancestors.file.name", "ptrace.tracee.ancestors.file.path", "ptrace.tracee.ancestors.interpreter.file.name", @@ -8417,6 +8434,7 @@ "rmdir.file.path", "setxattr.file.name", "setxattr.file.path", + "signal.target.ancestors", "signal.target.ancestors.file.name", "signal.target.ancestors.file.path", "signal.target.ancestors.interpreter.file.name", diff --git a/docs/cloud-workload-security/secl_windows.json b/docs/cloud-workload-security/secl_windows.json index bdcf0069bfc56..e8e3f1e601c4e 100644 --- a/docs/cloud-workload-security/secl_windows.json +++ b/docs/cloud-workload-security/secl_windows.json @@ -84,7 +84,7 @@ }, { "name": "process.ancestors.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -94,7 +94,12 @@ }, { "name": "process.ancestors.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", + "property_doc_link": "common-string-length-doc" + }, + { + "name": "process.ancestors.length", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -149,7 +154,7 @@ }, { "name": "process.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -159,7 +164,7 @@ }, { "name": "process.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -194,7 +199,7 @@ }, { "name": "process.parent.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -204,7 +209,7 @@ }, { "name": "process.parent.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -302,7 +307,7 @@ }, { "name": "create.file.device_path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -312,7 +317,7 @@ }, { "name": "create.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -322,7 +327,7 @@ }, { "name": "create.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" } ] @@ -341,7 +346,7 @@ }, { "name": "create.registry.key_name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -351,7 +356,7 @@ }, { "name": "create.registry.key_path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -361,7 +366,7 @@ }, { "name": "create_key.registry.key_name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -371,7 +376,7 @@ }, { "name": "create_key.registry.key_path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" } ] @@ -390,7 +395,7 @@ }, { "name": "delete.file.device_path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -400,7 +405,7 @@ }, { "name": "delete.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -410,7 +415,7 @@ }, { "name": "delete.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" } ] @@ -429,7 +434,7 @@ }, { "name": "delete.registry.key_name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -439,7 +444,7 @@ }, { "name": "delete.registry.key_path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -449,7 +454,7 @@ }, { "name": "delete_key.registry.key_name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -459,7 +464,7 @@ }, { "name": "delete_key.registry.key_path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" } ] @@ -503,7 +508,7 @@ }, { "name": "exec.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -513,7 +518,7 @@ }, { "name": "exec.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -587,7 +592,7 @@ }, { "name": "exit.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -597,7 +602,7 @@ }, { "name": "exit.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -636,7 +641,7 @@ }, { "name": "open.registry.key_name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -646,7 +651,7 @@ }, { "name": "open.registry.key_path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -656,7 +661,7 @@ }, { "name": "open_key.registry.key_name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -666,7 +671,7 @@ }, { "name": "open_key.registry.key_path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" } ] @@ -685,7 +690,7 @@ }, { "name": "rename.file.destination.device_path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -695,7 +700,7 @@ }, { "name": "rename.file.destination.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -705,7 +710,7 @@ }, { "name": "rename.file.destination.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -715,7 +720,7 @@ }, { "name": "rename.file.device_path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -725,7 +730,7 @@ }, { "name": "rename.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -735,7 +740,7 @@ }, { "name": "rename.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" } ] @@ -754,7 +759,7 @@ }, { "name": "set.registry.key_name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -764,7 +769,7 @@ }, { "name": "set.registry.key_path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -774,7 +779,7 @@ }, { "name": "set.registry.value_name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -789,7 +794,7 @@ }, { "name": "set_key_value.registry.key_name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -799,7 +804,7 @@ }, { "name": "set_key_value.registry.key_path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -809,7 +814,7 @@ }, { "name": "set_key_value.registry.value_name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -833,7 +838,7 @@ }, { "name": "write.file.device_path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -843,7 +848,7 @@ }, { "name": "write.file.name.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" }, { @@ -853,7 +858,7 @@ }, { "name": "write.file.path.length", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "property_doc_link": "common-string-length-doc" } ] @@ -1012,7 +1017,7 @@ "name": "*.length", "link": "common-string-length-doc", "type": "int", - "definition": "Length of the corresponding string", + "definition": "Length of the corresponding element", "prefixes": [ "create.file.device_path", "create.file.name", @@ -1036,6 +1041,7 @@ "open.registry.key_path", "open_key.registry.key_name", "open_key.registry.key_path", + "process.ancestors", "process.ancestors.file.name", "process.ancestors.file.path", "process.file.name", diff --git a/docs/cloud-workload-security/windows_expressions.md b/docs/cloud-workload-security/windows_expressions.md index c749c152c24cd..035c98e380bd8 100644 --- a/docs/cloud-workload-security/windows_expressions.md +++ b/docs/cloud-workload-security/windows_expressions.md @@ -79,9 +79,10 @@ List of the available variables: | [`process.ancestors.envp`](#common-process-envp-doc) | Environment variables of the process | | [`process.ancestors.envs`](#common-process-envs-doc) | Environment variable names of the process | | [`process.ancestors.file.name`](#common-fileevent-name-doc) | File's basename | -| [`process.ancestors.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.ancestors.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.ancestors.file.path`](#common-fileevent-path-doc) | File's path | -| [`process.ancestors.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.ancestors.file.path.length`](#common-string-length-doc) | Length of the corresponding element | +| [`process.ancestors.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.ancestors.pid`](#common-pidcontext-pid-doc) | Process ID of the process (also called thread group ID) | | [`process.ancestors.ppid`](#common-process-ppid-doc) | Parent process ID | | [`process.ancestors.user`](#common-process-user-doc) | User name | @@ -92,18 +93,18 @@ List of the available variables: | [`process.envp`](#common-process-envp-doc) | Environment variables of the process | | [`process.envs`](#common-process-envs-doc) | Environment variable names of the process | | [`process.file.name`](#common-fileevent-name-doc) | File's basename | -| [`process.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.file.path`](#common-fileevent-path-doc) | File's path | -| [`process.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.parent.cmdline`](#common-process-cmdline-doc) | Command line of the process | | [`process.parent.container.id`](#common-process-container-id-doc) | Container ID | | [`process.parent.created_at`](#common-process-created_at-doc) | Timestamp of the creation of the process | | [`process.parent.envp`](#common-process-envp-doc) | Environment variables of the process | | [`process.parent.envs`](#common-process-envs-doc) | Environment variable names of the process | | [`process.parent.file.name`](#common-fileevent-name-doc) | File's basename | -| [`process.parent.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.parent.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.parent.file.path`](#common-fileevent-path-doc) | File's path | -| [`process.parent.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`process.parent.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`process.parent.pid`](#common-pidcontext-pid-doc) | Process ID of the process (also called thread group ID) | | [`process.parent.ppid`](#common-process-ppid-doc) | Parent process ID | | [`process.parent.user`](#common-process-user-doc) | User name | @@ -133,11 +134,11 @@ A file was created | Property | Definition | | -------- | ------------- | | [`create.file.device_path`](#common-fimfileevent-device_path-doc) | File's path | -| [`create.file.device_path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`create.file.device_path.length`](#common-string-length-doc) | Length of the corresponding element | | [`create.file.name`](#common-fimfileevent-name-doc) | File's basename | -| [`create.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`create.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`create.file.path`](#common-fimfileevent-path-doc) | File's path | -| [`create.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`create.file.path.length`](#common-string-length-doc) | Length of the corresponding element | ### Event `create_key` @@ -146,13 +147,13 @@ A registry key was created | Property | Definition | | -------- | ------------- | | [`create.registry.key_name`](#common-registryevent-key_name-doc) | Registry's name | -| [`create.registry.key_name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`create.registry.key_name.length`](#common-string-length-doc) | Length of the corresponding element | | [`create.registry.key_path`](#common-registryevent-key_path-doc) | Registry's path | -| [`create.registry.key_path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`create.registry.key_path.length`](#common-string-length-doc) | Length of the corresponding element | | [`create_key.registry.key_name`](#common-registryevent-key_name-doc) | Registry's name | -| [`create_key.registry.key_name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`create_key.registry.key_name.length`](#common-string-length-doc) | Length of the corresponding element | | [`create_key.registry.key_path`](#common-registryevent-key_path-doc) | Registry's path | -| [`create_key.registry.key_path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`create_key.registry.key_path.length`](#common-string-length-doc) | Length of the corresponding element | ### Event `delete` @@ -161,11 +162,11 @@ A file was deleted | Property | Definition | | -------- | ------------- | | [`delete.file.device_path`](#common-fimfileevent-device_path-doc) | File's path | -| [`delete.file.device_path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`delete.file.device_path.length`](#common-string-length-doc) | Length of the corresponding element | | [`delete.file.name`](#common-fimfileevent-name-doc) | File's basename | -| [`delete.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`delete.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`delete.file.path`](#common-fimfileevent-path-doc) | File's path | -| [`delete.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`delete.file.path.length`](#common-string-length-doc) | Length of the corresponding element | ### Event `delete_key` @@ -174,13 +175,13 @@ A registry key was deleted | Property | Definition | | -------- | ------------- | | [`delete.registry.key_name`](#common-registryevent-key_name-doc) | Registry's name | -| [`delete.registry.key_name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`delete.registry.key_name.length`](#common-string-length-doc) | Length of the corresponding element | | [`delete.registry.key_path`](#common-registryevent-key_path-doc) | Registry's path | -| [`delete.registry.key_path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`delete.registry.key_path.length`](#common-string-length-doc) | Length of the corresponding element | | [`delete_key.registry.key_name`](#common-registryevent-key_name-doc) | Registry's name | -| [`delete_key.registry.key_name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`delete_key.registry.key_name.length`](#common-string-length-doc) | Length of the corresponding element | | [`delete_key.registry.key_path`](#common-registryevent-key_path-doc) | Registry's path | -| [`delete_key.registry.key_path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`delete_key.registry.key_path.length`](#common-string-length-doc) | Length of the corresponding element | ### Event `exec` @@ -194,9 +195,9 @@ A process was executed or forked | [`exec.envp`](#common-process-envp-doc) | Environment variables of the process | | [`exec.envs`](#common-process-envs-doc) | Environment variable names of the process | | [`exec.file.name`](#common-fileevent-name-doc) | File's basename | -| [`exec.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`exec.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`exec.file.path`](#common-fileevent-path-doc) | File's path | -| [`exec.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`exec.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`exec.pid`](#common-pidcontext-pid-doc) | Process ID of the process (also called thread group ID) | | [`exec.ppid`](#common-process-ppid-doc) | Parent process ID | | [`exec.user`](#common-process-user-doc) | User name | @@ -216,9 +217,9 @@ A process was terminated | [`exit.envp`](#common-process-envp-doc) | Environment variables of the process | | [`exit.envs`](#common-process-envs-doc) | Environment variable names of the process | | [`exit.file.name`](#common-fileevent-name-doc) | File's basename | -| [`exit.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`exit.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`exit.file.path`](#common-fileevent-path-doc) | File's path | -| [`exit.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`exit.file.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`exit.pid`](#common-pidcontext-pid-doc) | Process ID of the process (also called thread group ID) | | [`exit.ppid`](#common-process-ppid-doc) | Parent process ID | | [`exit.user`](#common-process-user-doc) | User name | @@ -231,13 +232,13 @@ A registry key was opened | Property | Definition | | -------- | ------------- | | [`open.registry.key_name`](#common-registryevent-key_name-doc) | Registry's name | -| [`open.registry.key_name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`open.registry.key_name.length`](#common-string-length-doc) | Length of the corresponding element | | [`open.registry.key_path`](#common-registryevent-key_path-doc) | Registry's path | -| [`open.registry.key_path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`open.registry.key_path.length`](#common-string-length-doc) | Length of the corresponding element | | [`open_key.registry.key_name`](#common-registryevent-key_name-doc) | Registry's name | -| [`open_key.registry.key_name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`open_key.registry.key_name.length`](#common-string-length-doc) | Length of the corresponding element | | [`open_key.registry.key_path`](#common-registryevent-key_path-doc) | Registry's path | -| [`open_key.registry.key_path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`open_key.registry.key_path.length`](#common-string-length-doc) | Length of the corresponding element | ### Event `rename` @@ -246,17 +247,17 @@ A file was renamed | Property | Definition | | -------- | ------------- | | [`rename.file.destination.device_path`](#common-fimfileevent-device_path-doc) | File's path | -| [`rename.file.destination.device_path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`rename.file.destination.device_path.length`](#common-string-length-doc) | Length of the corresponding element | | [`rename.file.destination.name`](#common-fimfileevent-name-doc) | File's basename | -| [`rename.file.destination.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`rename.file.destination.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`rename.file.destination.path`](#common-fimfileevent-path-doc) | File's path | -| [`rename.file.destination.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`rename.file.destination.path.length`](#common-string-length-doc) | Length of the corresponding element | | [`rename.file.device_path`](#common-fimfileevent-device_path-doc) | File's path | -| [`rename.file.device_path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`rename.file.device_path.length`](#common-string-length-doc) | Length of the corresponding element | | [`rename.file.name`](#common-fimfileevent-name-doc) | File's basename | -| [`rename.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`rename.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`rename.file.path`](#common-fimfileevent-path-doc) | File's path | -| [`rename.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`rename.file.path.length`](#common-string-length-doc) | Length of the corresponding element | ### Event `set_key_value` @@ -265,18 +266,18 @@ A registry key value was set | Property | Definition | | -------- | ------------- | | [`set.registry.key_name`](#common-registryevent-key_name-doc) | Registry's name | -| [`set.registry.key_name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`set.registry.key_name.length`](#common-string-length-doc) | Length of the corresponding element | | [`set.registry.key_path`](#common-registryevent-key_path-doc) | Registry's path | -| [`set.registry.key_path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`set.registry.key_path.length`](#common-string-length-doc) | Length of the corresponding element | | [`set.registry.value_name`](#common-setregistrykeyvalueevent-registry-value_name-doc) | Registry's value name | -| [`set.registry.value_name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`set.registry.value_name.length`](#common-string-length-doc) | Length of the corresponding element | | [`set.value_name`](#common-setregistrykeyvalueevent-value_name-doc) | Registry's value name | | [`set_key_value.registry.key_name`](#common-registryevent-key_name-doc) | Registry's name | -| [`set_key_value.registry.key_name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`set_key_value.registry.key_name.length`](#common-string-length-doc) | Length of the corresponding element | | [`set_key_value.registry.key_path`](#common-registryevent-key_path-doc) | Registry's path | -| [`set_key_value.registry.key_path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`set_key_value.registry.key_path.length`](#common-string-length-doc) | Length of the corresponding element | | [`set_key_value.registry.value_name`](#common-setregistrykeyvalueevent-registry-value_name-doc) | Registry's value name | -| [`set_key_value.registry.value_name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`set_key_value.registry.value_name.length`](#common-string-length-doc) | Length of the corresponding element | | [`set_key_value.value_name`](#common-setregistrykeyvalueevent-value_name-doc) | Registry's value name | ### Event `write` @@ -286,11 +287,11 @@ A file was written | Property | Definition | | -------- | ------------- | | [`write.file.device_path`](#common-fimfileevent-device_path-doc) | File's path | -| [`write.file.device_path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`write.file.device_path.length`](#common-string-length-doc) | Length of the corresponding element | | [`write.file.name`](#common-fimfileevent-name-doc) | File's basename | -| [`write.file.name.length`](#common-string-length-doc) | Length of the corresponding string | +| [`write.file.name.length`](#common-string-length-doc) | Length of the corresponding element | | [`write.file.path`](#common-fimfileevent-path-doc) | File's path | -| [`write.file.path.length`](#common-string-length-doc) | Length of the corresponding string | +| [`write.file.path.length`](#common-string-length-doc) | Length of the corresponding element | ## Attributes documentation @@ -397,10 +398,10 @@ Definition: Registry's path ### `*.length` {#common-string-length-doc} Type: int -Definition: Length of the corresponding string +Definition: Length of the corresponding element -`*.length` has 43 possible prefixes: -`create.file.device_path` `create.file.name` `create.file.path` `create.registry.key_name` `create.registry.key_path` `create_key.registry.key_name` `create_key.registry.key_path` `delete.file.device_path` `delete.file.name` `delete.file.path` `delete.registry.key_name` `delete.registry.key_path` `delete_key.registry.key_name` `delete_key.registry.key_path` `exec.file.name` `exec.file.path` `exit.file.name` `exit.file.path` `open.registry.key_name` `open.registry.key_path` `open_key.registry.key_name` `open_key.registry.key_path` `process.ancestors.file.name` `process.ancestors.file.path` `process.file.name` `process.file.path` `process.parent.file.name` `process.parent.file.path` `rename.file.destination.device_path` `rename.file.destination.name` `rename.file.destination.path` `rename.file.device_path` `rename.file.name` `rename.file.path` `set.registry.key_name` `set.registry.key_path` `set.registry.value_name` `set_key_value.registry.key_name` `set_key_value.registry.key_path` `set_key_value.registry.value_name` `write.file.device_path` `write.file.name` `write.file.path` +`*.length` has 44 possible prefixes: +`create.file.device_path` `create.file.name` `create.file.path` `create.registry.key_name` `create.registry.key_path` `create_key.registry.key_name` `create_key.registry.key_path` `delete.file.device_path` `delete.file.name` `delete.file.path` `delete.registry.key_name` `delete.registry.key_path` `delete_key.registry.key_name` `delete_key.registry.key_path` `exec.file.name` `exec.file.path` `exit.file.name` `exit.file.path` `open.registry.key_name` `open.registry.key_path` `open_key.registry.key_name` `open_key.registry.key_path` `process.ancestors` `process.ancestors.file.name` `process.ancestors.file.path` `process.file.name` `process.file.path` `process.parent.file.name` `process.parent.file.path` `rename.file.destination.device_path` `rename.file.destination.name` `rename.file.destination.path` `rename.file.device_path` `rename.file.name` `rename.file.path` `set.registry.key_name` `set.registry.key_path` `set.registry.value_name` `set_key_value.registry.key_name` `set_key_value.registry.key_path` `set_key_value.registry.value_name` `write.file.device_path` `write.file.name` `write.file.path` ### `*.name` {#common-fileevent-name-doc} diff --git a/docs/dev/agent_build.md b/docs/dev/agent_build.md index d4490f71e1c18..fa05758d550f7 100644 --- a/docs/dev/agent_build.md +++ b/docs/dev/agent_build.md @@ -49,9 +49,8 @@ Also note that the trace agent needs to be built and run separately. For more in ## Additional details -We use `pkg-config` to make compilers and linkers aware of Python. If you need -to adjust the build for your specific configuration, add or edit the files within -the `pkg-config` folder. +We use `pkg-config` to make compilers and linkers aware of Python. The required .pc files are +provided automatically when building python through omnibus. By default, the Agent combines multiple functionalities into a single binary to reduce the space used on disk. The `DD_BUNDLED_AGENT` environment variable is used to select diff --git a/docs/public/hostname/hostname_force_config_as_canonical.md b/docs/public/hostname/hostname_force_config_as_canonical.md new file mode 100644 index 0000000000000..28d7a5d254602 --- /dev/null +++ b/docs/public/hostname/hostname_force_config_as_canonical.md @@ -0,0 +1,21 @@ +# Config-provided hostname starting with `ip-` or `domu` + +## Description of the issue + +In v6 and v7 Agents, if `hostname` is set in `datadog.yaml` (or through the `DD_HOSTNAME` env var) and its value starts with `ip-` or `domu`, the hostname is not used in-app as the canonical hostname, even if it is a valid hostname. +More information about what a canonical hostname is can be found at [How does Datadog determine the Agent hostname?](https://docs.datadoghq.com/agent/faq/how-datadog-agent-determines-the-hostname/?tab=agentv6v7#agent-versions). + +To know if your Agents are affected, starting with v6.16.0 and v7.16.0, the Agent logs the following warning if it detects a situation where the config-provided hostname is a valid hostname but will not be accepted as the canonical hostname in-app: +`Hostname '' defined in configuration are not used as the in-app hostname. For more information: https://dtdg.co/agent-hostname-force-config-as-canonical` + +If this warning is logged, you have the following options: + +- If you are satisfied with the in-app hostname: unset the configured `hostname` from `datadog.yaml` (or the `DD_HOSTNAME` env var) and restart the Agent; or +- If you are not satisfied with the in-app hostname, and want the configured hostname to appear as the in-app hostname, follow the instructions below + +## Allowing Agent in-app hostnames to start with `ip-` or `domu` + +Starting with Agent v6.16.0 and v7.16.0, the Agent supports the config option `hostname_force_config_as_canonical` (default: `false`). When set to `true`, a configuration-provided hostname starting with `ip-` or `domu` is accepted as the canonical hostname in-app: + +- For new hosts, enabling this option works immediately. +- For hosts that already report to Datadog, after enabling this option, contact Datadog support at support@datadoghq.com so that the in-app hostname can be changed to your configuration-provided hostname. diff --git a/go.mod b/go.mod index 6c2a739c3d56a..9b4978e72091d 100644 --- a/go.mod +++ b/go.mod @@ -153,13 +153,13 @@ require ( github.com/DataDog/datadog-agent/pkg/trace v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/cgroups v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/log v0.57.1 - github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.0 + github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.1 github.com/DataDog/datadog-agent/pkg/util/scrubber v0.57.1 github.com/DataDog/datadog-go/v5 v5.5.0 github.com/DataDog/datadog-operator v1.8.0-rc.1 github.com/DataDog/ebpf-manager v0.7.1 github.com/DataDog/gopsutil v1.2.2 - github.com/DataDog/nikos v1.12.5 + github.com/DataDog/nikos v1.12.7 github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.20.0 github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/metrics v0.20.0 github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.20.0 @@ -305,16 +305,16 @@ require ( go.uber.org/zap v1.27.0 go4.org/netipx v0.0.0-20220812043211-3cc044ffd68d golang.org/x/arch v0.11.0 - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 golang.org/x/net v0.30.0 golang.org/x/sync v0.8.0 golang.org/x/sys v0.26.0 golang.org/x/text v0.19.0 - golang.org/x/time v0.6.0 + golang.org/x/time v0.7.0 golang.org/x/tools v0.26.0 golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 // indirect - google.golang.org/grpc v1.66.2 + google.golang.org/grpc v1.67.1 google.golang.org/grpc/examples v0.0.0-20221020162917-9127159caf5a google.golang.org/protobuf v1.35.1 gopkg.in/DataDog/dd-trace-go.v1 v1.68.0 @@ -341,10 +341,7 @@ require ( ) require ( - cloud.google.com/go v0.115.1 // indirect - cloud.google.com/go/compute/metadata v0.5.0 // indirect - cloud.google.com/go/iam v1.2.0 // indirect - cloud.google.com/go/storage v1.43.0 // indirect + cloud.google.com/go/compute/metadata v0.5.2 // indirect code.cloudfoundry.org/cfhttp/v2 v2.0.0 // indirect code.cloudfoundry.org/clock v1.0.0 // indirect code.cloudfoundry.org/consuladapter v0.0.0-20200131002136-ac1daf48ba97 // indirect @@ -426,7 +423,7 @@ require ( github.com/go-openapi/validate v0.23.0 // indirect github.com/go-redis/redis/v8 v8.11.5 // indirect github.com/godbus/dbus/v5 v5.1.0 - github.com/golang/glog v1.2.1 // indirect + github.com/golang/glog v1.2.2 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/google/licenseclassifier/v2 v2.0.0 // indirect github.com/google/uuid v1.6.0 @@ -457,7 +454,7 @@ require ( github.com/karrick/godirwalk v1.17.0 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/kjk/lzma v0.0.0-20161016003348-3fd93898850d // indirect - github.com/klauspost/compress v1.17.9 // indirect + github.com/klauspost/compress v1.17.10 // indirect github.com/klauspost/pgzip v1.2.5 // indirect github.com/knadh/koanf v1.5.0 // indirect github.com/knqyf263/go-apk-version v0.0.0-20200609155635-041fdbb8563f // indirect @@ -561,22 +558,22 @@ require ( go.opentelemetry.io/collector/semconv v0.104.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect go.opentelemetry.io/contrib/propagators/b3 v1.27.0 // indirect - go.opentelemetry.io/otel v1.30.0 + go.opentelemetry.io/otel v1.31.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.27.0 go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect - go.opentelemetry.io/otel/metric v1.30.0 // indirect - go.opentelemetry.io/otel/sdk v1.28.0 - go.opentelemetry.io/otel/sdk/metric v1.27.0 // indirect - go.opentelemetry.io/otel/trace v1.30.0 + go.opentelemetry.io/otel/metric v1.31.0 // indirect + go.opentelemetry.io/otel/sdk v1.29.0 + go.opentelemetry.io/otel/sdk/metric v1.29.0 // indirect + go.opentelemetry.io/otel/trace v1.31.0 go.opentelemetry.io/proto/otlp v1.3.1 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/mod v0.21.0 golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/term v0.25.0 // indirect gonum.org/v1/gonum v0.15.0 // indirect - google.golang.org/api v0.197.0 // indirect + google.golang.org/api v0.199.0 // indirect google.golang.org/appengine v1.6.8 // indirect gopkg.in/Knetic/govaluate.v3 v3.0.0 // indirect gopkg.in/cheggaaa/pb.v1 v1.0.28 // indirect @@ -603,8 +600,9 @@ require ( github.com/DataDog/datadog-agent/comp/core/tagger/utils v0.56.2 github.com/DataDog/datadog-agent/comp/otelcol/ddflareextension/def v0.56.0-rc.3 github.com/DataDog/datadog-agent/comp/otelcol/ddflareextension/impl v0.0.0-00010101000000-000000000000 - github.com/DataDog/datadog-agent/pkg/config/structure v0.0.0-00010101000000-000000000000 + github.com/DataDog/datadog-agent/pkg/config/structure v0.60.0-devel github.com/DataDog/datadog-agent/pkg/util/defaultpaths v0.0.0-00010101000000-000000000000 + github.com/NVIDIA/go-nvml v0.12.4-0 github.com/containerd/containerd/api v1.7.19 github.com/containerd/errdefs v0.1.0 github.com/distribution/reference v0.6.0 @@ -625,12 +623,12 @@ require ( github.com/DataDog/datadog-agent/comp/core/log/impl v0.0.0-00010101000000-000000000000 github.com/DataDog/datadog-agent/comp/core/log/impl-trace v0.0.0-00010101000000-000000000000 github.com/DataDog/datadog-agent/comp/core/log/mock v0.58.0-devel - github.com/DataDog/datadog-agent/comp/core/secrets v0.57.0 + github.com/DataDog/datadog-agent/comp/core/secrets v0.57.1 github.com/DataDog/datadog-agent/comp/core/status v0.56.0-rc.3 github.com/DataDog/datadog-agent/comp/core/status/statusimpl v0.56.0-rc.3 github.com/DataDog/datadog-agent/comp/core/tagger/types v0.56.2 - github.com/DataDog/datadog-agent/comp/core/telemetry v0.56.0-rc.3 - github.com/DataDog/datadog-agent/comp/def v0.56.2 + github.com/DataDog/datadog-agent/comp/core/telemetry v0.57.1 + github.com/DataDog/datadog-agent/comp/def v0.57.1 github.com/DataDog/datadog-agent/comp/forwarder/defaultforwarder v0.56.0-rc.3 github.com/DataDog/datadog-agent/comp/forwarder/orchestrator/orchestratorinterface v0.56.0-rc.3 github.com/DataDog/datadog-agent/comp/logs/agent/config v0.56.0-rc.3 @@ -654,12 +652,12 @@ require ( github.com/DataDog/datadog-agent/comp/trace/compression/impl-zstd v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/aggregator/ckey v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/api v0.56.2 - github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.0 - github.com/DataDog/datadog-agent/pkg/config/env v0.57.0 + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.1 + github.com/DataDog/datadog-agent/pkg/config/env v0.57.1 github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel - github.com/DataDog/datadog-agent/pkg/config/model v0.57.0 + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 github.com/DataDog/datadog-agent/pkg/config/remote v0.56.0-rc.3 - github.com/DataDog/datadog-agent/pkg/config/setup v0.57.0 + github.com/DataDog/datadog-agent/pkg/config/setup v0.57.1 github.com/DataDog/datadog-agent/pkg/config/utils v0.56.2 github.com/DataDog/datadog-agent/pkg/errors v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/logs/auditor v0.56.0-rc.3 @@ -690,18 +688,18 @@ require ( github.com/DataDog/datadog-agent/pkg/util/common v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/containers/image v0.56.2 github.com/DataDog/datadog-agent/pkg/util/executable v0.57.1 - github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.0 + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.1 github.com/DataDog/datadog-agent/pkg/util/flavor v0.56.0-rc.3 - github.com/DataDog/datadog-agent/pkg/util/fxutil v0.56.2 + github.com/DataDog/datadog-agent/pkg/util/fxutil v0.57.1 github.com/DataDog/datadog-agent/pkg/util/grpc v0.56.0-rc.3 - github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.0 + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.1 github.com/DataDog/datadog-agent/pkg/util/http v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/json v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/log/setup v1.0.0 - github.com/DataDog/datadog-agent/pkg/util/optional v0.57.0 + github.com/DataDog/datadog-agent/pkg/util/optional v0.57.1 github.com/DataDog/datadog-agent/pkg/util/sort v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/startstop v0.56.0-rc.3 - github.com/DataDog/datadog-agent/pkg/util/system v0.57.0 + github.com/DataDog/datadog-agent/pkg/util/system v0.57.1 github.com/DataDog/datadog-agent/pkg/util/tagger v0.56.2 // indirect github.com/DataDog/datadog-agent/pkg/util/testutil v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/uuid v0.56.0-rc.3 @@ -754,7 +752,7 @@ require ( ) require ( - cloud.google.com/go/auth v0.9.3 // indirect + cloud.google.com/go/auth v0.9.5 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect code.cloudfoundry.org/go-diodes v0.0.0-20240604201846-c756bfed2ed3 // indirect code.cloudfoundry.org/go-loggregator v7.4.0+incompatible // indirect @@ -772,17 +770,17 @@ require ( github.com/Code-Hex/go-generics-cache v1.3.1 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.56.2 // indirect github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/statsprocessor v0.0.0-20240525065430-d0b647bcb646 // indirect - github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.60.0-devel // indirect + github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.60.0-devel // indirect github.com/DataDog/datadog-agent/pkg/logs/status/statusinterface v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/buf v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/statstracker v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.1 // indirect github.com/DataDog/datadog-api-client-go/v2 v2.26.0 // indirect github.com/DataDog/dd-sensitive-data-scanner/sds-go/go v0.0.0-20240816154533-f7f9beb53a42 // indirect github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata v0.20.0 // indirect github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/logs v0.20.0 // indirect - github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.24.0 // indirect + github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.24.1 // indirect github.com/Intevation/gval v1.3.0 // indirect github.com/Intevation/jsonpath v0.2.1 // indirect github.com/Showmax/go-fqdn v1.0.0 // indirect @@ -804,7 +802,7 @@ require ( github.com/cheggaaa/pb/v3 v3.1.4 // indirect github.com/chrusty/protoc-gen-jsonschema v0.0.0-20240212064413-73d5723042b8 // indirect github.com/cloudflare/circl v1.3.7 // indirect - github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b // indirect + github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78 // indirect github.com/containerd/log v0.1.0 // indirect github.com/containerd/platforms v0.2.1 // indirect github.com/csaf-poc/csaf_distribution/v3 v3.0.0 // indirect @@ -815,8 +813,8 @@ require ( github.com/elastic/go-licenser v0.4.1 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/emirpasic/gods v1.18.1 // indirect - github.com/envoyproxy/go-control-plane v0.12.1-0.20240621013728-1eb8caab5155 // indirect - github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect + github.com/envoyproxy/go-control-plane v0.13.0 // indirect + github.com/envoyproxy/protoc-gen-validate v1.1.0 // indirect github.com/evanphx/json-patch/v5 v5.8.0 // indirect github.com/expr-lang/expr v1.16.9 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect @@ -991,7 +989,7 @@ require ( golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/go.sum b/go.sum index a2036d88749e7..08658fcc4533c 100644 --- a/go.sum +++ b/go.sum @@ -37,8 +37,6 @@ cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFO cloud.google.com/go v0.107.0/go.mod h1:wpc2eNrD7hXUTy8EKS10jkxpZBjASrORK7goS+3YX2I= cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= cloud.google.com/go v0.110.2/go.mod h1:k04UEeEtb6ZBRTv3dZz4CeJC3jKGxyhl0sAiVVquxiw= -cloud.google.com/go v0.115.1 h1:Jo0SM9cQnSkYfp44+v+NQXHpcHqlnRJk2qxh6yvxxxQ= -cloud.google.com/go v0.115.1/go.mod h1:DuujITeaufu3gL68/lOFIirVNJwQeyf5UXyi+Wbgknc= cloud.google.com/go/accessapproval v1.4.0/go.mod h1:zybIuC3KpDOvotz59lFe5qxRZx6C75OtwbisN56xYB4= cloud.google.com/go/accessapproval v1.5.0/go.mod h1:HFy3tuiGvMdcd/u+Cu5b9NkO1pEICJ46IR82PoUdplw= cloud.google.com/go/accessapproval v1.6.0/go.mod h1:R0EiYnwV5fsRFiKZkPHr6mwyk2wxUJ30nL4j2pcFY2E= @@ -100,8 +98,8 @@ cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVo cloud.google.com/go/assuredworkloads v1.8.0/go.mod h1:AsX2cqyNCOvEQC8RMPnoc0yEarXQk6WEKkxYfL6kGIo= cloud.google.com/go/assuredworkloads v1.9.0/go.mod h1:kFuI1P78bplYtT77Tb1hi0FMxM0vVpRC7VVoJC3ZoT0= cloud.google.com/go/assuredworkloads v1.10.0/go.mod h1:kwdUQuXcedVdsIaKgKTp9t0UJkE5+PAVNhdQm4ZVq2E= -cloud.google.com/go/auth v0.9.3 h1:VOEUIAADkkLtyfr3BLa3R8Ed/j6w1jTBmARx+wb5w5U= -cloud.google.com/go/auth v0.9.3/go.mod h1:7z6VY+7h3KUdRov5F1i8NDP5ZzWKYmEPO842BgCsmTk= +cloud.google.com/go/auth v0.9.5 h1:4CTn43Eynw40aFVr3GpPqsQponx2jv0BQpjvajsbbzw= +cloud.google.com/go/auth v0.9.5/go.mod h1:Xo0n7n66eHyOWWCnitop6870Ilwo3PiZyodVkkH1xWM= cloud.google.com/go/auth/oauth2adapt v0.2.4 h1:0GWE/FUsXhf6C+jAkWgYm7X9tK8cuEIfy19DBn6B6bY= cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLMC/Pe3eaL4NmdvqPtc= cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= @@ -184,8 +182,8 @@ cloud.google.com/go/compute/metadata v0.1.0/go.mod h1:Z1VN+bulIf6bt4P/C37K4DyZYZ cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= -cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= -cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= +cloud.google.com/go/compute/metadata v0.5.2 h1:UxK4uu/Tn+I3p2dYWTfiX4wva7aYlKixAHn3fyqngqo= +cloud.google.com/go/compute/metadata v0.5.2/go.mod h1:C66sj2AluDcIqakBq/M8lw8/ybHgOZqin2obFxa/E5k= cloud.google.com/go/contactcenterinsights v1.3.0/go.mod h1:Eu2oemoePuEFc/xKFPjbTuPSj0fYJcPls9TFlPNnHHY= cloud.google.com/go/contactcenterinsights v1.4.0/go.mod h1:L2YzkGbPsv+vMQMCADxJoT9YiTTnSEd6fEvCeHTYVck= cloud.google.com/go/contactcenterinsights v1.6.0/go.mod h1:IIDlT6CLcDoyv79kDv8iWxMSTZhLxSCofVV5W6YFM/w= @@ -320,8 +318,6 @@ cloud.google.com/go/iam v0.8.0/go.mod h1:lga0/y3iH6CX7sYqypWJ33hf7kkfXJag67naqGE cloud.google.com/go/iam v0.11.0/go.mod h1:9PiLDanza5D+oWFZiH1uG+RnRCfEGKoyl6yo4cgWZGY= cloud.google.com/go/iam v0.12.0/go.mod h1:knyHGviacl11zrtZUoDuYpDgLjvr28sLQaG0YB2GYAY= cloud.google.com/go/iam v0.13.0/go.mod h1:ljOg+rcNfzZ5d6f1nAUJ8ZIxOaZUVoS14bKCtaLZ/D0= -cloud.google.com/go/iam v1.2.0 h1:kZKMKVNk/IsSSc/udOb83K0hL/Yh/Gcqpz+oAkoIFN8= -cloud.google.com/go/iam v1.2.0/go.mod h1:zITGuWgsLZxd8OwAlX+eMFgZDXzBm7icj1PVTYG766Q= cloud.google.com/go/iap v1.4.0/go.mod h1:RGFwRJdihTINIe4wZ2iCP0zF/qu18ZwyKxrhMhygBEc= cloud.google.com/go/iap v1.5.0/go.mod h1:UH/CGgKd4KyohZL5Pt0jSKE4m3FR51qg6FKQ/z/Ix9A= cloud.google.com/go/iap v1.6.0/go.mod h1:NSuvI9C/j7UdjGjIde7t7HBz+QTwBcapPE07+sSRcLk= @@ -354,8 +350,6 @@ cloud.google.com/go/logging v1.7.0/go.mod h1:3xjP2CjkM3ZkO73aj4ASA5wRPGGCRrPIAeN cloud.google.com/go/longrunning v0.1.1/go.mod h1:UUFxuDWkv22EuY93jjmDMFT5GPQKeFVJBIF6QlTqdsE= cloud.google.com/go/longrunning v0.3.0/go.mod h1:qth9Y41RRSUE69rDcOn6DdK3HfQfsUI0YSmW3iIlLJc= cloud.google.com/go/longrunning v0.4.1/go.mod h1:4iWDqhBZ70CvZ6BfETbvam3T8FMvLK+eFj0E6AaRQTo= -cloud.google.com/go/longrunning v0.6.0 h1:mM1ZmaNsQsnb+5n1DNPeL0KwQd9jQRqSqSDEkBZr+aI= -cloud.google.com/go/longrunning v0.6.0/go.mod h1:uHzSZqW89h7/pasCWNYdUpwGz3PcVWhrWupreVPYLts= cloud.google.com/go/managedidentities v1.3.0/go.mod h1:UzlW3cBOiPrzucO5qWkNkh0w33KFtBJU281hacNvsdE= cloud.google.com/go/managedidentities v1.4.0/go.mod h1:NWSBYbEMgqmbZsLIyKvxrYbtqOsxY1ZrGM+9RgDqInM= cloud.google.com/go/managedidentities v1.5.0/go.mod h1:+dWcZ0JlUmpuxpIDfyP5pP5y0bLdRwOS4Lp7gMni/LA= @@ -542,8 +536,6 @@ cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeL cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= cloud.google.com/go/storage v1.28.1/go.mod h1:Qnisd4CqDdo6BGs2AD5LLnEsmSQ80wQ5ogcBBKhU86Y= cloud.google.com/go/storage v1.29.0/go.mod h1:4puEjyTKnku6gfKoTfNOU/W+a9JyuVNxjpS5GBrB8h4= -cloud.google.com/go/storage v1.43.0 h1:CcxnSohZwizt4LCzQHWvBf1/kvtHUn7gk9QERXPyXFs= -cloud.google.com/go/storage v1.43.0/go.mod h1:ajvxEa7WmZS1PxvKRq4bq0tFT3vMd502JwstCcYv0Q0= cloud.google.com/go/storagetransfer v1.5.0/go.mod h1:dxNzUopWy7RQevYFHewchb29POFv3/AaBgnhqzqiK0w= cloud.google.com/go/storagetransfer v1.6.0/go.mod h1:y77xm4CQV/ZhFZH75PLEXY0ROiS7Gh6pSKrM8dJyg6I= cloud.google.com/go/storagetransfer v1.7.0/go.mod h1:8Giuj1QNb1kfLAiWM1bN6dHzfdlDAVC9rv9abHot2W4= @@ -730,8 +722,8 @@ github.com/DataDog/mmh3 v0.0.0-20210722141835-012dc69a9e49 h1:EbzDX8HPk5uE2FsJYx github.com/DataDog/mmh3 v0.0.0-20210722141835-012dc69a9e49/go.mod h1:SvsjzyJlSg0rKsqYgdcFxeEVflx3ZNAyFfkUHP0TxXg= github.com/DataDog/netlink v1.0.1-0.20240223195320-c7a4f832a3d1 h1:HnvrdC79xJ+RPxTQdhDDwxblTNWhJUKeyTPsuyaOnxQ= github.com/DataDog/netlink v1.0.1-0.20240223195320-c7a4f832a3d1/go.mod h1:whJevzBpTrid75eZy99s3DqCmy05NfibNaF2Ol5Ox5A= -github.com/DataDog/nikos v1.12.5 h1:O4kdkUkL0nws9+rdeLKQLIN5+lC542eKeUY1C5utQBA= -github.com/DataDog/nikos v1.12.5/go.mod h1:2KZ5BIt/7gYYg/hI8F1U+Urq+LfeZOeDbFnrrBmoYVg= +github.com/DataDog/nikos v1.12.7 h1:L04tM4ZUD9uqMgLwypQvYq9kq55WV7I09gfooH0G+gY= +github.com/DataDog/nikos v1.12.7/go.mod h1:wqQP+l+pb23yzUhWh+ejcxqlFHLh/pNAEAEU/YKHURU= github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata v0.20.0 h1:jdsuH8u4rxfvy3ZHoSLk5NAZrQMNZqyJwhM15FpEswE= github.com/DataDog/opentelemetry-mapping-go/pkg/inframetadata v0.20.0/go.mod h1:KI5I5JhJNOQWeE4vs+qk+BY/9PVSDwNmSjrCUrmuZKw= github.com/DataDog/opentelemetry-mapping-go/pkg/internal/sketchtest v0.20.0 h1:e4XT2+v4vgZBCbp5JUbe0Z+PRegh+nsLMp4X+esht9E= @@ -763,8 +755,8 @@ github.com/Datadog/dublin-traceroute v0.0.2/go.mod h1:k2H1x9n5hEVXV7BnEhf3J7Y9A1 github.com/DisposaBoy/JsonConfigReader v0.0.0-20130112093355-33a99fdf1d5e/go.mod h1:GCzqZQHydohgVLSIqRKZeTt8IGb1Y4NaFfim3H40uUI= github.com/DisposaBoy/JsonConfigReader v0.0.0-20201129172854-99cf318d67e7 h1:AJKJCKcb/psppPl/9CUiQQnTG+Bce0/cIweD5w5Q7aQ= github.com/DisposaBoy/JsonConfigReader v0.0.0-20201129172854-99cf318d67e7/go.mod h1:GCzqZQHydohgVLSIqRKZeTt8IGb1Y4NaFfim3H40uUI= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.24.0 h1:N4xzkSD2BkRwEZSPf3C2eUZxjS5trpo4gOwRh8mu+BA= -github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.24.0/go.mod h1:p2puVVSKjQ84Qb1gzw2XHLs34WQyHTYFZLaVxypAFYs= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.24.1 h1:pB2F2JKCj1Znmp2rwxxt1J0Fg0wezTMgWYk5Mpbi1kg= +github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.24.1/go.mod h1:itPGVDKf9cC/ov4MdvJ2QZ0khw4bfoo9jzwTJlaxy2k= github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/Intevation/gval v1.3.0 h1:+Ze5sft5MmGbZrHj06NVUbcxCb67l9RaPTLMNr37mjw= @@ -787,6 +779,8 @@ github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERo github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/Microsoft/hcsshim v0.12.7 h1:MP6R1spmjxTE4EU4J3YsrTxn8CjvN9qwjTKJXldFaRg= github.com/Microsoft/hcsshim v0.12.7/go.mod h1:HPbAuJ9BvQYYZbB4yEQcyGIsTP5L4yHKeO9XO149AEM= +github.com/NVIDIA/go-nvml v0.12.4-0 h1:4tkbB3pT1O77JGr0gQ6uD8FrsUPqP1A/EOEm2wI1TUg= +github.com/NVIDIA/go-nvml v0.12.4-0/go.mod h1:8Llmj+1Rr+9VGGwZuRer5N/aCjxGuR5nPb/9ebBiIEQ= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= @@ -1062,8 +1056,8 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20230105202645-06c439db220b/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b h1:ga8SEFjZ60pxLcmhnThWgvH2wg8376yUJmPhEH4H3kw= -github.com/cncf/xds/go v0.0.0-20240423153145-555b57ec207b/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= +github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78 h1:QVw89YDxXxEe+l8gU8ETbOasdwEV+avkR75ZzsVV9WI= +github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb h1:EDmT6Q9Zs+SbUoc7Ik9EfrFqcylYqgPZ9ANSbTAntnE= github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb/go.mod h1:ZjrT6AXHbDs86ZSdt/osfBi5qfexBrKUdONk989Wnk4= github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 h1:sDMmm+q/3+BukdIpxwO365v/Rbspp2Nt5XntgQRXq8Q= @@ -1202,15 +1196,15 @@ github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go. github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/go-control-plane v0.10.3/go.mod h1:fJJn/j26vwOu972OllsvAgJJM//w9BV6Fxbg2LuVd34= github.com/envoyproxy/go-control-plane v0.11.0/go.mod h1:VnHyVMpzcLvCFt9yUz1UnCwHLhwx1WguiVDV7pTG/tI= -github.com/envoyproxy/go-control-plane v0.12.1-0.20240621013728-1eb8caab5155 h1:IgJPqnrlY2Mr4pYB6oaMKvFvwJ9H+X6CCY5x1vCTcpc= -github.com/envoyproxy/go-control-plane v0.12.1-0.20240621013728-1eb8caab5155/go.mod h1:5Wkq+JduFtdAXihLmeTJf+tRYIT4KBc2vPXDhwVo1pA= +github.com/envoyproxy/go-control-plane v0.13.0 h1:HzkeUz1Knt+3bK+8LG1bxOO/jzWZmdxpwC51i202les= +github.com/envoyproxy/go-control-plane v0.13.0/go.mod h1:GRaKG3dwvFoTg4nj7aXdZnvMg4d7nvT/wl9WgVXn3Q8= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.6.7/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo= github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0++PMirau2/yoOwVac3AbF2w= github.com/envoyproxy/protoc-gen-validate v0.10.0/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= github.com/envoyproxy/protoc-gen-validate v0.10.1/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= -github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= -github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= +github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= +github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls= github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= @@ -1409,8 +1403,8 @@ github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGw github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= -github.com/golang/glog v1.2.1 h1:OptwRhECazUx5ix5TTWC3EZhsZEHWcYWY4FQHTIubm4= -github.com/golang/glog v1.2.1/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= +github.com/golang/glog v1.2.2 h1:1+mZ9upx1Dh6FmUTFR1naJ77miKiXgALjWOZ3NVFPmY= +github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -1492,14 +1486,11 @@ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/licenseclassifier/v2 v2.0.0 h1:1Y57HHILNf4m0ABuMVb6xk4vAJYEUO0gDxNpog0pyeA= github.com/google/licenseclassifier/v2 v2.0.0/go.mod h1:cOjbdH0kyC9R22sdQbYsFkto4NGCAc+ZSwbeThazEtM= -github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc= -github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= @@ -1795,8 +1786,8 @@ github.com/kjk/lzma v0.0.0-20161016003348-3fd93898850d/go.mod h1:phT/jsRPBAEqjAi github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= -github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= -github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.10 h1:oXAz+Vh0PMUvJczoi+flxpnBEPxoER1IaAnU/NMPtT0= +github.com/klauspost/compress v1.17.10/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE= github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= @@ -2742,8 +2733,8 @@ go.opentelemetry.io/contrib/propagators/b3 v1.27.0 h1:IjgxbomVrV9za6bRi8fWCNXENs go.opentelemetry.io/contrib/propagators/b3 v1.27.0/go.mod h1:Dv9obQz25lCisDvvs4dy28UPh974CxkahRDUPsY7y9E= go.opentelemetry.io/contrib/zpages v0.52.0 h1:MPgkMy0Cp3O5EdfVXP0ss3ujhEibysTM4eszx7E7d+E= go.opentelemetry.io/contrib/zpages v0.52.0/go.mod h1:fqG5AFdoYru3A3DnhibVuaaEfQV2WKxE7fYE1jgDRwk= -go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= -go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= go.opentelemetry.io/otel/bridge/opencensus v1.27.0 h1:ao9aGGHd+G4YfjBpGs6vbkvt5hoC67STlJA9fCnOAcs= go.opentelemetry.io/otel/bridge/opencensus v1.27.0/go.mod h1:uRvWtAAXzyVOST0WMPX5JHGBaAvBws+2F8PcC5gMnTk= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.27.0 h1:bFgvUr3/O4PHj3VQcFEuYKvRZJX1SJDQ+11JXuSB3/w= @@ -2762,14 +2753,14 @@ go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.27.0 h1:/jlt1Y8gXWiHG9 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.27.0/go.mod h1:bmToOGOBZ4hA9ghphIc1PAf66VA8KOtsuy3+ScStG20= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.27.0 h1:/0YaXu3755A/cFbtXp+21lkXgI0QE5avTWA2HjU9/WE= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.27.0/go.mod h1:m7SFxp0/7IxmJPLIY3JhOcU9CoFzDaCPL6xxQIxhA+o= -go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= -go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= -go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= -go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= -go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2NemcCrOL8gI= -go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= -go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= -go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= +go.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHyryo= +go.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok= +go.opentelemetry.io/otel/sdk/metric v1.29.0 h1:K2CfmJohnRgvZ9UAj2/FhIf/okdWcNdBwe1m8xFXiSY= +go.opentelemetry.io/otel/sdk/metric v1.29.0/go.mod h1:6zZLdCl2fkauYoZIOn/soQIDSWFmNSRcICarHfuhNJQ= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= @@ -2861,8 +2852,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20220827204233-334a2380cb91/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 h1:jWGQJV4niP+CCmFW9ekjA9Zx8vYORzOUH2/Nl5WPuLQ= golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= @@ -3234,8 +3225,8 @@ golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= -golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= -golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= +golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -3402,8 +3393,8 @@ google.golang.org/api v0.118.0/go.mod h1:76TtD3vkgmZ66zZzp72bUUklpmQmKlhh6sYtIjY google.golang.org/api v0.122.0/go.mod h1:gcitW0lvnyWjSp9nKxAbdHKIZ6vF4aajGueeslZOyms= google.golang.org/api v0.124.0/go.mod h1:xu2HQurE5gi/3t1aFCvhPD781p0a3p11sdunTJ2BlP4= google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= -google.golang.org/api v0.197.0 h1:x6CwqQLsFiA5JKAiGyGBjc2bNtHtLddhJCE2IKuhhcQ= -google.golang.org/api v0.197.0/go.mod h1:AuOuo20GoQ331nq7DquGHlU6d+2wN2fZ8O0ta60nRNw= +google.golang.org/api v0.199.0 h1:aWUXClp+VFJmqE0JPvpZOK3LDQMyFKYIow4etYd9qxs= +google.golang.org/api v0.199.0/go.mod h1:ohG4qSztDJmZdjK/Ar6MhbAmb/Rpi4JHOqagsh90K28= 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/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -3558,8 +3549,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230525234020-1aefcd67740a/go. google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/api v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed h1:3RgNmBoI9MZhsj3QxC+AP/qQhNwpCLOvYDYYsFrhFt0= -google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:OCdP9MfskevB/rbYvHTsXTtKC+3bHWajPdoKgjcYkfo= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= google.golang.org/genproto/googleapis/bytestream v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:ylj+BE99M198VPbBh6A8d9n3w8fChvyLK3wwBOjXBFA= google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234015-3fc162c6f38a/go.mod h1:xURIpW9ES5+/GZhnV6beoEtxQrnkRGIfP5VQG2tCBLc= google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= @@ -3613,8 +3604,8 @@ google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5v google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= -google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/grpc/examples v0.0.0-20221020162917-9127159caf5a h1:p51n6zkL483uumoZhCSGtHCem9kDeU05G5jX/wYI9gw= google.golang.org/grpc/examples v0.0.0-20221020162917-9127159caf5a/go.mod h1:gxndsbNG1n4TZcHGgsYEfVGnTxqfEdfiDv6/DADXX9o= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index c564f986c3540..1f9bbe2b7fc31 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -219,16 +219,16 @@ require ( go.uber.org/automaxprocs v1.5.3 // indirect go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/crypto v0.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/crypto v0.28.0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/term v0.24.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/term v0.25.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gonum.org/v1/gonum v0.7.0 // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index b6d9d71cc4626..be27183a31753 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -748,8 +748,8 @@ golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -764,8 +764,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f h1:phY1HzDcf18Aq9A8KkmRtY9WvOFIxN8wgfvy6Zm1DV8= @@ -848,8 +848,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20170207211851-4464e7848382/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -938,8 +938,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -949,8 +949,8 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= -golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= -golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -964,8 +964,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1034,8 +1034,8 @@ golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= diff --git a/internal/tools/proto/go.mod b/internal/tools/proto/go.mod index 7f80ded538883..81da9e02f95db 100644 --- a/internal/tools/proto/go.mod +++ b/internal/tools/proto/go.mod @@ -17,11 +17,11 @@ require ( github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect github.com/philhofer/fwd v1.1.2 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/internal/tools/proto/go.sum b/internal/tools/proto/go.sum index 03b9687913320..1733dfc1dcd6d 100644 --- a/internal/tools/proto/go.sum +++ b/internal/tools/proto/go.sum @@ -53,8 +53,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/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.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -66,12 +66,12 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h 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-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= 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= @@ -79,8 +79,8 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= diff --git a/omnibus/config/projects/agent.rb b/omnibus/config/projects/agent.rb index c2421a99bffb6..0fb7b138432d6 100644 --- a/omnibus/config/projects/agent.rb +++ b/omnibus/config/projects/agent.rb @@ -47,7 +47,6 @@ # dir will be determined by the Windows installer. This path must not contain # spaces because Omnibus doesn't quote the Git commands it launches. INSTALL_DIR = 'C:/opt/datadog-agent/' - PYTHON_2_EMBEDDED_DIR = format('%s/embedded2', INSTALL_DIR) PYTHON_3_EMBEDDED_DIR = format('%s/embedded3', INSTALL_DIR) else INSTALL_DIR = ENV["INSTALL_DIR"] || '/opt/datadog-agent' @@ -56,7 +55,6 @@ install_dir INSTALL_DIR if windows_target? - python_2_embedded PYTHON_2_EMBEDDED_DIR python_3_embedded PYTHON_3_EMBEDDED_DIR maintainer 'Datadog Inc.' # Windows doesn't want our e-mail address :( else @@ -232,14 +230,7 @@ dependency 'datadog-agent-mac-app' end - if with_python_runtime? "2" - dependency 'pylint2' - dependency 'datadog-agent-integrations-py2' - end - - if with_python_runtime? "3" - dependency 'datadog-agent-integrations-py3' - end + dependency 'datadog-agent-integrations-py3' if linux_target? dependency 'datadog-security-agent-policies' @@ -345,14 +336,6 @@ "#{install_dir}\\bin\\agent\\ddtray.exe", "#{install_dir}\\bin\\agent\\libdatadog-agent-three.dll" ] - if with_python_runtime? "2" - BINARIES_TO_SIGN.concat([ - "#{install_dir}\\bin\\agent\\libdatadog-agent-two.dll", - "#{install_dir}\\embedded2\\python.exe", - "#{install_dir}\\embedded2\\python27.dll", - "#{install_dir}\\embedded2\\pythonw.exe" - ]) - end BINARIES_TO_SIGN.each do |bin| sign_file bin diff --git a/omnibus/config/software/datadog-agent-dependencies.rb b/omnibus/config/software/datadog-agent-dependencies.rb index fe4a6332d361f..9b0ba32e5e80c 100644 --- a/omnibus/config/software/datadog-agent-dependencies.rb +++ b/omnibus/config/software/datadog-agent-dependencies.rb @@ -5,13 +5,6 @@ # Used for memory profiling with the `status py` agent subcommand dependency 'pympler' -if with_python_runtime? "2" - dependency 'pylint2' - dependency 'datadog-agent-integrations-py2-dependencies' -end - -if with_python_runtime? "3" - dependency 'datadog-agent-integrations-py3-dependencies' -end +dependency 'datadog-agent-integrations-py3-dependencies' dependency "systemd" if linux_target? diff --git a/omnibus/config/software/datadog-agent-finalize.rb b/omnibus/config/software/datadog-agent-finalize.rb index da54ee837006f..18156227f1d58 100644 --- a/omnibus/config/software/datadog-agent-finalize.rb +++ b/omnibus/config/software/datadog-agent-finalize.rb @@ -64,27 +64,16 @@ if linux_target? || osx_target? # Setup script aliases, e.g. `/opt/datadog-agent/embedded/bin/pip` will # default to `pip2` if the default Python runtime is Python 2. - if with_python_runtime? "2" - delete "#{install_dir}/embedded/bin/pip" - link "#{install_dir}/embedded/bin/pip2", "#{install_dir}/embedded/bin/pip" + delete "#{install_dir}/embedded/bin/pip" + link "#{install_dir}/embedded/bin/pip3", "#{install_dir}/embedded/bin/pip" + + delete "#{install_dir}/embedded/bin/python" + link "#{install_dir}/embedded/bin/python3", "#{install_dir}/embedded/bin/python" + + # Used in https://docs.datadoghq.com/agent/guide/python-3/ + delete "#{install_dir}/embedded/bin/2to3" + link "#{install_dir}/embedded/bin/2to3-3.12", "#{install_dir}/embedded/bin/2to3" - # Used in https://docs.datadoghq.com/agent/guide/python-3/ - delete "#{install_dir}/embedded/bin/2to3" - link "#{install_dir}/embedded/bin/2to3-2.7", "#{install_dir}/embedded/bin/2to3" - # Setup script aliases, e.g. `/opt/datadog-agent/embedded/bin/pip` will - # default to `pip3` if the default Python runtime is Python 3 (Agent 7.x). - # Caution: we don't want to do this for Agent 6.x - elsif with_python_runtime? "3" - delete "#{install_dir}/embedded/bin/pip" - link "#{install_dir}/embedded/bin/pip3", "#{install_dir}/embedded/bin/pip" - - delete "#{install_dir}/embedded/bin/python" - link "#{install_dir}/embedded/bin/python3", "#{install_dir}/embedded/bin/python" - - # Used in https://docs.datadoghq.com/agent/guide/python-3/ - delete "#{install_dir}/embedded/bin/2to3" - link "#{install_dir}/embedded/bin/2to3-3.12", "#{install_dir}/embedded/bin/2to3" - end delete "#{install_dir}/embedded/lib/config_guess" # Delete .pc files which aren't needed after building diff --git a/omnibus/config/software/datadog-agent-integrations-py2-dependencies.rb b/omnibus/config/software/datadog-agent-integrations-py2-dependencies.rb deleted file mode 100644 index 5f9592c9d97f6..0000000000000 --- a/omnibus/config/software/datadog-agent-integrations-py2-dependencies.rb +++ /dev/null @@ -1,10 +0,0 @@ -name 'datadog-agent-integrations-py2-dependencies' - -dependency 'pip2' - -if linux_target? - # add nfsiostat script - dependency 'nfsiostat' - # needed for glusterfs - dependency 'gstatus' -end diff --git a/omnibus/config/software/datadog-agent-integrations-py2.rb b/omnibus/config/software/datadog-agent-integrations-py2.rb deleted file mode 100644 index ee05b6d366b32..0000000000000 --- a/omnibus/config/software/datadog-agent-integrations-py2.rb +++ /dev/null @@ -1,252 +0,0 @@ -# Unless explicitly stated otherwise all files in this repository are licensed -# under the Apache License Version 2.0. -# This product includes software developed at Datadog (https:#www.datadoghq.com/). -# Copyright 2016-present Datadog, Inc. - -require './lib/ostools.rb' -require 'json' - -name 'datadog-agent-integrations-py2' - -license "BSD-3-Clause" -license_file "./LICENSE" - -dependency 'datadog-agent-integrations-py2-dependencies' - -relative_path 'integrations-core' -whitelist_file "embedded/lib/python2.7/site-packages/.libsaerospike" -whitelist_file "embedded/lib/python2.7/site-packages/psycopg2" -whitelist_file "embedded/lib/python2.7/site-packages/wrapt" -whitelist_file "embedded/lib/python2.7/site-packages/pymqi" - -source git: 'https://github.com/DataDog/integrations-core.git' - -always_build true - -integrations_core_version = ENV['INTEGRATIONS_CORE_VERSION'] -if integrations_core_version.nil? || integrations_core_version.empty? - integrations_core_version = 'master' -end -default_version integrations_core_version - -# folder names containing integrations from -core that won't be packaged with the Agent -excluded_folders = [ - 'datadog_checks_base', # namespacing package for wheels (NOT AN INTEGRATION) - 'datadog_checks_dev', # Development package, (NOT AN INTEGRATION) - 'datadog_checks_tests_helper', # Testing and Development package, (NOT AN INTEGRATION) - 'docker_daemon', # Agent v5 only -] - -if osx_target? - # Temporarily exclude Aerospike until builder supports new dependency - excluded_folders.push('aerospike') -end - -if arm_target? - # This doesn't build on ARM - excluded_folders.push('ibm_mq') -end - -final_constraints_file = 'final_constraints-py2.txt' -agent_requirements_file = 'agent_requirements-py2.txt' -filtered_agent_requirements_in = 'agent_requirements-py2.in' -agent_requirements_in = 'agent_requirements.in' - -build do - # The dir for confs - if osx_target? - conf_dir = "#{install_dir}/etc/conf.d" - else - conf_dir = "#{install_dir}/etc/datadog-agent/conf.d" - end - mkdir conf_dir - - # aliases for pip - if windows_target? - pip = "#{windows_safe_path(python_2_embedded)}\\Scripts\\pip.exe" - python = "#{windows_safe_path(python_2_embedded)}\\python.exe" - else - pip = "#{install_dir}/embedded/bin/pip2" - python = "#{install_dir}/embedded/bin/python2" - end - - # If a python_mirror was set, it's passed through a pip config file so that we're not leaking the API key in the CI Output - # Else the pip config file so pip will act casually - pip_config_file = ENV['PIP_CONFIG_FILE'] - pre_build_env = { - "PIP_CONFIG_FILE" => "#{pip_config_file}" - } - - # Install dependencies - python_version = "py2" - lockfile_name = case - when linux_target? - arm_target? ? "linux-aarch64" : "linux-x86_64" - when osx_target? - "macos-x86_64" - when windows_target? - "windows-x86_64" - end + "_#{python_version}.txt" - lockfile = windows_safe_path(project_dir, ".deps", "resolved", lockfile_name) - command "#{python} -m pip install --require-hashes --only-binary=:all: --no-deps -r #{lockfile}" - - # Prepare build env for integrations - wheel_build_dir = windows_safe_path(project_dir, ".wheels") - build_deps_dir = windows_safe_path(project_dir, ".build_deps") - # We download build dependencies to make them available without an index when installing integrations - command "#{pip} download --dest #{build_deps_dir} hatchling==0.25.1", :env => pre_build_env - command "#{pip} download --dest #{build_deps_dir} setuptools==40.9.0", :env => pre_build_env # Version from ./setuptools2.rb - command "#{pip} install wheel==0.37.1", :env => pre_build_env # Pin to the last version that supports Python 2 - build_env = { - "PIP_FIND_LINKS" => build_deps_dir, - "PIP_CONFIG_FILE" => pip_config_file, - } - - # Install base package - cwd_base = windows_safe_path(project_dir, "datadog_checks_base") - command "#{python} -m pip wheel . --no-deps --no-index --wheel-dir=#{wheel_build_dir}", :env => build_env, :cwd => cwd_base - command "#{python} -m pip install datadog_checks_base --no-deps --no-index --find-links=#{wheel_build_dir}" - - # - # Install Core integrations - # - - # Create a constraint file after installing all the core dependencies and before any integration - # This is then used as a constraint file by the integration command to avoid messing with the agent's python environment - command "#{pip} freeze > #{install_dir}/#{final_constraints_file}" - - if windows_target? - cached_wheels_dir = "#{windows_safe_path(wheel_build_dir)}\\.cached" - else - cached_wheels_dir = "#{wheel_build_dir}/.cached" - end - - block "Install integrations" do - tasks_dir_in = windows_safe_path(Dir.pwd) - # Collect integrations to install - checks_to_install = ( - shellout! "inv agent.collect-integrations #{project_dir} 2 #{os} #{excluded_folders.join(',')}", - :cwd => tasks_dir_in - ).stdout.split() - - # Retrieving integrations from cache - cache_bucket = ENV.fetch('INTEGRATION_WHEELS_CACHE_BUCKET', '') - cache_branch = (shellout! "inv release.get-release-json-value base_branch", cwd: File.expand_path('..', tasks_dir_in)).stdout.strip - if cache_bucket != '' - mkdir cached_wheels_dir - shellout! "inv -e agent.get-integrations-from-cache " \ - "--python 2 --bucket #{cache_bucket} " \ - "--branch #{cache_branch || 'main'} " \ - "--integrations-dir #{windows_safe_path(project_dir)} " \ - "--target-dir #{cached_wheels_dir} " \ - "--integrations #{checks_to_install.join(',')}", - :cwd => tasks_dir_in - - # install all wheels from cache in one pip invocation to speed things up - if windows_target? - shellout! "#{python} -m pip install --no-deps --no-index " \ - "--find-links #{windows_safe_path(cached_wheels_dir)} -r #{windows_safe_path(cached_wheels_dir)}\\found.txt" - else - shellout! "#{python} -m pip install --no-deps --no-index " \ - "--find-links #{cached_wheels_dir} -r #{cached_wheels_dir}/found.txt" - end - end - - # get list of integration wheels already installed from cache - installed_list = Array.new - if cache_bucket != '' - installed_out = `#{python} -m pip list --format json` - if $?.exitstatus == 0 - installed = JSON.parse(installed_out) - installed.each do |package| - package.each do |key, value| - if key == "name" && value.start_with?("datadog-") - installed_list.push(value["datadog-".length..-1]) - end - end - end - else - raise "Failed to list pip installed packages" - end - end - - checks_to_install.each do |check| - check_dir = File.join(project_dir, check) - check_conf_dir = "#{conf_dir}/#{check}.d" - - # For each conf file, if it already exists, that means the `datadog-agent` software def - # wrote it first. In that case, since the agent's confs take precedence, skip the conf - conf_files = ["conf.yaml.example", "conf.yaml.default", "metrics.yaml", "auto_conf.yaml"] - - conf_files.each do |filename| - src = windows_safe_path(check_dir,"datadog_checks", check, "data", filename) - dest = check_conf_dir - if File.exist?(src) and !File.exist?(windows_safe_path(dest, filename)) - FileUtils.mkdir_p(dest) - FileUtils.cp_r(src, dest) - end - end - - # Copy SNMP profiles - profile_folders = ['profiles', 'default_profiles'] - profile_folders.each do |profile_folder| - folder_path = "#{check_dir}/datadog_checks/#{check}/data/#{profile_folder}" - if File.exist? folder_path - FileUtils.cp_r folder_path, "#{check_conf_dir}/" - end - end - - # pip < 21.2 replace underscores by dashes in package names per https://pip.pypa.io/en/stable/news/#v21-2 - # whether or not this might switch back in the future is not guaranteed, so we check for both name - # with dashes and underscores - if installed_list.include?(check) || installed_list.include?(check.gsub('_', '-')) - next - end - - if windows_target? - shellout! "#{python} -m pip wheel . --no-deps --no-index --wheel-dir=#{wheel_build_dir}", :env => build_env, :cwd => "#{windows_safe_path(project_dir)}\\#{check}" - shellout! "#{python} -m pip install datadog-#{check} --no-deps --no-index --find-links=#{wheel_build_dir}" - else - shellout! "#{pip} wheel . --no-deps --no-index --wheel-dir=#{wheel_build_dir}", :env => build_env, :cwd => "#{project_dir}/#{check}" - shellout! "#{pip} install datadog-#{check} --no-deps --no-index --find-links=#{wheel_build_dir}" - end - if cache_bucket != '' && ENV.fetch('INTEGRATION_WHEELS_SKIP_CACHE_UPLOAD', '') == '' && cache_branch != nil - shellout! "inv -e agent.upload-integration-to-cache " \ - "--python 2 --bucket #{cache_bucket} " \ - "--branch #{cache_branch} " \ - "--integrations-dir #{windows_safe_path(project_dir)} " \ - "--build-dir #{wheel_build_dir} " \ - "--integration #{check}", - :cwd => tasks_dir_in - end - end - end - - # Patch applies to only one file: set it explicitly as a target, no need for -p - if windows_target? - patch :source => "create-regex-at-runtime.patch", :target => "#{python_2_embedded}/Lib/site-packages/yaml/reader.py" - patch :source => "remove-maxfile-maxpath-psutil.patch", :target => "#{python_2_embedded}/Lib/site-packages/psutil/__init__.py" - else - patch :source => "create-regex-at-runtime.patch", :target => "#{install_dir}/embedded/lib/python2.7/site-packages/yaml/reader.py" - patch :source => "remove-maxfile-maxpath-psutil.patch", :target => "#{install_dir}/embedded/lib/python2.7/site-packages/psutil/__init__.py" - end - - # Run pip check to make sure the agent's python environment is clean, all the dependencies are compatible - if windows_target? - command "#{python} -m pip check" - else - command "#{pip} check" - end - - # Removing tests that don't need to be shipped in the embedded folder - if windows_target? - delete "#{python_2_embedded}/Lib/site-packages/Cryptodome/SelfTest/" - else - delete "#{install_dir}/embedded/lib/python2.7/site-packages/Cryptodome/SelfTest/" - end - - # Ship `requirements-agent-release.txt` file containing the versions of every check shipped with the agent - # Used by the `datadog-agent integration` command to prevent downgrading a check to a version - # older than the one shipped in the agent - copy "#{project_dir}/requirements-agent-release.txt", "#{install_dir}/" -end diff --git a/omnibus/config/software/datadog-agent.rb b/omnibus/config/software/datadog-agent.rb index adfd26bd5671c..ee030c17aacca 100644 --- a/omnibus/config/software/datadog-agent.rb +++ b/omnibus/config/software/datadog-agent.rb @@ -11,11 +11,14 @@ # creates required build directories dependency 'datadog-agent-prepare' -dependency "python2" if with_python_runtime? "2" -dependency "python3" if with_python_runtime? "3" +dependency "python3" dependency "openscap" if linux_target? and !arm7l_target? and !heroku_target? # Security-agent dependency, not needed for Heroku +# Alternative memory allocator which has better support for memory allocated by cgo calls, +# especially at higher thread counts. +dependency "libjemalloc" if linux_target? + dependency 'agent-dependencies' dependency 'datadog-agent-dependencies' @@ -39,24 +42,17 @@ env = { 'GOPATH' => gopath.to_path, 'PATH' => "#{gopath.to_path}/bin:#{ENV['PATH']}", - "Python2_ROOT_DIR" => "#{windows_safe_path(python_2_embedded)}", - "Python3_ROOT_DIR" => "#{windows_safe_path(python_3_embedded)}", - "CMAKE_INSTALL_PREFIX" => "#{windows_safe_path(python_2_embedded)}", } major_version_arg = "%MAJOR_VERSION%" - py_runtimes_arg = "%PY_RUNTIMES%" else env = { 'GOPATH' => gopath.to_path, 'PATH' => "#{gopath.to_path}/bin:#{ENV['PATH']}", - "Python2_ROOT_DIR" => "#{install_dir}/embedded", - "Python3_ROOT_DIR" => "#{install_dir}/embedded", "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib", "CGO_CFLAGS" => "-I. -I#{install_dir}/embedded/include", "CGO_LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib" } major_version_arg = "$MAJOR_VERSION" - py_runtimes_arg = "$PY_RUNTIMES" end unless ENV["OMNIBUS_GOMODCACHE"].nil? || ENV["OMNIBUS_GOMODCACHE"].empty? @@ -70,7 +66,7 @@ if Omnibus::Config.host_distribution == "ociru" default_install_dir = "#{install_dir}" end - + # we assume the go deps are already installed before running omnibus if windows_target? platform = windows_arch_i386? ? "x86" : "x64" @@ -79,13 +75,13 @@ do_windows_sysprobe = "--windows-sysprobe" end command "inv -e rtloader.clean" - command "inv -e rtloader.make --python-runtimes #{py_runtimes_arg} --install-prefix \"#{windows_safe_path(python_2_embedded)}\" --cmake-options \"-G \\\"Unix Makefiles\\\"\"", :env => env + command "inv -e rtloader.make --install-prefix \"#{windows_safe_path(python_2_embedded)}\" --cmake-options \"-G \\\"Unix Makefiles\\\" \\\"-DPython3_EXECUTABLE=#{windows_safe_path(python_3_embedded)}\\python.exe\"\"", :env => env command "mv rtloader/bin/*.dll #{install_dir}/bin/agent/" - command "inv -e agent.build --exclude-rtloader --python-runtimes #{py_runtimes_arg} --major-version #{major_version_arg} --rebuild --no-development --install-path=#{install_dir} --embedded-path=#{install_dir}/embedded #{do_windows_sysprobe} --flavor #{flavor_arg}", env: env + command "inv -e agent.build --exclude-rtloader --major-version #{major_version_arg} --rebuild --no-development --install-path=#{install_dir} --embedded-path=#{install_dir}/embedded #{do_windows_sysprobe} --flavor #{flavor_arg}", env: env command "inv -e systray.build --major-version #{major_version_arg} --rebuild", env: env else command "inv -e rtloader.clean" - command "inv -e rtloader.make --python-runtimes #{py_runtimes_arg} --install-prefix \"#{install_dir}/embedded\" --cmake-options '-DCMAKE_CXX_FLAGS:=\"-D_GLIBCXX_USE_CXX11_ABI=0\" -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_FIND_FRAMEWORK:STRING=NEVER'", :env => env + command "inv -e rtloader.make --install-prefix \"#{install_dir}/embedded\" --cmake-options '-DCMAKE_CXX_FLAGS:=\"-D_GLIBCXX_USE_CXX11_ABI=0\" -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_FIND_FRAMEWORK:STRING=NEVER -DPython3_EXECUTABLE=#{install_dir}/embedded/bin/python3'", :env => env command "inv -e rtloader.install" bundle_arg = bundled_agents ? bundled_agents.map { |k| "--bundle #{k}" }.join(" ") : "--bundle agent" @@ -93,10 +89,10 @@ if linux_target? include_sds = "--include-sds" # we only support SDS on Linux targets for now end - command "inv -e agent.build --exclude-rtloader #{include_sds} --python-runtimes #{py_runtimes_arg} --major-version #{major_version_arg} --rebuild --no-development --install-path=#{install_dir} --embedded-path=#{default_install_dir}/embedded --python-home-2=#{default_install_dir}/embedded --python-home-3=#{default_install_dir}/embedded --flavor #{flavor_arg} #{bundle_arg}", env: env + command "inv -e agent.build --exclude-rtloader #{include_sds} --major-version #{major_version_arg} --rebuild --no-development --install-path=#{install_dir} --embedded-path=#{default_install_dir}/embedded --python-home-2=#{default_install_dir}/embedded --python-home-3=#{default_install_dir}/embedded --flavor #{flavor_arg} #{bundle_arg}", env: env if heroku_target? - command "inv -e agent.build --exclude-rtloader --python-runtimes #{py_runtimes_arg} --major-version #{major_version_arg} --rebuild --no-development --install-path=#{install_dir} --embedded-path=#{install_dir}/embedded --python-home-2=#{install_dir}/embedded --python-home-3=#{install_dir}/embedded --flavor #{flavor_arg} --agent-bin=bin/agent/core-agent --bundle agent", env: env + command "inv -e agent.build --exclude-rtloader --major-version #{major_version_arg} --rebuild --no-development --install-path=#{install_dir} --embedded-path=#{install_dir}/embedded --python-home-2=#{install_dir}/embedded --python-home-3=#{install_dir}/embedded --flavor #{flavor_arg} --agent-bin=bin/agent/core-agent --bundle agent", env: env end end @@ -127,7 +123,7 @@ if not bundled_agents.include? "trace-agent" platform = windows_arch_i386? ? "x86" : "x64" - command "invoke trace-agent.build --python-runtimes #{py_runtimes_arg} --install-path=#{install_dir} --major-version #{major_version_arg} --flavor #{flavor_arg}", :env => env + command "invoke trace-agent.build --install-path=#{install_dir} --major-version #{major_version_arg} --flavor #{flavor_arg}", :env => env end if windows_target? @@ -138,7 +134,7 @@ # Process agent if not bundled_agents.include? "process-agent" - command "invoke -e process-agent.build --python-runtimes #{py_runtimes_arg} --install-path=#{install_dir} --major-version #{major_version_arg} --flavor #{flavor_arg} --no-bundle", :env => env + command "invoke -e process-agent.build --install-path=#{install_dir} --major-version #{major_version_arg} --flavor #{flavor_arg} --no-bundle", :env => env end if windows_target? diff --git a/omnibus/config/software/datadog-cf-finalize.rb b/omnibus/config/software/datadog-cf-finalize.rb index 32714e87f86b0..5de3c3d423c46 100644 --- a/omnibus/config/software/datadog-cf-finalize.rb +++ b/omnibus/config/software/datadog-cf-finalize.rb @@ -34,9 +34,6 @@ copy "#{install_dir}/bin/agent/agent.exe", "#{cf_bin_root_bin}" copy "#{install_dir}/bin/agent/libdatadog-agent-three.dll", "#{cf_bin_root_bin}" - if with_python_runtime? "2" - copy "#{install_dir}/bin/agent/libdatadog-agent-two.dll", "#{cf_bin_root_bin}" - end copy "#{install_dir}/bin/agent/process-agent.exe", "#{cf_bin_root_bin}/agent" copy "#{install_dir}/bin/agent/trace-agent.exe", "#{cf_bin_root_bin}/agent" diff --git a/omnibus/config/software/datadog-iot-agent.rb b/omnibus/config/software/datadog-iot-agent.rb index ac2b4887928bc..afabbd0835188 100644 --- a/omnibus/config/software/datadog-iot-agent.rb +++ b/omnibus/config/software/datadog-iot-agent.rb @@ -33,15 +33,13 @@ if windows_target? major_version_arg = "%MAJOR_VERSION%" - py_runtimes_arg = "%PY_RUNTIMES%" else major_version_arg = "$MAJOR_VERSION" - py_runtimes_arg = "$PY_RUNTIMES" env['CGO_CFLAGS'] = "-I#{install_dir}/embedded/include" end if linux_target? - command "invoke agent.build --flavor iot --rebuild --no-development --python-runtimes #{py_runtimes_arg} --major-version #{major_version_arg}", env: env + command "invoke agent.build --flavor iot --rebuild --no-development --major-version #{major_version_arg}", env: env mkdir "#{install_dir}/bin" mkdir "#{install_dir}/run/" @@ -63,7 +61,7 @@ mkdir conf_dir mkdir "#{install_dir}/bin/agent" - command "inv agent.build --flavor iot --rebuild --no-development --python-runtimes #{py_runtimes_arg} --major-version #{major_version_arg}", env: env + command "inv agent.build --flavor iot --rebuild --no-development --major-version #{major_version_arg}", env: env # move around bin and config files move 'bin/agent/dist/datadog.yaml', "#{conf_dir}/datadog.yaml.example" diff --git a/omnibus/config/software/kubernetes-py2.rb b/omnibus/config/software/kubernetes-py2.rb deleted file mode 100644 index afd3a55f87369..0000000000000 --- a/omnibus/config/software/kubernetes-py2.rb +++ /dev/null @@ -1,18 +0,0 @@ -name "kubernetes-py2" -default_version "18.20.0" - -dependency "pip2" -dependency "pyyaml-py2" - -source :url => "https://files.pythonhosted.org/packages/9c/f8/0eb10c6939b77788c10449d47d85a4740bb4a5608e1a504807fcdb5babd0/kubernetes-#{version}.tar.gz", - :sha256 => "0c72d00e7883375bd39ae99758425f5e6cb86388417cf7cc84305c211b2192cf", - :extract => :seven_zip - -relative_path "kubernetes-#{version}" - -build do - license "Apache-2.0" - license_file "./LICENSE.txt" - - command "#{install_dir}/embedded/bin/pip2 install ." -end diff --git a/omnibus/config/software/libjemalloc.rb b/omnibus/config/software/libjemalloc.rb new file mode 100644 index 0000000000000..d217968605585 --- /dev/null +++ b/omnibus/config/software/libjemalloc.rb @@ -0,0 +1,39 @@ +# Unless explicitly stated otherwise all files in this repository are licensed +# under the Apache License Version 2.0. +# This product includes software developed at Datadog (https:#www.datadoghq.com/). +# Copyright 2022-present Datadog, Inc. + +name "libjemalloc" +default_version "5.3.0" + +version "5.3.0" do + source sha256: "ef6f74fd45e95ee4ef7f9e19ebe5b075ca6b7fbe0140612b2a161abafb7ee179" +end + +ship_source_offer true + +source url:"https://github.com/jemalloc/jemalloc/archive/refs/tags/#{version}.tar.gz", + extract: :seven_zip + +relative_path "jemalloc-#{version}" + +build do + license "BSD-2-Clause" + license_file "./COPYING" + + env = with_standard_compiler_flags + + command "autoconf" + + # This builds libjemalloc.so.2 + configure_options = [ + "--disable-debug", + "--disable-stats", + "--disable-fill", + "--disable-prof", + "--disable-static", + ] + configure(*configure_options, env: env) + command "make -j #{workers}", env: env + command "make install_lib_shared" +end diff --git a/omnibus/config/software/pip2.rb b/omnibus/config/software/pip2.rb deleted file mode 100644 index e05ceb8530227..0000000000000 --- a/omnibus/config/software/pip2.rb +++ /dev/null @@ -1,34 +0,0 @@ -name "pip2" -default_version "20.3.3" - -dependency "setuptools2" - - -source :url => "https://github.com/pypa/pip/archive/#{version}.tar.gz", - :sha256 => "016f8d509871b72fb05da911db513c11059d8a99f4591dda3050a3cf83a29a79", - :extract => :seven_zip - -relative_path "pip-#{version}" - -build do - license "MIT" - license_file "https://raw.githubusercontent.com/pypa/pip/main/LICENSE.txt" - - patch :source => "remove-python27-deprecation-warning.patch", :target => "src/pip/_internal/cli/base_command.py" - - if ohai["platform"] == "windows" - python_bin = "#{windows_safe_path(python_2_embedded)}\\python.exe" - python_prefix = "#{windows_safe_path(python_2_embedded)}" - else - python_bin = "#{install_dir}/embedded/bin/python2" - python_prefix = "#{install_dir}/embedded" - end - - command "#{python_bin} setup.py install --prefix=#{python_prefix}" - - if ohai["platform"] != "windows" - block do - FileUtils.rm_f(Dir.glob("#{install_dir}/embedded/lib/python2.7/site-packages/pip-*-py2.7.egg/pip/_vendor/distlib/*.exe")) - end - end -end diff --git a/omnibus/config/software/pylint2.rb b/omnibus/config/software/pylint2.rb deleted file mode 100644 index 4e5fdabfe34ef..0000000000000 --- a/omnibus/config/software/pylint2.rb +++ /dev/null @@ -1,37 +0,0 @@ -name "pylint2" -# Ship 1.x as 2.x only supports python 3 -default_version "1.9.5" - -dependency "pip2" - -build do - # pylint is only called in a subprocess by the Agent, so the Agent doesn't have to be GPL as well - license "GPL-2.0" - - # aliases for the pips - if windows_target? - pip2 = "#{windows_safe_path(python_2_embedded)}\\Scripts\\pip.exe" - python2 = "#{windows_safe_path(python_2_embedded)}\\python.exe" - else - pip2 = "#{install_dir}/embedded/bin/pip2" - python2 = "#{install_dir}/embedded/bin/python2" - end - - # If a python_mirror was set, it's passed through a pip config file so that we're not leaking the API key in the CI Output - # Else the pip config file so pip will act casually - pip_config_file = ENV['PIP_CONFIG_FILE'] - build_env = { - "PIP_CONFIG_FILE" => "#{pip_config_file}" - } - - # pin 2 dependencies of pylint: - # - configparser: later versions (up to v3.7.1) are broken - # - lazy-object-proxy 1.7.0 broken on python 2 https://github.com/ionelmc/python-lazy-object-proxy/issues/61 - if windows_target? - command "#{python2} -m pip install configparser==3.5.0 lazy-object-proxy==1.6.0", :env => build_env - command "#{python2} -m pip install pylint==#{version}", :env => build_env - else - command "#{pip2} install configparser==3.5.0 lazy-object-proxy==1.6.0", :env => build_env - command "#{pip2} install pylint==#{version}", :env => build_env - end -end diff --git a/omnibus/config/software/pympler.rb b/omnibus/config/software/pympler.rb index 367a8d182e059..fdfcdd4d00f0d 100644 --- a/omnibus/config/software/pympler.rb +++ b/omnibus/config/software/pympler.rb @@ -9,34 +9,17 @@ name 'pympler' default_version "0.7" -if with_python_runtime? "3" - dependency 'pip3' - dependency 'setuptools3' -end - -if with_python_runtime? "2" - dependency 'pip2' -end +dependency 'pip3' +dependency 'setuptools3' pympler_requirement = "pympler==#{default_version}" build do - if with_python_runtime? "3" - if windows_target? - python = "#{windows_safe_path(python_3_embedded)}\\python.exe" - else - python = "#{install_dir}/embedded/bin/python3" - end - command "#{python} -m pip install #{pympler_requirement}" - end - - if with_python_runtime? "2" - if windows_target? - python = "#{windows_safe_path(python_2_embedded)}\\python.exe" - else - python = "#{install_dir}/embedded/bin/python2" - end - command "#{python} -m pip install #{pympler_requirement}" + if windows_target? + python = "#{windows_safe_path(python_3_embedded)}\\python.exe" + else + python = "#{install_dir}/embedded/bin/python3" end + command "#{python} -m pip install #{pympler_requirement}" end diff --git a/omnibus/config/software/python2.rb b/omnibus/config/software/python2.rb deleted file mode 100644 index f35a7275e1cd6..0000000000000 --- a/omnibus/config/software/python2.rb +++ /dev/null @@ -1,101 +0,0 @@ -# -# Copyright:: Copyright (c) 2013-2014 Chef Software, Inc. -# License:: Apache License, Version 2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name "python2" - -if ohai["platform"] != "windows" - default_version "2.7.18" - - dependency "libxcrypt" - dependency "ncurses" - dependency "zlib" - dependency "openssl" - dependency "bzip2" - dependency "libsqlite3" - dependency "libyaml" - - source :url => "http://python.org/ftp/python/#{version}/Python-#{version}.tgz", - :sha256 => "da3080e3b488f648a3d7a4560ddee895284c3380b11d6de75edb986526b9a814" - - relative_path "Python-#{version}" - - env = with_standard_compiler_flags(with_embedded_path) - env['CFLAGS'] << ' -fPIC' - - python_configure_options = ["--with-ensurepip=no"] # pip is installed separately by its own software def - - if mac_os_x? - python_configure_options.push("--enable-ipv6", - "--with-universal-archs=intel", - "--enable-shared", - "--without-gcc", - "CC=clang") - elsif linux_target? - python_configure_options.push("--enable-unicode=ucs4", - "--enable-shared") - end - - build do - # 2.0 is the license version here, not the python version - license "Python-2.0" - - patch :source => "avoid-allocating-thunks-in-ctypes.patch" if linux_target? - patch :source => "fix-platform-ubuntu.diff" if linux_target? - patch :source => "0001-disable-multiarch.patch" if linux_target? - # security patches backported by the debian community - # see: http://deb.debian.org/debian/pool/main/p/python2.7/python2.7_2.7.18-6.diff.gz - patch :source => "python2.7_2.7.18-cve-2019-20907.diff" unless windows_target? - patch :source => "python2.7_2.7.18-cve-2020-8492.diff" unless windows_target? - patch :source => "python2.7_2.7.18-cve-2021-3177.diff" unless windows_target? - - configure(*python_configure_options, :env => env) - command "make -j #{workers}", :env => env - command "make install", :env => env - delete "#{install_dir}/embedded/lib/python2.7/test" - - move "#{install_dir}/embedded/bin/2to3", "#{install_dir}/embedded/bin/2to3-2.7" - - block do - FileUtils.rm_f(Dir.glob("#{install_dir}/embedded/lib/python2.7/lib-dynload/readline.*")) - FileUtils.rm_f(Dir.glob("#{install_dir}/embedded/lib/python2.7/lib-dynload/gdbm.so")) - FileUtils.rm_f(Dir.glob("#{install_dir}/embedded/lib/python2.7/lib-dynload/dbm.so")) - FileUtils.rm_f(Dir.glob("#{install_dir}/embedded/lib/python2.7/distutils/command/wininst-*.exe")) - end - end - -else - default_version "2.7.18-8829519" - dependency "vc_redist" - - if windows_arch_i386? - source :url => "https://dd-agent-omnibus.s3.amazonaws.com/python-windows-#{version}-x86.zip", - :sha256 => "295F16FB166AC26624AE9CBA08666DB437E0B8DDBB8D8D987F0598B71E4B6B24".downcase, - :extract => :seven_zip - else - source :url => "https://dd-agent-omnibus.s3.amazonaws.com/python-windows-#{version}-x64.zip", - :sha256 => "58424EEB272E5678E732402CAF150124CD583B81F5DA442C911CE71A63ECD339".downcase, - :extract => :seven_zip - end - build do - # 2.0 is the license version here, not the python version - license "Python-2.0" - - # - # expand python zip into the embedded directory - command "XCOPY /YEHIR *.* \"#{windows_safe_path(python_2_embedded)}\"" - end -end diff --git a/omnibus/config/software/pyyaml-py2.rb b/omnibus/config/software/pyyaml-py2.rb deleted file mode 100644 index c4ee7f6e9735b..0000000000000 --- a/omnibus/config/software/pyyaml-py2.rb +++ /dev/null @@ -1,19 +0,0 @@ -name "pyyaml-py2" -default_version "5.4.1" - -dependency "pip2" - -source :url => "https://github.com/yaml/pyyaml/archive/refs/tags/#{version}.tar.gz", - :sha256 => "75f966559c5f262dfc44da0f958cc2aa18953ae5021f2c3657b415c5a370045f", - :extract => :seven_zip - -relative_path "pyyaml-#{version}" - -build do - license "MIT" - license_file "./LICENSE.txt" - - command "sed -i 's/Cython/Cython<3.0.0/g' pyproject.toml" - - command "#{install_dir}/embedded/bin/pip2 install ." -end diff --git a/omnibus/config/software/setuptools2.rb b/omnibus/config/software/setuptools2.rb deleted file mode 100644 index a02111346eb8d..0000000000000 --- a/omnibus/config/software/setuptools2.rb +++ /dev/null @@ -1,28 +0,0 @@ -name "setuptools2" -default_version "40.9.0" - -skip_transitive_dependency_licensing true - -dependency "python2" - -relative_path "setuptools-#{version}" - -source :url => "https://github.com/pypa/setuptools/archive/v#{version}.tar.gz", - :sha256 => "9ef6623c057d6e46ada8156bb48dc72ef6dbe721768720cc66966cca4097061c", - :extract => :seven_zip - -build do - # 2.0 is the license version here, not the python version - license "Python-2.0" - - if ohai["platform"] == "windows" - python_bin = "#{windows_safe_path(python_2_embedded)}\\python.exe" - python_prefix = "#{windows_safe_path(python_2_embedded)}" - else - python_bin = "#{install_dir}/embedded/bin/python2" - python_prefix = "#{install_dir}/embedded" - end - - command "#{python_bin} bootstrap.py" - command "#{python_bin} setup.py install --prefix=#{python_prefix}" -end diff --git a/omnibus/lib/ostools.rb b/omnibus/lib/ostools.rb index cc5722a9e8b6b..13d8d26e06e67 100644 --- a/omnibus/lib/ostools.rb +++ b/omnibus/lib/ostools.rb @@ -63,7 +63,3 @@ def os end end -def with_python_runtime?(runtime) - python_runtimes = ENV['PY_RUNTIMES'].nil? ? ['3'] : ENV['PY_RUNTIMES'].split(',') - return python_runtimes.include? runtime -end diff --git a/pkg-config/README.md b/pkg-config/README.md deleted file mode 100644 index 5a7bd31b52ba7..0000000000000 --- a/pkg-config/README.md +++ /dev/null @@ -1,24 +0,0 @@ -## pkg-config modules - -This directory contains the `pkg-config` module files of the dependencies of the project, by platform and -"build type" (i.e. using either system libraries or embedded libraries). - -During a build, pkg-config will search for a module file in these directories, in this order: -1. `/embedded/` (unless `USE_SYSTEM_LIBS` is passed to the rake build command) -2. `/system/` -3. default pkg-config paths of the environment - -The "embedded/" module files define the flags to compile and link against the libraries -provided in the datadog-agent package. - -The "system/" files should only be present for dependencies that don't provide pkg-config files -for the platform. They define the flags to compile and link against the libraries provided by the system. - -`cgo` uses `pkg-config` to determine which compiler and linker flags to use when the following directive -is present in the go source file: - -``` -// #cgo pkg-config -``` - -(see https://golang.org/cmd/cgo/ for more details on `cgo` usage) diff --git a/pkg-config/darwin/embedded/python-2.7.pc b/pkg-config/darwin/embedded/python-2.7.pc deleted file mode 100644 index b180204361c84..0000000000000 --- a/pkg-config/darwin/embedded/python-2.7.pc +++ /dev/null @@ -1,13 +0,0 @@ -prefix=/opt/datadog-agent/embedded -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include -osx_include=/System/Library/Frameworks/Python.framework/Headers - -Name: Python -Description: Python library -Requires: -Version: 2.7 -Libs.private: -ldl -Libs: -L${libdir} -lpython2.7 -Cflags: -I${includedir}/python2.7 diff --git a/pkg-config/linux/embedded/python-2.7.pc b/pkg-config/linux/embedded/python-2.7.pc deleted file mode 100644 index 44c19be883ecf..0000000000000 --- a/pkg-config/linux/embedded/python-2.7.pc +++ /dev/null @@ -1,11 +0,0 @@ -prefix=/opt/datadog-agent/embedded -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: Python -Description: Python library -Requires: -Version: 2.7 -Libs: -L${libdir} -lpython2.7 -lpthread -ldl -lutil -lm -Cflags: -I${includedir}/python2.7 diff --git a/pkg-config/windows/embedded/python-2.7.pc b/pkg-config/windows/embedded/python-2.7.pc deleted file mode 100644 index b6f11bd55b0ad..0000000000000 --- a/pkg-config/windows/embedded/python-2.7.pc +++ /dev/null @@ -1,11 +0,0 @@ -prefix=C:/opt/datadog-agent/embedded -exec_prefix=${prefix} -libdir=${exec_prefix}/libs -includedir=${prefix}/include - -Name: Python -Description: Python library -Requires: -Version: 2.7 -Libs: -L${libdir} -lpython27 -lpthread -lm -Cflags: -I${includedir} -DMS_WIN64 diff --git a/pkg-config/windows/system/python-2.7.pc b/pkg-config/windows/system/python-2.7.pc deleted file mode 100644 index 31415a879aad3..0000000000000 --- a/pkg-config/windows/system/python-2.7.pc +++ /dev/null @@ -1,11 +0,0 @@ -prefix=C:/python27-x64 -exec_prefix=${prefix} -libdir=${exec_prefix}/libs -includedir=${prefix}/include - -Name: Python -Description: Python library -Requires: -Version: 2.7 -Libs: -L${libdir} -lpython27 -lpthread -lm -Cflags: -I${includedir} -DMS_WIN64 diff --git a/pkg/api/go.mod b/pkg/api/go.mod index 33c534533c7ae..a545660008c34 100644 --- a/pkg/api/go.mod +++ b/pkg/api/go.mod @@ -38,6 +38,7 @@ replace ( require ( github.com/DataDog/datadog-agent/comp/core/config v0.56.0-rc.3 + github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/config/utils v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/filesystem v0.56.0-rc.3 @@ -53,7 +54,6 @@ require ( github.com/DataDog/datadog-agent/comp/def v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/config/env v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel // indirect github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect github.com/DataDog/datadog-agent/pkg/config/setup v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect @@ -98,12 +98,12 @@ require ( go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/api/go.sum b/pkg/api/go.sum index c4df7b42ad5d0..42636c1b8bc19 100644 --- a/pkg/api/go.sum +++ b/pkg/api/go.sum @@ -256,8 +256,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -300,11 +300,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -317,8 +317,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/pkg/api/security/security_test.go b/pkg/api/security/security_test.go index 1b40228ddeefb..7743920bebb00 100644 --- a/pkg/api/security/security_test.go +++ b/pkg/api/security/security_test.go @@ -11,12 +11,12 @@ import ( "fmt" "os" "path/filepath" - "strings" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" "github.com/DataDog/datadog-agent/pkg/config/model" ) @@ -29,7 +29,7 @@ func initMockConf(t *testing.T) (model.Config, string) { f.Close() }) - mockConfig := model.NewConfig("datadog", "fake-datadog-yaml", strings.NewReplacer(".", "_")) + mockConfig := configmock.New(t) mockConfig.SetConfigFile(f.Name()) mockConfig.SetWithoutSource("auth_token", "") diff --git a/pkg/api/util/doget_test.go b/pkg/api/util/doget_test.go index 73bde6c629e5d..af5fe3e38415a 100644 --- a/pkg/api/util/doget_test.go +++ b/pkg/api/util/doget_test.go @@ -10,12 +10,11 @@ import ( "net/http" "net/http/httptest" "os" - "strings" "testing" "github.com/stretchr/testify/require" - "github.com/DataDog/datadog-agent/pkg/config/model" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" ) func makeTestServer(t *testing.T, handler func(w http.ResponseWriter, r *http.Request)) *httptest.Server { @@ -77,7 +76,7 @@ func TestDoGet(t *testing.T) { } server := makeTestServer(t, http.HandlerFunc(handler)) - cfg := model.NewConfig("datadog", "test", strings.NewReplacer("_", ".")) + cfg := configmock.New(t) dir := t.TempDir() authTokenPath := dir + "/auth_token" err := os.WriteFile(authTokenPath, []byte("0123456789abcdef0123456789abcdef"), 0644) diff --git a/pkg/api/util/ipc_endpoint_test.go b/pkg/api/util/ipc_endpoint_test.go index 243362a6f9303..26df3f8ce7205 100644 --- a/pkg/api/util/ipc_endpoint_test.go +++ b/pkg/api/util/ipc_endpoint_test.go @@ -14,16 +14,16 @@ import ( "net/http/httptest" "net/url" "os" - "strings" "testing" "github.com/stretchr/testify/assert" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model" ) func createConfig(t *testing.T, ts *httptest.Server) pkgconfigmodel.Config { - conf := pkgconfigmodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + conf := configmock.New(t) // create a fake auth token authTokenFile, err := os.CreateTemp("", "") @@ -44,7 +44,7 @@ func createConfig(t *testing.T, ts *httptest.Server) pkgconfigmodel.Config { } func TestNewIPCEndpoint(t *testing.T) { - conf := pkgconfigmodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + conf := configmock.New(t) // create a fake auth token authTokenFile, err := os.CreateTemp("", "") @@ -64,7 +64,7 @@ func TestNewIPCEndpoint(t *testing.T) { } func TestNewIPCEndpointWithCloseConnection(t *testing.T) { - conf := pkgconfigmodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + conf := configmock.New(t) // create a fake auth token authTokenFile, err := os.CreateTemp("", "") diff --git a/pkg/cli/subcommands/check/command.go b/pkg/cli/subcommands/check/command.go index a9788a143c7f1..56f224389b455 100644 --- a/pkg/cli/subcommands/check/command.go +++ b/pkg/cli/subcommands/check/command.go @@ -254,7 +254,7 @@ func run( cliParams *cliParams, demultiplexer demultiplexer.Component, wmeta workloadmeta.Component, - _ tagger.Component, + tagger tagger.Component, ac autodiscovery.Component, secretResolver secrets.Component, agentAPI internalAPI.Component, @@ -289,7 +289,7 @@ func run( // TODO: (components) - Until the checks are components we set there context so they can depends on components. check.InitializeInventoryChecksContext(invChecks) pkgcollector.InitPython(common.GetPythonPaths()...) - commonchecks.RegisterChecks(wmeta, config, telemetry) + commonchecks.RegisterChecks(wmeta, tagger, config, telemetry) common.LoadComponents(secretResolver, wmeta, ac, pkgconfigsetup.Datadog().GetString("confd_path")) ac.LoadAndRun(context.Background()) diff --git a/pkg/clusteragent/admission/mutate/agent_sidecar/agent_sidecar.go b/pkg/clusteragent/admission/mutate/agent_sidecar/agent_sidecar.go index c8b2c6c4eb2eb..f0741c1819942 100644 --- a/pkg/clusteragent/admission/mutate/agent_sidecar/agent_sidecar.go +++ b/pkg/clusteragent/admission/mutate/agent_sidecar/agent_sidecar.go @@ -53,7 +53,19 @@ type Webhook struct { namespaceSelector *metav1.LabelSelector objectSelector *metav1.LabelSelector containerRegistry string - datadogConfig config.Component + + // These fields store datadog agent config parameters + // to avoid calling the config resolution each time the webhook + // receives requests because the resolution is CPU expensive. + profilesJSON string + provider string + imageName string + imageTag string + isLangDetectEnabled bool + isLangDetectReportingEnabled bool + isClusterAgentEnabled bool + clusterAgentCmdPort int + clusterAgentServiceName string } // NewWebhook returns a new Webhook @@ -71,7 +83,16 @@ func NewWebhook(datadogConfig config.Component) *Webhook { namespaceSelector: nsSelector, objectSelector: objSelector, containerRegistry: containerRegistry, - datadogConfig: datadogConfig, + + profilesJSON: datadogConfig.GetString("admission_controller.agent_sidecar.profiles"), + provider: datadogConfig.GetString("admission_controller.agent_sidecar.provider"), + imageName: datadogConfig.GetString("admission_controller.agent_sidecar.image_name"), + imageTag: datadogConfig.GetString("admission_controller.agent_sidecar.image_tag"), + clusterAgentServiceName: datadogConfig.GetString("cluster_agent.kubernetes_service_name"), + clusterAgentCmdPort: datadogConfig.GetInt("cluster_agent.cmd_port"), + isClusterAgentEnabled: datadogConfig.GetBool("admission_controller.agent_sidecar.cluster_agent.enabled"), + isLangDetectEnabled: datadogConfig.GetBool("language_detection.enabled"), + isLangDetectReportingEnabled: datadogConfig.GetBool("language_detection.reporting.enabled"), } } @@ -132,12 +153,12 @@ func (w *Webhook) injectAgentSidecar(pod *corev1.Pod, _ string, _ dynamic.Interf podUpdated := false if !agentSidecarExists { - agentSidecarContainer := getDefaultSidecarTemplate(w.containerRegistry, w.datadogConfig) + agentSidecarContainer := w.getDefaultSidecarTemplate() pod.Spec.Containers = append(pod.Spec.Containers, *agentSidecarContainer) podUpdated = true } - updated, err := applyProviderOverrides(pod, w.datadogConfig) + updated, err := applyProviderOverrides(pod, w.provider) if err != nil { log.Errorf("Failed to apply provider overrides: %v", err) return podUpdated, errors.New(metrics.InvalidInput) @@ -148,7 +169,7 @@ func (w *Webhook) injectAgentSidecar(pod *corev1.Pod, _ string, _ dynamic.Interf // highest override-priority. They only apply to the agent sidecar container. for i := range pod.Spec.Containers { if pod.Spec.Containers[i].Name == agentSidecarContainerName { - updated, err = applyProfileOverrides(&pod.Spec.Containers[i], w.datadogConfig) + updated, err = applyProfileOverrides(&pod.Spec.Containers[i], w.profilesJSON) if err != nil { log.Errorf("Failed to apply profile overrides: %v", err) return podUpdated, errors.New(metrics.InvalidInput) @@ -161,15 +182,12 @@ func (w *Webhook) injectAgentSidecar(pod *corev1.Pod, _ string, _ dynamic.Interf return podUpdated, nil } -func getDefaultSidecarTemplate(containerRegistry string, datadogConfig config.Component) *corev1.Container { +func (w *Webhook) getDefaultSidecarTemplate() *corev1.Container { ddSite := os.Getenv("DD_SITE") if ddSite == "" { ddSite = pkgconfigsetup.DefaultSite } - imageName := datadogConfig.GetString("admission_controller.agent_sidecar.image_name") - imageTag := datadogConfig.GetString("admission_controller.agent_sidecar.image_tag") - agentContainer := &corev1.Container{ Env: []corev1.EnvVar{ { @@ -202,10 +220,10 @@ func getDefaultSidecarTemplate(containerRegistry string, datadogConfig config.Co }, { Name: "DD_LANGUAGE_DETECTION_ENABLED", - Value: strconv.FormatBool(datadogConfig.GetBool("language_detection.enabled") && datadogConfig.GetBool("language_detection.reporting.enabled")), + Value: strconv.FormatBool(w.isLangDetectEnabled && w.isLangDetectReportingEnabled), }, }, - Image: fmt.Sprintf("%s/%s:%s", containerRegistry, imageName, imageTag), + Image: fmt.Sprintf("%s/%s:%s", w.containerRegistry, w.imageName, w.imageTag), ImagePullPolicy: corev1.PullIfNotPresent, Name: agentSidecarContainerName, Resources: corev1.ResourceRequirements{ @@ -220,11 +238,7 @@ func getDefaultSidecarTemplate(containerRegistry string, datadogConfig config.Co }, } - clusterAgentEnabled := datadogConfig.GetBool("admission_controller.agent_sidecar.cluster_agent.enabled") - - if clusterAgentEnabled { - clusterAgentCmdPort := datadogConfig.GetInt("cluster_agent.cmd_port") - clusterAgentServiceName := datadogConfig.GetString("cluster_agent.kubernetes_service_name") + if w.isClusterAgentEnabled { _, _ = withEnvOverrides(agentContainer, corev1.EnvVar{ Name: "DD_CLUSTER_AGENT_ENABLED", @@ -241,7 +255,7 @@ func getDefaultSidecarTemplate(containerRegistry string, datadogConfig config.Co }, }, corev1.EnvVar{ Name: "DD_CLUSTER_AGENT_URL", - Value: fmt.Sprintf("https://%s.%s.svc.cluster.local:%v", clusterAgentServiceName, apiCommon.GetMyNamespace(), clusterAgentCmdPort), + Value: fmt.Sprintf("https://%s.%s.svc.cluster.local:%v", w.clusterAgentServiceName, apiCommon.GetMyNamespace(), w.clusterAgentCmdPort), }, corev1.EnvVar{ Name: "DD_ORCHESTRATOR_EXPLORER_ENABLED", Value: "true", @@ -255,9 +269,10 @@ func getDefaultSidecarTemplate(containerRegistry string, datadogConfig config.Co func labelSelectors(datadogConfig config.Component) (namespaceSelector, objectSelector *metav1.LabelSelector) { // Read and parse selectors selectorsJSON := datadogConfig.GetString("admission_controller.agent_sidecar.selectors") + profilesJSON := datadogConfig.GetString("admission_controller.agent_sidecar.profiles") // Get sidecar profiles - _, err := loadSidecarProfiles(datadogConfig) + _, err := loadSidecarProfiles(profilesJSON) if err != nil { log.Errorf("encountered issue when loading sidecar profiles: %s", err) return nil, nil diff --git a/pkg/clusteragent/admission/mutate/agent_sidecar/agent_sidecar_test.go b/pkg/clusteragent/admission/mutate/agent_sidecar/agent_sidecar_test.go index 595dfc1b9fccb..eae1db443375e 100644 --- a/pkg/clusteragent/admission/mutate/agent_sidecar/agent_sidecar_test.go +++ b/pkg/clusteragent/admission/mutate/agent_sidecar/agent_sidecar_test.go @@ -28,6 +28,7 @@ const commonRegistry = "gcr.io/datadoghq" func TestInjectAgentSidecar(t *testing.T) { mockConfig := configmock.New(t) + mockConfig.SetWithoutSource("admission_controller.agent_sidecar.container_registry", commonRegistry) tests := []struct { Name string Pod *corev1.Pod @@ -70,7 +71,7 @@ func TestInjectAgentSidecar(t *testing.T) { Spec: corev1.PodSpec{ Containers: []corev1.Container{ {Name: "container-name"}, - *getDefaultSidecarTemplate(commonRegistry, configmock.New(t)), + *NewWebhook(mockConfig).getDefaultSidecarTemplate(), }, }, } @@ -116,7 +117,7 @@ func TestInjectAgentSidecar(t *testing.T) { Spec: corev1.PodSpec{ Containers: []corev1.Container{ {Name: "container-name"}, - *getDefaultSidecarTemplate(commonRegistry, configmock.New(t)), + *NewWebhook(mockConfig).getDefaultSidecarTemplate(), }, }, }, @@ -132,7 +133,7 @@ func TestInjectAgentSidecar(t *testing.T) { Spec: corev1.PodSpec{ Containers: []corev1.Container{ {Name: "container-name"}, - *getDefaultSidecarTemplate(commonRegistry, mockConfig), + *NewWebhook(mockConfig).getDefaultSidecarTemplate(), }, }, } @@ -155,7 +156,7 @@ func TestInjectAgentSidecar(t *testing.T) { ExpectError: false, ExpectInjection: true, ExpectedPodAfterInjection: func() *corev1.Pod { - sidecar := *getDefaultSidecarTemplate(commonRegistry, mockConfig) + sidecar := *NewWebhook(mockConfig).getDefaultSidecarTemplate() _, _ = withEnvOverrides( &sidecar, corev1.EnvVar{ @@ -256,7 +257,7 @@ func TestInjectAgentSidecar(t *testing.T) { ExpectError: false, ExpectInjection: true, ExpectedPodAfterInjection: func() *corev1.Pod { - sidecar := *getDefaultSidecarTemplate(commonRegistry, mockConfig) + sidecar := *NewWebhook(mockConfig).getDefaultSidecarTemplate() _, _ = withEnvOverrides( &sidecar, @@ -418,7 +419,7 @@ func TestDefaultSidecarTemplateAgentImage(t *testing.T) { for _, test := range tests { t.Run(test.name, func(tt *testing.T) { mockConfig := test.setConfig() - sidecar := getDefaultSidecarTemplate(test.containerRegistry, mockConfig) + sidecar := NewWebhook(mockConfig).getDefaultSidecarTemplate() assert.Equal(tt, test.expectedImage, sidecar.Image) }) } @@ -428,15 +429,17 @@ func TestDefaultSidecarTemplateClusterAgentEnvVars(t *testing.T) { tests := []struct { name string - setConfig func() + setConfig func() model.Config expectedEnvVars []corev1.EnvVar unexpectedEnvVars []string }{ { name: "cluster agent not enabled", - setConfig: func() { + setConfig: func() model.Config { mockConfig := configmock.New(t) mockConfig.SetWithoutSource("admission_controller.agent_sidecar.cluster_agent.enabled", false) + mockConfig.SetWithoutSource("admission_controller.agent_sidecar.container_registry", commonRegistry) + return mockConfig }, expectedEnvVars: []corev1.EnvVar{ { @@ -453,9 +456,11 @@ func TestDefaultSidecarTemplateClusterAgentEnvVars(t *testing.T) { }, { name: "cluster agent enabled with default values", - setConfig: func() { + setConfig: func() model.Config { mockConfig := configmock.New(t) mockConfig.SetWithoutSource("admission_controller.agent_sidecar.cluster_agent.enabled", true) + mockConfig.SetWithoutSource("admission_controller.agent_sidecar.container_registry", commonRegistry) + return mockConfig }, expectedEnvVars: []corev1.EnvVar{ { @@ -489,10 +494,12 @@ func TestDefaultSidecarTemplateClusterAgentEnvVars(t *testing.T) { }, { name: "cluster agent enabled with language derection enabled", - setConfig: func() { + setConfig: func() model.Config { mockConfig := configmock.New(t) mockConfig.SetWithoutSource("admission_controller.agent_sidecar.cluster_agent.enabled", true) + mockConfig.SetWithoutSource("admission_controller.agent_sidecar.container_registry", commonRegistry) mockConfig.SetWithoutSource("language_detection.enabled", true) + return mockConfig }, expectedEnvVars: []corev1.EnvVar{ { @@ -526,12 +533,14 @@ func TestDefaultSidecarTemplateClusterAgentEnvVars(t *testing.T) { }, { name: "cluster agent enabled with custom values", - setConfig: func() { + setConfig: func() model.Config { mockConfig := configmock.New(t) mockConfig.SetWithoutSource("admission_controller.agent_sidecar.cluster_agent.enabled", true) + mockConfig.SetWithoutSource("admission_controller.agent_sidecar.container_registry", commonRegistry) mockConfig.SetWithoutSource("cluster_agent.cmd_port", 12345) mockConfig.SetWithoutSource("cluster_agent.kubernetes_service_name", "test-service-name") mockConfig.SetWithoutSource("language_detection.enabled", "false") + return mockConfig }, expectedEnvVars: []corev1.EnvVar{ { @@ -567,8 +576,8 @@ func TestDefaultSidecarTemplateClusterAgentEnvVars(t *testing.T) { for _, test := range tests { t.Run(test.name, func(tt *testing.T) { - test.setConfig() - sidecar := getDefaultSidecarTemplate(commonRegistry, configmock.New(t)) + mockConfig := test.setConfig() + sidecar := NewWebhook(mockConfig).getDefaultSidecarTemplate() envVarsMap := make(map[string]corev1.EnvVar) for _, envVar := range sidecar.Env { envVarsMap[envVar.Name] = envVar diff --git a/pkg/clusteragent/admission/mutate/agent_sidecar/profiles.go b/pkg/clusteragent/admission/mutate/agent_sidecar/profiles.go index b5c05897c2632..101f54bd059eb 100644 --- a/pkg/clusteragent/admission/mutate/agent_sidecar/profiles.go +++ b/pkg/clusteragent/admission/mutate/agent_sidecar/profiles.go @@ -12,8 +12,6 @@ import ( "fmt" corev1 "k8s.io/api/core/v1" - - "github.com/DataDog/datadog-agent/comp/core/config" ) //////////////////////////////// @@ -32,10 +30,8 @@ type ProfileOverride struct { // loadSidecarProfiles returns the profile overrides provided by the user // It returns an error in case of miss-configuration or in case more than // one profile is configured -func loadSidecarProfiles(datadogConfig config.Component) ([]ProfileOverride, error) { +func loadSidecarProfiles(profilesJSON string) ([]ProfileOverride, error) { // Read and parse profiles - profilesJSON := datadogConfig.GetString("admission_controller.agent_sidecar.profiles") - var profiles []ProfileOverride err := json.Unmarshal([]byte(profilesJSON), &profiles) @@ -52,12 +48,12 @@ func loadSidecarProfiles(datadogConfig config.Component) ([]ProfileOverride, err // applyProfileOverrides applies the profile overrides to the container. It // returns a boolean that indicates if the container was mutated -func applyProfileOverrides(container *corev1.Container, datadogConfig config.Component) (bool, error) { +func applyProfileOverrides(container *corev1.Container, profilesJSON string) (bool, error) { if container == nil { return false, fmt.Errorf("can't apply profile overrides to nil containers") } - profiles, err := loadSidecarProfiles(datadogConfig) + profiles, err := loadSidecarProfiles(profilesJSON) if err != nil { return false, err diff --git a/pkg/clusteragent/admission/mutate/agent_sidecar/profiles_test.go b/pkg/clusteragent/admission/mutate/agent_sidecar/profiles_test.go index fdbb17364eee0..772e8b784a78d 100644 --- a/pkg/clusteragent/admission/mutate/agent_sidecar/profiles_test.go +++ b/pkg/clusteragent/admission/mutate/agent_sidecar/profiles_test.go @@ -14,13 +14,9 @@ import ( "github.com/stretchr/testify/assert" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" - - configmock "github.com/DataDog/datadog-agent/pkg/config/mock" ) func TestLoadSidecarProfiles(t *testing.T) { - mockConfig := configmock.New(t) - tests := []struct { name string profilesJSON string @@ -116,8 +112,7 @@ func TestLoadSidecarProfiles(t *testing.T) { for _, test := range tests { t.Run(test.name, func(tt *testing.T) { - mockConfig.SetWithoutSource("admission_controller.agent_sidecar.profiles", test.profilesJSON) - profiles, err := loadSidecarProfiles(mockConfig) + profiles, err := loadSidecarProfiles(test.profilesJSON) if test.expectError { assert.Error(tt, err) @@ -138,8 +133,6 @@ func TestLoadSidecarProfiles(t *testing.T) { } func TestApplyProfileOverrides(t *testing.T) { - mockConfig := configmock.New(t) - tests := []struct { name string profilesJSON string @@ -360,8 +353,7 @@ func TestApplyProfileOverrides(t *testing.T) { for _, test := range tests { t.Run(test.name, func(tt *testing.T) { - mockConfig.SetWithoutSource("admission_controller.agent_sidecar.profiles", test.profilesJSON) - mutated, err := applyProfileOverrides(test.baseContainer, mockConfig) + mutated, err := applyProfileOverrides(test.baseContainer, test.profilesJSON) assert.Equal(tt, test.expectMutated, mutated) diff --git a/pkg/clusteragent/admission/mutate/agent_sidecar/providers.go b/pkg/clusteragent/admission/mutate/agent_sidecar/providers.go index 60e24f331c6a7..254e9dcc8781d 100644 --- a/pkg/clusteragent/admission/mutate/agent_sidecar/providers.go +++ b/pkg/clusteragent/admission/mutate/agent_sidecar/providers.go @@ -13,7 +13,6 @@ import ( corev1 "k8s.io/api/core/v1" - "github.com/DataDog/datadog-agent/comp/core/config" "github.com/DataDog/datadog-agent/pkg/clusteragent/admission/mutate/common" configWebhook "github.com/DataDog/datadog-agent/pkg/clusteragent/admission/mutate/config" "github.com/DataDog/datadog-agent/pkg/util/pointer" @@ -55,8 +54,7 @@ func providerIsSupported(provider string) bool { // applyProviderOverrides applies the necessary overrides for the provider // configured. It returns a boolean that indicates if the pod was mutated. -func applyProviderOverrides(pod *corev1.Pod, datadogConfig config.Component) (bool, error) { - provider := datadogConfig.GetString("admission_controller.agent_sidecar.provider") +func applyProviderOverrides(pod *corev1.Pod, provider string) (bool, error) { if !providerIsSupported(provider) { return false, fmt.Errorf("unsupported provider: %v", provider) diff --git a/pkg/clusteragent/admission/mutate/agent_sidecar/providers_test.go b/pkg/clusteragent/admission/mutate/agent_sidecar/providers_test.go index c3aaf1674cfae..3e2431a60cf4b 100644 --- a/pkg/clusteragent/admission/mutate/agent_sidecar/providers_test.go +++ b/pkg/clusteragent/admission/mutate/agent_sidecar/providers_test.go @@ -17,12 +17,10 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" mutatecommon "github.com/DataDog/datadog-agent/pkg/clusteragent/admission/mutate/common" - configmock "github.com/DataDog/datadog-agent/pkg/config/mock" "github.com/DataDog/datadog-agent/pkg/util/pointer" ) func TestProviderIsSupported(t *testing.T) { - tests := []struct { name string provider string @@ -58,8 +56,6 @@ func TestProviderIsSupported(t *testing.T) { } func TestApplyProviderOverrides(t *testing.T) { - mockConfig := configmock.New(t) - tests := []struct { name string provider string @@ -415,8 +411,7 @@ func TestApplyProviderOverrides(t *testing.T) { for _, test := range tests { t.Run(test.name, func(tt *testing.T) { - mockConfig.SetWithoutSource("admission_controller.agent_sidecar.provider", test.provider) - mutated, err := applyProviderOverrides(test.basePod, mockConfig) + mutated, err := applyProviderOverrides(test.basePod, test.provider) if test.expectError { assert.Error(tt, err) diff --git a/pkg/clusteragent/admission/mutate/config/config.go b/pkg/clusteragent/admission/mutate/config/config.go index 17573870a2440..e0e54e03265b9 100644 --- a/pkg/clusteragent/admission/mutate/config/config.go +++ b/pkg/clusteragent/admission/mutate/config/config.go @@ -70,10 +70,18 @@ type Webhook struct { endpoint string resources []string operations []admissionregistrationv1.OperationType - mode string wmeta workloadmeta.Component injectionFilter mutatecommon.InjectionFilter - datadogConfig config.Component + + // These fields store datadog agent config parameters + // to avoid calling the config resolution each time the webhook + // receives requests because the resolution is CPU expensive. + mode string + localServiceName string + traceAgentSocket string + dogStatsDSocket string + socketPath string + typeSocketVolumes bool } // NewWebhook returns a new Webhook @@ -84,10 +92,15 @@ func NewWebhook(wmeta workloadmeta.Component, injectionFilter mutatecommon.Injec endpoint: datadogConfig.GetString("admission_controller.inject_config.endpoint"), resources: []string{"pods"}, operations: []admissionregistrationv1.OperationType{admissionregistrationv1.Create}, - mode: datadogConfig.GetString("admission_controller.inject_config.mode"), wmeta: wmeta, injectionFilter: injectionFilter, - datadogConfig: datadogConfig, + + mode: datadogConfig.GetString("admission_controller.inject_config.mode"), + localServiceName: datadogConfig.GetString("admission_controller.inject_config.local_service_name"), + traceAgentSocket: datadogConfig.GetString("admission_controller.inject_config.trace_agent_socket"), + dogStatsDSocket: datadogConfig.GetString("admission_controller.inject_config.dogstatsd_socket"), + socketPath: datadogConfig.GetString("admission_controller.inject_config.socket_path"), + typeSocketVolumes: datadogConfig.GetBool("admission_controller.inject_config.type_socket_volumes"), } } @@ -155,7 +168,7 @@ func (w *Webhook) inject(pod *corev1.Pod, _ string, _ dynamic.Interface) (bool, agentHostServiceEnvVar = corev1.EnvVar{ Name: agentHostEnvVarName, - Value: w.datadogConfig.GetString("admission_controller.inject_config.local_service_name") + "." + apiCommon.GetMyNamespace() + ".svc.cluster.local", + Value: w.localServiceName + "." + apiCommon.GetMyNamespace() + ".svc.cluster.local", } defaultDdEntityIDEnvVar = corev1.EnvVar{ @@ -170,12 +183,12 @@ func (w *Webhook) inject(pod *corev1.Pod, _ string, _ dynamic.Interface) (bool, traceURLSocketEnvVar = corev1.EnvVar{ Name: traceURLEnvVarName, - Value: w.datadogConfig.GetString("admission_controller.inject_config.trace_agent_socket"), + Value: w.traceAgentSocket, } dogstatsdURLSocketEnvVar = corev1.EnvVar{ Name: dogstatsdURLEnvVarName, - Value: w.datadogConfig.GetString("admission_controller.inject_config.dogstatsd_socket"), + Value: w.dogStatsDSocket, } ) @@ -194,7 +207,7 @@ func (w *Webhook) inject(pod *corev1.Pod, _ string, _ dynamic.Interface) (bool, case service: injectedConfig = mutatecommon.InjectEnv(pod, agentHostServiceEnvVar) case socket: - injectedVolumes := injectSocketVolumes(pod, w.datadogConfig) + injectedVolumes := w.injectSocketVolumes(pod) injectedEnv := mutatecommon.InjectEnv(pod, traceURLSocketEnvVar) injectedEnv = mutatecommon.InjectEnv(pod, dogstatsdURLSocketEnvVar) || injectedEnv injectedConfig = injectedVolumes || injectedEnv @@ -283,16 +296,16 @@ func buildVolume(volumeName, path string, hostpathType corev1.HostPathType, read // wait if the agent has issues that prevent it from creating the sockets. // // This function returns true if at least one volume was injected. -func injectSocketVolumes(pod *corev1.Pod, datadogConfig config.Component) bool { +func (w *Webhook) injectSocketVolumes(pod *corev1.Pod) bool { var injectedVolNames []string - if datadogConfig.GetBool("admission_controller.inject_config.type_socket_volumes") { + if w.typeSocketVolumes { volumes := map[string]string{ DogstatsdSocketVolumeName: strings.TrimPrefix( - datadogConfig.GetString("admission_controller.inject_config.dogstatsd_socket"), "unix://", + w.dogStatsDSocket, "unix://", ), TraceAgentSocketVolumeName: strings.TrimPrefix( - datadogConfig.GetString("admission_controller.inject_config.trace_agent_socket"), "unix://", + w.traceAgentSocket, "unix://", ), } @@ -306,7 +319,7 @@ func injectSocketVolumes(pod *corev1.Pod, datadogConfig config.Component) bool { } else { volume, volumeMount := buildVolume( DatadogVolumeName, - datadogConfig.GetString("admission_controller.inject_config.socket_path"), + w.socketPath, corev1.HostPathDirectoryOrCreate, true, ) diff --git a/pkg/collector/check/stats/stats_test.go b/pkg/collector/check/stats/stats_test.go index 37f9bf62871a2..436a55cc9f477 100644 --- a/pkg/collector/check/stats/stats_test.go +++ b/pkg/collector/check/stats/stats_test.go @@ -8,8 +8,6 @@ package stats import ( "net/http" "net/http/httptest" - "os" - "runtime" "testing" "time" @@ -79,31 +77,8 @@ func TestNewStats(t *testing.T) { assert.Equal(t, stats.Interval, 15*time.Second) } -func TestNewStatsStateTelemetryIgnoredWhenGloballyDisabled(t *testing.T) { - if os.Getenv("CI") == "true" && runtime.GOOS == "darwin" { - t.Skip("TestNewStatsStateTelemetryIgnoredWhenGloballyDisabled is known to fail on the macOS Gitlab runners because of the already running Agent") - } - mockConfig := configmock.New(t) - mockConfig.SetWithoutSource("agent_telemetry.enabled", false) - mockConfig.SetWithoutSource("telemetry.enabled", false) - mockConfig.SetWithoutSource("telemetry.checks", "*") - - NewStats(newMockCheck()) - - tlmData, err := getTelemetryData() - if !assert.NoError(t, err) { - return - } - - // Assert that no telemetry is recorded - assert.NotContains(t, tlmData, "checkString") - assert.NotContains(t, tlmData, "state=\"fail\"") - assert.NotContains(t, tlmData, "state=\"ok\"") -} - -func TestNewStatsStateTelemetryInitializedWhenGloballyEnabled(t *testing.T) { +func TestNewStatsStateTelemetryInitialized(t *testing.T) { mockConfig := configmock.New(t) - mockConfig.SetWithoutSource("telemetry.enabled", true) mockConfig.SetWithoutSource("telemetry.checks", "*") NewStats(newMockCheck()) diff --git a/pkg/collector/corechecks/cluster/ksm/kubernetes_state_test.go b/pkg/collector/corechecks/cluster/ksm/kubernetes_state_test.go index 001d20167f084..8a592fff35375 100644 --- a/pkg/collector/corechecks/cluster/ksm/kubernetes_state_test.go +++ b/pkg/collector/corechecks/cluster/ksm/kubernetes_state_test.go @@ -9,7 +9,6 @@ package ksm import ( "reflect" - "strings" "testing" "time" @@ -20,7 +19,7 @@ import ( "github.com/DataDog/datadog-agent/pkg/aggregator/mocksender" "github.com/DataDog/datadog-agent/pkg/aggregator/sender" core "github.com/DataDog/datadog-agent/pkg/collector/corechecks" - "github.com/DataDog/datadog-agent/pkg/config/model" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" ksmstore "github.com/DataDog/datadog-agent/pkg/kubestatemetrics/store" ) @@ -1644,7 +1643,7 @@ func TestKSMCheckInitTags(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - conf := model.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + conf := configmock.New(t) conf.SetWithoutSource("tags", tt.tagsInConfig) k := &KSMCheck{ diff --git a/pkg/collector/corechecks/cluster/kubernetesapiserver/kubernetes_apiserver.go b/pkg/collector/corechecks/cluster/kubernetesapiserver/kubernetes_apiserver.go index 5bb3ec879312b..37113ed5d1ae0 100644 --- a/pkg/collector/corechecks/cluster/kubernetesapiserver/kubernetes_apiserver.go +++ b/pkg/collector/corechecks/cluster/kubernetesapiserver/kubernetes_apiserver.go @@ -120,6 +120,7 @@ type KubeASCheck struct { eventCollection eventCollection ac *apiserver.APIClient oshiftAPILevel apiserver.OpenShiftAPILevel + tagger tagger.Component } func (c *KubeASConfig) parse(data []byte) error { @@ -133,20 +134,25 @@ func (c *KubeASConfig) parse(data []byte) error { } // NewKubeASCheck returns a new KubeASCheck -func NewKubeASCheck(base core.CheckBase, instance *KubeASConfig) *KubeASCheck { +func NewKubeASCheck(base core.CheckBase, instance *KubeASConfig, tagger tagger.Component) *KubeASCheck { return &KubeASCheck{ CheckBase: base, instance: instance, + tagger: tagger, } } // Factory creates a new check factory -func Factory() optional.Option[func() check.Check] { - return optional.NewOption(newCheck) +func Factory(tagger tagger.Component) optional.Option[func() check.Check] { + return optional.NewOption( + func() check.Check { + return newCheck(tagger) + }, + ) } -func newCheck() check.Check { - return NewKubeASCheck(core.NewCheckBase(CheckName), &KubeASConfig{}) +func newCheck(tagger tagger.Component) check.Check { + return NewKubeASCheck(core.NewCheckBase(CheckName), &KubeASConfig{}, tagger) } // Configure parses the check configuration and init the check. @@ -188,9 +194,9 @@ func (k *KubeASCheck) Configure(senderManager sender.SenderManager, _ uint64, co } if k.instance.UnbundleEvents { - k.eventCollection.Transformer = newUnbundledTransformer(clusterName, tagger.GetTaggerInstance(), k.instance.CollectedEventTypes, k.instance.BundleUnspecifiedEvents, k.instance.FilteringEnabled) + k.eventCollection.Transformer = newUnbundledTransformer(clusterName, k.tagger, k.instance.CollectedEventTypes, k.instance.BundleUnspecifiedEvents, k.instance.FilteringEnabled) } else { - k.eventCollection.Transformer = newBundledTransformer(clusterName, tagger.GetTaggerInstance(), k.instance.CollectedEventTypes, k.instance.FilteringEnabled) + k.eventCollection.Transformer = newBundledTransformer(clusterName, k.tagger, k.instance.CollectedEventTypes, k.instance.FilteringEnabled) } return nil diff --git a/pkg/collector/corechecks/cluster/kubernetesapiserver/kubernetes_apiserver_test.go b/pkg/collector/corechecks/cluster/kubernetesapiserver/kubernetes_apiserver_test.go index a345aaaedcae4..ca421c88b97cb 100644 --- a/pkg/collector/corechecks/cluster/kubernetesapiserver/kubernetes_apiserver_test.go +++ b/pkg/collector/corechecks/cluster/kubernetesapiserver/kubernetes_apiserver_test.go @@ -14,6 +14,7 @@ import ( v1 "k8s.io/api/core/v1" obj "k8s.io/apimachinery/pkg/apis/meta/v1" + "github.com/DataDog/datadog-agent/comp/core/tagger/taggerimpl" "github.com/DataDog/datadog-agent/pkg/aggregator/mocksender" core "github.com/DataDog/datadog-agent/pkg/collector/corechecks" "github.com/DataDog/datadog-agent/pkg/metrics/servicecheck" @@ -82,8 +83,10 @@ func TestParseComponentStatus(t *testing.T) { Items: nil, } + tagger := taggerimpl.SetupFakeTagger(t) + // FIXME: use the factory instead - kubeASCheck := NewKubeASCheck(core.NewCheckBase(CheckName), &KubeASConfig{}) + kubeASCheck := NewKubeASCheck(core.NewCheckBase(CheckName), &KubeASConfig{}, tagger) mocked := mocksender.NewMockSender(kubeASCheck.ID()) mocked.On("ServiceCheck", "kube_apiserver_controlplane.up", servicecheck.ServiceCheckOK, "", []string{"component:Zookeeper"}, "imok") diff --git a/pkg/collector/corechecks/cluster/kubernetesapiserver/kubernetes_openshift_test.go b/pkg/collector/corechecks/cluster/kubernetesapiserver/kubernetes_openshift_test.go index d410ec83c7724..9145bd72f3b24 100644 --- a/pkg/collector/corechecks/cluster/kubernetesapiserver/kubernetes_openshift_test.go +++ b/pkg/collector/corechecks/cluster/kubernetesapiserver/kubernetes_openshift_test.go @@ -17,6 +17,7 @@ import ( "github.com/stretchr/testify/require" "github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration" + "github.com/DataDog/datadog-agent/comp/core/tagger/taggerimpl" "github.com/DataDog/datadog-agent/pkg/aggregator" "github.com/DataDog/datadog-agent/pkg/aggregator/mocksender" pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" @@ -33,9 +34,11 @@ func TestReportClusterQuotas(t *testing.T) { pkgconfigsetup.Datadog().SetWithoutSource("cluster_name", "test-cluster-name") defer pkgconfigsetup.Datadog().SetWithoutSource("cluster_name", prevClusterName) + tagger := taggerimpl.SetupFakeTagger(t) + instanceCfg := []byte("") initCfg := []byte("") - kubeASCheck := newCheck().(*KubeASCheck) + kubeASCheck := newCheck(tagger).(*KubeASCheck) err = kubeASCheck.Configure(aggregator.NewNoOpSenderManager(), integration.FakeConfigHash, instanceCfg, initCfg, "test") require.NoError(t, err) diff --git a/pkg/collector/corechecks/cluster/kubernetesapiserver/stub.go b/pkg/collector/corechecks/cluster/kubernetesapiserver/stub.go index 8e34be6187ced..c43a33bfd3275 100644 --- a/pkg/collector/corechecks/cluster/kubernetesapiserver/stub.go +++ b/pkg/collector/corechecks/cluster/kubernetesapiserver/stub.go @@ -9,6 +9,7 @@ package kubernetesapiserver import ( + "github.com/DataDog/datadog-agent/comp/core/tagger" "github.com/DataDog/datadog-agent/pkg/collector/check" "github.com/DataDog/datadog-agent/pkg/util/optional" ) @@ -19,6 +20,6 @@ const ( ) // Factory creates a new check factory -func Factory() optional.Option[func() check.Check] { +func Factory(_ tagger.Component) optional.Option[func() check.Check] { return optional.NewNoneOption[func() check.Check]() } diff --git a/pkg/collector/corechecks/ebpf/ebpf.go b/pkg/collector/corechecks/ebpf/ebpf.go index 4e9e6fe65a3cf..c7c2eb17d80a4 100644 --- a/pkg/collector/corechecks/ebpf/ebpf.go +++ b/pkg/collector/corechecks/ebpf/ebpf.go @@ -39,7 +39,7 @@ type EBPFCheckConfig struct { // EBPFCheck grabs eBPF map/program/perf buffer metrics type EBPFCheck struct { config *EBPFCheckConfig - sysProbeUtil *processnet.RemoteSysProbeUtil + sysProbeUtil processnet.SysProbeUtil core.CheckBase } diff --git a/pkg/collector/corechecks/ebpf/probe/ebpfcheck/probe.go b/pkg/collector/corechecks/ebpf/probe/ebpfcheck/probe.go index d3cd6aab4cf12..231d7c2e027c4 100644 --- a/pkg/collector/corechecks/ebpf/probe/ebpfcheck/probe.go +++ b/pkg/collector/corechecks/ebpf/probe/ebpfcheck/probe.go @@ -20,6 +20,7 @@ import ( "unsafe" manager "github.com/DataDog/ebpf-manager" + "github.com/cihub/seelog" "github.com/cilium/ebpf" "github.com/cilium/ebpf/asm" "github.com/cilium/ebpf/features" @@ -305,9 +306,11 @@ func (k *Probe) getProgramStats(stats *model.EBPFStats) error { stats.Programs = append(stats.Programs, ps) } - log.Tracef("found %d programs", len(stats.Programs)) - for _, ps := range stats.Programs { - log.Tracef("name=%s prog_id=%d type=%s", ps.Name, ps.ID, ps.Type.String()) + if log.ShouldLog(seelog.TraceLvl) { + log.Tracef("found %d programs", len(stats.Programs)) + for _, ps := range stats.Programs { + log.Tracef("name=%s prog_id=%d type=%s", ps.Name, ps.ID, ps.Type.String()) + } } return nil diff --git a/pkg/collector/corechecks/gpu/config.go b/pkg/collector/corechecks/gpu/config.go new file mode 100644 index 0000000000000..d534be2f0ba2d --- /dev/null +++ b/pkg/collector/corechecks/gpu/config.go @@ -0,0 +1,16 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +// Package gpu defines the agent corecheck for +// the GPU integration +package gpu + +// CheckName defines the name of the +// GPU check +const CheckName = "gpu" + +// CheckConfig holds the configuration for the GPU check +type CheckConfig struct { +} diff --git a/pkg/collector/corechecks/gpu/gpu.go b/pkg/collector/corechecks/gpu/gpu.go new file mode 100644 index 0000000000000..5785acdbd50a7 --- /dev/null +++ b/pkg/collector/corechecks/gpu/gpu.go @@ -0,0 +1,212 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +//go:build linux + +package gpu + +import ( + "fmt" + "time" + + "gopkg.in/yaml.v2" + + "github.com/NVIDIA/go-nvml/pkg/nvml" + + sysconfig "github.com/DataDog/datadog-agent/cmd/system-probe/config" + "github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration" + "github.com/DataDog/datadog-agent/pkg/aggregator/sender" + "github.com/DataDog/datadog-agent/pkg/collector/check" + core "github.com/DataDog/datadog-agent/pkg/collector/corechecks" + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/gpu/model" + pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" + processnet "github.com/DataDog/datadog-agent/pkg/process/net" + sectime "github.com/DataDog/datadog-agent/pkg/security/resolvers/time" + "github.com/DataDog/datadog-agent/pkg/util/log" + "github.com/DataDog/datadog-agent/pkg/util/optional" +) + +// Check represents the GPU check that will be periodically executed via the Run() function +type Check struct { + core.CheckBase + config *CheckConfig // config for the check + sysProbeUtil processnet.SysProbeUtil // sysProbeUtil is used to communicate with system probe + lastCheckTime time.Time // lastCheckTime is the time the last check was done, used to compute GPU average utilization + timeResolver *sectime.Resolver // TODO: Move resolver to a common package, see EBPF-579 + statProcessors map[uint32]*StatsProcessor // statProcessors is a map of processors, one per pid + gpuDevices []gpuDevice // gpuDevices is a list of GPU devices found in the host +} + +// Factory creates a new check factory +func Factory() optional.Option[func() check.Check] { + return optional.NewOption(newCheck) +} + +func newCheck() check.Check { + return &Check{ + CheckBase: core.NewCheckBase(CheckName), + config: &CheckConfig{}, + statProcessors: make(map[uint32]*StatsProcessor), + } +} + +// Cancel cancels the check +func (m *Check) Cancel() { + m.CheckBase.Cancel() + + ret := nvml.Shutdown() + if ret != nvml.SUCCESS && ret != nvml.ERROR_UNINITIALIZED { + log.Warnf("Failed to shutdown NVML: %v", nvml.ErrorString(ret)) + } +} + +// Configure parses the check configuration and init the check +func (m *Check) Configure(senderManager sender.SenderManager, _ uint64, config, initConfig integration.Data, source string) error { + if err := m.CommonConfigure(senderManager, initConfig, config, source); err != nil { + return err + } + if err := yaml.Unmarshal(config, m.config); err != nil { + return fmt.Errorf("invalid gpu check config: %w", err) + } + + return nil +} + +func (m *Check) ensureInitialized() error { + var err error + + if m.sysProbeUtil == nil { + m.sysProbeUtil, err = processnet.GetRemoteSystemProbeUtil( + pkgconfigsetup.SystemProbe().GetString("system_probe_config.sysprobe_socket"), + ) + if err != nil { + return fmt.Errorf("sysprobe connection: %w", err) + } + } + + if m.timeResolver == nil { + m.timeResolver, err = sectime.NewResolver() + if err != nil { + return fmt.Errorf("cannot create time resolver: %w", err) + } + } + + if m.gpuDevices == nil { + m.gpuDevices, err = getGPUDevices() + if err != nil { + return fmt.Errorf("cannot get GPU devices: %w", err) + } + } + + return nil +} + +// ensureProcessor ensures that there is a stats processor for the given key +func (m *Check) ensureProcessor(key *model.StreamKey, snd sender.Sender, gpuThreads int, checkDuration time.Duration) { + if _, ok := m.statProcessors[key.Pid]; !ok { + m.statProcessors[key.Pid] = &StatsProcessor{ + key: key, + } + } + + m.statProcessors[key.Pid].totalThreadSecondsUsed = 0 + m.statProcessors[key.Pid].sender = snd + m.statProcessors[key.Pid].gpuMaxThreads = gpuThreads + m.statProcessors[key.Pid].measuredInterval = checkDuration + m.statProcessors[key.Pid].timeResolver = m.timeResolver + m.statProcessors[key.Pid].lastCheck = m.lastCheckTime +} + +// Run executes the check +func (m *Check) Run() error { + if err := m.ensureInitialized(); err != nil { + return err + } + if len(m.gpuDevices) == 0 { + log.Warnf("No GPU devices found") + return nil + } + + sysprobeData, err := m.sysProbeUtil.GetCheck(sysconfig.GPUMonitoringModule) + if err != nil { + return fmt.Errorf("cannot get data from system-probe: %w", err) + } + now := time.Now() + + var checkDuration time.Duration + // mark the check duration as close to the actual check as possible + if !m.lastCheckTime.IsZero() { + checkDuration = now.Sub(m.lastCheckTime) + } + + snd, err := m.GetSender() + if err != nil { + return fmt.Errorf("get metric sender: %w", err) + } + + // Commit the metrics even in case of an error + defer snd.Commit() + + stats, ok := sysprobeData.(model.GPUStats) + if !ok { + return log.Errorf("gpu check raw data has incorrect type: %T", stats) + } + + // TODO: Multiple GPUs are not supported yet + gpuThreads, err := m.gpuDevices[0].GetMaxThreads() + if err != nil { + return fmt.Errorf("get GPU device threads: %w", err) + } + + for _, data := range stats.CurrentData { + m.ensureProcessor(&data.Key, snd, gpuThreads, checkDuration) + m.statProcessors[data.Key.Pid].processCurrentData(data) + } + + for _, data := range stats.PastData { + m.ensureProcessor(&data.Key, snd, gpuThreads, checkDuration) + m.statProcessors[data.Key.Pid].processPastData(data) + } + + m.configureNormalizationFactor() + + for _, processor := range m.statProcessors { + if processor.hasPendingData { + err := processor.markInterval() + if err != nil { + return fmt.Errorf("mark interval: %w", err) + } + } else { + err := processor.finish(now) + // delete even in an error case, as we don't want to keep the processor around + delete(m.statProcessors, processor.key.Pid) + if err != nil { + return fmt.Errorf("finish processor: %w", err) + } + } + } + + m.lastCheckTime = now + + return nil +} + +func (m *Check) configureNormalizationFactor() { + // As we compute the utilization based on the number of threads launched by the kernel, we need to + // normalize the utilization if we get above 100%, as the GPU can enqueue threads. + totalGPUUtilization := 0.0 + for _, processor := range m.statProcessors { + // Only consider processors that received data this interval + if processor.hasPendingData { + totalGPUUtilization += processor.getGPUUtilization() + } + } + + normFactor := max(1.0, totalGPUUtilization) + + for _, processor := range m.statProcessors { + processor.setGPUUtilizationNormalizationFactor(normFactor) + } +} diff --git a/pkg/collector/corechecks/gpu/gpu_stub.go b/pkg/collector/corechecks/gpu/gpu_stub.go new file mode 100644 index 0000000000000..5aefc602175b9 --- /dev/null +++ b/pkg/collector/corechecks/gpu/gpu_stub.go @@ -0,0 +1,18 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +//go:build !linux + +package gpu + +import ( + "github.com/DataDog/datadog-agent/pkg/collector/check" + "github.com/DataDog/datadog-agent/pkg/util/optional" +) + +// Factory creates a new check factory +func Factory() optional.Option[func() check.Check] { + return optional.NewNoneOption[func() check.Check]() +} diff --git a/pkg/collector/corechecks/gpu/nvml.go b/pkg/collector/corechecks/gpu/nvml.go new file mode 100644 index 0000000000000..425dd52bd9572 --- /dev/null +++ b/pkg/collector/corechecks/gpu/nvml.go @@ -0,0 +1,89 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +//go:build linux + +// Package gpu defines the agent corecheck for +// the GPU integration +package gpu + +import ( + "errors" + "fmt" + "sync" + + "github.com/NVIDIA/go-nvml/pkg/nvml" +) + +var initOnce sync.Once + +type gpuDevice struct { + nvml.Device +} + +func wrapNvmlError(ret nvml.Return) error { + if ret == nvml.SUCCESS { + return nil + } + + return errors.New(nvml.ErrorString(ret)) +} + +func ensureNvmlInit() error { + var err error + initOnce.Do(func() { + err = wrapNvmlError(nvml.Init()) + }) + + return err +} + +func getGPUDevices() ([]gpuDevice, error) { + err := ensureNvmlInit() + if err != nil { + return nil, err + } + + count, ret := nvml.DeviceGetCount() + if err := wrapNvmlError(ret); err != nil { + return nil, fmt.Errorf("cannot get number of GPU devices: %w", err) + } + + var devices []gpuDevice + + for i := 0; i < count; i++ { + device, ret := nvml.DeviceGetHandleByIndex(i) + if err := wrapNvmlError(ret); err != nil { + return nil, fmt.Errorf("cannot get handle for GPU device %d: %w", i, err) + } + + devices = append(devices, gpuDevice{device}) + } + + return devices, nil +} + +func (d *gpuDevice) GetNumMultiprocessors() (int, error) { + devProps, ret := d.GetAttributes() + if err := wrapNvmlError(ret); err != nil { + return 0, fmt.Errorf("cannot get device attributes: %w", err) + } + + return int(devProps.MultiprocessorCount), nil +} + +// GetMaxThreads returns the maximum number of threads that can be run on the +// GPU. Each GPU core runs a thread, so this is the number of cores. Do not +// confuse the number of cores with the number of streaming multiprocessors +// (SM): the number of cores is equal to the number of SMs multiplied by the +// number of cores per SM. +func (d *gpuDevice) GetMaxThreads() (int, error) { + cores, ret := d.GetNumGpuCores() + if err := wrapNvmlError(ret); err != nil { + return 0, fmt.Errorf("cannot get number of GPU cores: %w", err) + } + + return int(cores), nil +} diff --git a/pkg/collector/corechecks/gpu/stats.go b/pkg/collector/corechecks/gpu/stats.go new file mode 100644 index 0000000000000..c055dcab74f83 --- /dev/null +++ b/pkg/collector/corechecks/gpu/stats.go @@ -0,0 +1,237 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +//go:build linux + +package gpu + +import ( + "fmt" + "math" + "time" + + "github.com/DataDog/datadog-agent/pkg/aggregator/sender" + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/gpu/model" + sectime "github.com/DataDog/datadog-agent/pkg/security/resolvers/time" +) + +const ( + gpuMetricsNs = "gpu." + metricNameMemory = gpuMetricsNs + "memory" + metricNameUtil = gpuMetricsNs + "utilization" + metricNameMaxMem = gpuMetricsNs + "max_memory" +) + +// StatsProcessor is responsible for processing the data from the GPU eBPF probe and generating metrics from it +type StatsProcessor struct { + // key is the key of the stream this processor is processing + key *model.StreamKey + + // totalThreadSecondsUsed is the total amount of thread-seconds used by the GPU in the current interval + totalThreadSecondsUsed float64 + + // sender is the sender to use to send metrics + sender sender.Sender + + // gpuMaxThreads is the maximum number of threads the GPU can run in parallel, for utilization computations + gpuMaxThreads int + + // lastCheck is the last time the processor was checked + lastCheck time.Time + + // lastMemPoint is the time of the last memory timeseries point sent + lastMemPointEpoch uint64 + + // measuredInterval is the interval between the last two checks + measuredInterval time.Duration + + // timeResolver is the time resolver to use to resolve timestamps + timeResolver *sectime.Resolver + + // currentAllocs is the list of current memory allocations + currentAllocs []*model.MemoryAllocation + + // pastAllocs is the list of past memory allocations + pastAllocs []*model.MemoryAllocation + + // lastKernelEnd is the timestamp of the last kernel end + lastKernelEnd time.Time + + // firstKernelStart is the timestamp of the first kernel start + firstKernelStart time.Time + + // sentEvents is the number of events sent by this processor + sentEvents int + + // maxTimestampLastMetric is the maximum timestamp of the last metric sent + maxTimestampLastMetric time.Time + + // utilizationNormFactor is the factor to normalize the utilization by, to account for the fact that we might have more kernels enqueued than the GPU can run in parallel. This factor + // allows distributing the utilization over all the streams that are enqueued + utilizationNormFactor float64 + + // hasPendingData is true if there is data pending to be sent + hasPendingData bool +} + +// processKernelSpan processes a kernel span +func (sp *StatsProcessor) processKernelSpan(span *model.KernelSpan) { + tsStart := sp.timeResolver.ResolveMonotonicTimestamp(span.StartKtime) + tsEnd := sp.timeResolver.ResolveMonotonicTimestamp(span.EndKtime) + + if sp.firstKernelStart.IsZero() || tsStart.Before(sp.firstKernelStart) { + sp.firstKernelStart = tsStart + } + + // we only want to consider data that was not already processed in the previous interval + if sp.lastCheck.After(tsStart) { + tsStart = sp.lastCheck + } + duration := tsEnd.Sub(tsStart) + sp.totalThreadSecondsUsed += duration.Seconds() * float64(min(span.AvgThreadCount, uint64(sp.gpuMaxThreads))) // we can't use more threads than the GPU has + if tsEnd.After(sp.lastKernelEnd) { + sp.lastKernelEnd = tsEnd + } +} + +func (sp *StatsProcessor) processPastData(data *model.StreamData) { + for _, span := range data.Spans { + sp.processKernelSpan(span) + } + + sp.pastAllocs = append(sp.pastAllocs, data.Allocations...) + sp.hasPendingData = true +} + +func (sp *StatsProcessor) processCurrentData(data *model.StreamData) { + for _, span := range data.Spans { + sp.processKernelSpan(span) + } + + sp.currentAllocs = data.Allocations + sp.hasPendingData = true +} + +// getTags returns the tags to use for the metrics +func (sp *StatsProcessor) getTags() []string { + return []string{ + fmt.Sprintf("pid:%d", sp.key.Pid), + } +} + +func (sp *StatsProcessor) getGPUUtilization() float64 { + intervalSecs := sp.measuredInterval.Seconds() + if intervalSecs > 0 { + availableThreadSeconds := float64(sp.gpuMaxThreads) * intervalSecs + return sp.totalThreadSecondsUsed / availableThreadSeconds + } + + return 0 +} + +func (sp *StatsProcessor) setGPUUtilizationNormalizationFactor(factor float64) { + sp.utilizationNormFactor = factor +} + +func (sp *StatsProcessor) markInterval() error { + intervalSecs := sp.measuredInterval.Seconds() + if intervalSecs > 0 { + utilization := sp.getGPUUtilization() / sp.utilizationNormFactor + + // if this is the first event, we need to send it with the timestamp of the first kernel start so that we have a complete series + if sp.sentEvents == 0 { + err := sp.sender.GaugeWithTimestamp(metricNameUtil, utilization, "", sp.getTags(), float64(sp.firstKernelStart.Unix())) + if err != nil { + return fmt.Errorf("cannot send metric: %w", err) + } + } + + // aftewards, we only need to update the utilization at the point of the last kernel end + err := sp.sender.GaugeWithTimestamp(metricNameUtil, utilization, "", sp.getTags(), float64(sp.lastKernelEnd.Unix())) + if err != nil { + return fmt.Errorf("cannot send metric: %w", err) + } + + if sp.lastKernelEnd.After(sp.maxTimestampLastMetric) { + sp.maxTimestampLastMetric = sp.lastKernelEnd + } + } + + var memTsBuilder tseriesBuilder + + firstUnfreedAllocKTime := uint64(math.MaxUint64) + + for _, alloc := range sp.currentAllocs { + firstUnfreedAllocKTime = min(firstUnfreedAllocKTime, alloc.StartKtime) + } + + for _, alloc := range sp.pastAllocs { + // Only build the timeseries up until the point of the first unfreed allocation. After that, the timeseries is still incomplete + // until all those allocations are freed. + if alloc.EndKtime < firstUnfreedAllocKTime { + startEpoch := sp.timeResolver.ResolveMonotonicTimestamp(alloc.StartKtime).Unix() + endEpoch := sp.timeResolver.ResolveMonotonicTimestamp(alloc.EndKtime).Unix() + memTsBuilder.AddEvent(uint64(startEpoch), uint64(endEpoch), int64(alloc.Size)) + } + } + + points, maxValue := memTsBuilder.Build() + tags := sp.getTags() + sentPoints := false + + for _, point := range points { + // Do not send points that are before the last check, those have been already sent + // Also do not send points that are 0, unless we have already sent some points, in which case + // we need them to close the series + if point.time > sp.lastMemPointEpoch && (point.value > 0 || sentPoints) { + err := sp.sender.GaugeWithTimestamp(metricNameMemory, float64(point.value), "", tags, float64(point.time)) + if err != nil { + return fmt.Errorf("cannot send metric: %w", err) + } + + if int64(point.time) > sp.maxTimestampLastMetric.Unix() { + sp.maxTimestampLastMetric = time.Unix(int64(point.time), 0) + } + + sentPoints = true + } + } + + if len(points) > 0 { + sp.lastMemPointEpoch = points[len(points)-1].time + } + + sp.sender.Gauge(metricNameMaxMem, float64(maxValue), "", tags) + sp.sentEvents++ + + sp.hasPendingData = false + + return nil +} + +// finish ensures that all metrics sent by this processor are properly closed with a 0 value +func (sp *StatsProcessor) finish(now time.Time) error { + lastTs := now + + // Don't mark events as lasting more than what they should. + if !sp.maxTimestampLastMetric.IsZero() { + lastTs = sp.maxTimestampLastMetric.Add(time.Second) + } + + err := sp.sender.GaugeWithTimestamp(metricNameMemory, 0, "", sp.getTags(), float64(lastTs.Unix())) + if err != nil { + return fmt.Errorf("cannot send metric: %w", err) + } + err = sp.sender.GaugeWithTimestamp(metricNameMaxMem, 0, "", sp.getTags(), float64(lastTs.Unix())) + if err != nil { + return fmt.Errorf("cannot send metric: %w", err) + } + err = sp.sender.GaugeWithTimestamp(metricNameUtil, 0, "", sp.getTags(), float64(lastTs.Unix())) + if err != nil { + return fmt.Errorf("cannot send metric: %w", err) + } + + return nil +} diff --git a/pkg/collector/corechecks/gpu/tseries.go b/pkg/collector/corechecks/gpu/tseries.go new file mode 100644 index 0000000000000..5abb42bfb3be8 --- /dev/null +++ b/pkg/collector/corechecks/gpu/tseries.go @@ -0,0 +1,68 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +package gpu + +import ( + "slices" +) + +// tseriesBuilder is a helper to build a time series of events with duration +type tseriesBuilder struct { + points []tsPoint +} + +type tsPoint struct { + time uint64 + value int64 +} + +func (b *tseriesBuilder) AddEvent(startTime, endTime uint64, value int64) { + b.points = append(b.points, tsPoint{time: startTime, value: value}) + b.points = append(b.points, tsPoint{time: endTime, value: -value}) +} + +func (b *tseriesBuilder) AddEventStart(startTime uint64, value int64) { + b.points = append(b.points, tsPoint{time: startTime, value: value}) +} + +// buildTseries builds the time series, returning a slice of points and the max value in the interval +func (b *tseriesBuilder) Build() ([]tsPoint, int64) { + // sort by timestamp. Stable so that events that start and end at the same time are processed in the order they were added + slices.SortStableFunc(b.points, func(p1, p2 tsPoint) int { + return int(p1.time - p2.time) + }) + + maxValue := int64(0) + currentValue := int64(0) + + // Now we build the time series by doing a cumulative sum of the values at each point, accounting for the unit factor. + // Multiple points can end up at the same rounded timestamp. + tseries := make([]tsPoint, 0) + for i := range b.points { + // Check if we need to add a new point + currTime := b.points[i].time + if i > 0 { + prevTime := tseries[len(tseries)-1].time + + // We advanced past the last timeseries point, so create a new one + if currTime != prevTime { + tseries = append(tseries, tsPoint{time: currTime, value: 0}) + } + } else if i == 0 { + // Always add the first point + tseries = append(tseries, tsPoint{time: uint64(currTime), value: 0}) + } + + // Update the current value for this point + currentValue += b.points[i].value + + // assign it to the current point and update the maximum + tseries[len(tseries)-1].value = currentValue + maxValue = max(maxValue, currentValue) + } + + return tseries, maxValue +} diff --git a/pkg/collector/corechecks/gpu/tseries_test.go b/pkg/collector/corechecks/gpu/tseries_test.go new file mode 100644 index 0000000000000..3e534bed55172 --- /dev/null +++ b/pkg/collector/corechecks/gpu/tseries_test.go @@ -0,0 +1,72 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +package gpu + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestTseriesBuilder(t *testing.T) { + events := []struct { + start uint64 + end uint64 + value int64 + }{ + // Test overlapping events + {0, 10, 1}, + {5, 15, 2}, + + // Test events with gaps + {20, 30, 10}, + // Test events with same end + {28, 30, 3}, + // Test events with same start + {31, 33, 4}, + {31, 34, 5}, + + // Test gap plus events with no end + {40, 50, 8}, + } + + onlystarts := []struct { + start uint64 + value int64 + }{ + {35, 7}, + } + + builder := tseriesBuilder{} + for _, e := range events { + builder.AddEvent(e.start, e.end, e.value) + } + for _, s := range onlystarts { + builder.AddEventStart(s.start, s.value) + } + + tseries, max := builder.Build() + assert.Equal(t, max, int64(15)) // From event [40,50]=8 and onlystarts [35,inf]=7a + + expected := []tsPoint{ + {0, 1}, + {5, 3}, + {10, 2}, + {15, 0}, + {20, 10}, + {28, 13}, + {30, 0}, + {31, 9}, + {33, 5}, + {34, 0}, + {35, 7}, + {40, 15}, + {50, 7}, + } + + require.ElementsMatch(t, expected, tseries) +} diff --git a/pkg/collector/corechecks/oracle/sql_wrappers.go b/pkg/collector/corechecks/oracle/sql_wrappers.go index a628a076afff0..82b0cb2739e36 100644 --- a/pkg/collector/corechecks/oracle/sql_wrappers.go +++ b/pkg/collector/corechecks/oracle/sql_wrappers.go @@ -16,6 +16,14 @@ import ( ) func selectWrapper[T any](c *Check, s T, sql string, binds ...interface{}) error { + if c.db == nil { + // Reconnect if the connection is lost + // If reconnect fails, return the error + err := reconnectOnConnectionLose(c) + if err != nil { + return err + } + } err := c.db.Select(s, sql, binds...) err = handleError(c, &c.db, err) if err != nil { @@ -25,6 +33,12 @@ func selectWrapper[T any](c *Check, s T, sql string, binds ...interface{}) error } func getWrapper[T any](c *Check, s T, sql string, binds ...interface{}) error { + if c.db == nil { + err := reconnectOnConnectionLose(c) + if err != nil { + return err + } + } err := c.db.Get(s, sql, binds...) err = handleError(c, &c.db, err) if err != nil { @@ -131,3 +145,13 @@ func reconnectOnConnectionError(c *Check, db **sqlx.DB, err error) { closeDatabase(c, *db) } } + +func reconnectOnConnectionLose(c *Check) error { + db, err := c.Connect() + if err != nil { + log.Errorf("%s failed to reconnect %s", c.logPrompt, err) + closeDatabase(c, c.db) + } + c.db = db + return err +} diff --git a/pkg/collector/corechecks/servicediscovery/apm/detect.go b/pkg/collector/corechecks/servicediscovery/apm/detect.go index a1ad2d303fe62..7b4df2c0738fc 100644 --- a/pkg/collector/corechecks/servicediscovery/apm/detect.go +++ b/pkg/collector/corechecks/servicediscovery/apm/detect.go @@ -18,6 +18,7 @@ import ( "strconv" "strings" + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/envs" "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/language" "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/usm" "github.com/DataDog/datadog-agent/pkg/network/go/bininspect" @@ -37,7 +38,7 @@ const ( Injected Instrumentation = "injected" ) -type detector func(pid int, args []string, envs map[string]string, contextMap usm.DetectorContextMap) Instrumentation +type detector func(pid int, args []string, envs envs.Variables, contextMap usm.DetectorContextMap) Instrumentation var ( detectorMap = map[language.Language]detector{ @@ -52,7 +53,7 @@ var ( ) // Detect attempts to detect the type of APM instrumentation for the given service. -func Detect(pid int, args []string, envs map[string]string, lang language.Language, contextMap usm.DetectorContextMap) Instrumentation { +func Detect(pid int, args []string, envs envs.Variables, lang language.Language, contextMap usm.DetectorContextMap) Instrumentation { // first check to see if the DD_INJECTION_ENABLED is set to tracer if isInjected(envs) { return Injected @@ -66,8 +67,8 @@ func Detect(pid int, args []string, envs map[string]string, lang language.Langua return None } -func isInjected(envs map[string]string) bool { - if val, ok := envs["DD_INJECTION_ENABLED"]; ok { +func isInjected(envs envs.Variables) bool { + if val, ok := envs.Get("DD_INJECTION_ENABLED"); ok { parts := strings.Split(val, ",") for _, v := range parts { if v == "tracer" { @@ -96,7 +97,7 @@ const ( // goDetector detects APM instrumentation for Go binaries by checking for // the presence of the dd-trace-go symbols in the ELF. This only works for // unstripped binaries. -func goDetector(pid int, _ []string, _ map[string]string, _ usm.DetectorContextMap) Instrumentation { +func goDetector(pid int, _ []string, _ envs.Variables, _ usm.DetectorContextMap) Instrumentation { exePath := kernel.HostProc(strconv.Itoa(pid), "exe") elfFile, err := elf.Open(exePath) @@ -142,7 +143,7 @@ func pythonDetectorFromMapsReader(reader io.Reader) Instrumentation { // For example: // 7aef453fc000-7aef453ff000 rw-p 0004c000 fc:06 7895473 /home/foo/.local/lib/python3.10/site-packages/ddtrace/internal/_encoding.cpython-310-x86_64-linux-gnu.so // 7aef45400000-7aef45459000 r--p 00000000 fc:06 7895588 /home/foo/.local/lib/python3.10/site-packages/ddtrace/internal/datadog/profiling/libdd_wrapper.so -func pythonDetector(pid int, _ []string, _ map[string]string, _ usm.DetectorContextMap) Instrumentation { +func pythonDetector(pid int, _ []string, _ envs.Variables, _ usm.DetectorContextMap) Instrumentation { mapsPath := kernel.HostProc(strconv.Itoa(pid), "maps") mapsFile, err := os.Open(mapsPath) if err != nil { @@ -172,7 +173,7 @@ func isNodeInstrumented(f fs.File) bool { // To check for APM instrumentation, we try to find a package.json in // the parent directories of the service. If found, we then check for a // `dd-trace` entry to be present. -func nodeDetector(_ int, _ []string, _ map[string]string, contextMap usm.DetectorContextMap) Instrumentation { +func nodeDetector(_ int, _ []string, _ envs.Variables, contextMap usm.DetectorContextMap) Instrumentation { pkgJSONPath, ok := contextMap[usm.NodePackageJSONPath] if !ok { log.Debugf("could not get package.json path from context map") @@ -199,7 +200,7 @@ func nodeDetector(_ int, _ []string, _ map[string]string, contextMap usm.Detecto return None } -func javaDetector(_ int, args []string, envs map[string]string, _ usm.DetectorContextMap) Instrumentation { +func javaDetector(_ int, args []string, envs envs.Variables, _ usm.DetectorContextMap) Instrumentation { ignoreArgs := map[string]bool{ "-version": true, "-Xshare:dump": true, @@ -229,7 +230,7 @@ func javaDetector(_ int, args []string, envs map[string]string, _ usm.DetectorCo "JDPA_OPTS", } for _, name := range toolOptionEnvs { - if val, ok := envs[name]; ok { + if val, ok := envs.Get(name); ok { if strings.Contains(val, "-javaagent:") && strings.Contains(val, "dd-java-agent.jar") { return Provided } @@ -265,8 +266,8 @@ func dotNetDetectorFromMapsReader(reader io.Reader) Instrumentation { // maps file. Note that this does not work for single-file deployments. // // 785c8a400000-785c8aaeb000 r--s 00000000 fc:06 12762267 /home/foo/.../publish/Datadog.Trace.dll -func dotNetDetector(pid int, _ []string, envs map[string]string, _ usm.DetectorContextMap) Instrumentation { - if val, ok := envs["CORECLR_ENABLE_PROFILING"]; ok && val == "1" { +func dotNetDetector(pid int, _ []string, envs envs.Variables, _ usm.DetectorContextMap) Instrumentation { + if val, ok := envs.Get("CORECLR_ENABLE_PROFILING"); ok && val == "1" { return Provided } diff --git a/pkg/collector/corechecks/servicediscovery/apm/detect_nix_test.go b/pkg/collector/corechecks/servicediscovery/apm/detect_nix_test.go index 79570d4159deb..efe3b291b289b 100644 --- a/pkg/collector/corechecks/servicediscovery/apm/detect_nix_test.go +++ b/pkg/collector/corechecks/servicediscovery/apm/detect_nix_test.go @@ -17,6 +17,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/envs" "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/usm" "github.com/DataDog/datadog-agent/pkg/network/protocols/http/testutil" usmtestutil "github.com/DataDog/datadog-agent/pkg/network/usm/testutil" @@ -54,7 +55,7 @@ func TestInjected(t *testing.T) { } for _, d := range data { t.Run(d.name, func(t *testing.T) { - result := isInjected(d.envs) + result := isInjected(envs.NewVariables(d.envs)) assert.Equal(t, d.result, result) }) } @@ -93,7 +94,7 @@ func Test_javaDetector(t *testing.T) { } for _, d := range data { t.Run(d.name, func(t *testing.T) { - result := javaDetector(0, d.args, d.envs, nil) + result := javaDetector(0, d.args, envs.NewVariables(d.envs), nil) if result != d.result { t.Errorf("expected %s got %s", d.result, result) } @@ -130,7 +131,7 @@ func Test_nodeDetector(t *testing.T) { for _, d := range data { t.Run(d.name, func(t *testing.T) { - result := nodeDetector(0, nil, nil, d.contextMap) + result := nodeDetector(0, nil, envs.NewVariables(nil), d.contextMap) assert.Equal(t, d.result, result) }) } @@ -176,7 +177,7 @@ func Test_pythonDetector(t *testing.T) { func TestDotNetDetector(t *testing.T) { for _, test := range []struct { name string - env map[string]string + envs map[string]string maps string result Instrumentation }{ @@ -186,14 +187,14 @@ func TestDotNetDetector(t *testing.T) { }, { name: "profiling disabled", - env: map[string]string{ + envs: map[string]string{ "CORECLR_ENABLE_PROFILING": "0", }, result: None, }, { name: "profiling enabled", - env: map[string]string{ + envs: map[string]string{ "CORECLR_ENABLE_PROFILING": "1", }, result: Provided, @@ -218,7 +219,7 @@ func TestDotNetDetector(t *testing.T) { }, { name: "in maps, env misleading", - env: map[string]string{ + envs: map[string]string{ "CORECLR_ENABLE_PROFILING": "0", }, maps: ` @@ -230,7 +231,7 @@ func TestDotNetDetector(t *testing.T) { t.Run(test.name, func(t *testing.T) { var result Instrumentation if test.maps == "" { - result = dotNetDetector(0, nil, test.env, nil) + result = dotNetDetector(0, nil, envs.NewVariables(test.envs), nil) } else { result = dotNetDetectorFromMapsReader(strings.NewReader(test.maps)) } @@ -240,6 +241,9 @@ func TestDotNetDetector(t *testing.T) { } func TestGoDetector(t *testing.T) { + if os.Getenv("CI") == "" && os.Getuid() != 0 { + t.Skip("skipping test; requires root privileges") + } curDir, err := testutil.CurDir() require.NoError(t, err) serverBinWithSymbols, err := usmtestutil.BuildGoBinaryWrapper(filepath.Join(curDir, "testutil"), "instrumented") @@ -259,12 +263,12 @@ func TestGoDetector(t *testing.T) { _ = cmdWithoutSymbols.Process.Kill() }) - result := goDetector(os.Getpid(), nil, nil, nil) + result := goDetector(os.Getpid(), nil, envs.NewVariables(nil), nil) require.Equal(t, None, result) - result = goDetector(cmdWithSymbols.Process.Pid, nil, nil, nil) + result = goDetector(cmdWithSymbols.Process.Pid, nil, envs.NewVariables(nil), nil) require.Equal(t, Provided, result) - result = goDetector(cmdWithoutSymbols.Process.Pid, nil, nil, nil) + result = goDetector(cmdWithoutSymbols.Process.Pid, nil, envs.NewVariables(nil), nil) require.Equal(t, Provided, result) } diff --git a/pkg/collector/corechecks/servicediscovery/cp_stub.go b/pkg/collector/corechecks/servicediscovery/cp_stub.go new file mode 100644 index 0000000000000..a3c26578ae6e8 --- /dev/null +++ b/pkg/collector/corechecks/servicediscovery/cp_stub.go @@ -0,0 +1,44 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +//go:build linux && test + +package servicediscovery + +import ( + "time" + + model "github.com/DataDog/agent-payload/v5/process" + + proccontainers "github.com/DataDog/datadog-agent/pkg/process/util/containers" +) + +const ( + dummyContainerID = "abcd" +) + +type containerProviderStub struct { + pidToCid map[int]string +} + +func newContainerProviderStub(targetPIDs []int) proccontainers.ContainerProvider { + pidToCid := make(map[int]string) + + for _, pid := range targetPIDs { + pidToCid[pid] = dummyContainerID + } + + return &containerProviderStub{ + pidToCid: pidToCid, + } +} + +func (*containerProviderStub) GetContainers(_ time.Duration, _ map[string]*proccontainers.ContainerRateMetrics) ([]*model.Container, map[string]*proccontainers.ContainerRateMetrics, map[int]string, error) { + return nil, nil, nil, nil +} + +func (s *containerProviderStub) GetPidToCid(_ time.Duration) map[int]string { + return s.pidToCid +} diff --git a/pkg/collector/corechecks/servicediscovery/envs/envs.go b/pkg/collector/corechecks/servicediscovery/envs/envs.go new file mode 100644 index 0000000000000..09c4ce0c366af --- /dev/null +++ b/pkg/collector/corechecks/servicediscovery/envs/envs.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +// Package envs provides target environment variables of interest. +package envs + +// targets is a collection of environment variables of interest. +var targets = map[string]struct{}{ + "PWD": {}, + "DD_INJECTION_ENABLED": {}, + "DD_SERVICE": {}, + "DD_TAGS": {}, + "DD_DISCOVERY_ENABLED": {}, + "GUNICORN_CMD_ARGS": {}, + "WSGI_APP": {}, + "CORECLR_ENABLE_PROFILING": {}, + "CATALINA_OPTS": {}, + "JAVA_TOOL_OPTIONS": {}, + "_JAVA_OPTIONS": {}, + "JDK_JAVA_OPTIONS": {}, + "JAVA_OPTIONS": {}, + "JDPA_OPTS": {}, + "SPRING_APPLICATION_NAME": {}, + "SPRING_CONFIG_LOCATIONS": {}, + "SPRING_CONFIG_NAME": {}, + "SPRING_PROFILES_ACTIVE": {}, +} + +// Variables - collected of targeted environment variables. +type Variables struct { + vars map[string]string +} + +// Get returns an environment variable if it is present in the collection +func (ev *Variables) Get(name string) (string, bool) { + val, ok := ev.vars[name] + return val, ok +} + +// GetDefault returns an environment variable or provided default. +func (ev *Variables) GetDefault(name, defVal string) string { + val, ok := ev.Get(name) + if !ok { + return defVal + } + + return val +} + +// Set saves the environment variable if it is targeted. +// returns true if env variable matches the target +func (ev *Variables) Set(name, val string) bool { + if _, ok := targets[name]; !ok { + return false + } + if ev.vars == nil { + ev.vars = make(map[string]string) + } + ev.vars[name] = val + + return true +} diff --git a/pkg/collector/corechecks/servicediscovery/envs/envs_testutils.go b/pkg/collector/corechecks/servicediscovery/envs/envs_testutils.go new file mode 100644 index 0000000000000..ead8e3d10e3e6 --- /dev/null +++ b/pkg/collector/corechecks/servicediscovery/envs/envs_testutils.go @@ -0,0 +1,43 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +//go:build test + +package envs + +import "fmt" + +// NewVariables returns a new [Variables] +// for unit tests to verify that the input map has only target variables. +func NewVariables(vars map[string]string) Variables { + for env := range vars { + if _, ok := targets[env]; !ok { + return Variables{} + } + } + return Variables{ + vars: vars, + } +} + +// GetExpectedEnvs - return list of expected env. variables for testing. +func GetExpectedEnvs() []string { + expectedEnvs := make([]string, 0, len(targets)) + + for env := range targets { + expectedEnvs = append(expectedEnvs, fmt.Sprintf("%s=true", env)) + } + return expectedEnvs +} + +// GetExpectedMap - return map of expected env. variables for testing. +func GetExpectedMap() map[string]string { + expectedMap := make(map[string]string, len(targets)) + + for env := range targets { + expectedMap[env] = "true" + } + return expectedMap +} diff --git a/pkg/collector/corechecks/servicediscovery/events.go b/pkg/collector/corechecks/servicediscovery/events.go index ae25068e956b0..55ff2d382680d 100644 --- a/pkg/collector/corechecks/servicediscovery/events.go +++ b/pkg/collector/corechecks/servicediscovery/events.go @@ -43,6 +43,7 @@ type eventPayload struct { CommandLine []string `json:"command_line"` RSSMemory uint64 `json:"rss_memory"` CPUCores float64 `json:"cpu_cores"` + ContainerID string `json:"container_id"` } type event struct { @@ -89,6 +90,7 @@ func (ts *telemetrySender) newEvent(t eventType, svc serviceInfo) *event { CommandLine: svc.service.CommandLine, RSSMemory: svc.service.RSS, CPUCores: svc.service.CPUCores, + ContainerID: svc.service.ContainerID, }, } } diff --git a/pkg/collector/corechecks/servicediscovery/events_test.go b/pkg/collector/corechecks/servicediscovery/events_test.go index 0675a7dedd4c9..13d9ef013931e 100644 --- a/pkg/collector/corechecks/servicediscovery/events_test.go +++ b/pkg/collector/corechecks/servicediscovery/events_test.go @@ -65,6 +65,7 @@ func Test_telemetrySender(t *testing.T) { DDService: "dd-service", DDServiceInjected: true, CPUCores: 1.5, + ContainerID: "abcd", }, meta: ServiceMetadata{ Name: "test-service", @@ -101,6 +102,7 @@ func Test_telemetrySender(t *testing.T) { CommandLine: []string{"test-service", "--args"}, RSSMemory: 500 * 1024 * 1024, CPUCores: 1.5, + ContainerID: "abcd", }, }, { @@ -124,6 +126,7 @@ func Test_telemetrySender(t *testing.T) { CommandLine: []string{"test-service", "--args"}, RSSMemory: 500 * 1024 * 1024, CPUCores: 1.5, + ContainerID: "abcd", }, }, { @@ -147,6 +150,7 @@ func Test_telemetrySender(t *testing.T) { CommandLine: []string{"test-service", "--args"}, RSSMemory: 500 * 1024 * 1024, CPUCores: 1.5, + ContainerID: "abcd", }, }, } @@ -182,6 +186,7 @@ func Test_telemetrySender_name_provided(t *testing.T) { StartTimeSecs: uint64(now.Add(-20 * time.Minute).Unix()), GeneratedName: "generated-name2", DDService: "dd-service-provided", + ContainerID: "abcd", }, meta: ServiceMetadata{ Name: "test-service", @@ -215,6 +220,7 @@ func Test_telemetrySender_name_provided(t *testing.T) { APMInstrumentation: "injected", PID: 55, CommandLine: []string{"foo", "--option"}, + ContainerID: "abcd", }, }, { @@ -235,6 +241,7 @@ func Test_telemetrySender_name_provided(t *testing.T) { APMInstrumentation: "injected", PID: 55, CommandLine: []string{"foo", "--option"}, + ContainerID: "abcd", }, }, { @@ -255,6 +262,7 @@ func Test_telemetrySender_name_provided(t *testing.T) { APMInstrumentation: "injected", PID: 55, CommandLine: []string{"foo", "--option"}, + ContainerID: "abcd", }, }, } diff --git a/pkg/collector/corechecks/servicediscovery/impl_linux.go b/pkg/collector/corechecks/servicediscovery/impl_linux.go index 5478b38f507d1..a8c737762c249 100644 --- a/pkg/collector/corechecks/servicediscovery/impl_linux.go +++ b/pkg/collector/corechecks/servicediscovery/impl_linux.go @@ -14,6 +14,7 @@ import ( "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/servicetype" pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" processnet "github.com/DataDog/datadog-agent/pkg/process/net" + proccontainers "github.com/DataDog/datadog-agent/pkg/process/util/containers" "github.com/DataDog/datadog-agent/pkg/util/log" ) @@ -24,21 +25,23 @@ func init() { } type linuxImpl struct { - getSysProbeClient func() (systemProbeClient, error) + getSysProbeClient processnet.SysProbeUtilGetter time timer - ignoreCfg map[string]bool + ignoreCfg map[string]bool + containerProvider proccontainers.ContainerProvider ignoreProcs map[int]bool aliveServices map[int]*serviceInfo potentialServices map[int]*serviceInfo } -func newLinuxImpl(ignoreCfg map[string]bool) (osImpl, error) { +func newLinuxImpl(ignoreCfg map[string]bool, containerProvider proccontainers.ContainerProvider) (osImpl, error) { return &linuxImpl{ - getSysProbeClient: getSysProbeClient, + getSysProbeClient: processnet.GetRemoteSystemProbeUtil, time: realTime{}, ignoreCfg: ignoreCfg, + containerProvider: containerProvider, ignoreProcs: make(map[int]bool), aliveServices: make(map[int]*serviceInfo), potentialServices: make(map[int]*serviceInfo), @@ -46,7 +49,8 @@ func newLinuxImpl(ignoreCfg map[string]bool) (osImpl, error) { } func (li *linuxImpl) DiscoverServices() (*discoveredServices, error) { - sysProbe, err := li.getSysProbeClient() + socket := pkgconfigsetup.SystemProbe().GetString("system_probe_config.sysprobe_socket") + sysProbe, err := li.getSysProbeClient(socket) if err != nil { return nil, errWithCode{ err: err, @@ -69,21 +73,9 @@ func (li *linuxImpl) DiscoverServices() (*discoveredServices, error) { } events := serviceEvents{} - now := li.time.Now() - // potentialServices contains processes that we scanned in the previous iteration and had open ports. - // we check if they are still alive in this iteration, and if so, we send a start-service telemetry event. - for pid, svc := range li.potentialServices { - if service, ok := serviceMap[pid]; ok { - svc.LastHeartbeat = now - svc.service.RSS = service.RSS - svc.service.CPUCores = service.CPUCores - li.aliveServices[pid] = svc - events.start = append(events.start, *svc) - } - } - clear(li.potentialServices) + li.handlePotentialServices(&events, now, serviceMap) // check open ports - these will be potential new services if they are still alive in the next iteration. for _, service := range response.Services { @@ -100,6 +92,7 @@ func (li *linuxImpl) DiscoverServices() (*discoveredServices, error) { li.ignoreProcs[pid] = true continue } + log.Debugf("[pid: %d] adding process to potential: %s", pid, svc.meta.Name) li.potentialServices[pid] = &svc } @@ -133,6 +126,42 @@ func (li *linuxImpl) DiscoverServices() (*discoveredServices, error) { }, nil } +// handlePotentialServices checks cached potential services we have seen in the +// previous call of the check. If they are still alive, start events are sent +// for these services. +func (li *linuxImpl) handlePotentialServices(events *serviceEvents, now time.Time, serviceMap map[int]*model.Service) { + if len(li.potentialServices) == 0 { + return + } + + // Get container IDs to enrich the service info with it. The SD check is + // supposed to run once every minute, so we use this duration for cache + // validity. + // TODO: use/find a global constant for this delay, to keep in sync with + // the check delay if it were to change. + containers := li.containerProvider.GetPidToCid(1 * time.Minute) + + // potentialServices contains processes that we scanned in the previous + // iteration and had open ports. We check if they are still alive in this + // iteration, and if so, we send a start-service telemetry event. + for pid, svc := range li.potentialServices { + if service, ok := serviceMap[pid]; ok { + svc.LastHeartbeat = now + svc.service.RSS = service.RSS + svc.service.CPUCores = service.CPUCores + + if id, ok := containers[pid]; ok { + svc.service.ContainerID = id + log.Debugf("[pid: %d] add containerID to process: %s", pid, id) + } + + li.aliveServices[pid] = svc + events.start = append(events.start, *svc) + } + } + clear(li.potentialServices) +} + func (li *linuxImpl) getServiceInfo(service model.Service) serviceInfo { // if the process name is docker-proxy, we should talk to docker to get the process command line and env vars // have to see how far this can go but not for the initial release @@ -154,13 +183,3 @@ func (li *linuxImpl) getServiceInfo(service model.Service) serviceInfo { LastHeartbeat: li.time.Now(), } } - -type systemProbeClient interface { - GetDiscoveryServices() (*model.ServicesResponse, error) -} - -func getSysProbeClient() (systemProbeClient, error) { - return processnet.GetRemoteSystemProbeUtil( - pkgconfigsetup.SystemProbe().GetString("system_probe_config.sysprobe_socket"), - ) -} diff --git a/pkg/collector/corechecks/servicediscovery/impl_linux_mock.go b/pkg/collector/corechecks/servicediscovery/impl_linux_mock.go deleted file mode 100644 index 2022d4bcce6c9..0000000000000 --- a/pkg/collector/corechecks/servicediscovery/impl_linux_mock.go +++ /dev/null @@ -1,57 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed -// under the Apache License Version 2.0. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2016-present Datadog, Inc. - -//go:build linux - -// Code generated by MockGen. DO NOT EDIT. -// Source: impl_linux.go - -// Package servicediscovery is a generated GoMock package. -package servicediscovery - -import ( - reflect "reflect" - - model "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/model" - gomock "github.com/golang/mock/gomock" -) - -// MocksystemProbeClient is a mock of systemProbeClient interface. -type MocksystemProbeClient struct { - ctrl *gomock.Controller - recorder *MocksystemProbeClientMockRecorder -} - -// MocksystemProbeClientMockRecorder is the mock recorder for MocksystemProbeClient. -type MocksystemProbeClientMockRecorder struct { - mock *MocksystemProbeClient -} - -// NewMocksystemProbeClient creates a new mock instance. -func NewMocksystemProbeClient(ctrl *gomock.Controller) *MocksystemProbeClient { - mock := &MocksystemProbeClient{ctrl: ctrl} - mock.recorder = &MocksystemProbeClientMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MocksystemProbeClient) EXPECT() *MocksystemProbeClientMockRecorder { - return m.recorder -} - -// GetDiscoveryListeners mocks base method. -func (m *MocksystemProbeClient) GetDiscoveryServices() (*model.ServicesResponse, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetDiscoveryServices") - ret0, _ := ret[0].(*model.ServicesResponse) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetDiscoveryServices indicates an expected call of GetDiscoveryServices. -func (mr *MocksystemProbeClientMockRecorder) GetDiscoveryServices() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDiscoveryServices", reflect.TypeOf((*MocksystemProbeClient)(nil).GetDiscoveryServices)) -} diff --git a/pkg/collector/corechecks/servicediscovery/impl_linux_test.go b/pkg/collector/corechecks/servicediscovery/impl_linux_test.go index b8ea7760d724d..91bbc71c59458 100644 --- a/pkg/collector/corechecks/servicediscovery/impl_linux_test.go +++ b/pkg/collector/corechecks/servicediscovery/impl_linux_test.go @@ -22,6 +22,8 @@ import ( "github.com/DataDog/datadog-agent/pkg/aggregator/mocksender" "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/apm" "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/model" + "github.com/DataDog/datadog-agent/pkg/process/net" + netmocks "github.com/DataDog/datadog-agent/pkg/process/net/mocks" ) type testProc struct { @@ -172,6 +174,16 @@ func Test_linuxImpl(t *testing.T) { time time.Time } + collectTargetPIDs := func(checkRuns []*checkRun) []int { + targetPIDs := make([]int, 0) + for _, cr := range checkRuns { + for _, service := range cr.servicesResp.Services { + targetPIDs = append(targetPIDs, service.PID) + } + } + return targetPIDs + } + tests := []struct { name string checkRun []*checkRun @@ -232,6 +244,7 @@ func Test_linuxImpl(t *testing.T) { APMInstrumentation: "none", RSSMemory: 100 * 1024 * 1024, CPUCores: 1.5, + ContainerID: dummyContainerID, }, }, { @@ -254,6 +267,7 @@ func Test_linuxImpl(t *testing.T) { APMInstrumentation: "none", RSSMemory: 200 * 1024 * 1024, CPUCores: 1.5, + ContainerID: dummyContainerID, }, }, { @@ -276,6 +290,7 @@ func Test_linuxImpl(t *testing.T) { APMInstrumentation: "none", RSSMemory: 200 * 1024 * 1024, CPUCores: 1.5, + ContainerID: dummyContainerID, }, }, { @@ -294,6 +309,7 @@ func Test_linuxImpl(t *testing.T) { PID: 500, ServiceLanguage: "python", CommandLine: pythonCommandLine, + ContainerID: dummyContainerID, }, }, { @@ -312,6 +328,7 @@ func Test_linuxImpl(t *testing.T) { PID: 500, ServiceLanguage: "python", CommandLine: pythonCommandLine, + ContainerID: dummyContainerID, }, }, }, @@ -366,6 +383,7 @@ func Test_linuxImpl(t *testing.T) { Ports: []uint16{5432}, PID: 101, CommandLine: []string{"test-service-1"}, + ContainerID: dummyContainerID, }, }, { @@ -388,6 +406,7 @@ func Test_linuxImpl(t *testing.T) { APMInstrumentation: "none", RSSMemory: 100 * 1024 * 1024, CPUCores: 1.5, + ContainerID: dummyContainerID, }, }, { @@ -405,6 +424,7 @@ func Test_linuxImpl(t *testing.T) { Ports: []uint16{5432}, PID: 101, CommandLine: []string{"test-service-1"}, + ContainerID: dummyContainerID, }, }, { @@ -422,6 +442,7 @@ func Test_linuxImpl(t *testing.T) { Ports: []uint16{5432}, PID: 101, CommandLine: []string{"test-service-1"}, + ContainerID: dummyContainerID, }, }, { @@ -444,6 +465,7 @@ func Test_linuxImpl(t *testing.T) { APMInstrumentation: "none", RSSMemory: 100 * 1024 * 1024, CPUCores: 1.5, + ContainerID: dummyContainerID, }, }, }, @@ -501,6 +523,7 @@ func Test_linuxImpl(t *testing.T) { APMInstrumentation: "none", RSSMemory: 100 * 1024 * 1024, CPUCores: 1.5, + ContainerID: dummyContainerID, }, }, { @@ -521,6 +544,7 @@ func Test_linuxImpl(t *testing.T) { PID: 102, CommandLine: []string{"test-service-1"}, APMInstrumentation: "injected", + ContainerID: dummyContainerID, }, }, }, @@ -533,7 +557,9 @@ func Test_linuxImpl(t *testing.T) { defer ctrl.Finish() // check and mocks setup - check := newCheck().(*Check) + targetPIDs := collectTargetPIDs(tc.checkRun) + cpStub := newContainerProviderStub(targetPIDs) + check := newCheck(cpStub) mSender := mocksender.NewMockSender(check.ID()) mSender.SetupAcceptAll() @@ -549,7 +575,7 @@ func Test_linuxImpl(t *testing.T) { require.NotNil(t, check.os) for _, cr := range tc.checkRun { - mSysProbe := NewMocksystemProbeClient(ctrl) + mSysProbe := netmocks.NewSysProbeUtil(t) mSysProbe.EXPECT().GetDiscoveryServices(). Return(cr.servicesResp, nil). Times(1) @@ -560,7 +586,7 @@ func Test_linuxImpl(t *testing.T) { mTimer.EXPECT().Now().Return(cr.time).AnyTimes() // set mocks - check.os.(*linuxImpl).getSysProbeClient = func() (systemProbeClient, error) { + check.os.(*linuxImpl).getSysProbeClient = func(_ string) (net.SysProbeUtil, error) { return mSysProbe, nil } check.os.(*linuxImpl).time = mTimer diff --git a/pkg/collector/corechecks/servicediscovery/model/model.go b/pkg/collector/corechecks/servicediscovery/model/model.go index 93a3585167214..98a610f7ff304 100644 --- a/pkg/collector/corechecks/servicediscovery/model/model.go +++ b/pkg/collector/corechecks/servicediscovery/model/model.go @@ -20,6 +20,7 @@ type Service struct { CommandLine []string `json:"cmdline"` StartTimeSecs uint64 `json:"start_time"` CPUCores float64 `json:"cpu_cores"` + ContainerID string `json:"container_id"` } // ServicesResponse is the response for the system-probe /discovery/services endpoint. diff --git a/pkg/collector/corechecks/servicediscovery/module/envs.go b/pkg/collector/corechecks/servicediscovery/module/envs.go index 5ae6ebf797e96..0c841b3d108c5 100644 --- a/pkg/collector/corechecks/servicediscovery/module/envs.go +++ b/pkg/collector/corechecks/servicediscovery/module/envs.go @@ -8,15 +8,18 @@ package module import ( + "bufio" "io" "os" "path/filepath" "strconv" "strings" + "github.com/shirou/gopsutil/v3/process" + + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/envs" "github.com/DataDog/datadog-agent/pkg/util/kernel" "github.com/DataDog/datadog-agent/pkg/util/log" - "github.com/shirou/gopsutil/v3/process" ) const ( @@ -153,3 +156,86 @@ func getEnvs(proc *process.Process) (map[string]string, error) { } return envs, nil } + +// EnvReader reads the environment variables from /proc//environ file. +type EnvReader struct { + file *os.File // open pointer to environment variables file + scanner *bufio.Scanner // iterator to read strings from text file + envs envs.Variables // collected environment variables +} + +func zeroSplitter(data []byte, atEOF bool) (advance int, token []byte, err error) { + for i := 0; i < len(data); i++ { + if data[i] == '\x00' { + return i + 1, data[:i], nil + } + } + if !atEOF { + return 0, nil, nil + } + return 0, data, bufio.ErrFinalToken +} + +// newEnvReader returns a new [EnvReader] to read from path, it reads null terminated strings. +func newEnvReader(proc *process.Process) (*EnvReader, error) { + envPath := kernel.HostProc(strconv.Itoa(int(proc.Pid)), "environ") + file, err := os.Open(envPath) + if err != nil { + return nil, err + } + + scanner := bufio.NewScanner(file) + scanner.Split(zeroSplitter) + + return &EnvReader{ + file: file, + scanner: scanner, + envs: envs.Variables{}, + }, nil +} + +// close closes an open file. +func (er *EnvReader) close() { + if er.file != nil { + er.file.Close() + } +} + +// add adds env. variable to the map of environment variables, +func (er *EnvReader) add() { + env := er.scanner.Text() + name, val, found := strings.Cut(env, "=") + if found { + er.envs.Set(name, val) + } +} + +// getTargetEnvs reads the environment variables of interest from the /proc//environ file. +func getTargetEnvs(proc *process.Process) (envs.Variables, error) { + reader, err := newEnvReader(proc) + defer func() { + if reader != nil { + reader.close() + } + }() + + if err != nil { + return envs.Variables{}, err + } + + for reader.scanner.Scan() { + reader.add() + } + + injectionMeta, ok := getInjectionMeta(proc) + if !ok { + return reader.envs, nil + } + for _, env := range injectionMeta.InjectedEnv { + name, val, found := strings.Cut(string(env), "=") + if found { + reader.envs.Set(name, val) + } + } + return reader.envs, nil +} diff --git a/pkg/collector/corechecks/servicediscovery/module/envs_test.go b/pkg/collector/corechecks/servicediscovery/module/envs_test.go index 9a56755c097b6..31cb3c8816fe7 100644 --- a/pkg/collector/corechecks/servicediscovery/module/envs_test.go +++ b/pkg/collector/corechecks/servicediscovery/module/envs_test.go @@ -16,6 +16,8 @@ import ( "github.com/shirou/gopsutil/v3/process" "github.com/stretchr/testify/require" "golang.org/x/sys/unix" + + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/envs" ) func TestInjectedEnvBasic(t *testing.T) { @@ -55,7 +57,7 @@ func TestInjectedEnvLimit(t *testing.T) { require.False(t, ok) } -// createEnvsMemfd creates an memfd in the current process with the specified +// createEnvsMemfd creates a memfd in the current process with the specified // environment variables in the same way as Datadog/auto_inject. func createEnvsMemfd(t *testing.T, envs []string) { t.Helper() @@ -103,3 +105,79 @@ func memfile(name string, b []byte) (int, error) { return fd, nil } + +// TestTargetEnvs it checks reading of target environment variables only from /proc//environ. +func TestTargetEnvs(t *testing.T) { + curPid := os.Getpid() + proc, err := process.NewProcess(int32(curPid)) + require.NoError(t, err) + + expectedEnvs := envs.GetExpectedEnvs() + createEnvsMemfd(t, expectedEnvs) + + vars, err := getTargetEnvs(proc) + require.NoError(t, err) + + expectedMap := envs.GetExpectedMap() + for k, v := range expectedMap { + val, ok := vars.Get(k) + require.True(t, ok) + require.Equal(t, val, v) + } + + // check unexpected env variables + val, ok := vars.Get("HOME") + require.Empty(t, val) + require.False(t, ok) + val, ok = vars.Get("PATH") + require.Empty(t, val) + require.False(t, ok) + val, ok = vars.Get("SHELL") + require.Empty(t, val) + require.False(t, ok) + + // check that non-target variables return an empty map. + vars = envs.NewVariables(map[string]string{ + "NON_TARGET1": "some", + "NON_TARGET2": "some", + }) + val, ok = vars.Get("NON_TARGET1") + require.Empty(t, val) + require.False(t, ok) + val, ok = vars.Get("NON_TARGET2") + require.Empty(t, val) + require.False(t, ok) +} + +// BenchmarkGetEnvs benchmarks reading of all environment variables from /proc//environ. +func BenchmarkGetEnvs(b *testing.B) { + proc, err := customNewProcess(int32(os.Getpid())) + if err != nil { + return + } + b.ResetTimer() + b.ReportAllocs() + for i := 0; i < b.N; i++ { + _, err = getEnvs(proc) + if err != nil { + return + } + } +} + +// BenchmarkGetEnvsTarget benchmarks reading of target environment variables only from /proc//environ. +func BenchmarkGetEnvsTarget(b *testing.B) { + proc, err := customNewProcess(int32(os.Getpid())) + if err != nil { + return + } + + b.ResetTimer() + b.ReportAllocs() + for i := 0; i < b.N; i++ { + _, err = getTargetEnvs(proc) + if err != nil { + return + } + } +} diff --git a/pkg/collector/corechecks/servicediscovery/module/impl_linux.go b/pkg/collector/corechecks/servicediscovery/module/impl_linux.go index 9646bb4d31f28..071087398f9f1 100644 --- a/pkg/collector/corechecks/servicediscovery/module/impl_linux.go +++ b/pkg/collector/corechecks/servicediscovery/module/impl_linux.go @@ -332,11 +332,6 @@ func (s *discovery) getServiceInfo(proc *process.Process) (*serviceInfo, error) return nil, err } - envs, err := getEnvs(proc) - if err != nil { - return nil, err - } - exe, err := proc.Exe() if err != nil { return nil, err @@ -354,6 +349,11 @@ func (s *discovery) getServiceInfo(proc *process.Process) (*serviceInfo, error) if lang == "" { lang = language.FindUsingPrivilegedDetector(s.privilegedDetector, proc.Pid) } + envs, err := getTargetEnvs(proc) + if err != nil { + return nil, err + } + nameMeta := servicediscovery.GetServiceName(cmdline, envs, root, lang, contextMap) apmInstrumentation := apm.Detect(int(proc.Pid), cmdline, envs, lang, contextMap) diff --git a/pkg/collector/corechecks/servicediscovery/module/impl_linux_test.go b/pkg/collector/corechecks/servicediscovery/module/impl_linux_test.go index a88c31590efa1..5130011217ef9 100644 --- a/pkg/collector/corechecks/servicediscovery/module/impl_linux_test.go +++ b/pkg/collector/corechecks/servicediscovery/module/impl_linux_test.go @@ -15,6 +15,7 @@ import ( "fmt" "net" "net/http" + "net/http/httptest" "os" "os/exec" "path/filepath" @@ -27,8 +28,6 @@ import ( "testing" "time" - "net/http/httptest" - gorillamux "github.com/gorilla/mux" "github.com/prometheus/procfs" "github.com/shirou/gopsutil/v3/process" diff --git a/pkg/collector/corechecks/servicediscovery/service_detector.go b/pkg/collector/corechecks/servicediscovery/service_detector.go index f403ec3bbde4a..aed9b77ec98df 100644 --- a/pkg/collector/corechecks/servicediscovery/service_detector.go +++ b/pkg/collector/corechecks/servicediscovery/service_detector.go @@ -9,6 +9,7 @@ import ( "slices" "strings" + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/envs" "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/language" "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/usm" "github.com/DataDog/datadog-agent/pkg/trace/traceutil" @@ -61,7 +62,7 @@ func fixupMetadata(meta usm.ServiceMetadata, lang language.Language) usm.Service // GetServiceName gets the service name based on the command line arguments and // the list of environment variables. -func GetServiceName(cmdline []string, env map[string]string, root string, lang language.Language, contextMap usm.DetectorContextMap) usm.ServiceMetadata { +func GetServiceName(cmdline []string, env envs.Variables, root string, lang language.Language, contextMap usm.DetectorContextMap) usm.ServiceMetadata { fs := usm.NewSubDirFS(root) meta, _ := usm.ExtractServiceMetadata(cmdline, env, fs, lang, contextMap) return fixupMetadata(meta, lang) diff --git a/pkg/collector/corechecks/servicediscovery/servicediscovery.go b/pkg/collector/corechecks/servicediscovery/servicediscovery.go index 1cdd101ebeb1e..9abc7ad4dd45b 100644 --- a/pkg/collector/corechecks/servicediscovery/servicediscovery.go +++ b/pkg/collector/corechecks/servicediscovery/servicediscovery.go @@ -15,11 +15,13 @@ import ( "gopkg.in/yaml.v2" "github.com/DataDog/datadog-agent/comp/core/autodiscovery/integration" + workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def" "github.com/DataDog/datadog-agent/pkg/aggregator/sender" "github.com/DataDog/datadog-agent/pkg/collector/check" "github.com/DataDog/datadog-agent/pkg/collector/corechecks" "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/model" pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" + proccontainers "github.com/DataDog/datadog-agent/pkg/process/util/containers" "github.com/DataDog/datadog-agent/pkg/util/log" "github.com/DataDog/datadog-agent/pkg/util/optional" ) @@ -58,7 +60,7 @@ type osImpl interface { DiscoverServices() (*discoveredServices, error) } -var newOSImpl func(ignoreCfg map[string]bool) (osImpl, error) +var newOSImpl func(ignoreCfg map[string]bool, containerProvider proccontainers.ContainerProvider) (osImpl, error) type config struct { IgnoreProcesses []string `yaml:"ignore_processes"` @@ -79,23 +81,28 @@ type Check struct { os osImpl sender *telemetrySender sentRepeatedEventPIDs map[int]bool + containerProvider proccontainers.ContainerProvider } // Factory creates a new check factory -func Factory() optional.Option[func() check.Check] { +func Factory(store workloadmeta.Component) optional.Option[func() check.Check] { // Since service_discovery is enabled by default, we want to prevent returning an error in Configure() for platforms // where the check is not implemented. Instead of that, we return an empty check. if newOSImpl == nil { return optional.NewNoneOption[func() check.Check]() } - return optional.NewOption(newCheck) + return optional.NewOption(func() check.Check { + return newCheck(proccontainers.GetSharedContainerProvider(store)) + }) } -func newCheck() check.Check { +// TODO: add metastore param +func newCheck(containerProvider proccontainers.ContainerProvider) *Check { return &Check{ CheckBase: corechecks.NewCheckBase(CheckName), cfg: &config{}, sentRepeatedEventPIDs: make(map[int]bool), + containerProvider: containerProvider, } } @@ -122,7 +129,7 @@ func (c *Check) Configure(senderManager sender.SenderManager, _ uint64, instance } c.sender = newTelemetrySender(s) - c.os, err = newOSImpl(ignoreCfg) + c.os, err = newOSImpl(ignoreCfg, c.containerProvider) if err != nil { return err } diff --git a/pkg/collector/corechecks/servicediscovery/usm/jboss_test.go b/pkg/collector/corechecks/servicediscovery/usm/jboss_test.go index cb2bf610d214d..ad9acb9a82334 100644 --- a/pkg/collector/corechecks/servicediscovery/usm/jboss_test.go +++ b/pkg/collector/corechecks/servicediscovery/usm/jboss_test.go @@ -13,6 +13,8 @@ import ( "testing/fstest" "github.com/stretchr/testify/require" + + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/envs" ) func TestJbossExtractServerName(t *testing.T) { @@ -209,7 +211,7 @@ func TestJbossExtractWarContextRoot(t *testing.T) { if len(tt.location) > 0 { memFs[tt.location] = &fstest.MapFile{Data: []byte(tt.jbossWebXML)} } - value, ok := newJbossExtractor(NewDetectionContext(nil, nil, nil)).customExtractWarContextRoot(memFs) + value, ok := newJbossExtractor(NewDetectionContext(nil, envs.NewVariables(nil), nil)).customExtractWarContextRoot(memFs) require.Equal(t, tt.expected, value) require.Equal(t, len(value) > 0, ok) }) @@ -397,10 +399,10 @@ func TestJbossFindDeployedApps(t *testing.T) { t.Run(tt.name, func(t *testing.T) { // A sibling directory is used as PWD since the tests uses relative // paths to the app root (../testdata/a). - envs := map[string]string{ + envsMap := map[string]string{ "PWD": "/sibling", } - value, ok := newJbossExtractor(NewDetectionContext(tt.args, envs, tt.fs)).findDeployedApps(tt.domainHome) + value, ok := newJbossExtractor(NewDetectionContext(tt.args, envs.NewVariables(envsMap), tt.fs)).findDeployedApps(tt.domainHome) require.Equal(t, tt.expected, value) require.Equal(t, len(value) > 0, ok) }) diff --git a/pkg/collector/corechecks/servicediscovery/usm/jee_test.go b/pkg/collector/corechecks/servicediscovery/usm/jee_test.go index cf0e94ac0e06d..8da0f17ceea4c 100644 --- a/pkg/collector/corechecks/servicediscovery/usm/jee_test.go +++ b/pkg/collector/corechecks/servicediscovery/usm/jee_test.go @@ -16,6 +16,8 @@ import ( "testing/fstest" "github.com/stretchr/testify/require" + + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/envs" ) // TestResolveAppServerFromCmdLine tests that vendor can be determined from the process cmdline @@ -110,7 +112,7 @@ com.ibm.wsspi.bootstrap.WSPreLauncher -nosplash -application com.ibm.ws.bootstra for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { cmd := strings.Split(strings.ReplaceAll(tt.rawCmd, "\n", " "), " ") - vendor, home := jeeExtractor{NewDetectionContext(cmd, nil, fstest.MapFS{})}.resolveAppServer() + vendor, home := jeeExtractor{NewDetectionContext(cmd, envs.NewVariables(nil), fstest.MapFS{})}.resolveAppServer() require.Equal(t, tt.expectedVendor, vendor) // the base dir is making sense only when the vendor has been properly understood if tt.expectedVendor != unknown { @@ -240,10 +242,10 @@ func TestWeblogicExtractServiceNamesForJEEServer(t *testing.T) { wlsHomeSysProp + "/wls", wlsServerMainClass, } - envs := map[string]string{ + envsMap := map[string]string{ "PWD": "wls/domain", } - extractor := jeeExtractor{ctx: NewDetectionContext(cmd, envs, memfs)} + extractor := jeeExtractor{ctx: NewDetectionContext(cmd, envs.NewVariables(envsMap), memfs)} extractedContextRoots := extractor.extractServiceNamesForJEEServer() require.Equal(t, []string{ "app1_context", // taken from ear application.xml diff --git a/pkg/collector/corechecks/servicediscovery/usm/laravel_test.go b/pkg/collector/corechecks/servicediscovery/usm/laravel_test.go index 8aa2b2af0e4b5..e3ed5cfef7e00 100644 --- a/pkg/collector/corechecks/servicediscovery/usm/laravel_test.go +++ b/pkg/collector/corechecks/servicediscovery/usm/laravel_test.go @@ -11,6 +11,8 @@ import ( "testing/fstest" "github.com/stretchr/testify/require" + + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/envs" ) func TestGetLaravelAppNameFromEnv(t *testing.T) { @@ -97,7 +99,7 @@ func TestGetLaravelAppNameFromEnv(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - name := newLaravelParser(NewDetectionContext(nil, nil, tt.filesystem)).GetLaravelAppName("artisan") + name := newLaravelParser(NewDetectionContext(nil, envs.NewVariables(nil), tt.filesystem)).GetLaravelAppName("artisan") require.Equal(t, tt.expected, name) }) } diff --git a/pkg/collector/corechecks/servicediscovery/usm/php_test.go b/pkg/collector/corechecks/servicediscovery/usm/php_test.go index dcf9c61921b90..c1abc44df8499 100644 --- a/pkg/collector/corechecks/servicediscovery/usm/php_test.go +++ b/pkg/collector/corechecks/servicediscovery/usm/php_test.go @@ -6,8 +6,11 @@ package usm import ( - "github.com/stretchr/testify/require" "testing" + + "github.com/stretchr/testify/require" + + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/envs" ) func TestServiceNameFromCLI(t *testing.T) { @@ -47,7 +50,7 @@ func TestServiceNameFromCLI(t *testing.T) { expected: "", }, } - instance := &phpDetector{ctx: NewDetectionContext(nil, nil, nil)} + instance := &phpDetector{ctx: NewDetectionContext(nil, envs.NewVariables(nil), nil)} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { value, ok := instance.detect(tt.args) diff --git a/pkg/collector/corechecks/servicediscovery/usm/python_test.go b/pkg/collector/corechecks/servicediscovery/usm/python_test.go index 953e5071cd539..ed1a35b84cf46 100644 --- a/pkg/collector/corechecks/servicediscovery/usm/python_test.go +++ b/pkg/collector/corechecks/servicediscovery/usm/python_test.go @@ -11,6 +11,8 @@ import ( "testing/fstest" "github.com/stretchr/testify/require" + + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/envs" ) func TestPythonDetect(t *testing.T) { @@ -74,7 +76,7 @@ func TestPythonDetect(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - value, ok := newPythonDetector(NewDetectionContext(nil, nil, memFs)).detect(strings.Split(tt.cmd, " ")[1:]) + value, ok := newPythonDetector(NewDetectionContext(nil, envs.NewVariables(nil), memFs)).detect(strings.Split(tt.cmd, " ")[1:]) require.Equal(t, tt.expected, value.Name) require.Equal(t, len(value.Name) > 0, ok) }) diff --git a/pkg/collector/corechecks/servicediscovery/usm/service.go b/pkg/collector/corechecks/servicediscovery/usm/service.go index 36ddc7e804d35..f6b6c1948d945 100644 --- a/pkg/collector/corechecks/servicediscovery/usm/service.go +++ b/pkg/collector/corechecks/servicediscovery/usm/service.go @@ -18,6 +18,7 @@ import ( "strings" "unicode" + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/envs" "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/language" ) @@ -30,9 +31,9 @@ type DetectorContextMap map[int]interface{} // DetectorContextMap keys enum const ( - // The path to the Node service's package.json + // NodePackageJSONPath The path to the Node service's package.json NodePackageJSONPath = iota - // The SubdirFS instance package.json path is valid in. + // ServiceSubFS The SubdirFS instance package.json path is valid in. ServiceSubFS = iota ) @@ -108,13 +109,13 @@ func newDotnetDetector(ctx DetectionContext) detector { // DetectionContext allows to detect ServiceMetadata. type DetectionContext struct { args []string - envs map[string]string + envs envs.Variables fs fs.SubFS contextMap DetectorContextMap } // NewDetectionContext initializes DetectionContext. -func NewDetectionContext(args []string, envs map[string]string, fs fs.SubFS) DetectionContext { +func NewDetectionContext(args []string, envs envs.Variables, fs fs.SubFS) DetectionContext { return DetectionContext{ args: args, envs: envs, @@ -123,12 +124,12 @@ func NewDetectionContext(args []string, envs map[string]string, fs fs.SubFS) Det } // workingDirFromEnvs returns the current working dir extracted from the PWD env -func workingDirFromEnvs(envs map[string]string) (string, bool) { +func workingDirFromEnvs(envs envs.Variables) (string, bool) { return extractEnvVar(envs, "PWD") } -func extractEnvVar(envs map[string]string, name string) (string, bool) { - value, ok := envs[name] +func extractEnvVar(envs envs.Variables, name string) (string, bool) { + value, ok := envs.Get(name) if !ok { return "", false } @@ -184,8 +185,8 @@ var executableDetectors = map[string]detectorCreatorFn{ "gunicorn": newGunicornDetector, } -func serviceNameInjected(envs map[string]string) bool { - if env, ok := envs["DD_INJECTION_ENABLED"]; ok { +func serviceNameInjected(envs envs.Variables) bool { + if env, ok := envs.Get("DD_INJECTION_ENABLED"); ok { values := strings.Split(env, ",") for _, v := range values { if v == "service_name" { @@ -197,7 +198,7 @@ func serviceNameInjected(envs map[string]string) bool { } // ExtractServiceMetadata attempts to detect ServiceMetadata from the given process. -func ExtractServiceMetadata(args []string, envs map[string]string, fs fs.SubFS, lang language.Language, contextMap DetectorContextMap) (metadata ServiceMetadata, success bool) { +func ExtractServiceMetadata(args []string, envs envs.Variables, fs fs.SubFS, lang language.Language, contextMap DetectorContextMap) (metadata ServiceMetadata, success bool) { dc := DetectionContext{ args: args, envs: envs, @@ -330,11 +331,11 @@ func normalizeExeName(exe string) string { // chooseServiceNameFromEnvs extracts the service name from usual tracer env variables (DD_SERVICE, DD_TAGS). // returns the service name, true if found, otherwise "", false -func chooseServiceNameFromEnvs(envs map[string]string) (string, bool) { - if val, ok := envs["DD_SERVICE"]; ok { +func chooseServiceNameFromEnvs(envs envs.Variables) (string, bool) { + if val, ok := envs.Get("DD_SERVICE"); ok { return val, true } - if val, ok := envs["DD_TAGS"]; ok && strings.Contains(val, "service:") { + if val, ok := envs.Get("DD_TAGS"); ok && strings.Contains(val, "service:") { parts := strings.Split(val, ",") for _, p := range parts { if strings.HasPrefix(p, "service:") { diff --git a/pkg/collector/corechecks/servicediscovery/usm/service_test.go b/pkg/collector/corechecks/servicediscovery/usm/service_test.go index d3e4f2df2b6a3..ea35911d3a575 100644 --- a/pkg/collector/corechecks/servicediscovery/usm/service_test.go +++ b/pkg/collector/corechecks/servicediscovery/usm/service_test.go @@ -18,6 +18,7 @@ import ( "github.com/stretchr/testify/require" + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/envs" "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/language" "github.com/DataDog/datadog-agent/pkg/network/protocols/http/testutil" ) @@ -623,7 +624,7 @@ func TestExtractServiceMetadata(t *testing.T) { if tt.fs != nil { fs = *tt.fs } - meta, ok := ExtractServiceMetadata(tt.cmdline, tt.envs, fs, tt.lang, make(DetectorContextMap)) + meta, ok := ExtractServiceMetadata(tt.cmdline, envs.NewVariables(tt.envs), fs, tt.lang, make(DetectorContextMap)) if len(tt.expectedGeneratedName) == 0 && len(tt.expectedDDService) == 0 { require.False(t, ok) } else { diff --git a/pkg/collector/corechecks/servicediscovery/usm/spring.go b/pkg/collector/corechecks/servicediscovery/usm/spring.go index 73a6048758ebf..ccce818dcc1a6 100644 --- a/pkg/collector/corechecks/servicediscovery/usm/spring.go +++ b/pkg/collector/corechecks/servicediscovery/usm/spring.go @@ -17,6 +17,7 @@ import ( "github.com/rickar/props" "github.com/vibrantbyte/go-antpath/antpath" + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/envs" "github.com/DataDog/datadog-agent/pkg/util/log" ) @@ -82,8 +83,8 @@ func (y *environmentSource) Get(key string) (string, bool) { func (y *environmentSource) GetDefault(key string, defVal string) string { return y.m.GetDefault(strings.Map(normalizeEnv, key), defVal) } -func newEnvironmentSource(envs map[string]string) props.PropertyGetter { - return &environmentSource{m: &mapSource{m: envs}} +func newEnvironmentSource(envs envs.Variables) props.PropertyGetter { + return &environmentSource{m: &envs} } // normalizeEnv converts a rune into a suitable replacement for an environment variable name. diff --git a/pkg/collector/corechecks/servicediscovery/usm/spring_test.go b/pkg/collector/corechecks/servicediscovery/usm/spring_test.go index 78c1f75b539d4..8ef3a94d3955b 100644 --- a/pkg/collector/corechecks/servicediscovery/usm/spring_test.go +++ b/pkg/collector/corechecks/servicediscovery/usm/spring_test.go @@ -17,6 +17,8 @@ import ( "testing/fstest" "github.com/stretchr/testify/require" + + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/envs" ) func TestIsSpringBootArchive(t *testing.T) { @@ -118,7 +120,7 @@ func TestParseUri(t *testing.T) { expectedClassPathLocations: map[string][]string{}, }, } - parser := newSpringBootParser(NewDetectionContext(nil, nil, fstest.MapFS(nil))) + parser := newSpringBootParser(NewDetectionContext(nil, envs.NewVariables(nil), fstest.MapFS(nil))) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { fsLocs, cpLocs := parser.parseURI(strings.Split(tt.locations, ";"), tt.configName, tt.profiles, tt.cwd) @@ -212,7 +214,7 @@ func TestScanSourcesFromFileSystem(t *testing.T) { full, err := filepath.Abs("testdata/root") require.NoError(t, err) sub := NewSubDirFS(full) - parser := newSpringBootParser(NewDetectionContext(nil, nil, sub)) + parser := newSpringBootParser(NewDetectionContext(nil, envs.NewVariables(nil), sub)) fileSources := parser.scanSourcesFromFileSystem(map[string][]string{ "fs": { @@ -397,7 +399,7 @@ func TestExtractServiceMetadataSpringBoot(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - app, ok := newSpringBootParser(NewDetectionContext(tt.cmdline, tt.envs, RealFs{})).GetSpringBootAppName(tt.jarname) + app, ok := newSpringBootParser(NewDetectionContext(tt.cmdline, envs.NewVariables(tt.envs), RealFs{})).GetSpringBootAppName(tt.jarname) require.Equal(t, tt.expected, app) require.Equal(t, len(app) > 0, ok) }) diff --git a/pkg/collector/corechecks/servicediscovery/usm/tomcat_test.go b/pkg/collector/corechecks/servicediscovery/usm/tomcat_test.go index e28d630f0bfbd..8340314edc5e8 100644 --- a/pkg/collector/corechecks/servicediscovery/usm/tomcat_test.go +++ b/pkg/collector/corechecks/servicediscovery/usm/tomcat_test.go @@ -11,6 +11,8 @@ import ( "testing/fstest" "github.com/stretchr/testify/require" + + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/envs" ) func TestTomcatDefaultContextRootFromFile(t *testing.T) { @@ -47,7 +49,7 @@ func TestTomcatDefaultContextRootFromFile(t *testing.T) { expected: "", }, } - extractor := newTomcatExtractor(NewDetectionContext(nil, nil, nil)) + extractor := newTomcatExtractor(NewDetectionContext(nil, envs.NewVariables(nil), nil)) for _, tt := range tests { t.Run("Should parse "+tt.filename, func(t *testing.T) { value, ok := extractor.defaultContextRootFromFile(tt.filename) @@ -92,7 +94,7 @@ func TestScanDirForDeployments(t *testing.T) { }, }, } - extractor := tomcatExtractor{ctx: NewDetectionContext(nil, nil, memfs)} + extractor := tomcatExtractor{ctx: NewDetectionContext(nil, envs.NewVariables(nil), memfs)} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { deployments := extractor.scanDirForDeployments(tt.path, &map[string]struct{}{ @@ -169,7 +171,7 @@ func TestFindDeployedApps(t *testing.T) { } for _, tt := range tests { - extractor := tomcatExtractor{ctx: NewDetectionContext(nil, nil, tt.fs)} + extractor := tomcatExtractor{ctx: NewDetectionContext(nil, envs.NewVariables(nil), tt.fs)} deployments, ok := extractor.findDeployedApps(tt.domainHome) require.Equal(t, len(tt.expected) > 0, ok) require.Equal(t, tt.expected, deployments) diff --git a/pkg/collector/corechecks/servicediscovery/usm/weblogic_nix_test.go b/pkg/collector/corechecks/servicediscovery/usm/weblogic_nix_test.go index 70866b660f3af..047621d8c53bb 100644 --- a/pkg/collector/corechecks/servicediscovery/usm/weblogic_nix_test.go +++ b/pkg/collector/corechecks/servicediscovery/usm/weblogic_nix_test.go @@ -17,6 +17,8 @@ import ( "testing/fstest" "github.com/stretchr/testify/require" + + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/envs" ) // TestWeblogicFindDeployedApps tests the ability to extract deployed application from a weblogic config.xml @@ -75,7 +77,7 @@ func TestWeblogicFindDeployedApps(t *testing.T) { if len(tt.serverName) > 0 { args = append(args, wlsServerNameSysProp+tt.serverName) } - value, ok := weblogicExtractor{ctx: NewDetectionContext(args, nil, tt.fs)}.findDeployedApps(tt.domainHome) + value, ok := weblogicExtractor{ctx: NewDetectionContext(args, envs.NewVariables(nil), tt.fs)}.findDeployedApps(tt.domainHome) require.Equal(t, len(value) > 0, ok) require.Equal(t, tt.expected, value) }) @@ -133,7 +135,7 @@ http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">inva // now create a zip reader to pass to the tested function reader, err := zip.NewReader(bytes.NewReader(buf.Bytes()), int64(buf.Len())) require.NoError(t, err) - value, ok := newWeblogicExtractor(NewDetectionContext(nil, nil, nil)).customExtractWarContextRoot(reader) + value, ok := newWeblogicExtractor(NewDetectionContext(nil, envs.NewVariables(nil), nil)).customExtractWarContextRoot(reader) require.Equal(t, len(tt.expected) > 0, ok) require.Equal(t, tt.expected, value) }) @@ -146,7 +148,7 @@ func TestWeblogicExtractExplodedWarContextRoot(t *testing.T) { cwd, err := os.Getwd() require.NoError(t, err) fs := os.DirFS(path.Join(cwd, "../../../../discovery/testdata/root/testdata/b", "test.war")) - value, ok := newWeblogicExtractor(NewDetectionContext(nil, nil, nil)).customExtractWarContextRoot(fs) + value, ok := newWeblogicExtractor(NewDetectionContext(nil, envs.NewVariables(nil), nil)).customExtractWarContextRoot(fs) require.True(t, ok) require.Equal(t, "my_context", value) } diff --git a/pkg/collector/corechecks/servicediscovery/usm/websphere_test.go b/pkg/collector/corechecks/servicediscovery/usm/websphere_test.go index fd7a476d8eb9f..ee3d45c59753f 100644 --- a/pkg/collector/corechecks/servicediscovery/usm/websphere_test.go +++ b/pkg/collector/corechecks/servicediscovery/usm/websphere_test.go @@ -11,6 +11,8 @@ import ( "testing/fstest" "github.com/stretchr/testify/require" + + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/envs" ) func TestWebsphereFindDeployedApps(t *testing.T) { @@ -110,7 +112,7 @@ func TestWebsphereFindDeployedApps(t *testing.T) { &fstest.MapFile{Data: []byte(tt.deploymentXML)} } - value, ok := newWebsphereExtractor(NewDetectionContext(tt.args, nil, fs)).findDeployedApps("base") + value, ok := newWebsphereExtractor(NewDetectionContext(tt.args, envs.NewVariables(nil), fs)).findDeployedApps("base") require.Equal(t, tt.expected, value) require.Equal(t, len(value) > 0, ok) }) @@ -118,7 +120,7 @@ func TestWebsphereFindDeployedApps(t *testing.T) { } func TestWebsphereDefaultContextRootFromFile(t *testing.T) { - value, ok := newWebsphereExtractor(NewDetectionContext(nil, nil, nil)).defaultContextRootFromFile("myapp.war") + value, ok := newWebsphereExtractor(NewDetectionContext(nil, envs.NewVariables(nil), nil)).defaultContextRootFromFile("myapp.war") require.Equal(t, "myapp", value) require.True(t, ok) } diff --git a/pkg/collector/corechecks/system/wincrashdetect/probe/crashparse.go b/pkg/collector/corechecks/system/wincrashdetect/probe/crashparse.go index c4fb188d2e5d2..38fe8119ba9cd 100644 --- a/pkg/collector/corechecks/system/wincrashdetect/probe/crashparse.go +++ b/pkg/collector/corechecks/system/wincrashdetect/probe/crashparse.go @@ -23,6 +23,7 @@ import ( // allow us to change for testing var readfn = doReadCrashDump +var parseCrashDump = parseWinCrashDump type logCallbackContext struct { loglines []string @@ -107,14 +108,14 @@ func doReadCrashDump(filename string, ctx *logCallbackContext, exterr *uint32) e return nil } -func parseCrashDump(wcs *WinCrashStatus) { +func parseWinCrashDump(wcs *WinCrashStatus) { var ctx logCallbackContext var extendedError uint32 err := readfn(wcs.FileName, &ctx, &extendedError) if err != nil { - wcs.Success = false + wcs.StatusCode = WinCrashStatusCodeFailed wcs.ErrString = fmt.Sprintf("Failed to load crash dump file %v %x", err, extendedError) log.Errorf("Failed to open crash dump %s: %v %x", wcs.FileName, err, extendedError) return @@ -122,7 +123,7 @@ func parseCrashDump(wcs *WinCrashStatus) { if len(ctx.loglines) < 2 { wcs.ErrString = fmt.Sprintf("Invalid crash dump file %s", wcs.FileName) - wcs.Success = false + wcs.StatusCode = WinCrashStatusCodeFailed return } @@ -190,5 +191,5 @@ func parseCrashDump(wcs *WinCrashStatus) { wcs.Offender = callsite break } - wcs.Success = true + wcs.StatusCode = WinCrashStatusCodeSuccess } diff --git a/pkg/collector/corechecks/system/wincrashdetect/probe/crashparse_test.go b/pkg/collector/corechecks/system/wincrashdetect/probe/crashparse_test.go index 161b3b6068119..2efd8d5f21781 100644 --- a/pkg/collector/corechecks/system/wincrashdetect/probe/crashparse_test.go +++ b/pkg/collector/corechecks/system/wincrashdetect/probe/crashparse_test.go @@ -51,12 +51,11 @@ func TestCrashParser(t *testing.T) { FileName: "testdata/crashsample1.txt", } // first read in the sample data - - readfn = testCrashReader + OverrideCrashDumpReader(testCrashReader) parseCrashDump(wcs) - assert.True(t, wcs.Success) + assert.Equal(t, WinCrashStatusCodeSuccess, wcs.StatusCode) assert.Empty(t, wcs.ErrString) assert.Equal(t, "Mon Jun 26 20:44:49.742 2023 (UTC - 7:00)", wcs.DateString) before, _, _ := strings.Cut(wcs.Offender, "+") @@ -72,11 +71,11 @@ func TestCrashParserWithLineSplits(t *testing.T) { } // first read in the sample data - readfn = testCrashReaderWithLineSplits + OverrideCrashDumpReader(testCrashReaderWithLineSplits) parseCrashDump(wcs) - assert.True(t, wcs.Success) + assert.Equal(t, WinCrashStatusCodeSuccess, wcs.StatusCode) assert.Empty(t, wcs.ErrString) assert.Equal(t, "Mon Jun 26 20:44:49.742 2023 (UTC - 7:00)", wcs.DateString) before, _, _ := strings.Cut(wcs.Offender, "+") diff --git a/pkg/collector/corechecks/system/wincrashdetect/probe/win_crash_types.go b/pkg/collector/corechecks/system/wincrashdetect/probe/win_crash_types.go index 5fac5c9853b17..a1a36691be08a 100644 --- a/pkg/collector/corechecks/system/wincrashdetect/probe/win_crash_types.go +++ b/pkg/collector/corechecks/system/wincrashdetect/probe/win_crash_types.go @@ -29,10 +29,26 @@ const ( DumpTypeAutomatic = int(7) // automatic ) +const ( + // WinCrashStatusCodeUnknown indicates an invalid or corrupted code. + WinCrashStatusCodeUnknown = int(-1) + + // WinCrashStatusCodeSuccess indicates that crash dump processing succeeded + // or no crash dump was found. + WinCrashStatusCodeSuccess = int(0) + + // WinCrashStatusCodeBusy indicates that crash dump processing is still busy + // and no result is yet available. + WinCrashStatusCodeBusy = int(1) + + // WinCrashStatusCodeFailed indicates that crash dump processing failed or had an error. + WinCrashStatusCodeFailed = int(2) +) + // WinCrashStatus defines all of the information returned from the system // probe to the caller type WinCrashStatus struct { - Success bool `json:"success"` + StatusCode int `json:"statuscode"` ErrString string `json:"errstring"` FileName string `json:"filename"` Type int `json:"dumptype"` diff --git a/pkg/collector/corechecks/system/wincrashdetect/probe/wincrash_testutil.go b/pkg/collector/corechecks/system/wincrashdetect/probe/wincrash_testutil.go new file mode 100644 index 0000000000000..c2f52b0071589 --- /dev/null +++ b/pkg/collector/corechecks/system/wincrashdetect/probe/wincrash_testutil.go @@ -0,0 +1,26 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +//go:build test && windows + +package probe + +type readCrashDumpType func(filename string, ctx *logCallbackContext, _ *uint32) error +type parseCrashDumpType func(wcs *WinCrashStatus) + +// SetCachedSettings sets the settings used for tests without reading the Registry. +func (p *WinCrashProbe) SetCachedSettings(wcs *WinCrashStatus) { + p.status = wcs +} + +// OverrideCrashDumpReader relpaces the crash dump reading function for tests. +func OverrideCrashDumpReader(customCrashReader readCrashDumpType) { + readfn = customCrashReader +} + +// OverrideCrashDumpParser relpaces the crash dump parsing function for tests. +func OverrideCrashDumpParser(customParseCrashDump parseCrashDumpType) { + parseCrashDump = customParseCrashDump +} diff --git a/pkg/collector/corechecks/system/wincrashdetect/probe/wincrashprobe.go b/pkg/collector/corechecks/system/wincrashdetect/probe/wincrashprobe.go index 1d75c514142df..533cfcc2c431b 100644 --- a/pkg/collector/corechecks/system/wincrashdetect/probe/wincrashprobe.go +++ b/pkg/collector/corechecks/system/wincrashdetect/probe/wincrashprobe.go @@ -11,38 +11,126 @@ import ( "fmt" "os" "path/filepath" + "sync" sysconfigtypes "github.com/DataDog/datadog-agent/cmd/system-probe/config/types" "github.com/DataDog/datadog-agent/pkg/util/winutil" "golang.org/x/sys/windows/registry" ) +type probeState uint32 + +const ( + // Idle indicates that the probe is waiting for a request + idle probeState = iota + + // Busy indicates that the probe is currently processing a crash dump + busy + + // Completed indicates that the probe finished processing a crash dump. + completed + + // Failed indicates that the probe failed to process a crash dump. + failed +) + // WinCrashProbe has no stored state. type WinCrashProbe struct { + state probeState + status *WinCrashStatus + mu sync.Mutex } // NewWinCrashProbe returns an initialized WinCrashProbe func NewWinCrashProbe(_ *sysconfigtypes.Config) (*WinCrashProbe, error) { - return &WinCrashProbe{}, nil + return &WinCrashProbe{ + state: idle, + status: nil, + }, nil +} + +// Handles crash dump parsing in a separate thread since this may take very long. +func (p *WinCrashProbe) parseCrashDumpAsync() { + if p.status == nil { + p.state = failed + return + } + + parseCrashDump(p.status) + + p.mu.Lock() + defer p.mu.Unlock() + p.state = completed } // Get returns the current crash, if any func (p *WinCrashProbe) Get() *WinCrashStatus { wcs := &WinCrashStatus{} - err := wcs.getCurrentCrashSettings() - if err != nil { - wcs.ErrString = err.Error() - wcs.Success = false - return wcs - } + // Nothing in this method should take long. + p.mu.Lock() + defer p.mu.Unlock() + + switch p.state { + case idle: + if p.status == nil { + // This is a new request. + err := wcs.getCurrentCrashSettings() + if err != nil { + wcs.ErrString = err.Error() + wcs.StatusCode = WinCrashStatusCodeFailed + } + } else { + // Use cached settings, set by tests. + // Make a copy to avoid side-effect modifications. + *wcs = *(p.status) + } - if len(wcs.FileName) == 0 { - // no filename means no crash dump - wcs.Success = true // we succeeded - return wcs + // Transition to the next state. + if wcs.StatusCode == WinCrashStatusCodeFailed { + // Only try once and cache the failure. + p.status = wcs + p.state = failed + } else if len(wcs.FileName) == 0 { + // No filename means no crash dump + p.status = wcs + p.state = completed + wcs.StatusCode = WinCrashStatusCodeSuccess + } else { + // Kick off the crash dump processing asynchronously. + // The crash dump may be very large and we should not block for a response. + p.state = busy + wcs.StatusCode = WinCrashStatusCodeBusy + + // Make a new copy of the wcs for async processing while returning "Busy" + // for the current response. + p.status = &WinCrashStatus{ + FileName: wcs.FileName, + Type: wcs.Type, + } + + go p.parseCrashDumpAsync() + } + + case busy: + // The crash dump processing is not done yet. Reply busy. + if p.status != nil { + wcs.FileName = p.status.FileName + wcs.Type = p.status.Type + } + wcs.StatusCode = WinCrashStatusCodeBusy + + case failed: + fallthrough + case completed: + // The crash dump processing was done, return the result. + if p.status != nil { + // This result is cached for all subsequent queries. + wcs = p.status + } else { + wcs.StatusCode = WinCrashStatusCodeFailed + } } - parseCrashDump(wcs) return wcs } diff --git a/pkg/collector/corechecks/system/wincrashdetect/wincrashdetect_windows_test.go b/pkg/collector/corechecks/system/wincrashdetect/wincrashdetect_windows_test.go index ffb9ce3647dbc..ff1cdb0ced1c8 100644 --- a/pkg/collector/corechecks/system/wincrashdetect/wincrashdetect_windows_test.go +++ b/pkg/collector/corechecks/system/wincrashdetect/wincrashdetect_windows_test.go @@ -10,11 +10,10 @@ package wincrashdetect import ( "net" "net/http" - - //"strings" + "sync" "testing" + "time" - //"github.com/stretchr/testify/require" "github.com/stretchr/testify/assert" "github.com/DataDog/datadog-agent/cmd/system-probe/utils" @@ -108,7 +107,7 @@ func TestWinCrashReporting(t *testing.T) { // set the return value handled in the check handler above p = &probe.WinCrashStatus{ - Success: true, + StatusCode: probe.WinCrashStatusCodeSuccess, } check := newCheck() @@ -128,7 +127,7 @@ func TestWinCrashReporting(t *testing.T) { testSetup(t) defer testCleanup() p = &probe.WinCrashStatus{ - Success: true, + StatusCode: probe.WinCrashStatusCodeSuccess, FileName: `c:\windows\memory.dmp`, Type: probe.DumpTypeAutomatic, DateString: `Fri Jun 30 15:33:05.086 2023 (UTC - 7:00)`, @@ -201,3 +200,163 @@ func TestWinCrashReporting(t *testing.T) { mock.AssertNumberOfCalls(t, "Commit", 2) }) } + +func TestCrashReportingStates(t *testing.T) { + var crashStatus *probe.WinCrashStatus + + listener, closefunc := createSystemProbeListener() + defer closefunc() + + pkgconfigsetup.InitSystemProbeConfig(pkgconfigsetup.SystemProbe()) + + mux := http.NewServeMux() + server := http.Server{ + Handler: mux, + } + defer server.Close() + + cp, err := probe.NewWinCrashProbe(nil) + assert.NotNil(t, cp) + assert.Nil(t, err) + + wg := sync.WaitGroup{} + + // This will artificially delay the "parsing" to ensure the first check gets a "busy" status. + delayedCrashDumpParser := func(wcs *probe.WinCrashStatus) { + time.Sleep(4 * time.Second) + + assert.Equal(t, `c:\windows\memory.dmp`, wcs.FileName) + assert.Equal(t, probe.DumpTypeAutomatic, wcs.Type) + + wcs.StatusCode = probe.WinCrashStatusCodeSuccess + wcs.ErrString = crashStatus.ErrString + wcs.DateString = crashStatus.DateString + wcs.Offender = crashStatus.Offender + wcs.BugCheck = crashStatus.BugCheck + + // Signal that the artificial delay is done. + wg.Done() + } + + // This ensures that no crash dump parsing should happen. + noCrashDumpParser := func(_ *probe.WinCrashStatus) { + assert.FailNow(t, "Should not parse") + } + + mux.Handle("/windows_crash_detection/check", http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) { + results := cp.Get() + utils.WriteAsJSON(rw, results) + })) + mux.Handle("/debug/stats", http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) { + })) + go server.Serve(listener) + + t.Run("test reporting a crash with a busy intermediate state", func(t *testing.T) { + testSetup(t) + defer testCleanup() + + check := newCheck() + crashCheck := check.(*WinCrashDetect) + mock := mocksender.NewMockSender(crashCheck.ID()) + err := crashCheck.Configure(mock.GetSenderManager(), 0, nil, nil, "") + assert.NoError(t, err) + + crashStatus = &probe.WinCrashStatus{ + StatusCode: probe.WinCrashStatusCodeSuccess, + FileName: `c:\windows\memory.dmp`, + Type: probe.DumpTypeAutomatic, + ErrString: "", + DateString: `Fri Jun 30 15:33:05.086 2023 (UTC - 7:00)`, + Offender: `somedriver.sys`, + BugCheck: "0x00000007", + } + + // Test the 2-check response from crash reporting. + cp.SetCachedSettings(crashStatus) + probe.OverrideCrashDumpParser(delayedCrashDumpParser) + + // First run should be "busy" and not return an event yet. + wg.Add(1) + err = crashCheck.Run() + assert.Nil(t, err) + mock.AssertNumberOfCalls(t, "Gauge", 0) + mock.AssertNumberOfCalls(t, "Rate", 0) + mock.AssertNumberOfCalls(t, "Event", 0) + mock.AssertNumberOfCalls(t, "Commit", 0) + + // Wait for the artificial delay to finish, plus a small time buffer. + wg.Wait() + time.Sleep(4 * time.Second) + + expected := event.Event{ + Priority: event.PriorityNormal, + SourceTypeName: CheckName, + EventType: CheckName, + AlertType: event.AlertTypeError, + Title: formatTitle(crashStatus), + Text: formatText(crashStatus), + } + + mock.On("Event", expected).Return().Times(1) + mock.On("Commit").Return().Times(1) + + // The result should be available now. + err = crashCheck.Run() + assert.Nil(t, err) + mock.AssertNumberOfCalls(t, "Gauge", 0) + mock.AssertNumberOfCalls(t, "Rate", 0) + mock.AssertNumberOfCalls(t, "Event", 1) + mock.AssertNumberOfCalls(t, "Commit", 1) + }) + + t.Run("test that no crash is reported", func(t *testing.T) { + testSetup(t) + defer testCleanup() + + check := newCheck() + crashCheck := check.(*WinCrashDetect) + mock := mocksender.NewMockSender(crashCheck.ID()) + err := crashCheck.Configure(mock.GetSenderManager(), 0, nil, nil, "") + assert.NoError(t, err) + + noCrashStatus := &probe.WinCrashStatus{ + StatusCode: probe.WinCrashStatusCodeSuccess, + FileName: "", + } + + // Test finding no crashes. The response should be immediate. + cp.SetCachedSettings(noCrashStatus) + probe.OverrideCrashDumpParser(noCrashDumpParser) + err = crashCheck.Run() + assert.Nil(t, err) + mock.AssertNumberOfCalls(t, "Gauge", 0) + mock.AssertNumberOfCalls(t, "Rate", 0) + mock.AssertNumberOfCalls(t, "Event", 0) + mock.AssertNumberOfCalls(t, "Commit", 0) + }) + + t.Run("test failure on reading crash settings", func(t *testing.T) { + testSetup(t) + defer testCleanup() + + check := newCheck() + crashCheck := check.(*WinCrashDetect) + mock := mocksender.NewMockSender(crashCheck.ID()) + err := crashCheck.Configure(mock.GetSenderManager(), 0, nil, nil, "") + assert.NoError(t, err) + + failedStatus := &probe.WinCrashStatus{ + StatusCode: probe.WinCrashStatusCodeFailed, + ErrString: "Mocked failure", + } + + // Test having a failure reading setings. The response should be immediate. + cp.SetCachedSettings(failedStatus) + probe.OverrideCrashDumpParser(noCrashDumpParser) + err = crashCheck.Run() + assert.NotNil(t, err) + mock.AssertNumberOfCalls(t, "Rate", 0) + mock.AssertNumberOfCalls(t, "Event", 0) + mock.AssertNumberOfCalls(t, "Commit", 0) + }) +} diff --git a/pkg/collector/python/init.go b/pkg/collector/python/init.go index 7188952a425a5..3bbd1102c2bc6 100644 --- a/pkg/collector/python/init.go +++ b/pkg/collector/python/init.go @@ -205,7 +205,6 @@ var ( PythonVersion = "" // The pythonHome variable typically comes from -ldflags // it's needed in case the agent was built using embedded libs - pythonHome2 = "" pythonHome3 = "" // PythonHome contains the computed value of the Python Home path once the // intepreter is created. It might be empty in case the interpreter wasn't @@ -303,7 +302,7 @@ func pathToBinary(name string, ignoreErrors bool) (string, error) { return absPath, nil } -func resolvePythonExecPath(pythonVersion string, ignoreErrors bool) (string, error) { +func resolvePythonExecPath(ignoreErrors bool) (string, error) { // Since the install location can be set by the user on Windows we use relative import if runtime.GOOS == "windows" { _here, err := executable.Folder() @@ -317,18 +316,12 @@ func resolvePythonExecPath(pythonVersion string, ignoreErrors bool) (string, err } log.Debugf("Executable folder is %v", _here) - embeddedPythonHome2 := filepath.Join(_here, "..", "embedded2") embeddedPythonHome3 := filepath.Join(_here, "..", "embedded3") // We want to use the path-relative embedded2/3 directories above by default. // They will be correct for normal installation on Windows. However, if they // are not present for cases like running unit tests, fall back to the compile // time values. - if _, err := os.Stat(embeddedPythonHome2); os.IsNotExist(err) { - log.Warnf("Relative embedded directory not found for Python 2. Using default: %s", pythonHome2) - } else { - pythonHome2 = embeddedPythonHome2 - } if _, err := os.Stat(embeddedPythonHome3); os.IsNotExist(err) { log.Warnf("Relative embedded directory not found for Python 3. Using default: %s", pythonHome3) } else { @@ -336,11 +329,7 @@ func resolvePythonExecPath(pythonVersion string, ignoreErrors bool) (string, err } } - if pythonVersion == "2" { - PythonHome = pythonHome2 - } else if pythonVersion == "3" { - PythonHome = pythonHome3 - } + PythonHome = pythonHome3 log.Infof("Using '%s' as Python home", PythonHome) @@ -361,7 +350,7 @@ func resolvePythonExecPath(pythonVersion string, ignoreErrors bool) (string, err // don't want to use the default version (aka "python") but rather "python2" or // "python3" based on the configuration. Also on some Python3 platforms there // are no "python" aliases either. - interpreterBasename := "python" + pythonVersion + interpreterBasename := "python3" // If we are in a development env or just the ldflags haven't been set, the PythonHome // variable won't be set so what we do here is to just find out where our current @@ -393,7 +382,7 @@ func Initialize(paths ...string) error { } // Note: pythonBinPath is a module-level var - pythonBinPath, err := resolvePythonExecPath(pythonVersion, allowPathHeuristicsFailure) + pythonBinPath, err := resolvePythonExecPath(allowPathHeuristicsFailure) if err != nil { return err } @@ -407,10 +396,7 @@ func Initialize(paths ...string) error { csPythonExecPath := TrackedCString(pythonBinPath) defer C._free(unsafe.Pointer(csPythonExecPath)) - if pythonVersion == "2" { - log.Infof("Initializing rtloader with Python 2 %s", PythonHome) - rtloader = C.make2(csPythonHome, csPythonExecPath, &pyErr) - } else if pythonVersion == "3" { + if pythonVersion == "3" { log.Infof("Initializing rtloader with Python 3 %s", PythonHome) rtloader = C.make3(csPythonHome, csPythonExecPath, &pyErr) } else { diff --git a/pkg/collector/python/test_util.go b/pkg/collector/python/test_util.go index 2f4404694c939..02ffca4587210 100644 --- a/pkg/collector/python/test_util.go +++ b/pkg/collector/python/test_util.go @@ -59,7 +59,7 @@ func testGetSubprocessOutputUnknownBin(t *testing.T) { assert.Equal(t, "", C.GoString(cStdout)) assert.Equal(t, "", C.GoString(cStderr)) assert.Equal(t, C.int(0), cRetCode) - assert.NotNil(t, exception) + assert.Nil(t, exception) } func testGetSubprocessOutputError(t *testing.T) { diff --git a/pkg/collector/python/util.go b/pkg/collector/python/util.go index 4d66ae653c8c2..8486cc7c74117 100644 --- a/pkg/collector/python/util.go +++ b/pkg/collector/python/util.go @@ -68,11 +68,7 @@ func GetSubprocessOutput(argv **C.char, env **C.char, cStdout **C.char, cStderr outputErr, _ = io.ReadAll(stderr) }() - err = cmd.Start() - if err != nil { - *exception = TrackedCString(fmt.Sprintf("internal error starting subprocess: %v", err)) - return - } + cmd.Start() //nolint:errcheck // Wait for the pipes to be closed *before* waiting for the cmd to exit, as per os.exec docs wg.Wait() diff --git a/pkg/commonchecks/corechecks.go b/pkg/commonchecks/corechecks.go index be3a206d35340..f4719c58ba0e6 100644 --- a/pkg/commonchecks/corechecks.go +++ b/pkg/commonchecks/corechecks.go @@ -8,6 +8,7 @@ package commonchecks import ( "github.com/DataDog/datadog-agent/comp/core/config" + "github.com/DataDog/datadog-agent/comp/core/tagger" "github.com/DataDog/datadog-agent/comp/core/telemetry" workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def" corecheckLoader "github.com/DataDog/datadog-agent/pkg/collector/corechecks" @@ -27,6 +28,7 @@ import ( "github.com/DataDog/datadog-agent/pkg/collector/corechecks/ebpf/tcpqueuelength" "github.com/DataDog/datadog-agent/pkg/collector/corechecks/embed/apm" "github.com/DataDog/datadog-agent/pkg/collector/corechecks/embed/process" + "github.com/DataDog/datadog-agent/pkg/collector/corechecks/gpu" "github.com/DataDog/datadog-agent/pkg/collector/corechecks/net/network" "github.com/DataDog/datadog-agent/pkg/collector/corechecks/net/ntp" ciscosdwan "github.com/DataDog/datadog-agent/pkg/collector/corechecks/network-devices/cisco-sdwan" @@ -53,7 +55,7 @@ import ( ) // RegisterChecks registers all core checks -func RegisterChecks(store workloadmeta.Component, cfg config.Component, telemetry telemetry.Component) { +func RegisterChecks(store workloadmeta.Component, tagger tagger.Component, cfg config.Component, telemetry telemetry.Component) { // Required checks corecheckLoader.RegisterCheck(cpu.CheckName, cpu.Factory()) corecheckLoader.RegisterCheck(memory.CheckName, memory.Factory()) @@ -70,11 +72,12 @@ func RegisterChecks(store workloadmeta.Component, cfg config.Component, telemetr // Flavor specific checks corecheckLoader.RegisterCheck(load.CheckName, load.Factory()) - corecheckLoader.RegisterCheck(kubernetesapiserver.CheckName, kubernetesapiserver.Factory()) + corecheckLoader.RegisterCheck(kubernetesapiserver.CheckName, kubernetesapiserver.Factory(tagger)) corecheckLoader.RegisterCheck(ksm.CheckName, ksm.Factory()) corecheckLoader.RegisterCheck(helm.CheckName, helm.Factory()) corecheckLoader.RegisterCheck(pod.CheckName, pod.Factory(store, cfg)) corecheckLoader.RegisterCheck(ebpf.CheckName, ebpf.Factory()) + corecheckLoader.RegisterCheck(gpu.CheckName, gpu.Factory()) corecheckLoader.RegisterCheck(ecs.CheckName, ecs.Factory(store)) corecheckLoader.RegisterCheck(oomkill.CheckName, oomkill.Factory()) corecheckLoader.RegisterCheck(tcpqueuelength.CheckName, tcpqueuelength.Factory()) @@ -96,5 +99,5 @@ func RegisterChecks(store workloadmeta.Component, cfg config.Component, telemetr corecheckLoader.RegisterCheck(containerd.CheckName, containerd.Factory(store)) corecheckLoader.RegisterCheck(cri.CheckName, cri.Factory(store)) corecheckLoader.RegisterCheck(ciscosdwan.CheckName, ciscosdwan.Factory()) - corecheckLoader.RegisterCheck(servicediscovery.CheckName, servicediscovery.Factory()) + corecheckLoader.RegisterCheck(servicediscovery.CheckName, servicediscovery.Factory(store)) } diff --git a/pkg/compliance/agent.go b/pkg/compliance/agent.go index 1c73f1b3f5321..801a94638cc73 100644 --- a/pkg/compliance/agent.go +++ b/pkg/compliance/agent.go @@ -133,6 +133,15 @@ func xccdfEnabled() bool { return pkgconfigsetup.Datadog().GetBool("compliance_config.xccdf.enabled") || pkgconfigsetup.Datadog().GetBool("compliance_config.host_benchmarks.enabled") } +var defaultSECLRuleFilter = sync.OnceValues(func() (*secl.SECLRuleFilter, error) { + ruleFilterModel, err := rules.NewRuleFilterModel(nil, "") + if err != nil { + return nil, fmt.Errorf("failed to create default SECL rule filter: %w", err) + } + filter := secl.NewSECLRuleFilter(ruleFilterModel) + return filter, nil +}) + // DefaultRuleFilter implements the default filtering of benchmarks' rules. It // will exclude rules based on the evaluation context / environment running // the benchmark. @@ -150,12 +159,12 @@ func DefaultRuleFilter(r *Rule) bool { return false } if len(r.Filters) > 0 { - ruleFilterModel, err := rules.NewRuleFilterModel(nil, "") + seclRuleFilter, err := defaultSECLRuleFilter() if err != nil { - log.Errorf("failed to apply rule filters: %v", err) + log.Errorf("failed to apply rule filters: %s", err) return false } - seclRuleFilter := secl.NewSECLRuleFilter(ruleFilterModel) + accepted, err := seclRuleFilter.IsRuleAccepted(&secl.RuleDefinition{ Filters: r.Filters, }) diff --git a/pkg/config/env/go.mod b/pkg/config/env/go.mod index ae5ae9b84549d..9aa77030032ce 100644 --- a/pkg/config/env/go.mod +++ b/pkg/config/env/go.mod @@ -41,12 +41,12 @@ require ( github.com/spf13/pflag v1.0.3 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/config/env/go.sum b/pkg/config/env/go.sum index 03e03e2aa5848..464a8b348cb26 100644 --- a/pkg/config/env/go.sum +++ b/pkg/config/env/go.sum @@ -191,8 +191,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -235,11 +235,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -252,8 +252,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/pkg/config/mock/go.mod b/pkg/config/mock/go.mod index a9b7c8842b2d3..c470539a9a5bc 100644 --- a/pkg/config/mock/go.mod +++ b/pkg/config/mock/go.mod @@ -77,12 +77,12 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/config/mock/go.sum b/pkg/config/mock/go.sum index e92309f06689e..fcbe4c21f6c43 100644 --- a/pkg/config/mock/go.sum +++ b/pkg/config/mock/go.sum @@ -252,8 +252,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -296,11 +296,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -313,8 +313,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/pkg/config/mock/mock.go b/pkg/config/mock/mock.go index 407bbc41ee7a3..975a7270c7311 100644 --- a/pkg/config/mock/mock.go +++ b/pkg/config/mock/mock.go @@ -28,21 +28,6 @@ type mockConfig struct { model.Config } -// Set is used for setting configuration in tests -func (c *mockConfig) Set(key string, value interface{}, source model.Source) { - c.Config.Set(key, value, source) -} - -// SetWithoutSource is used for setting configuration in tests -func (c *mockConfig) SetWithoutSource(key string, value interface{}) { - c.Config.SetWithoutSource(key, value) -} - -// SetKnown is used for setting configuration in tests -func (c *mockConfig) SetKnown(key string) { - c.Config.SetKnown(key) -} - // New creates a mock for the config func New(t testing.TB) model.Config { m.Lock() @@ -58,13 +43,13 @@ func New(t testing.TB) model.Config { m.Lock() defer m.Unlock() isConfigMocked = false - setup.SetDatadog(originalDatadogConfig) + setup.SetDatadog(originalDatadogConfig) // nolint: forbidigo // legitimate use of SetDatadog }) // Configure Datadog global configuration - newCfg := model.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + newCfg := model.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo // legitimate use of NewConfig // Configuration defaults - setup.SetDatadog(newCfg) + setup.SetDatadog(newCfg) // nolint forbidigo legitimate use of SetDatadog setup.InitConfig(newCfg) return &mockConfig{newCfg} } @@ -107,12 +92,12 @@ func NewSystemProbe(t testing.TB) model.Config { m.Lock() defer m.Unlock() isSystemProbeConfigMocked = false - setup.SetSystemProbe(originalConfig) + setup.SetSystemProbe(originalConfig) // nolint forbidigo legitimate use of SetSystemProbe }) } // Configure Datadog global configuration - setup.SetSystemProbe(model.NewConfig("system-probe", "DD", strings.NewReplacer(".", "_"))) + setup.SetSystemProbe(model.NewConfig("system-probe", "DD", strings.NewReplacer(".", "_"))) // nolint forbidigo legitimate use of NewConfig and SetSystemProbe // Configuration defaults setup.InitSystemProbeConfig(setup.SystemProbe()) return &mockConfig{setup.SystemProbe()} diff --git a/pkg/config/model/go.mod b/pkg/config/model/go.mod index 3f9abcc636285..693b2d2a57260 100644 --- a/pkg/config/model/go.mod +++ b/pkg/config/model/go.mod @@ -13,9 +13,8 @@ require ( github.com/DataDog/datadog-agent/pkg/util/log v0.56.0-rc.3 github.com/DataDog/viper v1.13.5 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 - github.com/spf13/afero v1.1.2 github.com/stretchr/testify v1.9.0 - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 ) require ( @@ -28,12 +27,13 @@ require ( github.com/mitchellh/mapstructure v1.1.2 // indirect github.com/pelletier/go-toml v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/spf13/afero v1.1.2 // indirect github.com/spf13/cast v1.3.0 // indirect github.com/spf13/jwalterweatherman v1.0.0 // indirect github.com/spf13/pflag v1.0.3 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/config/model/go.sum b/pkg/config/model/go.sum index af0475b1b927c..60bcc9d5ce2ca 100644 --- a/pkg/config/model/go.sum +++ b/pkg/config/model/go.sum @@ -167,8 +167,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -201,11 +201,11 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/pkg/config/model/types.go b/pkg/config/model/types.go index 68f94dc3346fe..1d3de47a8952f 100644 --- a/pkg/config/model/types.go +++ b/pkg/config/model/types.go @@ -11,7 +11,6 @@ import ( "time" "github.com/DataDog/viper" - "github.com/spf13/afero" ) // Proxy represents the configuration for proxies in the agent @@ -105,7 +104,6 @@ type Setup interface { // API implemented by viper.Viper SetDefault(key string, value interface{}) - SetFs(fs afero.Fs) SetEnvPrefix(in string) BindEnv(key string, envvars ...string) @@ -142,8 +140,6 @@ type Setup interface { // some misc functions, that should likely be split into another interface type Compound interface { UnmarshalKey(key string, rawVal interface{}, opts ...viper.DecoderConfigOption) error - Unmarshal(rawVal interface{}) error - UnmarshalExact(rawVal interface{}) error ReadInConfig() error ReadConfig(in io.Reader) error diff --git a/pkg/config/model/viper.go b/pkg/config/model/viper.go index 3ae870cfb0ee7..ff66d1db00543 100644 --- a/pkg/config/model/viper.go +++ b/pkg/config/model/viper.go @@ -22,7 +22,6 @@ import ( "github.com/DataDog/viper" "github.com/mohae/deepcopy" - "github.com/spf13/afero" "golang.org/x/exp/slices" "github.com/DataDog/datadog-agent/pkg/util/log" @@ -279,13 +278,6 @@ func (c *safeConfig) ParseEnvAsSlice(key string, fn func(string) []interface{}) c.Viper.SetEnvKeyTransformer(key, func(data string) interface{} { return fn(data) }) } -// SetFs wraps Viper for concurrent access -func (c *safeConfig) SetFs(fs afero.Fs) { - c.Lock() - defer c.Unlock() - c.Viper.SetFs(fs) -} - // IsSet wraps Viper for concurrent access func (c *safeConfig) IsSet(key string) bool { c.RLock() @@ -572,6 +564,7 @@ func (c *safeConfig) SetEnvKeyReplacer(r *strings.Replacer) { } // UnmarshalKey wraps Viper for concurrent access +// DEPRECATED: use pkg/config/structure.UnmarshalKey instead func (c *safeConfig) UnmarshalKey(key string, rawVal interface{}, opts ...viper.DecoderConfigOption) error { c.RLock() defer c.RUnlock() @@ -579,20 +572,6 @@ func (c *safeConfig) UnmarshalKey(key string, rawVal interface{}, opts ...viper. return c.Viper.UnmarshalKey(key, rawVal, opts...) } -// Unmarshal wraps Viper for concurrent access -func (c *safeConfig) Unmarshal(rawVal interface{}) error { - c.RLock() - defer c.RUnlock() - return c.Viper.Unmarshal(rawVal) -} - -// UnmarshalExact wraps Viper for concurrent access -func (c *safeConfig) UnmarshalExact(rawVal interface{}) error { - c.RLock() - defer c.RUnlock() - return c.Viper.UnmarshalExact(rawVal) -} - // ReadInConfig wraps Viper for concurrent access func (c *safeConfig) ReadInConfig() error { c.Lock() diff --git a/pkg/config/model/viper_test.go b/pkg/config/model/viper_test.go index 22209d122c8fd..e9a8c1602f972 100644 --- a/pkg/config/model/viper_test.go +++ b/pkg/config/model/viper_test.go @@ -18,7 +18,7 @@ import ( ) func TestConcurrencySetGet(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo var wg sync.WaitGroup @@ -41,7 +41,7 @@ func TestConcurrencySetGet(t *testing.T) { } func TestConcurrencyUnmarshalling(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo config.SetDefault("foo", map[string]string{}) config.SetDefault("BAR", "test") @@ -83,7 +83,7 @@ func TestConcurrencyUnmarshalling(t *testing.T) { } func TestGetConfigEnvVars(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo config.BindEnv("app_key") assert.Contains(t, config.GetEnvVars(), "DD_APP_KEY") @@ -98,7 +98,7 @@ func TestGetConfigEnvVars(t *testing.T) { // config parameters using DD_CONFIG_OPTION, and asserting that // GetConfigVars only returns that env var once. func TestGetConfigEnvVarsDedupe(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo config.BindEnv("config_option_1", "DD_CONFIG_OPTION") config.BindEnv("config_option_2", "DD_CONFIG_OPTION") @@ -112,7 +112,7 @@ func TestGetConfigEnvVarsDedupe(t *testing.T) { } func TestGetFloat64SliceE(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo config.BindEnv("float_list") config.SetConfigType("yaml") @@ -143,7 +143,7 @@ float_list: } func TestGetFloat64SliceEEnv(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo config.BindEnv("float_list") config.SetConfigType("yaml") @@ -163,7 +163,7 @@ float_list: } func TestSet(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo config.Set("foo", "bar", SourceFile) config.Set("foo", "baz", SourceEnvVar) config.Set("foo", "qux", SourceAgentRuntime) @@ -182,7 +182,7 @@ func TestSet(t *testing.T) { } func TestGetSource(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo config.Set("foo", "bar", SourceFile) config.Set("foo", "baz", SourceEnvVar) assert.Equal(t, SourceEnvVar, config.GetSource("foo")) @@ -221,7 +221,7 @@ func TestIsKnown(t *testing.T) { } t.Run(testName, func(t *testing.T) { for _, configName := range []string{"foo", "BAR", "BaZ", "foo_BAR", "foo.BAR", "foo.BAR.baz"} { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo if tc.setKnown { config.SetKnown(configName) @@ -240,7 +240,7 @@ func TestIsKnown(t *testing.T) { } func TestAllFileSettingsWithoutDefault(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo config.Set("foo", "bar", SourceFile) config.Set("baz", "qux", SourceFile) config.UnsetForSource("foo", SourceFile) @@ -254,7 +254,7 @@ func TestAllFileSettingsWithoutDefault(t *testing.T) { } func TestSourceFileReadConfig(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo yamlExample := []byte(` foo: bar `) @@ -273,7 +273,7 @@ foo: bar } func TestNotification(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo updatedKeyCB1 := []string{} updatedKeyCB2 := []string{} @@ -292,7 +292,7 @@ func TestNotification(t *testing.T) { } func TestNotificationNoChange(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo updatedKeyCB1 := []string{} @@ -306,7 +306,7 @@ func TestNotificationNoChange(t *testing.T) { } func TestCheckKnownKey(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")).(*safeConfig) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")).(*safeConfig) // nolint: forbidigo config.SetKnown("foo") config.Get("foo") @@ -321,14 +321,14 @@ func TestCheckKnownKey(t *testing.T) { } func TestCopyConfig(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo config.SetDefault("baz", "qux") config.Set("foo", "bar", SourceFile) config.BindEnv("xyz", "XXYYZZ") config.SetKnown("tyu") config.OnUpdate(func(_ string, _, _ any) {}) - backup := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + backup := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo backup.CopyConfig(config) assert.Equal(t, "qux", backup.Get("baz")) @@ -341,7 +341,7 @@ func TestCopyConfig(t *testing.T) { } func TestExtraConfig(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo confs := []struct { name string @@ -405,7 +405,7 @@ proxy: } func TestMergeFleetPolicy(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo config.SetConfigType("yaml") config.Set("foo", "bar", SourceFile) @@ -420,7 +420,7 @@ func TestMergeFleetPolicy(t *testing.T) { } func TestParseEnvAsStringSlice(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo config.BindEnv("slice_of_string") config.ParseEnvAsStringSlice("slice_of_string", func(string) []string { return []string{"a", "b", "c"} }) @@ -430,7 +430,7 @@ func TestParseEnvAsStringSlice(t *testing.T) { } func TestParseEnvAsMapStringInterface(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo config.BindEnv("map_of_float") config.ParseEnvAsMapStringInterface("map_of_float", func(string) map[string]interface{} { return map[string]interface{}{"a": 1.0, "b": 2.0, "c": 3.0} }) @@ -441,7 +441,7 @@ func TestParseEnvAsMapStringInterface(t *testing.T) { } func TestParseEnvAsSliceMapString(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo config.BindEnv("map") config.ParseEnvAsSliceMapString("map", func(string) []map[string]string { return []map[string]string{{"a": "a", "b": "b", "c": "c"}} }) @@ -451,7 +451,7 @@ func TestParseEnvAsSliceMapString(t *testing.T) { } func TestListenersUnsetForSource(t *testing.T) { - config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) + config := NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo // Create a listener that will keep track of the changes logLevels := []string{} diff --git a/pkg/config/nodetreemodel/config.go b/pkg/config/nodetreemodel/config.go index 46aa80ba54694..4194c4f115006 100644 --- a/pkg/config/nodetreemodel/config.go +++ b/pkg/config/nodetreemodel/config.go @@ -7,12 +7,10 @@ package nodetreemodel import ( - "bytes" "errors" "fmt" "io" "os" - "path" "reflect" "strconv" "strings" @@ -30,7 +28,7 @@ import ( "github.com/DataDog/datadog-agent/pkg/util/log" ) -// sources list the known sources, following the order of hierarchy between them +// sources lists the known sources, following the order of hierarchy between them var sources = []model.Source{ model.SourceDefault, model.SourceUnknown, @@ -43,13 +41,15 @@ var sources = []model.Source{ model.SourceCLI, } -// safeConfig implements Config: -// - wraps viper with a safety lock -// - implements the additional DDHelpers -type safeConfig struct { - *viper.Viper - configSources map[model.Source]*viper.Viper +// ntmConfig implements Config +// - wraps a tree of node that represent config data +// - uses a lock to synchronize all methods +// - contains metadata about known keys, env var support +type ntmConfig struct { sync.RWMutex + root Node + noimpl notImplementedMethods + envPrefix string envKeyReplacer *strings.Replacer @@ -58,10 +58,17 @@ type safeConfig struct { // Proxy settings proxies *model.Proxy + configName string + configFile string + configType string + // configEnvVars is the set of env vars that are consulted for // configuration values. configEnvVars map[string]struct{} + // known keys are all the keys that meet at least one of these criteria: + // 1) have a default, 2) have an environment variable binded, 3) are an alias or 4) have been SetKnown() + knownKeys map[string]struct{} // keys that have been used but are unknown // used to warn (a single time) on use unknownKeys map[string]struct{} @@ -70,17 +77,29 @@ type safeConfig struct { extraConfigFilePaths []string } -// OnUpdate adds a callback to the list receivers to be called each time a value is changed in the configuration +// OnUpdate adds a callback to the list of receivers to be called each time a value is changed in the configuration // by a call to the 'Set' method. // Callbacks are only called if the value is effectively changed. -func (c *safeConfig) OnUpdate(callback model.NotificationReceiver) { +func (c *ntmConfig) OnUpdate(callback model.NotificationReceiver) { c.Lock() defer c.Unlock() c.notificationReceivers = append(c.notificationReceivers, callback) } -// Set wraps Viper for concurrent access -func (c *safeConfig) Set(key string, newValue interface{}, source model.Source) { +// getValue gets a value, should only be called within a locked mutex +func (c *ntmConfig) getValue(key string) (interface{}, error) { + return c.leafAtPath(key).GetAny() +} + +func (c *ntmConfig) setValueSource(key string, newValue interface{}, source model.Source) { + err := c.leafAtPath(key).SetWithSource(newValue, source) + if err != nil { + log.Errorf("%s", err) + } +} + +// Set assigns the newValue to the given key and marks it as originating from the given source +func (c *ntmConfig) Set(key string, newValue interface{}, source model.Source) { if source == model.SourceDefault { c.SetDefault(key, newValue) return @@ -89,9 +108,8 @@ func (c *safeConfig) Set(key string, newValue interface{}, source model.Source) // modify the config then release the lock to avoid deadlocks while notifying var receivers []model.NotificationReceiver c.Lock() - previousValue := c.Viper.Get(key) - c.configSources[source].Set(key, newValue) - c.mergeViperInstances(key) + previousValue, _ := c.getValue(key) + c.setValueSource(key, newValue, source) if !reflect.DeepEqual(previousValue, newValue) { // if the value has not changed, do not duplicate the slice so that no callback is called receivers = slices.Clone(c.notificationReceivers) @@ -104,66 +122,38 @@ func (c *safeConfig) Set(key string, newValue interface{}, source model.Source) } } -// SetWithoutSource sets the given value using source Unknown -func (c *safeConfig) SetWithoutSource(key string, value interface{}) { +// SetWithoutSource assigns the value to the given key using source Unknown +func (c *ntmConfig) SetWithoutSource(key string, value interface{}) { c.Set(key, value, model.SourceUnknown) } -// SetDefault wraps Viper for concurrent access -func (c *safeConfig) SetDefault(key string, value interface{}) { - c.Lock() - defer c.Unlock() - c.configSources[model.SourceDefault].Set(key, value) - c.Viper.SetDefault(key, value) +// SetDefault assigns the value to the given key using source Default +func (c *ntmConfig) SetDefault(key string, value interface{}) { + c.Set(key, value, model.SourceDefault) } // UnsetForSource unsets a config entry for a given source -func (c *safeConfig) UnsetForSource(key string, source model.Source) { - // modify the config then release the lock to avoid deadlocks while notifying - var receivers []model.NotificationReceiver +func (c *ntmConfig) UnsetForSource(_key string, _source model.Source) { c.Lock() - previousValue := c.Viper.Get(key) - c.configSources[source].Set(key, nil) - c.mergeViperInstances(key) - newValue := c.Viper.Get(key) // Can't use nil, so we get the newly computed value - if previousValue != nil { - // if the value has not changed, do not duplicate the slice so that no callback is called - receivers = slices.Clone(c.notificationReceivers) - } + c.logErrorNotImplemented("UnsetForSource") c.Unlock() - - // notifying all receiver about the updated setting - for _, receiver := range receivers { - receiver(key, previousValue, newValue) - } -} - -// mergeViperInstances is called after a change in an instance of Viper -// to recompute the state of the main Viper -// (it must be used with a lock to prevent concurrent access to Viper) -func (c *safeConfig) mergeViperInstances(key string) { - var val interface{} - for _, source := range sources { - if currVal := c.configSources[source].Get(key); currVal != nil { - val = currVal - } - } - c.Viper.Set(key, val) } // SetKnown adds a key to the set of known valid config keys -func (c *safeConfig) SetKnown(key string) { +func (c *ntmConfig) SetKnown(key string) { c.Lock() defer c.Unlock() - c.Viper.SetKnown(key) + key = strings.ToLower(key) + c.knownKeys[key] = struct{}{} } // IsKnown returns whether a key is known -func (c *safeConfig) IsKnown(key string) bool { +func (c *ntmConfig) IsKnown(key string) bool { c.RLock() defer c.RUnlock() - - return c.Viper.IsKnown(key) + key = strings.ToLower(key) + _, found := c.knownKeys[key] + return found } // checkKnownKey checks if a key is known, and if not logs a warning @@ -171,8 +161,8 @@ func (c *safeConfig) IsKnown(key string) bool { // // Must be called with the lock read-locked. // The lock can be released and re-locked. -func (c *safeConfig) checkKnownKey(key string) { - if c.Viper.IsKnown(key) { +func (c *ntmConfig) checkKnownKey(key string) { + if c.IsKnown(key) { return } @@ -180,224 +170,232 @@ func (c *safeConfig) checkKnownKey(key string) { return } - // need to write-lock to add the key to the unknownKeys map - c.RUnlock() - // but we need to have the lock in the same state (RLocked) at the end of the function - defer c.RLock() - - c.Lock() c.unknownKeys[key] = struct{}{} - c.Unlock() - - // log without holding the lock log.Warnf("config key %v is unknown", key) } // GetKnownKeysLowercased returns all the keys that meet at least one of these criteria: // 1) have a default, 2) have an environment variable binded or 3) have been SetKnown() // Note that it returns the keys lowercased. -func (c *safeConfig) GetKnownKeysLowercased() map[string]interface{} { +func (c *ntmConfig) GetKnownKeysLowercased() map[string]interface{} { c.RLock() defer c.RUnlock() // GetKnownKeysLowercased returns a fresh map, so the caller may do with it // as they please without holding the lock. - return c.Viper.GetKnownKeys() + ret := make(map[string]interface{}) + for key, value := range c.knownKeys { + ret[key] = value + } + return ret } -// ParseEnvAsStringSlice registers a transformer function to parse an an environment variables as a []string. -func (c *safeConfig) ParseEnvAsStringSlice(key string, fn func(string) []string) { +// ParseEnvAsStringSlice registers a transform function to parse an environment variable as a []string. +func (c *ntmConfig) ParseEnvAsStringSlice(key string, fn func(string) []string) { c.Lock() defer c.Unlock() - c.Viper.SetEnvKeyTransformer(key, func(data string) interface{} { return fn(data) }) + c.noimpl.SetEnvKeyTransformer(key, func(data string) interface{} { return fn(data) }) } -// ParseEnvAsMapStringInterface registers a transformer function to parse an an environment variables as a -// map[string]interface{}. -func (c *safeConfig) ParseEnvAsMapStringInterface(key string, fn func(string) map[string]interface{}) { +// ParseEnvAsMapStringInterface registers a transform function to parse an environment variable as a map[string]interface{} +func (c *ntmConfig) ParseEnvAsMapStringInterface(key string, fn func(string) map[string]interface{}) { c.Lock() defer c.Unlock() - c.Viper.SetEnvKeyTransformer(key, func(data string) interface{} { return fn(data) }) + c.noimpl.SetEnvKeyTransformer(key, func(data string) interface{} { return fn(data) }) } -// ParseEnvAsSliceMapString registers a transformer function to parse an an environment variables as a []map[string]string. -func (c *safeConfig) ParseEnvAsSliceMapString(key string, fn func(string) []map[string]string) { +// ParseEnvAsSliceMapString registers a transform function to parse an environment variable as a []map[string]string +func (c *ntmConfig) ParseEnvAsSliceMapString(key string, fn func(string) []map[string]string) { c.Lock() defer c.Unlock() - c.Viper.SetEnvKeyTransformer(key, func(data string) interface{} { return fn(data) }) + c.noimpl.SetEnvKeyTransformer(key, func(data string) interface{} { return fn(data) }) } -// ParseEnvAsSlice registers a transformer function to parse an an environment variables as a -// []interface{}. -func (c *safeConfig) ParseEnvAsSlice(key string, fn func(string) []interface{}) { +// ParseEnvAsSlice registers a transform function to parse an environment variable as a []interface +func (c *ntmConfig) ParseEnvAsSlice(key string, fn func(string) []interface{}) { c.Lock() defer c.Unlock() - c.Viper.SetEnvKeyTransformer(key, func(data string) interface{} { return fn(data) }) + c.noimpl.SetEnvKeyTransformer(key, func(data string) interface{} { return fn(data) }) } -// SetFs wraps Viper for concurrent access -func (c *safeConfig) SetFs(fs afero.Fs) { +// SetFs assigns a filesystem to the config +func (c *ntmConfig) SetFs(fs afero.Fs) { c.Lock() defer c.Unlock() - c.Viper.SetFs(fs) + c.noimpl.SetFs(fs) } -// IsSet wraps Viper for concurrent access -func (c *safeConfig) IsSet(key string) bool { +// IsSet checks if a key is set in the config +func (c *ntmConfig) IsSet(key string) bool { c.RLock() defer c.RUnlock() - return c.Viper.IsSet(key) + return c.noimpl.IsSet(key) } -func (c *safeConfig) AllKeysLowercased() []string { +// AllKeysLowercased returns all keys lower-cased +func (c *ntmConfig) AllKeysLowercased() []string { c.RLock() defer c.RUnlock() - return c.Viper.AllKeys() + return c.noimpl.AllKeys() } -// Get wraps Viper for concurrent access -func (c *safeConfig) Get(key string) interface{} { +func (c *ntmConfig) leafAtPath(key string) LeafNode { + pathParts := strings.Split(key, ".") + curr := c.root + for _, part := range pathParts { + next, err := curr.GetChild(part) + if err != nil { + return &missingLeaf + } + curr = next + } + if leaf, ok := curr.(LeafNode); ok { + return leaf + } + return &missingLeaf +} + +// Get returns a copy of the value for the given key +func (c *ntmConfig) Get(key string) interface{} { c.RLock() defer c.RUnlock() c.checkKnownKey(key) - val, err := c.Viper.GetE(key) + val, err := c.getValue(key) if err != nil { log.Warnf("failed to get configuration value for key %q: %s", key, err) } + // NOTE: should only need to deepcopy for `Get`, because it can be an arbitrary value, + // and we shouldn't ever return complex types like maps and slices that could be modified + // by callers accidentally or on purpose. By copying, the caller may modify the result safetly return deepcopy.Copy(val) } // GetAllSources returns the value of a key for each source -func (c *safeConfig) GetAllSources(key string) []model.ValueWithSource { +func (c *ntmConfig) GetAllSources(key string) []model.ValueWithSource { c.RLock() defer c.RUnlock() c.checkKnownKey(key) vals := make([]model.ValueWithSource, len(sources)) - for i, source := range sources { - vals[i] = model.ValueWithSource{ - Source: source, - Value: deepcopy.Copy(c.configSources[source].Get(key)), - } - } + c.logErrorNotImplemented("GetAllSources") return vals } -// GetString wraps Viper for concurrent access -func (c *safeConfig) GetString(key string) string { +// GetString returns a string-typed value for the given key +func (c *ntmConfig) GetString(key string) string { c.RLock() defer c.RUnlock() c.checkKnownKey(key) - val, err := c.Viper.GetStringE(key) + str, err := c.leafAtPath(key).GetString() if err != nil { log.Warnf("failed to get configuration value for key %q: %s", key, err) } - return val + return str } -// GetBool wraps Viper for concurrent access -func (c *safeConfig) GetBool(key string) bool { +// GetBool returns a bool-typed value for the given key +func (c *ntmConfig) GetBool(key string) bool { c.RLock() defer c.RUnlock() c.checkKnownKey(key) - val, err := c.Viper.GetBoolE(key) + b, err := c.leafAtPath(key).GetBool() if err != nil { log.Warnf("failed to get configuration value for key %q: %s", key, err) } - return val + return b } -// GetInt wraps Viper for concurrent access -func (c *safeConfig) GetInt(key string) int { +// GetInt returns an int-typed value for the given key +func (c *ntmConfig) GetInt(key string) int { c.RLock() defer c.RUnlock() c.checkKnownKey(key) - val, err := c.Viper.GetIntE(key) + val, err := c.leafAtPath(key).GetInt() if err != nil { log.Warnf("failed to get configuration value for key %q: %s", key, err) } return val } -// GetInt32 wraps Viper for concurrent access -func (c *safeConfig) GetInt32(key string) int32 { +// GetInt32 returns an int32-typed value for the given key +func (c *ntmConfig) GetInt32(key string) int32 { c.RLock() defer c.RUnlock() c.checkKnownKey(key) - val, err := c.Viper.GetInt32E(key) + val, err := c.leafAtPath(key).GetInt() if err != nil { log.Warnf("failed to get configuration value for key %q: %s", key, err) } - return val + return int32(val) } -// GetInt64 wraps Viper for concurrent access -func (c *safeConfig) GetInt64(key string) int64 { +// GetInt64 returns an int64-typed value for the given key +func (c *ntmConfig) GetInt64(key string) int64 { c.RLock() defer c.RUnlock() c.checkKnownKey(key) - val, err := c.Viper.GetInt64E(key) + val, err := c.leafAtPath(key).GetInt() if err != nil { log.Warnf("failed to get configuration value for key %q: %s", key, err) } - return val + return int64(val) } -// GetFloat64 wraps Viper for concurrent access -func (c *safeConfig) GetFloat64(key string) float64 { +// GetFloat64 returns a float64-typed value for the given key +func (c *ntmConfig) GetFloat64(key string) float64 { c.RLock() defer c.RUnlock() c.checkKnownKey(key) - val, err := c.Viper.GetFloat64E(key) + val, err := c.leafAtPath(key).GetFloat() if err != nil { log.Warnf("failed to get configuration value for key %q: %s", key, err) } return val } -// GetTime wraps Viper for concurrent access -func (c *safeConfig) GetTime(key string) time.Time { +// GetTime returns a time-typed value for the given key +func (c *ntmConfig) GetTime(key string) time.Time { c.RLock() defer c.RUnlock() c.checkKnownKey(key) - val, err := c.Viper.GetTimeE(key) + val, err := c.leafAtPath(key).GetTime() if err != nil { log.Warnf("failed to get configuration value for key %q: %s", key, err) } return val } -// GetDuration wraps Viper for concurrent access -func (c *safeConfig) GetDuration(key string) time.Duration { +// GetDuration returns a duration-typed value for the given key +func (c *ntmConfig) GetDuration(key string) time.Duration { c.RLock() defer c.RUnlock() c.checkKnownKey(key) - val, err := c.Viper.GetDurationE(key) + val, err := c.leafAtPath(key).GetDuration() if err != nil { log.Warnf("failed to get configuration value for key %q: %s", key, err) } return val } -// GetStringSlice wraps Viper for concurrent access -func (c *safeConfig) GetStringSlice(key string) []string { +// GetStringSlice returns a string slice value for the given key +func (c *ntmConfig) GetStringSlice(key string) []string { c.RLock() defer c.RUnlock() c.checkKnownKey(key) - val, err := c.Viper.GetStringSliceE(key) + val, err := c.noimpl.GetStringSliceE(key) if err != nil { log.Warnf("failed to get configuration value for key %q: %s", key, err) } return slices.Clone(val) } -// GetFloat64SliceE loads a key as a []float64 -func (c *safeConfig) GetFloat64SliceE(key string) ([]float64, error) { +// GetFloat64SliceE returns a float slice value for the given key, or an error +func (c *ntmConfig) GetFloat64SliceE(key string) ([]float64, error) { c.RLock() defer c.RUnlock() c.checkKnownKey(key) // We're using GetStringSlice because viper can only parse list of string from env variables - list, err := c.Viper.GetStringSliceE(key) + list, err := c.noimpl.GetStringSliceE(key) if err != nil { return nil, fmt.Errorf("'%v' is not a list", key) } @@ -413,86 +411,83 @@ func (c *safeConfig) GetFloat64SliceE(key string) ([]float64, error) { return res, nil } -// GetStringMap wraps Viper for concurrent access -func (c *safeConfig) GetStringMap(key string) map[string]interface{} { +// GetStringMap returns a map[string]interface value for the given key +func (c *ntmConfig) GetStringMap(key string) map[string]interface{} { c.RLock() defer c.RUnlock() c.checkKnownKey(key) - val, err := c.Viper.GetStringMapE(key) + val, err := c.noimpl.GetStringMapE(key) if err != nil { log.Warnf("failed to get configuration value for key %q: %s", key, err) } return deepcopy.Copy(val).(map[string]interface{}) } -// GetStringMapString wraps Viper for concurrent access -func (c *safeConfig) GetStringMapString(key string) map[string]string { +// GetStringMapString returns a map[string]string value for the given key +func (c *ntmConfig) GetStringMapString(key string) map[string]string { c.RLock() defer c.RUnlock() c.checkKnownKey(key) - val, err := c.Viper.GetStringMapStringE(key) + val, err := c.noimpl.GetStringMapStringE(key) if err != nil { log.Warnf("failed to get configuration value for key %q: %s", key, err) } return deepcopy.Copy(val).(map[string]string) } -// GetStringMapStringSlice wraps Viper for concurrent access -func (c *safeConfig) GetStringMapStringSlice(key string) map[string][]string { +// GetStringMapStringSlice returns a map[string][]string value for the given key +func (c *ntmConfig) GetStringMapStringSlice(key string) map[string][]string { c.RLock() defer c.RUnlock() c.checkKnownKey(key) - val, err := c.Viper.GetStringMapStringSliceE(key) + val, err := c.noimpl.GetStringMapStringSliceE(key) if err != nil { log.Warnf("failed to get configuration value for key %q: %s", key, err) } return deepcopy.Copy(val).(map[string][]string) } -// GetSizeInBytes wraps Viper for concurrent access -func (c *safeConfig) GetSizeInBytes(key string) uint { +// GetSizeInBytes returns the size in bytes of the filename for the given key +func (c *ntmConfig) GetSizeInBytes(key string) uint { c.RLock() defer c.RUnlock() c.checkKnownKey(key) - val, err := c.Viper.GetSizeInBytesE(key) + val, err := c.noimpl.GetSizeInBytesE(key) if err != nil { log.Warnf("failed to get configuration value for key %q: %s", key, err) } return val } -// GetSource wraps Viper for concurrent access -func (c *safeConfig) GetSource(key string) model.Source { +func (c *ntmConfig) logErrorNotImplemented(method string) error { + err := fmt.Errorf("not implemented: %s", method) + log.Error(err) + return err +} + +// GetSource returns the source of the given key +func (c *ntmConfig) GetSource(key string) model.Source { c.RLock() defer c.RUnlock() c.checkKnownKey(key) - var source model.Source - for _, s := range sources { - if c.configSources[s].Get(key) != nil { - source = s - } - } - return source + c.logErrorNotImplemented("GetSource") + return model.SourceUnknown } -// SetEnvPrefix wraps Viper for concurrent access, and keeps the envPrefix for -// future reference -func (c *safeConfig) SetEnvPrefix(in string) { +// SetEnvPrefix sets the environment variable prefix to use +func (c *ntmConfig) SetEnvPrefix(in string) { c.Lock() defer c.Unlock() - c.configSources[model.SourceEnvVar].SetEnvPrefix(in) - c.Viper.SetEnvPrefix(in) c.envPrefix = in } -// mergeWithEnvPrefix derives the environment variable that Viper will use for a given key. -// mergeWithEnvPrefix must be called while holding the config log (read or write). -func (c *safeConfig) mergeWithEnvPrefix(key string) string { +// mergeWithEnvPrefix derives the environment variable to use for a given key. +func (c *ntmConfig) mergeWithEnvPrefix(key string) string { return strings.Join([]string{c.envPrefix, strings.ToUpper(key)}, "_") } -// BindEnv wraps Viper for concurrent access, and adds tracking of the configurable env vars -func (c *safeConfig) BindEnv(key string, envvars ...string) { +// BindEnv binds one or more environment variables to the given key +func (c *ntmConfig) BindEnv(key string, envvars ...string) { c.Lock() defer c.Unlock() var envKeys []string @@ -513,98 +508,30 @@ func (c *safeConfig) BindEnv(key string, envvars ...string) { c.configEnvVars[key] = struct{}{} } - newKeys := append([]string{key}, envvars...) - _ = c.configSources[model.SourceEnvVar].BindEnv(newKeys...) - _ = c.Viper.BindEnv(newKeys...) + c.logErrorNotImplemented("BindEnv") } -// SetEnvKeyReplacer wraps Viper for concurrent access -func (c *safeConfig) SetEnvKeyReplacer(r *strings.Replacer) { +// SetEnvKeyReplacer binds a replacer function for keys +func (c *ntmConfig) SetEnvKeyReplacer(_r *strings.Replacer) { c.Lock() defer c.Unlock() - c.configSources[model.SourceEnvVar].SetEnvKeyReplacer(r) - c.Viper.SetEnvKeyReplacer(r) - c.envKeyReplacer = r + c.logErrorNotImplemented("SetEnvKeyReplacer") } -// UnmarshalKey wraps Viper for concurrent access -func (c *safeConfig) UnmarshalKey(key string, rawVal interface{}, opts ...viper.DecoderConfigOption) error { +// UnmarshalKey unmarshals the data for the given key +// DEPRECATED: use pkg/config/structure.UnmarshalKey instead +func (c *ntmConfig) UnmarshalKey(key string, _rawVal interface{}, _opts ...viper.DecoderConfigOption) error { c.RLock() defer c.RUnlock() c.checkKnownKey(key) - return c.Viper.UnmarshalKey(key, rawVal, opts...) -} - -// Unmarshal wraps Viper for concurrent access -func (c *safeConfig) Unmarshal(rawVal interface{}) error { - c.RLock() - defer c.RUnlock() - return c.Viper.Unmarshal(rawVal) -} - -// UnmarshalExact wraps Viper for concurrent access -func (c *safeConfig) UnmarshalExact(rawVal interface{}) error { - c.RLock() - defer c.RUnlock() - return c.Viper.UnmarshalExact(rawVal) -} - -// ReadInConfig wraps Viper for concurrent access -func (c *safeConfig) ReadInConfig() error { - c.Lock() - defer c.Unlock() - // ReadInConfig reset configuration with the main config file - err := errors.Join(c.Viper.ReadInConfig(), c.configSources[model.SourceFile].ReadInConfig()) - if err != nil { - return err - } - - type extraConf struct { - path string - content []byte - } - - // Read extra config files - extraConfContents := []extraConf{} - for _, path := range c.extraConfigFilePaths { - b, err := os.ReadFile(path) - if err != nil { - return fmt.Errorf("could not read extra config file '%s': %w", path, err) - } - extraConfContents = append(extraConfContents, extraConf{path: path, content: b}) - } - - // Merge with base config and 'file' config - for _, confFile := range extraConfContents { - err = errors.Join(c.Viper.MergeConfig(bytes.NewReader(confFile.content)), c.configSources[model.SourceFile].MergeConfig(bytes.NewReader(confFile.content))) - if err != nil { - return fmt.Errorf("error merging %s config file: %w", confFile.path, err) - } - log.Infof("extra configuration file %s was loaded successfully", confFile.path) - } - return nil -} - -// ReadConfig wraps Viper for concurrent access -func (c *safeConfig) ReadConfig(in io.Reader) error { - c.Lock() - defer c.Unlock() - b, err := io.ReadAll(in) - if err != nil { - return err - } - err = c.Viper.ReadConfig(bytes.NewReader(b)) - if err != nil { - return err - } - return c.configSources[model.SourceFile].ReadConfig(bytes.NewReader(b)) + return c.logErrorNotImplemented("UnmarshalKey") } -// MergeConfig wraps Viper for concurrent access -func (c *safeConfig) MergeConfig(in io.Reader) error { +// MergeConfig merges in another config +func (c *ntmConfig) MergeConfig(_in io.Reader) error { c.Lock() defer c.Unlock() - return c.Viper.MergeConfig(in) + return c.logErrorNotImplemented("MergeConfig") } // MergeFleetPolicy merges the configuration from the reader given with an existing config @@ -612,7 +539,7 @@ func (c *safeConfig) MergeConfig(in io.Reader) error { // according to sources priority order. // // Note: this should only be called at startup, as notifiers won't receive a notification when this loads -func (c *safeConfig) MergeFleetPolicy(configPath string) error { +func (c *ntmConfig) MergeFleetPolicy(configPath string) error { c.Lock() defer c.Unlock() @@ -629,83 +556,57 @@ func (c *safeConfig) MergeFleetPolicy(configPath string) error { } defer in.Close() - c.configSources[model.SourceFleetPolicies].SetConfigType("yaml") - err = c.configSources[model.SourceFleetPolicies].MergeConfigOverride(in) - if err != nil { - return err - } - for _, key := range c.configSources[model.SourceFleetPolicies].AllKeys() { - c.mergeViperInstances(key) - } - log.Infof("Fleet policies configuration %s successfully merged", path.Base(configPath)) - return nil + // TODO: Implement merging, merge in the policy that was read + return c.logErrorNotImplemented("MergeFleetPolicy") } // MergeConfigMap merges the configuration from the map given with an existing config. // Note that the map given may be modified. -func (c *safeConfig) MergeConfigMap(cfg map[string]any) error { +func (c *ntmConfig) MergeConfigMap(_cfg map[string]any) error { c.Lock() defer c.Unlock() - return c.Viper.MergeConfigMap(cfg) + c.logErrorNotImplemented("AllSettings") + return nil } -// AllSettings wraps Viper for concurrent access -func (c *safeConfig) AllSettings() map[string]interface{} { +// AllSettings returns all settings from the config +func (c *ntmConfig) AllSettings() map[string]interface{} { c.RLock() defer c.RUnlock() - - // AllSettings returns a fresh map, so the caller may do with it - // as they please without holding the lock. - return c.Viper.AllSettings() + c.logErrorNotImplemented("AllSettings") + return nil } // AllSettingsWithoutDefault returns a copy of the all the settings in the configuration without defaults -func (c *safeConfig) AllSettingsWithoutDefault() map[string]interface{} { +func (c *ntmConfig) AllSettingsWithoutDefault() map[string]interface{} { c.RLock() defer c.RUnlock() - - // AllSettingsWithoutDefault returns a fresh map, so the caller may do with it - // as they please without holding the lock. - return c.Viper.AllSettingsWithoutDefault() + c.logErrorNotImplemented("AllSettingsWithoutDefault") + return nil } // AllSettingsBySource returns the settings from each source (file, env vars, ...) -func (c *safeConfig) AllSettingsBySource() map[model.Source]interface{} { +func (c *ntmConfig) AllSettingsBySource() map[model.Source]interface{} { c.RLock() defer c.RUnlock() - sources := []model.Source{ - model.SourceDefault, - model.SourceUnknown, - model.SourceFile, - model.SourceEnvVar, - model.SourceFleetPolicies, - model.SourceAgentRuntime, - model.SourceRC, - model.SourceCLI, - model.SourceLocalConfigProcess, - } res := map[model.Source]interface{}{} - for _, source := range sources { - res[source] = c.configSources[source].AllSettingsWithoutDefault() - } - res[model.SourceProvided] = c.Viper.AllSettingsWithoutDefault() + c.logErrorNotImplemented("AllSettingsBySource") return res } -// AddConfigPath wraps Viper for concurrent access -func (c *safeConfig) AddConfigPath(in string) { +// AddConfigPath adds another config for the given path +func (c *ntmConfig) AddConfigPath(_in string) { c.Lock() defer c.Unlock() - c.configSources[model.SourceFile].AddConfigPath(in) - c.Viper.AddConfigPath(in) + c.logErrorNotImplemented("AddConfigPath") } // AddExtraConfigPaths allows adding additional configuration files // which will be merged into the main configuration during the ReadInConfig call. // Configuration files are merged sequentially. If a key already exists and the foreign value type matches the existing one, the foreign value overrides it. // If both the existing value and the new value are nested configurations, they are merged recursively following the same principles. -func (c *safeConfig) AddExtraConfigPaths(ins []string) error { +func (c *ntmConfig) AddExtraConfigPaths(ins []string) error { if len(ins) == 0 { return nil } @@ -730,48 +631,44 @@ func (c *safeConfig) AddExtraConfigPaths(ins []string) error { return err } -// SetConfigName wraps Viper for concurrent access -func (c *safeConfig) SetConfigName(in string) { +// SetConfigName sets the name of the config +func (c *ntmConfig) SetConfigName(in string) { c.Lock() defer c.Unlock() - c.configSources[model.SourceFile].SetConfigName(in) - c.Viper.SetConfigName(in) + c.configName = in + c.configFile = "" } -// SetConfigFile wraps Viper for concurrent access -func (c *safeConfig) SetConfigFile(in string) { +// SetConfigFile sets the config file +func (c *ntmConfig) SetConfigFile(in string) { c.Lock() defer c.Unlock() - c.configSources[model.SourceFile].SetConfigFile(in) - c.Viper.SetConfigFile(in) + c.configFile = in } -// SetConfigType wraps Viper for concurrent access -func (c *safeConfig) SetConfigType(in string) { +// SetConfigType sets the type of the config +func (c *ntmConfig) SetConfigType(in string) { c.Lock() defer c.Unlock() - c.configSources[model.SourceFile].SetConfigType(in) - c.Viper.SetConfigType(in) + c.configType = in } -// ConfigFileUsed wraps Viper for concurrent access -func (c *safeConfig) ConfigFileUsed() string { +// ConfigFileUsed returns the config file +func (c *ntmConfig) ConfigFileUsed() string { c.RLock() defer c.RUnlock() - return c.Viper.ConfigFileUsed() + return c.configFile } -func (c *safeConfig) SetTypeByDefaultValue(in bool) { +// SetTypeByDefaultValue enables typing using default values +func (c *ntmConfig) SetTypeByDefaultValue(_in bool) { c.Lock() defer c.Unlock() - for _, source := range sources { - c.configSources[source].SetTypeByDefaultValue(in) - } - c.Viper.SetTypeByDefaultValue(in) + c.logErrorNotImplemented("SetTypeByDefaultValue") } -// GetEnvVars implements the Config interface -func (c *safeConfig) GetEnvVars() []string { +// GetEnvVars gets all environment variables +func (c *ntmConfig) GetEnvVars() []string { c.RLock() defer c.RUnlock() vars := make([]string, 0, len(c.configEnvVars)) @@ -781,34 +678,31 @@ func (c *safeConfig) GetEnvVars() []string { return vars } -// BindEnvAndSetDefault implements the Config interface -func (c *safeConfig) BindEnvAndSetDefault(key string, val interface{}, envvars ...string) { +// BindEnvAndSetDefault binds an environment variable and sets a default for the given key +func (c *ntmConfig) BindEnvAndSetDefault(key string, val interface{}, envvars ...string) { c.SetDefault(key, val) c.BindEnv(key, envvars...) //nolint:errcheck } -func (c *safeConfig) Warnings() *model.Warnings { +// Warnings just returns nil +func (c *ntmConfig) Warnings() *model.Warnings { return nil } -func (c *safeConfig) Object() model.Reader { +// Object returns the config as a Reader interface +func (c *ntmConfig) Object() model.Reader { return c } // NewConfig returns a new Config object. func NewConfig(name string, envPrefix string, envKeyReplacer *strings.Replacer) model.Config { - config := safeConfig{ - Viper: viper.New(), - configSources: map[model.Source]*viper.Viper{}, + config := ntmConfig{ + noimpl: ¬ImplMethodsImpl{}, configEnvVars: map[string]struct{}{}, + knownKeys: map[string]struct{}{}, unknownKeys: map[string]struct{}{}, } - // load one Viper instance per source of setting change - for _, source := range sources { - config.configSources[source] = viper.New() - } - config.SetTypeByDefaultValue(true) config.SetConfigName(name) config.SetEnvPrefix(envPrefix) @@ -819,13 +713,13 @@ func NewConfig(name string, envPrefix string, envKeyReplacer *strings.Replacer) // CopyConfig copies the given config to the receiver config. This should only be used in tests as replacing // the global config reference is unsafe. -func (c *safeConfig) CopyConfig(cfg model.Config) { +func (c *ntmConfig) CopyConfig(cfg model.Config) { c.Lock() defer c.Unlock() - - if cfg, ok := cfg.(*safeConfig); ok { - c.Viper = cfg.Viper - c.configSources = cfg.configSources + c.logErrorNotImplemented("CopyConfig") + if cfg, ok := cfg.(*ntmConfig); ok { + // TODO: Probably a bug, should be a deep copy, add a test and verify + c.root = cfg.root c.envPrefix = cfg.envPrefix c.envKeyReplacer = cfg.envKeyReplacer c.proxies = cfg.proxies @@ -834,33 +728,34 @@ func (c *safeConfig) CopyConfig(cfg model.Config) { c.notificationReceivers = cfg.notificationReceivers return } - panic("Replacement config must be an instance of safeConfig") + panic("Replacement config must be an instance of ntmConfig") } // GetProxies returns the proxy settings from the configuration -func (c *safeConfig) GetProxies() *model.Proxy { +func (c *ntmConfig) GetProxies() *model.Proxy { c.Lock() - defer c.Unlock() - if c.proxies != nil { - return c.proxies + hasProxies := c.proxies + c.Unlock() + if hasProxies != nil { + return hasProxies } - if c.Viper.GetBool("fips.enabled") { + if c.GetBool("fips.enabled") { return nil } - if !c.Viper.IsSet("proxy.http") && !c.Viper.IsSet("proxy.https") && !c.Viper.IsSet("proxy.no_proxy") { + if !c.IsSet("proxy.http") && !c.IsSet("proxy.https") && !c.IsSet("proxy.no_proxy") { return nil } p := &model.Proxy{ - HTTP: c.Viper.GetString("proxy.http"), - HTTPS: c.Viper.GetString("proxy.https"), - NoProxy: c.Viper.GetStringSlice("proxy.no_proxy"), + HTTP: c.GetString("proxy.http"), + HTTPS: c.GetString("proxy.https"), + NoProxy: c.GetStringSlice("proxy.no_proxy"), } - c.proxies = p return c.proxies } -func (c *safeConfig) ExtraConfigFilesUsed() []string { +// ExtraConfigFilesUsed returns the additional config files used +func (c *ntmConfig) ExtraConfigFilesUsed() []string { c.Lock() defer c.Unlock() res := make([]string, len(c.extraConfigFilePaths)) diff --git a/pkg/config/nodetreemodel/go.mod b/pkg/config/nodetreemodel/go.mod index 24bc4dae7a1db..68a7ed4848cb1 100644 --- a/pkg/config/nodetreemodel/go.mod +++ b/pkg/config/nodetreemodel/go.mod @@ -14,22 +14,26 @@ require ( github.com/DataDog/viper v1.13.5 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 github.com/spf13/afero v1.11.0 - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 + github.com/stretchr/testify v1.9.0 + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 + gopkg.in/yaml.v2 v2.4.0 ) require ( github.com/DataDog/datadog-agent/pkg/util/scrubber v0.56.0-rc.3 // indirect github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/fsnotify/fsnotify v1.4.7 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/magiconair/properties v1.8.1 // indirect github.com/mitchellh/mapstructure v1.1.2 // indirect github.com/pelletier/go-toml v1.2.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect github.com/spf13/cast v1.3.0 // indirect github.com/spf13/jwalterweatherman v1.0.0 // indirect github.com/spf13/pflag v1.0.3 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/config/nodetreemodel/go.sum b/pkg/config/nodetreemodel/go.sum index fd8d0133a518b..b726a3b799e83 100644 --- a/pkg/config/nodetreemodel/go.sum +++ b/pkg/config/nodetreemodel/go.sum @@ -168,8 +168,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -202,11 +202,11 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/pkg/config/nodetreemodel/missing.go b/pkg/config/nodetreemodel/missing.go new file mode 100644 index 0000000000000..79d470b702a3f --- /dev/null +++ b/pkg/config/nodetreemodel/missing.go @@ -0,0 +1,50 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016-present Datadog, Inc. + +package nodetreemodel + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-agent/pkg/config/model" +) + +// missingLeafImpl is a none-object representing when a child node is missing +type missingLeafImpl struct{} + +var missingLeaf missingLeafImpl + +func (m *missingLeafImpl) GetAny() (any, error) { + return nil, fmt.Errorf("GetAny(): missing") +} + +func (m *missingLeafImpl) GetBool() (bool, error) { + return false, fmt.Errorf("GetBool(): missing") +} + +func (m *missingLeafImpl) GetInt() (int, error) { + return 0, fmt.Errorf("GetInt(): missing") +} + +func (m *missingLeafImpl) GetFloat() (float64, error) { + return 0.0, fmt.Errorf("GetFloat(): missing") +} + +func (m *missingLeafImpl) GetString() (string, error) { + return "", fmt.Errorf("GetString(): missing") +} + +func (m *missingLeafImpl) GetTime() (time.Time, error) { + return time.Time{}, fmt.Errorf("GetTime(): missing") +} + +func (m *missingLeafImpl) GetDuration() (time.Duration, error) { + return time.Duration(0), fmt.Errorf("GetDuration(): missing") +} + +func (m *missingLeafImpl) SetWithSource(interface{}, model.Source) error { + return fmt.Errorf("SetWithSource(): missing") +} diff --git a/pkg/config/nodetreemodel/node.go b/pkg/config/nodetreemodel/node.go new file mode 100644 index 0000000000000..3687bf24bc1fc --- /dev/null +++ b/pkg/config/nodetreemodel/node.go @@ -0,0 +1,376 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016-present Datadog, Inc. + +package nodetreemodel + +import ( + "fmt" + "slices" + "strconv" + "strings" + "time" + + "github.com/DataDog/datadog-agent/pkg/config/model" + "golang.org/x/exp/maps" +) + +// ErrNotFound is an error for when a key is not found +var ErrNotFound = fmt.Errorf("not found") + +// NewNode constructs a Node from either a map, a slice, or a scalar value +func NewNode(v interface{}) (Node, error) { + switch it := v.(type) { + case map[interface{}]interface{}: + return newMapNodeImpl(mapInterfaceToMapString(it)) + case map[string]interface{}: + return newMapNodeImpl(it) + case []interface{}: + return newArrayNodeImpl(it) + } + if isScalar(v) { + return newLeafNodeImpl(v) + } + // Finally, try determining node type using reflection, should only be needed for unit tests that + // supply data that isn't one of the "plain" types produced by parsing json, yaml, etc + node, err := asReflectionNode(v) + if err == errUnknownConversion { + return nil, fmt.Errorf("could not create node from: %v of type %T", v, v) + } + return node, err +} + +// LeafNode represents a leaf node of the config +type LeafNode interface { + GetAny() (interface{}, error) + GetBool() (bool, error) + GetInt() (int, error) + GetFloat() (float64, error) + GetString() (string, error) + GetTime() (time.Time, error) + GetDuration() (time.Duration, error) + SetWithSource(interface{}, model.Source) error +} + +// ArrayNode represents a node with ordered, numerically indexed set of children +type ArrayNode interface { + Size() int + Index(int) (Node, error) +} + +// Node represents an arbitrary node +type Node interface { + GetChild(string) (Node, error) + ChildrenKeys() ([]string, error) +} + +// leafNode represents a leaf with a scalar value + +type leafNodeImpl struct { + // val must be a scalar kind + val interface{} + source model.Source +} + +func newLeafNodeImpl(v interface{}) (Node, error) { + if isScalar(v) { + return &leafNodeImpl{val: v}, nil + } + return nil, fmt.Errorf("cannot create leaf node from %v of type %T", v, v) +} + +var _ LeafNode = (*leafNodeImpl)(nil) +var _ Node = (*leafNodeImpl)(nil) + +// arrayNode represents a node with an ordered array of children + +type arrayNodeImpl struct { + nodes []Node +} + +func newArrayNodeImpl(v []interface{}) (Node, error) { + nodes := make([]Node, 0, len(v)) + for _, it := range v { + if n, ok := it.(Node); ok { + nodes = append(nodes, n) + continue + } + n, err := NewNode(it) + if err != nil { + return nil, err + } + nodes = append(nodes, n) + } + return &arrayNodeImpl{nodes: nodes}, nil +} + +var _ ArrayNode = (*arrayNodeImpl)(nil) +var _ Node = (*arrayNodeImpl)(nil) + +// node represents an arbitrary node of the tree + +type mapNodeImpl struct { + val map[string]interface{} + // remapCase maps each lower-case key to the original case. This + // enables GetChild to retrieve values using case-insensitive keys + remapCase map[string]string +} + +func newMapNodeImpl(v map[string]interface{}) (Node, error) { + return &mapNodeImpl{val: v, remapCase: makeRemapCase(v)}, nil +} + +var _ Node = (*mapNodeImpl)(nil) + +/////// + +func isScalar(v interface{}) bool { + switch v.(type) { + case int, int8, int16, int32, int64: + return true + case uint, uint8, uint16, uint32, uint64: + return true + case bool, string, float32, float64, time.Time, time.Duration: + return true + default: + return false + } +} + +// creates a map that converts keys from their lower-cased version to their original case +func makeRemapCase(m map[string]interface{}) map[string]string { + remap := make(map[string]string) + for k := range m { + remap[strings.ToLower(k)] = k + } + return remap +} + +func mapInterfaceToMapString(m map[interface{}]interface{}) map[string]interface{} { + res := make(map[string]interface{}, len(m)) + for k, v := range m { + mk := "" + if str, ok := k.(string); ok { + mk = str + } else { + mk = fmt.Sprintf("%s", k) + } + res[mk] = v + } + return res +} + +///// + +// GetChild returns the child node at the given case-insensitive key, or an error if not found +func (n *mapNodeImpl) GetChild(key string) (Node, error) { + mkey := n.remapCase[strings.ToLower(key)] + child, found := n.val[mkey] + if !found { + return nil, ErrNotFound + } + // If the map is already storing a Node, return it + if n, ok := child.(Node); ok { + return n, nil + } + // Otherwise construct a new node + return NewNode(child) +} + +// ChildrenKeys returns the list of keys of the children of the given node, if it is a map +func (n *mapNodeImpl) ChildrenKeys() ([]string, error) { + mapkeys := maps.Keys(n.val) + // map keys are iterated non-deterministically, sort them + slices.Sort(mapkeys) + return mapkeys, nil +} + +// GetChild returns an error because array node does not have children accessible by name +func (n *arrayNodeImpl) GetChild(string) (Node, error) { + return nil, fmt.Errorf("arrayNodeImpl.GetChild not implemented") +} + +// ChildrenKeys returns an error because array node does not have children accessible by name +func (n *arrayNodeImpl) ChildrenKeys() ([]string, error) { + return nil, fmt.Errorf("arrayNodeImpl.ChildrenKeys not implemented") +} + +// Size returns number of children in the list +func (n *arrayNodeImpl) Size() int { + return len(n.nodes) +} + +// Index returns the kth element of the list +func (n *arrayNodeImpl) Index(k int) (Node, error) { + if k < 0 || k >= len(n.nodes) { + return nil, ErrNotFound + } + return n.nodes[k], nil +} + +// GetChild returns an error because a leaf has no children +func (n *leafNodeImpl) GetChild(key string) (Node, error) { + return nil, fmt.Errorf("can't GetChild(%s) of a leaf node", key) +} + +// ChildrenKeys returns an error because a leaf has no children +func (n *leafNodeImpl) ChildrenKeys() ([]string, error) { + return nil, fmt.Errorf("can't get ChildrenKeys of a leaf node") +} + +// GetAny returns the scalar as an interface +func (n *leafNodeImpl) GetAny() (interface{}, error) { + return n, nil +} + +// GetBool returns the scalar as a bool, or an error otherwise +func (n *leafNodeImpl) GetBool() (bool, error) { + switch it := n.val.(type) { + case bool: + return it, nil + case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64: + num, err := n.GetInt() + if err != nil { + return false, err + } + return num != 0, nil + case string: + return convertToBool(it) + default: + return false, newConversionError(n, "bool") + } +} + +// GetInt returns the scalar as a int, or an error otherwise +func (n *leafNodeImpl) GetInt() (int, error) { + switch it := n.val.(type) { + case int: + return int(it), nil + case int8: + return int(it), nil + case int16: + return int(it), nil + case int32: + return int(it), nil + case int64: + return int(it), nil + case uint: + return int(it), nil + case uint8: + return int(it), nil + case uint16: + return int(it), nil + case uint32: + return int(it), nil + case uint64: + return int(it), nil + case float32: + return int(it), nil + case float64: + return int(it), nil + } + return 0, newConversionError(n.val, "int") +} + +// GetFloat returns the scalar as a float64, or an error otherwise +func (n *leafNodeImpl) GetFloat() (float64, error) { + switch it := n.val.(type) { + case int: + return float64(it), nil + case int8: + return float64(it), nil + case int16: + return float64(it), nil + case int32: + return float64(it), nil + case int64: + return float64(it), nil + case uint: + return float64(it), nil + case uint8: + return float64(it), nil + case uint16: + return float64(it), nil + case uint32: + return float64(it), nil + case uint64: + return float64(it), nil + case float32: + return float64(it), nil + case float64: + return float64(it), nil + } + return 0, newConversionError(n.val, "float") +} + +// GetString returns the scalar as a string, or an error otherwise +func (n *leafNodeImpl) GetString() (string, error) { + switch it := n.val.(type) { + case int, int8, int16, int32, int64: + num, err := n.GetInt() + if err != nil { + return "", err + } + stringVal := strconv.FormatInt(int64(num), 10) + return stringVal, nil + case uint, uint8, uint16, uint32, uint64: + num, err := n.GetInt() + if err != nil { + return "", err + } + stringVal := strconv.FormatUint(uint64(num), 10) + return stringVal, nil + case float32: + f, err := n.GetFloat() + if err != nil { + return "", err + } + stringVal := strconv.FormatFloat(f, 'f', -1, 32) + return stringVal, nil + case float64: + f, err := n.GetFloat() + if err != nil { + return "", err + } + stringVal := strconv.FormatFloat(f, 'f', -1, 64) + return stringVal, nil + case string: + return it, nil + } + return "", newConversionError(n.val, "string") +} + +// GetTime returns the scalar as a time, or an error otherwise, not implemented +func (n *leafNodeImpl) GetTime() (time.Time, error) { + return time.Time{}, fmt.Errorf("not implemented") +} + +// GetDuration returns the scalar as a duration, or an error otherwise, not implemented +func (n *leafNodeImpl) GetDuration() (time.Duration, error) { + return time.Duration(0), fmt.Errorf("not implemented") +} + +// Set assigns a value in the config, for the given source +func (n *leafNodeImpl) SetWithSource(newValue interface{}, source model.Source) error { + // TODO: enforce type-checking, return an error if type changes + n.val = newValue + n.source = source + // TODO: Record previous value and source + return nil +} + +// convert a string to a bool using standard yaml constants +func convertToBool(text string) (bool, error) { + lower := strings.ToLower(text) + if lower == "y" || lower == "yes" || lower == "on" || lower == "true" || lower == "1" { + return true, nil + } else if lower == "n" || lower == "no" || lower == "off" || lower == "false" || lower == "0" { + return false, nil + } + return false, newConversionError(text, "bool") +} + +func newConversionError(v interface{}, expectType string) error { + return fmt.Errorf("could not convert to %s: %v of type %T", expectType, v, v) +} diff --git a/pkg/config/nodetreemodel/node_test.go b/pkg/config/nodetreemodel/node_test.go new file mode 100644 index 0000000000000..7cf34c9ceb1be --- /dev/null +++ b/pkg/config/nodetreemodel/node_test.go @@ -0,0 +1,66 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016-present Datadog, Inc. + +package nodetreemodel + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestNewNodeAndNodeMethods(t *testing.T) { + obj := map[string]interface{}{ + "a": "apple", + "b": 123, + "c": map[string]interface{}{ + "d": true, + "e": []string{"f", "g"}, + }, + } + + n, err := NewNode(obj) + assert.NoError(t, err) + + keys, err := n.ChildrenKeys() + assert.NoError(t, err) + assert.Equal(t, keys, []string{"a", "b", "c"}) + + first, err := n.GetChild("a") + assert.NoError(t, err) + + firstLeaf := first.(LeafNode) + str, err := firstLeaf.GetString() + assert.NoError(t, err) + assert.Equal(t, str, "apple") + + second, err := n.GetChild("b") + assert.NoError(t, err) + + secondLeaf := second.(LeafNode) + num, err := secondLeaf.GetInt() + assert.NoError(t, err) + assert.Equal(t, num, 123) + + third, err := n.GetChild("c") + assert.NoError(t, err) + _, ok := third.(LeafNode) + assert.Equal(t, ok, false) + + keys, err = third.ChildrenKeys() + assert.NoError(t, err) + assert.Equal(t, keys, []string{"d", "e"}) + + fourth, err := third.GetChild("d") + assert.NoError(t, err) + + fourthLeaf := fourth.(LeafNode) + b, err := fourthLeaf.GetBool() + assert.NoError(t, err) + assert.Equal(t, b, true) + + _, err = third.GetChild("e") + assert.NoError(t, err) +} diff --git a/pkg/config/nodetreemodel/noimpl_methods.go b/pkg/config/nodetreemodel/noimpl_methods.go new file mode 100644 index 0000000000000..2bfa2cfb98c9f --- /dev/null +++ b/pkg/config/nodetreemodel/noimpl_methods.go @@ -0,0 +1,71 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016-present Datadog, Inc. + +package nodetreemodel + +import ( + "fmt" + + "github.com/DataDog/datadog-agent/pkg/util/log" + "github.com/spf13/afero" +) + +type notImplementedMethods interface { + SetFs(afero.Fs) + IsSet(string) bool + AllKeys() []string + SetEnvKeyTransformer(string, func(data string) interface{}) + GetStringSliceE(string) ([]string, error) + GetStringMapE(string) (map[string]interface{}, error) + GetStringMapStringE(string) (map[string]string, error) + GetStringMapStringSliceE(string) (map[string][]string, error) + GetSizeInBytesE(string) (uint, error) +} + +type notImplMethodsImpl struct{} + +func (n *notImplMethodsImpl) SetFs(afero.Fs) { + n.logErrorNotImplemented("SetFs") +} + +func (n *notImplMethodsImpl) IsSet(string) bool { + n.logErrorNotImplemented("IsSet") + return false +} + +func (n *notImplMethodsImpl) AllKeys() []string { + n.logErrorNotImplemented("AllKeys") + return nil +} + +func (n *notImplMethodsImpl) SetEnvKeyTransformer(string, func(data string) interface{}) { + n.logErrorNotImplemented("SetEnvKeyTransformer") +} + +func (n *notImplMethodsImpl) GetStringSliceE(string) ([]string, error) { + return nil, n.logErrorNotImplemented("GetStringSliceE") +} + +func (n *notImplMethodsImpl) GetStringMapE(string) (map[string]interface{}, error) { + return nil, n.logErrorNotImplemented("GetStringMapE") +} + +func (n *notImplMethodsImpl) GetStringMapStringE(string) (map[string]string, error) { + return nil, n.logErrorNotImplemented("GetStringMapStringE") +} + +func (n *notImplMethodsImpl) GetStringMapStringSliceE(string) (map[string][]string, error) { + return nil, n.logErrorNotImplemented("GetStringMapStringSliceE") +} + +func (n *notImplMethodsImpl) GetSizeInBytesE(string) (uint, error) { + return 0, n.logErrorNotImplemented("GetSizeInBytesE") +} + +func (n *notImplMethodsImpl) logErrorNotImplemented(method string) error { + err := fmt.Errorf("not implemented: %s", method) + log.Error(err) + return err +} diff --git a/pkg/config/nodetreemodel/read_config_file.go b/pkg/config/nodetreemodel/read_config_file.go new file mode 100644 index 0000000000000..3cc574472453c --- /dev/null +++ b/pkg/config/nodetreemodel/read_config_file.go @@ -0,0 +1,77 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016-present Datadog, Inc. + +package nodetreemodel + +import ( + "io" + "os" + + "gopkg.in/yaml.v2" +) + +func (c *ntmConfig) getConfigFile() string { + if c.configFile == "" { + return "datadog.yaml" + } + return c.configFile +} + +// ReadInConfig wraps Viper for concurrent access +func (c *ntmConfig) ReadInConfig() error { + c.Lock() + defer c.Unlock() + // ReadInConfig reset configuration with the main config file + err := c.readInConfig() + if err != nil { + return err + } + + // Read extra config files + // TODO: handle c.extraConfigFilePaths, read and merge files + return nil +} + +func (c *ntmConfig) readInConfig() error { + filename := c.getConfigFile() + content, err := os.ReadFile(filename) + if err != nil { + return err + } + root, err := c.readConfigurationContent(content) + if err != nil { + return err + } + c.root = root + return nil +} + +// ReadConfig wraps Viper for concurrent access +func (c *ntmConfig) ReadConfig(in io.Reader) error { + c.Lock() + defer c.Unlock() + content, err := io.ReadAll(in) + if err != nil { + return err + } + root, err := c.readConfigurationContent(content) + if err != nil { + return err + } + c.root = root + return nil +} + +func (c *ntmConfig) readConfigurationContent(content []byte) (Node, error) { + var obj map[string]interface{} + if err := yaml.Unmarshal(content, &obj); err != nil { + return nil, err + } + root, err := NewNode(obj) + if err != nil { + return nil, err + } + return root, nil +} diff --git a/pkg/config/nodetreemodel/read_config_file_test.go b/pkg/config/nodetreemodel/read_config_file_test.go new file mode 100644 index 0000000000000..65a88192254a1 --- /dev/null +++ b/pkg/config/nodetreemodel/read_config_file_test.go @@ -0,0 +1,55 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016-present Datadog, Inc. + +package nodetreemodel + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/assert" +) + +var confYaml = ` +network_devices: + snmp_traps: + enabled: true + port: 1234 + community_strings: ["a","b","c"] + users: + - user: alice + authKey: hunter2 + authProtocol: MD5 + privKey: pswd + privProtocol: AE5 + - user: bob + authKey: "123456" + authProtocol: MD5 + privKey: secret + privProtocol: AE5 + bind_host: ok + stop_timeout: 4 + namespace: abc +` + +func TestReadConfigAndGetValues(t *testing.T) { + cfg := NewConfig("datadog", "DD", nil) + err := cfg.ReadConfig(strings.NewReader(confYaml)) + if err != nil { + panic(err) + } + + enabled := cfg.GetBool("network_devices.snmp_traps.enabled") + port := cfg.GetInt("network_devices.snmp_traps.port") + bindHost := cfg.GetString("network_devices.snmp_traps.bind_host") + stopTimeout := cfg.GetInt("network_devices.snmp_traps.stop_timeout") + namespace := cfg.GetString("network_devices.snmp_traps.namespace") + + assert.Equal(t, enabled, true) + assert.Equal(t, port, 1234) + assert.Equal(t, bindHost, "ok") + assert.Equal(t, stopTimeout, 4) + assert.Equal(t, namespace, "abc") +} diff --git a/pkg/config/nodetreemodel/reflection_node.go b/pkg/config/nodetreemodel/reflection_node.go new file mode 100644 index 0000000000000..41abc6d3c9a3a --- /dev/null +++ b/pkg/config/nodetreemodel/reflection_node.go @@ -0,0 +1,139 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016-present Datadog, Inc. + +package nodetreemodel + +import ( + "fmt" + "reflect" + "strings" + "unicode" + "unicode/utf8" +) + +var ( + // error when a caller tries to construct a node from reflect.Value, this is a logic error, calling code should + // not be reflection based, but should be working with "native" go types that come from parsing json, yaml, etc + errReflectValue = fmt.Errorf("refusing to construct node from reflect.Value") + errUnknownConversion = fmt.Errorf("no conversion found") +) + +// asReflectionNode returns a node using reflection: should only show up in test code +// The reason is that data produced by parsing json, yaml, etc should always made up +// of "plain" go-lang types (maps, slices, scalars). Some unit tests assign structs directly +// to the state of the config, which then require reflection to properly handle +func asReflectionNode(v interface{}) (Node, error) { + if _, ok := v.(reflect.Value); ok { + return nil, errReflectValue + } + rv := reflect.ValueOf(v) + if rv.Kind() == reflect.Struct { + return &structNodeImpl{val: rv}, nil + } else if rv.Kind() == reflect.Slice { + elems := make([]interface{}, 0, rv.Len()) + for i := 0; i < rv.Len(); i++ { + node, err := NewNode(rv.Index(i).Interface()) + if err != nil { + return nil, err + } + elems = append(elems, node) + } + return newArrayNodeImpl(elems) + } else if rv.Kind() == reflect.Map { + res := make(map[string]interface{}, rv.Len()) + mapkeys := rv.MapKeys() + for _, mk := range mapkeys { + kstr := "" + if key, ok := mk.Interface().(string); ok { + kstr = key + } else { + kstr = fmt.Sprintf("%s", mk.Interface()) + } + res[kstr] = rv.MapIndex(mk).Interface() + } + return newMapNodeImpl(res) + } + return nil, errUnknownConversion +} + +type structNodeImpl struct { + // val must be a struct + val reflect.Value +} + +// GetChild returns the child node at the given case-insensitive key, or an error if not found +func (n *structNodeImpl) GetChild(key string) (Node, error) { + findex := findFieldMatch(n.val, key) + if findex == -1 { + return nil, ErrNotFound + } + inner := n.val.Field(findex) + if inner.Kind() == reflect.Interface { + inner = inner.Elem() + } + return NewNode(inner.Interface()) +} + +// ChildrenKeys returns the list of keys of the children of the given node, if it is a map +func (n *structNodeImpl) ChildrenKeys() ([]string, error) { + structType := n.val.Type() + keys := make([]string, 0, n.val.NumField()) + for i := 0; i < structType.NumField(); i++ { + f := structType.Field(i) + ch, _ := utf8.DecodeRuneInString(f.Name) + if unicode.IsLower(ch) { + continue + } + fieldKey, _ := fieldNameToKey(f) + keys = append(keys, fieldKey) + } + return keys, nil +} + +type specifierSet map[string]struct{} + +// fieldNameToKey returns the lower-cased field name, for case insensitive comparisons, +// with struct tag rename applied, as well as the set of specifiers from struct tags +// struct tags are handled in order of yaml, then json, then mapstructure +func fieldNameToKey(field reflect.StructField) (string, specifierSet) { + name := field.Name + + tagtext := "" + if val := field.Tag.Get("yaml"); val != "" { + tagtext = val + } else if val := field.Tag.Get("json"); val != "" { + tagtext = val + } else if val := field.Tag.Get("mapstructure"); val != "" { + tagtext = val + } + + // skip any additional specifiers such as ",omitempty" or ",squash" + // TODO: support multiple specifiers + var specifiers map[string]struct{} + if commaPos := strings.IndexRune(tagtext, ','); commaPos != -1 { + specifiers = make(map[string]struct{}) + val := tagtext[:commaPos] + specifiers[tagtext[commaPos+1:]] = struct{}{} + if val != "" { + name = val + } + } else if tagtext != "" { + name = tagtext + } + return strings.ToLower(name), specifiers +} + +func findFieldMatch(val reflect.Value, key string) int { + // case-insensitive match for struct names + key = strings.ToLower(key) + schema := val.Type() + for i := 0; i < schema.NumField(); i++ { + fieldKey, _ := fieldNameToKey(schema.Field(i)) + if key == fieldKey { + return i + } + } + return -1 +} diff --git a/pkg/config/nodetreemodel/reflection_node_test.go b/pkg/config/nodetreemodel/reflection_node_test.go new file mode 100644 index 0000000000000..5a6b69d286fca --- /dev/null +++ b/pkg/config/nodetreemodel/reflection_node_test.go @@ -0,0 +1,45 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016-present Datadog, Inc. + +package nodetreemodel + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +type Object struct { + Name string + Num int +} + +func TestNewReflectionNode(t *testing.T) { + n, err := NewNode(Object{ + Name: "test", + Num: 7, + }) + assert.NoError(t, err) + + keys, err := n.ChildrenKeys() + assert.NoError(t, err) + assert.Equal(t, keys, []string{"name", "num"}) + + first, err := n.GetChild("name") + assert.NoError(t, err) + + firstLeaf := first.(LeafNode) + str, err := firstLeaf.GetString() + assert.NoError(t, err) + assert.Equal(t, str, "test") + + second, err := n.GetChild("num") + assert.NoError(t, err) + + secondLeaf := second.(LeafNode) + num, err := secondLeaf.GetInt() + assert.NoError(t, err) + assert.Equal(t, num, 7) +} diff --git a/pkg/config/remote/go.mod b/pkg/config/remote/go.mod index 7bc136b578865..e8b932262da4e 100644 --- a/pkg/config/remote/go.mod +++ b/pkg/config/remote/go.mod @@ -3,6 +3,9 @@ module github.com/DataDog/datadog-agent/pkg/config/remote go 1.22.0 replace ( + github.com/DataDog/datadog-agent/comp/api/api/def => ../../../comp/api/api/def + github.com/DataDog/datadog-agent/comp/core/flare/builder => ../../../comp/core/flare/builder + github.com/DataDog/datadog-agent/comp/core/flare/types => ../../../comp/core/flare/types github.com/DataDog/datadog-agent/comp/core/secrets => ../../../comp/core/secrets github.com/DataDog/datadog-agent/comp/core/telemetry => ../../../comp/core/telemetry github.com/DataDog/datadog-agent/comp/def => ../../../comp/def @@ -31,11 +34,13 @@ replace ( github.com/DataDog/datadog-agent/pkg/util/scrubber => ../../util/scrubber github.com/DataDog/datadog-agent/pkg/util/system => ../../util/system github.com/DataDog/datadog-agent/pkg/util/system/socket => ../../util/system/socket + github.com/DataDog/datadog-agent/pkg/util/testutil => ../../../pkg/util/testutil github.com/DataDog/datadog-agent/pkg/util/uuid => ../../util/uuid github.com/DataDog/datadog-agent/pkg/util/winutil => ../../util/winutil ) require ( + github.com/DataDog/datadog-agent/pkg/config/mock v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/proto v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.56.0-rc.3 @@ -57,11 +62,25 @@ require ( require ( github.com/DataDog/appsec-internal-go v1.7.0 // indirect + github.com/DataDog/datadog-agent/comp/core/secrets v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/config/env v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/config/setup v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect github.com/DataDog/datadog-agent/pkg/obfuscate v0.48.0 // indirect github.com/DataDog/datadog-agent/pkg/util/cache v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/executable v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/optional v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/pointer v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/system v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/winutil v0.56.0-rc.3 // indirect github.com/DataDog/datadog-go/v5 v5.5.0 // indirect github.com/DataDog/go-libddwaf/v3 v3.3.0 // indirect - github.com/DataDog/go-sqllexer v0.0.15 // indirect + github.com/DataDog/go-sqllexer v0.0.16 // indirect github.com/DataDog/sketches-go v1.4.5 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect @@ -69,6 +88,8 @@ require ( github.com/ebitengine/purego v0.6.0-alpha.5 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/google/uuid v1.5.0 // indirect + github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95 // indirect + github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/outcaste-io/ristretto v0.2.3 // indirect @@ -80,11 +101,11 @@ require ( github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/time v0.6.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/time v0.7.0 // indirect + golang.org/x/tools v0.26.0 // indirect golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect ) @@ -110,9 +131,9 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/tinylib/msgp v1.1.8 // indirect - golang.org/x/net v0.29.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/net v0.30.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect diff --git a/pkg/config/remote/go.sum b/pkg/config/remote/go.sum index 7d71762afe880..1c40a8aabd49d 100644 --- a/pkg/config/remote/go.sum +++ b/pkg/config/remote/go.sum @@ -13,8 +13,8 @@ github.com/DataDog/datadog-go/v5 v5.5.0 h1:G5KHeB8pWBNXT4Jtw0zAkhdxEAWSpWH00geHI github.com/DataDog/datadog-go/v5 v5.5.0/go.mod h1:K9kcYBlxkcPP8tvvjZZKs/m1edNAUFzBbdpTUKfCsuw= github.com/DataDog/go-libddwaf/v3 v3.3.0 h1:jS72fuQpFgJZEdEJDmHJCPAgNTEMZoz1EUvimPUOiJ4= github.com/DataDog/go-libddwaf/v3 v3.3.0/go.mod h1:Bz/0JkpGf689mzbUjKJeheJINqsyyhM8p9PDuHdK2Ec= -github.com/DataDog/go-sqllexer v0.0.15 h1:rUUu52dP8EQhJLnUw0MIAxZp0BQx2fOTuMztr3vtHUU= -github.com/DataDog/go-sqllexer v0.0.15/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc= +github.com/DataDog/go-sqllexer v0.0.16 h1:RoSUMS6MECyB3gTUIdydzXwK5NhEhv6GMJkS7ptsgRA= +github.com/DataDog/go-sqllexer v0.0.16/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc= github.com/DataDog/go-tuf v1.1.0-0.5.2 h1:4CagiIekonLSfL8GMHRHcHudo1fQnxELS9g4tiAupQ4= github.com/DataDog/go-tuf v1.1.0-0.5.2/go.mod h1:zBcq6f654iVqmkk8n2Cx81E1JnNTMOAx1UEO/wZR+P0= github.com/DataDog/gostackparse v0.7.0 h1:i7dLkXHvYzHV308hnkvVGDL3BR4FWl7IsXNPz/IGQh4= @@ -40,6 +40,7 @@ github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= @@ -90,6 +91,10 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/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-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -146,6 +151,8 @@ github.com/hashicorp/hcl v1.0.1-vault-5 h1:kI3hhbbyzr4dldA8UdTb7ZlVVlI2DACdCfz31 github.com/hashicorp/hcl v1.0.1-vault-5/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95 h1:S4qyfL2sEm5Budr4KVMyEniCy+PbS55651I/a+Kn/NQ= github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95/go.mod h1:QiyDdbZLaJ/mZP4Zwc9g2QsfaEA4o7XvvgZegSci5/E= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -172,6 +179,8 @@ github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czP github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= @@ -207,18 +216,26 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= +github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= +github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= +github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= @@ -254,6 +271,8 @@ github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNo github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= +github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= +github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= @@ -297,29 +316,47 @@ github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQ go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= +go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= +go.opentelemetry.io/otel/metric v1.27.0 h1:hvj3vdEKyeCi4YaYfNjv2NUje8FqKqUY8IlF0FxV/ik= +go.opentelemetry.io/otel/metric v1.27.0/go.mod h1:mVFgmRlhljgBiuk/MP/oKylr4hs85GZAylncepAX/ak= +go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kTWmI= +go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A= +go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2NemcCrOL8gI= +go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= +go.opentelemetry.io/otel/trace v1.27.0 h1:IqYb813p7cmbHk0a5y6pD5JPakbVfftRXABGt5/Rscw= +go.opentelemetry.io/otel/trace v1.27.0/go.mod h1:6RiD1hkAprV4/q+yd2ln1HG9GoPx39SuvvstaLBl+l4= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/dig v1.18.0 h1:imUL1UiY0Mg4bqbFfsRQO5G4CGRBec/ZujWTvSVp3pw= +go.uber.org/dig v1.18.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= +go.uber.org/fx v1.22.2 h1:iPW+OPxv0G8w75OemJ1RAnTUrF55zOJlXlo1TbJ0Buw= +go.uber.org/fx v1.22.2/go.mod h1:o/D9n+2mLP6v1EG+qsdT1O8wKopYAsqZasju97SDFCU= 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.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +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/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.14.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +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-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 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/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -348,8 +385,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= @@ -371,6 +408,7 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h 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-20190529164535-6a60838ec259/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -389,8 +427,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= @@ -398,12 +436,12 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= -golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= +golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -419,8 +457,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= diff --git a/pkg/config/remote/service/service_test.go b/pkg/config/remote/service/service_test.go index 860b6546fcbe0..40d8302db3192 100644 --- a/pkg/config/remote/service/service_test.go +++ b/pkg/config/remote/service/service_test.go @@ -12,7 +12,6 @@ import ( "encoding/json" "errors" "fmt" - "strings" "testing" "time" @@ -24,7 +23,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "github.com/DataDog/datadog-agent/pkg/config/model" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" rdata "github.com/DataDog/datadog-agent/pkg/config/remote/data" "github.com/DataDog/datadog-agent/pkg/config/remote/uptane" "github.com/DataDog/datadog-agent/pkg/proto/msgpgo" @@ -158,10 +157,8 @@ var testRCKey = msgpgo.RemoteConfigKey{ } func newTestService(t *testing.T, api *mockAPI, uptane *mockCoreAgentUptane, clock clock.Clock) *CoreAgentService { - cfg := model.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) - + cfg := configmock.New(t) cfg.SetWithoutSource("hostname", "test-hostname") - defer cfg.SetWithoutSource("hostname", "") dir := t.TempDir() cfg.SetWithoutSource("run_path", dir) @@ -960,7 +957,7 @@ func TestOrgStatus(t *testing.T) { } func TestWithTraceAgentEnv(t *testing.T) { - cfg := model.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + cfg := configmock.New(t) dir := t.TempDir() cfg.SetWithoutSource("run_path", dir) @@ -979,7 +976,7 @@ func TestWithTraceAgentEnv(t *testing.T) { } func TestWithDatabaseFileName(t *testing.T) { - cfg := model.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + cfg := configmock.New(t) cfg.SetWithoutSource("run_path", "/tmp") baseRawURL := "https://localhost" @@ -1020,7 +1017,7 @@ func TestWithRefreshInterval(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - cfg := model.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + cfg := configmock.New(t) cfg.SetWithoutSource("run_path", "/tmp") baseRawURL := "https://localhost" @@ -1117,7 +1114,7 @@ type clientTTLTest struct { } func TestWithDirectorRootOverride(t *testing.T) { - cfg := model.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + cfg := configmock.New(t) cfg.SetWithoutSource("run_path", "/tmp") baseRawURL := "https://localhost" diff --git a/pkg/config/remote/uptane/client_benchmark_test.go b/pkg/config/remote/uptane/client_benchmark_test.go index ec68a23457b18..d961741433856 100644 --- a/pkg/config/remote/uptane/client_benchmark_test.go +++ b/pkg/config/remote/uptane/client_benchmark_test.go @@ -44,7 +44,7 @@ func BenchmarkVerify(b *testing.B) { }) } repository := newTestRepository(2, 1, configTargets, directorTargets, targetFiles) - cfg := newTestConfig(repository) + cfg := newTestConfig(b, repository) db := getBenchmarkDB(b) client, err := newTestClient(db, cfg) if err != nil { diff --git a/pkg/config/remote/uptane/client_test.go b/pkg/config/remote/uptane/client_test.go index 171eb605b985f..f2258def85635 100644 --- a/pkg/config/remote/uptane/client_test.go +++ b/pkg/config/remote/uptane/client_test.go @@ -10,7 +10,6 @@ import ( "crypto/sha256" "encoding/json" "fmt" - "strings" "testing" "time" @@ -20,6 +19,7 @@ import ( "github.com/stretchr/testify/assert" "go.etcd.io/bbolt" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" "github.com/DataDog/datadog-agent/pkg/config/model" "github.com/DataDog/datadog-agent/pkg/config/remote/meta" pbgo "github.com/DataDog/datadog-agent/pkg/proto/pbgo/core" @@ -35,8 +35,8 @@ func getTestOrgUUIDFromID(orgID int) string { return fmt.Sprintf("org-%d-uuid", orgID) } -func newTestConfig(repo testRepositories) model.Config { - cfg := model.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) +func newTestConfig(t testing.TB, repo testRepositories) model.Config { + cfg := configmock.New(t) cfg.SetWithoutSource("remote_configuration.director_root", repo.directorRoot) cfg.SetWithoutSource("remote_configuration.config_root", repo.configRoot) return cfg @@ -53,7 +53,7 @@ func newTestClient(db *bbolt.DB, cfg model.Config) (*CoreAgentClient, error) { func TestClientState(t *testing.T) { testRepository1 := newTestRepository(2, 1, nil, nil, nil) - cfg := newTestConfig(testRepository1) + cfg := newTestConfig(t, testRepository1) db := getTestDB(t) client1, err := newTestClient(db, cfg) assert.NoError(t, err) @@ -104,7 +104,7 @@ func TestClientFullState(t *testing.T) { "datadog/2/APM_SAMPLING/id/1": target1, } testRepository := newTestRepository(2, 1, configTargets, directorTargets, []*pbgo.File{{Path: "datadog/2/APM_SAMPLING/id/1", Raw: target1content}}) - cfg := newTestConfig(testRepository) + cfg := newTestConfig(t, testRepository) db := getTestDB(t) // Prepare @@ -141,7 +141,7 @@ func assertMetaVersion(t *testing.T, state map[string]MetaState, metaName string func TestClientVerifyTUF(t *testing.T) { testRepository1 := newTestRepository(2, 1, nil, nil, nil) - cfg := newTestConfig(testRepository1) + cfg := newTestConfig(t, testRepository1) db := getTestDB(t) previousConfigTargets := testRepository1.configTargets @@ -179,7 +179,7 @@ func TestClientVerifyUptane(t *testing.T) { testRepositoryValid := newTestRepository(2, 1, configTargets1, directorTargets1, []*pbgo.File{{Path: "datadog/2/APM_SAMPLING/id/1", Raw: target1content}}) testRepositoryInvalid1 := newTestRepository(2, 1, configTargets2, directorTargets2, []*pbgo.File{{Path: "datadog/2/APM_SAMPLING/id/1", Raw: target1content}, {Path: "datadog/2/APM_SAMPLING/id/2", Raw: target2content}}) - cfgValid := newTestConfig(testRepositoryValid) + cfgValid := newTestConfig(t, testRepositoryValid) db := getTestDB(t) client1, err := newTestClient(db, cfgValid) @@ -190,7 +190,7 @@ func TestClientVerifyUptane(t *testing.T) { assert.NoError(t, err) assert.Equal(t, target1content, targetFile) - cfgInvalid1 := newTestConfig(testRepositoryInvalid1) + cfgInvalid1 := newTestConfig(t, testRepositoryInvalid1) client2, err := newTestClient(db, cfgInvalid1) assert.NoError(t, err) err = client2.Update(testRepositoryInvalid1.toUpdate()) @@ -221,14 +221,14 @@ func TestClientVerifyOrgID(t *testing.T) { testRepositoryValid := newTestRepository(2, 1, configTargets1, directorTargets1, []*pbgo.File{{Path: "datadog/2/APM_SAMPLING/id/1", Raw: target1content}}) testRepositoryInvalid := newTestRepository(2, 1, configTargets2, directorTargets2, []*pbgo.File{{Path: "datadog/3/APM_SAMPLING/id/1", Raw: target1content}}) - cfgValid := newTestConfig(testRepositoryValid) + cfgValid := newTestConfig(t, testRepositoryValid) client1, err := newTestClient(db, cfgValid) assert.NoError(t, err) err = client1.Update(testRepositoryValid.toUpdate()) assert.NoError(t, err) - cfgInvalid := newTestConfig(testRepositoryInvalid) + cfgInvalid := newTestConfig(t, testRepositoryInvalid) client2, err := newTestClient(db, cfgInvalid) assert.NoError(t, err) err = client2.Update(testRepositoryInvalid.toUpdate()) @@ -252,9 +252,7 @@ func TestClientVerifyOrgUUID(t *testing.T) { testRepositoryValidNoUUID := newTestRepository(4, 1, configTargets, directorTargets, []*pbgo.File{{Path: "datadog/2/APM_SAMPLING/id/1", Raw: target1content}}) testRepositoryInvalid := newTestRepository(3, 1, configTargets, directorTargets, []*pbgo.File{{Path: "datadog/2/APM_SAMPLING/id/1", Raw: target1content}}) - cfgValid := newTestConfig(testRepositoryValid) - cfgValidNoUUID := newTestConfig(testRepositoryValidNoUUID) - cfgInvalid := newTestConfig(testRepositoryInvalid) + cfgValid := newTestConfig(t, testRepositoryValid) // Valid repository with an orgID and a UUID in the snapshot client1, err := newTestClient(db, cfgValid) @@ -262,6 +260,7 @@ func TestClientVerifyOrgUUID(t *testing.T) { err = client1.Update(testRepositoryValid.toUpdate()) assert.NoError(t, err) + cfgValidNoUUID := newTestConfig(t, testRepositoryValidNoUUID) // Valid repository with an orgID but no UUID in the snapshot db2 := getTestDB(t) client2, err := newTestClient(db2, cfgValidNoUUID) @@ -269,6 +268,7 @@ func TestClientVerifyOrgUUID(t *testing.T) { err = client2.Update(testRepositoryValidNoUUID.toUpdate()) assert.Error(t, err) + cfgInvalid := newTestConfig(t, testRepositoryInvalid) // Invalid repository : receives snapshot with orgUUID for org 2, but is org 3 client3, err := newTestClient(db, cfgInvalid) assert.NoError(t, err) diff --git a/pkg/config/setup/config.go b/pkg/config/setup/config.go index 79cd76e8a3a28..c805ca0e2a58a 100644 --- a/pkg/config/setup/config.go +++ b/pkg/config/setup/config.go @@ -250,16 +250,16 @@ func init() { // - "tee": Construct both viper and nodetreemodel. Write to both, only read from viper // - other: Use viper for the config if found && envvar == "enable" { - datadog = nodetreemodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + datadog = nodetreemodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo // legit use case } else if found && envvar == "tee" { - var viperConfig = pkgconfigmodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) - var nodetreeConfig = nodetreemodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + var viperConfig = pkgconfigmodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo // legit use case + var nodetreeConfig = nodetreemodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo // legit use case datadog = teeconfig.NewTeeConfig(viperConfig, nodetreeConfig) } else { - datadog = pkgconfigmodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + datadog = pkgconfigmodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo // legit use case } - systemProbe = pkgconfigmodel.NewConfig("system-probe", "DD", strings.NewReplacer(".", "_")) + systemProbe = pkgconfigmodel.NewConfig("system-probe", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo // legit use case // Configuration defaults initConfig() @@ -354,7 +354,7 @@ func InitConfig(config pkgconfigmodel.Setup) { config.BindEnvAndSetDefault("scrubber.additional_keys", []string{}) // flare configs - config.BindEnvAndSetDefault("flare_provider_timeout", 10) + config.BindEnvAndSetDefault("flare_provider_timeout", 10*time.Second) // Docker config.BindEnvAndSetDefault("docker_query_timeout", int64(5)) @@ -1878,12 +1878,13 @@ func findUnknownEnvVars(config pkgconfigmodel.Config, environ []string, addition "DD_TRACE_PIPE_NAME": {}, "DD_TRACE_TRANSPORT": {}, "DD_VERSION": {}, - // this variable is used by CWS functional tests - "DD_TESTS_RUNTIME_COMPILED": {}, // this variable is used by the Kubernetes leader election mechanism "DD_POD_NAME": {}, // this variable is used by tracers "DD_INSTRUMENTATION_TELEMETRY_ENABLED": {}, + // these variables are used by source code integration + "DD_GIT_COMMIT_SHA": {}, + "DD_GIT_REPOSITORY_URL": {}, } for _, key := range config.GetEnvVars() { knownVars[key] = struct{}{} @@ -2334,7 +2335,7 @@ func sanitizeAPIKeyConfig(config pkgconfigmodel.Config, key string) { if !config.IsKnown(key) || !config.IsSet(key) { return } - config.Set(key, strings.TrimSpace(config.GetString(key)), pkgconfigmodel.SourceAgentRuntime) + config.Set(key, strings.TrimSpace(config.GetString(key)), config.GetSource(key)) } // sanitizeExternalMetricsProviderChunkSize ensures the value of `external_metrics_provider.chunk_size` is within an acceptable range diff --git a/pkg/config/setup/config_test.go b/pkg/config/setup/config_test.go index a52c698fb2e68..35116152a322b 100644 --- a/pkg/config/setup/config_test.go +++ b/pkg/config/setup/config_test.go @@ -1033,7 +1033,7 @@ func TestPeerTagsEnv(t *testing.T) { func TestLogDefaults(t *testing.T) { // New config - c := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + c := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo // legit use case require.Equal(t, 0, c.GetInt("log_file_max_rolls")) require.Equal(t, "", c.GetString("log_file_max_size")) require.Equal(t, "", c.GetString("log_file")) @@ -1052,7 +1052,7 @@ func TestLogDefaults(t *testing.T) { // SystemProbe config - SystemProbe := pkgconfigmodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + SystemProbe := pkgconfigmodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo // legit use case InitSystemProbeConfig(SystemProbe) require.Equal(t, 1, SystemProbe.GetInt("log_file_max_rolls")) @@ -1393,7 +1393,7 @@ func TestServerlessConfigNumComponents(t *testing.T) { } func TestServerlessConfigInit(t *testing.T) { - conf := pkgconfigmodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + conf := pkgconfigmodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo // legit use case initCommonWithServerless(conf) @@ -1419,7 +1419,7 @@ func TestAgentConfigInit(t *testing.T) { func TestENVAdditionalKeysToScrubber(t *testing.T) { // Test that the scrubber is correctly configured with the expected keys - cfg := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + cfg := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo // legit use case data := `scrubber.additional_keys: - yet_another_key diff --git a/pkg/config/setup/go.mod b/pkg/config/setup/go.mod index f7d403c4ca226..027a3ad35462a 100644 --- a/pkg/config/setup/go.mod +++ b/pkg/config/setup/go.mod @@ -107,12 +107,12 @@ require ( go.uber.org/dig v1.18.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/config/setup/go.sum b/pkg/config/setup/go.sum index 19f9fa3323e57..0d30b71e178a6 100644 --- a/pkg/config/setup/go.sum +++ b/pkg/config/setup/go.sum @@ -259,8 +259,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -303,11 +303,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -320,8 +320,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/pkg/config/setup/ipc_address_test.go b/pkg/config/setup/ipc_address_test.go index f8574a23b825d..eeeaf9bfc9847 100644 --- a/pkg/config/setup/ipc_address_test.go +++ b/pkg/config/setup/ipc_address_test.go @@ -69,7 +69,7 @@ func TestGetIPCAddress(t *testing.T) { } func getConfig() model.Config { - cfg := model.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + cfg := model.NewConfig("test", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo // legit use case cfg.BindEnv("ipc_address") cfg.BindEnvAndSetDefault("cmd_host", localhostStr) return cfg diff --git a/pkg/config/setup/system_probe.go b/pkg/config/setup/system_probe.go index 66762a7d98fae..97d0f0bf85856 100644 --- a/pkg/config/setup/system_probe.go +++ b/pkg/config/setup/system_probe.go @@ -31,7 +31,7 @@ const ( pngNS = "ping" tracerouteNS = "traceroute" discoveryNS = "discovery" - gpuMonitoringNS = "gpu_monitoring" + gpuNS = "gpu_monitoring" defaultConnsMessageBatchSize = 600 // defaultServiceMonitoringJavaAgentArgs is default arguments that are passing to the injected java USM agent @@ -408,7 +408,10 @@ func InitSystemProbeConfig(cfg pkgconfigmodel.Config) { cfg.BindEnv("fleet_policies_dir") // GPU monitoring - cfg.BindEnvAndSetDefault(join(gpuMonitoringNS, "enabled"), false) + cfg.BindEnvAndSetDefault(join(gpuNS, "enabled"), false) + cfg.BindEnv(join(gpuNS, "nvml_lib_path")) + cfg.BindEnvAndSetDefault(join(gpuNS, "process_scan_interval_seconds"), 5) + cfg.BindEnvAndSetDefault(join(gpuNS, "initial_process_sync"), true) initCWSSystemProbeConfig(cfg) } diff --git a/pkg/config/setup/test_helpers.go b/pkg/config/setup/test_helpers.go index ffa77d59810a8..165f7b4057712 100644 --- a/pkg/config/setup/test_helpers.go +++ b/pkg/config/setup/test_helpers.go @@ -15,7 +15,7 @@ import ( // newTestConf generates and returns a new configuration func newTestConf() pkgconfigmodel.Config { - conf := pkgconfigmodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + conf := pkgconfigmodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) // nolint: forbidigo // legit use case InitConfig(conf) conf.SetConfigFile("") pkgconfigmodel.ApplyOverrideFuncs(conf) diff --git a/pkg/config/structure/go.mod b/pkg/config/structure/go.mod index 800d2d54169c8..2b9f64d2de73e 100644 --- a/pkg/config/structure/go.mod +++ b/pkg/config/structure/go.mod @@ -33,6 +33,7 @@ replace ( require ( github.com/DataDog/datadog-agent/pkg/config/mock v0.0.0-00010101000000-000000000000 github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.3 + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 github.com/stretchr/testify v1.9.0 ) @@ -40,7 +41,6 @@ require ( github.com/DataDog/datadog-agent/comp/core/secrets v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/config/env v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect github.com/DataDog/datadog-agent/pkg/config/setup v0.0.0-00010101000000-000000000000 // indirect github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect github.com/DataDog/datadog-agent/pkg/util/executable v0.56.0-rc.3 // indirect @@ -79,12 +79,12 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/config/structure/go.sum b/pkg/config/structure/go.sum index e92309f06689e..fcbe4c21f6c43 100644 --- a/pkg/config/structure/go.sum +++ b/pkg/config/structure/go.sum @@ -252,8 +252,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -296,11 +296,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -313,8 +313,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/pkg/config/structure/unmarshal.go b/pkg/config/structure/unmarshal.go index c336a8bbc91d2..e59e59f8850c7 100644 --- a/pkg/config/structure/unmarshal.go +++ b/pkg/config/structure/unmarshal.go @@ -9,13 +9,12 @@ package structure import ( "fmt" "reflect" - "slices" - "strconv" "strings" "unicode" "unicode/utf8" "github.com/DataDog/datadog-agent/pkg/config/model" + "github.com/DataDog/datadog-agent/pkg/config/nodetreemodel" ) // features allowed for handling edge-cases @@ -38,9 +37,6 @@ var ConvertEmptyStringToNil UnmarshalKeyOption = func(fs *featureSet) { fs.convertEmptyStrNil = true } -// error for when a key is not found -var errNotFound = fmt.Errorf("not found") - // UnmarshalKey retrieves data from the config at the given key and deserializes it // to be stored on the target struct. It is implemented entirely using reflection, and // does not depend upon details of the data model of the config. @@ -55,7 +51,7 @@ func UnmarshalKey(cfg model.Reader, key string, target interface{}, opts ...Unma if rawval == nil { return nil } - source, err := newNode(reflect.ValueOf(rawval)) + source, err := nodetreemodel.NewNode(rawval) if err != nil { return err } @@ -69,7 +65,7 @@ func UnmarshalKey(cfg model.Reader, key string, target interface{}, opts ...Unma case reflect.Struct: return copyStruct(outValue, source, fs) case reflect.Slice: - if arr, ok := source.(arrayNode); ok { + if arr, ok := source.(nodetreemodel.ArrayNode); ok { return copyList(outValue, arr, fs) } if isEmptyString(source) { @@ -84,238 +80,6 @@ func UnmarshalKey(cfg model.Reader, key string, target interface{}, opts ...Unma } } -// leafNode represents a leaf with a scalar value - -type leafNode interface { - GetBool() (bool, error) - GetInt() (int, error) - GetFloat() (float64, error) - GetString() (string, error) -} - -type leafNodeImpl struct { - // val must be a scalar kind - val reflect.Value -} - -var _ leafNode = (*leafNodeImpl)(nil) -var _ node = (*leafNodeImpl)(nil) - -// arrayNode represents a node with an ordered array of children - -type arrayNode interface { - Size() int - Index(int) (node, error) -} - -type arrayNodeImpl struct { - // val must be a Slice with Len() and Index() - val reflect.Value -} - -var _ arrayNode = (*arrayNodeImpl)(nil) -var _ node = (*arrayNodeImpl)(nil) - -// node represents an arbitrary node of the tree - -type node interface { - GetChild(string) (node, error) - ChildrenKeys() ([]string, error) -} - -type innerNodeImpl struct { - // val must be a struct - val reflect.Value -} - -type innerMapNodeImpl struct { - // val must be a map[string]interface{} - val reflect.Value - // remapCase maps each lower-case key to the original case. This - // enables GetChild to retrieve values using case-insensitive keys - remapCase map[string]string -} - -var _ node = (*innerNodeImpl)(nil) -var _ node = (*innerMapNodeImpl)(nil) - -// all nodes, leaf, inner, and array nodes, each act as nodes -func newNode(v reflect.Value) (node, error) { - if v.Kind() == reflect.Struct { - return &innerNodeImpl{val: v}, nil - } else if v.Kind() == reflect.Map { - return &innerMapNodeImpl{val: v, remapCase: makeRemapCase(v)}, nil - } else if v.Kind() == reflect.Slice { - return &arrayNodeImpl{val: v}, nil - } else if isScalarKind(v) { - return &leafNodeImpl{val: v}, nil - } - return nil, fmt.Errorf("could not create node from: %v of type %T and kind %v", v, v, v.Kind()) -} - -// GetChild returns the child node at the given case-insensitive key, or an error if not found -func (n *innerNodeImpl) GetChild(key string) (node, error) { - findex := findFieldMatch(n.val, key) - if findex == -1 { - return nil, errNotFound - } - inner := n.val.Field(findex) - if inner.Kind() == reflect.Interface { - inner = inner.Elem() - } - return newNode(inner) -} - -// ChildrenKeys returns the list of keys of the children of the given node, if it is a map -func (n *innerNodeImpl) ChildrenKeys() ([]string, error) { - structType := n.val.Type() - keys := make([]string, 0, n.val.NumField()) - for i := 0; i < structType.NumField(); i++ { - f := structType.Field(i) - ch, _ := utf8.DecodeRuneInString(f.Name) - if unicode.IsLower(ch) { - continue - } - fieldKey, _ := fieldNameToKey(f) - keys = append(keys, fieldKey) - } - return keys, nil -} - -// GetChild returns the child node at the given case-insensitive key, or an error if not found -func (n *innerMapNodeImpl) GetChild(key string) (node, error) { - mkey := n.remapCase[strings.ToLower(key)] - inner := n.val.MapIndex(reflect.ValueOf(mkey)) - if !inner.IsValid() { - return nil, errNotFound - } - if inner.Kind() == reflect.Interface { - inner = inner.Elem() - } - return newNode(inner) -} - -// ChildrenKeys returns the list of keys of the children of the given node, if it is a map -func (n *innerMapNodeImpl) ChildrenKeys() ([]string, error) { - mapkeys := n.val.MapKeys() - keys := make([]string, 0, len(mapkeys)) - for _, kv := range mapkeys { - if kstr, ok := kv.Interface().(string); ok { - keys = append(keys, kstr) - } else { - return nil, fmt.Errorf("map node has invalid non-string key: %v", kv) - } - } - // map keys are iterated non-deterministically, sort them - slices.Sort(keys) - return keys, nil -} - -// GetChild returns an error because array node does not have children accessible by name -func (n *arrayNodeImpl) GetChild(string) (node, error) { - return nil, fmt.Errorf("arrayNodeImpl.GetChild not implemented") -} - -// ChildrenKeys returns an error because array node does not have children accessible by name -func (n *arrayNodeImpl) ChildrenKeys() ([]string, error) { - return nil, fmt.Errorf("arrayNodeImpl.ChildrenKeys not implemented") -} - -// Size returns number of children in the list -func (n *arrayNodeImpl) Size() int { - return n.val.Len() -} - -// Index returns the kth element of the list -func (n *arrayNodeImpl) Index(k int) (node, error) { - // arrayNodeImpl assumes val is an Array with Len() and Index() - elem := n.val.Index(k) - if elem.Kind() == reflect.Interface { - elem = elem.Elem() - } - return newNode(elem) -} - -// GetChild returns an error because a leaf has no children -func (n *leafNodeImpl) GetChild(key string) (node, error) { - return nil, fmt.Errorf("can't GetChild(%s) of a leaf node", key) -} - -// ChildrenKeys returns an error because a leaf has no children -func (n *leafNodeImpl) ChildrenKeys() ([]string, error) { - return nil, fmt.Errorf("can't get ChildrenKeys of a leaf node") -} - -// GetBool returns the scalar as a bool, or an error otherwise -func (n *leafNodeImpl) GetBool() (bool, error) { - if n.val.Kind() == reflect.Bool { - return n.val.Bool(), nil - } else if n.val.Kind() == reflect.Int { - return n.val.Int() != 0, nil - } else if n.val.Kind() == reflect.String { - return convertToBool(n.val.String()) - } - return false, newConversionError(n.val, "bool") -} - -// GetInt returns the scalar as a int, or an error otherwise -func (n *leafNodeImpl) GetInt() (int, error) { - switch n.val.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return int(n.val.Int()), nil - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - return int(n.val.Uint()), nil - case reflect.Float32, reflect.Float64: - return int(n.val.Float()), nil - } - return 0, newConversionError(n.val, "int") -} - -// GetFloat returns the scalar as a float64, or an error otherwise -func (n *leafNodeImpl) GetFloat() (float64, error) { - switch n.val.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return float64(n.val.Int()), nil - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - return float64(n.val.Uint()), nil - case reflect.Float32, reflect.Float64: - return float64(n.val.Float()), nil - } - return 0, newConversionError(n.val, "float") -} - -// GetString returns the scalar as a string, or an error otherwise -func (n *leafNodeImpl) GetString() (string, error) { - switch n.val.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - stringVal := strconv.FormatInt(n.val.Int(), 10) - return stringVal, nil - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - stringVal := strconv.FormatUint(n.val.Uint(), 10) - return stringVal, nil - case reflect.Float32: - stringVal := strconv.FormatFloat(n.val.Float(), 'f', -1, 32) - return stringVal, nil - case reflect.Float64: - stringVal := strconv.FormatFloat(n.val.Float(), 'f', -1, 64) - return stringVal, nil - case reflect.String: - return n.val.String(), nil - } - return "", newConversionError(n.val, "string") -} - -// convert a string to a bool using standard yaml constants -func convertToBool(text string) (bool, error) { - lower := strings.ToLower(text) - if lower == "y" || lower == "yes" || lower == "on" || lower == "true" || lower == "1" { - return true, nil - } else if lower == "n" || lower == "no" || lower == "off" || lower == "false" || lower == "0" { - return false, nil - } - return false, newConversionError(reflect.ValueOf(text), "bool") -} - type specifierSet map[string]struct{} // fieldNameToKey returns the lower-cased field name, for case insensitive comparisons, @@ -349,7 +113,7 @@ func fieldNameToKey(field reflect.StructField) (string, specifierSet) { return strings.ToLower(name), specifiers } -func copyStruct(target reflect.Value, source node, fs *featureSet) error { +func copyStruct(target reflect.Value, source nodetreemodel.Node, fs *featureSet) error { targetType := target.Type() for i := 0; i < targetType.NumField(); i++ { f := targetType.Field(i) @@ -369,7 +133,7 @@ func copyStruct(target reflect.Value, source node, fs *featureSet) error { continue } child, err := source.GetChild(fieldKey) - if err == errNotFound { + if err == nodetreemodel.ErrNotFound { continue } if err != nil { @@ -383,7 +147,7 @@ func copyStruct(target reflect.Value, source node, fs *featureSet) error { return nil } -func copyMap(target reflect.Value, source node, _ *featureSet) error { +func copyMap(target reflect.Value, source nodetreemodel.Node, _ *featureSet) error { // TODO: Should handle maps with more complex types in a future PR ktype := reflect.TypeOf("") vtype := reflect.TypeOf("") @@ -402,7 +166,7 @@ func copyMap(target reflect.Value, source node, _ *featureSet) error { if child == nil { continue } - if scalar, ok := child.(leafNode); ok { + if scalar, ok := child.(nodetreemodel.LeafNode); ok { if mval, err := scalar.GetString(); err == nil { results.SetMapIndex(reflect.ValueOf(mkey), reflect.ValueOf(mval)) } else { @@ -414,7 +178,7 @@ func copyMap(target reflect.Value, source node, _ *featureSet) error { return nil } -func copyLeaf(target reflect.Value, source leafNode, _ *featureSet) error { +func copyLeaf(target reflect.Value, source nodetreemodel.LeafNode, _ *featureSet) error { if source == nil { return fmt.Errorf("source value is not a scalar") } @@ -458,7 +222,7 @@ func copyLeaf(target reflect.Value, source leafNode, _ *featureSet) error { return fmt.Errorf("unsupported scalar type %v", target.Kind()) } -func copyList(target reflect.Value, source arrayNode, fs *featureSet) error { +func copyList(target reflect.Value, source nodetreemodel.ArrayNode, fs *featureSet) error { if source == nil { return fmt.Errorf("source value is not a list") } @@ -483,14 +247,14 @@ func copyList(target reflect.Value, source arrayNode, fs *featureSet) error { return nil } -func copyAny(target reflect.Value, source node, fs *featureSet) error { +func copyAny(target reflect.Value, source nodetreemodel.Node, fs *featureSet) error { if target.Kind() == reflect.Pointer { allocPtr := reflect.New(target.Type().Elem()) target.Set(allocPtr) target = allocPtr.Elem() } if isScalarKind(target) { - if leaf, ok := source.(leafNode); ok { + if leaf, ok := source.(nodetreemodel.LeafNode); ok { return copyLeaf(target, leaf, fs) } return fmt.Errorf("can't copy into target: scalar required, but source is not a leaf") @@ -499,7 +263,7 @@ func copyAny(target reflect.Value, source node, fs *featureSet) error { } else if target.Kind() == reflect.Struct { return copyStruct(target, source, fs) } else if target.Kind() == reflect.Slice { - if arr, ok := source.(arrayNode); ok { + if arr, ok := source.(nodetreemodel.ArrayNode); ok { return copyList(target, arr, fs) } return fmt.Errorf("can't copy into target: []T required, but source is not an array") @@ -509,8 +273,8 @@ func copyAny(target reflect.Value, source node, fs *featureSet) error { return fmt.Errorf("unknown value to copy: %v", target.Type()) } -func isEmptyString(source node) bool { - if leaf, ok := source.(leafNode); ok { +func isEmptyString(source nodetreemodel.Node) bool { + if leaf, ok := source.(nodetreemodel.LeafNode); ok { if str, err := leaf.GetString(); err == nil { return str == "" } @@ -522,36 +286,3 @@ func isScalarKind(v reflect.Value) bool { k := v.Kind() return (k >= reflect.Bool && k <= reflect.Float64) || k == reflect.String } - -func makeRemapCase(v reflect.Value) map[string]string { - remap := make(map[string]string) - iter := v.MapRange() - for iter.Next() { - mkey := "" - switch k := iter.Key().Interface().(type) { - case string: - mkey = k - default: - mkey = fmt.Sprintf("%s", k) - } - remap[strings.ToLower(mkey)] = mkey - } - return remap -} - -func findFieldMatch(val reflect.Value, key string) int { - // case-insensitive match for struct names - key = strings.ToLower(key) - schema := val.Type() - for i := 0; i < schema.NumField(); i++ { - fieldKey, _ := fieldNameToKey(schema.Field(i)) - if key == fieldKey { - return i - } - } - return -1 -} - -func newConversionError(v reflect.Value, expectType string) error { - return fmt.Errorf("could not convert to %s: %v of type %T and Kind %v", expectType, v, v, v.Kind()) -} diff --git a/pkg/config/structure/unmarshal_test.go b/pkg/config/structure/unmarshal_test.go index e268281ddda84..61f7811ba7057 100644 --- a/pkg/config/structure/unmarshal_test.go +++ b/pkg/config/structure/unmarshal_test.go @@ -12,6 +12,7 @@ import ( "testing" "github.com/DataDog/datadog-agent/pkg/config/mock" + "github.com/DataDog/datadog-agent/pkg/config/nodetreemodel" "github.com/stretchr/testify/assert" ) @@ -1258,13 +1259,13 @@ service: } func TestMapGetChildNotFound(t *testing.T) { - m := map[string]string{"a": "apple", "b": "banana"} - n, err := newNode(reflect.ValueOf(m)) + m := map[string]interface{}{"a": "apple", "b": "banana"} + n, err := nodetreemodel.NewNode(m) assert.NoError(t, err) val, err := n.GetChild("a") assert.NoError(t, err) - str, err := val.(leafNode).GetString() + str, err := val.(nodetreemodel.LeafNode).GetString() assert.NoError(t, err) assert.Equal(t, str, "apple") diff --git a/pkg/config/teeconfig/go.mod b/pkg/config/teeconfig/go.mod index 6cf73f8b14ba4..c0a7e97877f75 100644 --- a/pkg/config/teeconfig/go.mod +++ b/pkg/config/teeconfig/go.mod @@ -11,7 +11,6 @@ replace ( require ( github.com/DataDog/datadog-agent/pkg/config/model v0.0.0-00010101000000-000000000000 github.com/DataDog/viper v1.13.5 - github.com/spf13/afero v1.11.0 ) require ( @@ -24,12 +23,13 @@ require ( github.com/mitchellh/mapstructure v1.1.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.2.0 // indirect + github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.3.0 // indirect github.com/spf13/jwalterweatherman v1.0.0 // indirect github.com/spf13/pflag v1.0.3 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/pkg/config/teeconfig/go.sum b/pkg/config/teeconfig/go.sum index fd8d0133a518b..b726a3b799e83 100644 --- a/pkg/config/teeconfig/go.sum +++ b/pkg/config/teeconfig/go.sum @@ -168,8 +168,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -202,11 +202,11 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/pkg/config/teeconfig/teeconfig.go b/pkg/config/teeconfig/teeconfig.go index aa312e3bdad05..ed490fd127fe5 100644 --- a/pkg/config/teeconfig/teeconfig.go +++ b/pkg/config/teeconfig/teeconfig.go @@ -12,7 +12,6 @@ import ( "time" "github.com/DataDog/viper" - "github.com/spf13/afero" "github.com/DataDog/datadog-agent/pkg/config/model" ) @@ -104,12 +103,6 @@ func (t *teeConfig) ParseEnvAsSlice(key string, fn func(string) []interface{}) { t.compare.ParseEnvAsSlice(key, fn) } -// SetFs wraps Viper for concurrent access -func (t *teeConfig) SetFs(fs afero.Fs) { - t.baseline.SetFs(fs) - t.compare.SetFs(fs) -} - // IsSet wraps Viper for concurrent access func (t *teeConfig) IsSet(key string) bool { return t.baseline.IsSet(key) @@ -228,16 +221,6 @@ func (t *teeConfig) UnmarshalKey(key string, rawVal interface{}, opts ...viper.D return t.baseline.UnmarshalKey(key, rawVal, opts...) } -// Unmarshal wraps Viper for concurrent access -func (t *teeConfig) Unmarshal(rawVal interface{}) error { - return t.baseline.Unmarshal(rawVal) -} - -// UnmarshalExact wraps Viper for concurrent access -func (t *teeConfig) UnmarshalExact(rawVal interface{}) error { - return t.baseline.UnmarshalExact(rawVal) -} - // ReadInConfig wraps Viper for concurrent access func (t *teeConfig) ReadInConfig() error { err1 := t.baseline.ReadInConfig() diff --git a/pkg/config/utils/endpoints_test.go b/pkg/config/utils/endpoints_test.go index 17b9449188054..64d87bfe7af17 100644 --- a/pkg/config/utils/endpoints_test.go +++ b/pkg/config/utils/endpoints_test.go @@ -9,10 +9,7 @@ import ( "testing" "github.com/DataDog/datadog-agent/pkg/config/mock" - pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" - "github.com/DataDog/datadog-agent/comp/core/secrets" - "github.com/DataDog/datadog-agent/pkg/util/optional" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -22,11 +19,7 @@ import ( // endpoints are configured. // Refer to https://github.com/DataDog/viper/pull/2 for more details. func TestSecretBackendWithMultipleEndpoints(t *testing.T) { - conf := mock.New(t) - conf.SetConfigFile("./tests/datadog_secrets.yaml") - // load the configuration - _, err := pkgconfigsetup.LoadDatadogCustom(conf, "datadog_secrets.yaml", optional.NewNoneOption[secrets.Component](), nil) - assert.NoError(t, err) + conf := mock.NewFromFile(t, "./tests/datadog_secrets.yaml") expectedKeysPerDomain := map[string][]string{ "https://app.datadoghq.com": {"someapikey", "someotherapikey"}, diff --git a/pkg/config/utils/go.mod b/pkg/config/utils/go.mod index 572ec9aeee790..442215229081c 100644 --- a/pkg/config/utils/go.mod +++ b/pkg/config/utils/go.mod @@ -33,17 +33,16 @@ replace ( ) require ( - github.com/DataDog/datadog-agent/comp/core/secrets v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/config/setup v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/log v0.56.0-rc.3 - github.com/DataDog/datadog-agent/pkg/util/optional v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/version v0.56.0-rc.3 github.com/stretchr/testify v1.9.0 ) require ( + github.com/DataDog/datadog-agent/comp/core/secrets v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/config/env v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect @@ -51,6 +50,7 @@ require ( github.com/DataDog/datadog-agent/pkg/util/executable v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/filesystem v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/optional v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/pointer v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/system v0.56.0-rc.3 // indirect @@ -82,12 +82,12 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/config/utils/go.sum b/pkg/config/utils/go.sum index e92309f06689e..fcbe4c21f6c43 100644 --- a/pkg/config/utils/go.sum +++ b/pkg/config/utils/go.sum @@ -252,8 +252,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -296,11 +296,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -313,8 +313,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/pkg/config/utils/metadata_as_tags_test.go b/pkg/config/utils/metadata_as_tags_test.go index c1f73c8fa1599..59aef7752da2b 100644 --- a/pkg/config/utils/metadata_as_tags_test.go +++ b/pkg/config/utils/metadata_as_tags_test.go @@ -7,12 +7,11 @@ package utils import ( "reflect" - "strings" "testing" "github.com/stretchr/testify/assert" - pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" ) @@ -101,7 +100,7 @@ func TestGetMetadataAsTagsNoError(t *testing.T) { for _, test := range tests { t.Run(test.name, func(tt *testing.T) { - mockConfig := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + mockConfig := configmock.New(t) pkgconfigsetup.InitConfig(mockConfig) mockConfig.SetWithoutSource("kubernetes_pod_labels_as_tags", test.podLabelsAsTags) diff --git a/pkg/config/utils/tags_test.go b/pkg/config/utils/tags_test.go index 081cf771e676d..c244a1492c35f 100644 --- a/pkg/config/utils/tags_test.go +++ b/pkg/config/utils/tags_test.go @@ -6,16 +6,15 @@ package utils import ( - "strings" "testing" - pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" "github.com/stretchr/testify/assert" ) func TestGetConfiguredaTags(t *testing.T) { - mockConfig := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + mockConfig := configmock.New(t) pkgconfigsetup.InitConfig(mockConfig) set1 := []string{"1", "2", "3"} @@ -25,7 +24,7 @@ func TestGetConfiguredaTags(t *testing.T) { } func TestGetConfiguredaTagsExtraTags(t *testing.T) { - mockConfig := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + mockConfig := configmock.New(t) pkgconfigsetup.InitConfig(mockConfig) set1 := []string{"1", "2", "3"} @@ -35,7 +34,7 @@ func TestGetConfiguredaTagsExtraTags(t *testing.T) { } func TestGetConfiguredaTagsDSD(t *testing.T) { - mockConfig := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + mockConfig := configmock.New(t) pkgconfigsetup.InitConfig(mockConfig) set1 := []string{"1", "2", "3"} @@ -46,7 +45,7 @@ func TestGetConfiguredaTagsDSD(t *testing.T) { } func TestGetConfiguredaTagsCombined(t *testing.T) { - mockConfig := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + mockConfig := configmock.New(t) pkgconfigsetup.InitConfig(mockConfig) set1 := []string{"1", "2", "3"} diff --git a/pkg/config/utils/telemetry_test.go b/pkg/config/utils/telemetry_test.go index 3ac22275eea89..49e2729ceddab 100644 --- a/pkg/config/utils/telemetry_test.go +++ b/pkg/config/utils/telemetry_test.go @@ -6,10 +6,9 @@ package utils import ( - "strings" "testing" - pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" "github.com/stretchr/testify/assert" ) @@ -17,7 +16,7 @@ import ( func TestIsCheckTelemetryEnabled(t *testing.T) { assert := assert.New(t) - mockConfig := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + mockConfig := configmock.New(t) pkgconfigsetup.InitConfig(mockConfig) mockConfig.SetWithoutSource("agent_telemetry.enabled", false) mockConfig.SetWithoutSource("telemetry.enabled", false) diff --git a/pkg/ebpf/config.go b/pkg/ebpf/config.go index 3bcea9ba21de2..1f27d5ff7525a 100644 --- a/pkg/ebpf/config.go +++ b/pkg/ebpf/config.go @@ -6,8 +6,6 @@ package ebpf import ( - "strings" - sysconfig "github.com/DataDog/datadog-agent/cmd/system-probe/config" pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" "github.com/DataDog/datadog-agent/pkg/util/kernel" @@ -81,38 +79,34 @@ type Config struct { BypassEnabled bool } -func key(pieces ...string) string { - return strings.Join(pieces, ".") -} - // NewConfig creates a config with ebpf-related settings func NewConfig() *Config { cfg := pkgconfigsetup.SystemProbe() sysconfig.Adjust(cfg) c := &Config{ - BPFDebug: cfg.GetBool(key(spNS, "bpf_debug")), - BPFDir: cfg.GetString(key(spNS, "bpf_dir")), - ExcludedBPFLinuxVersions: cfg.GetStringSlice(key(spNS, "excluded_linux_versions")), - EnableTracepoints: cfg.GetBool(key(spNS, "enable_tracepoints")), + BPFDebug: cfg.GetBool(sysconfig.FullKeyPath(spNS, "bpf_debug")), + BPFDir: cfg.GetString(sysconfig.FullKeyPath(spNS, "bpf_dir")), + ExcludedBPFLinuxVersions: cfg.GetStringSlice(sysconfig.FullKeyPath(spNS, "excluded_linux_versions")), + EnableTracepoints: cfg.GetBool(sysconfig.FullKeyPath(spNS, "enable_tracepoints")), ProcRoot: kernel.ProcFSRoot(), - InternalTelemetryEnabled: cfg.GetBool(key(spNS, "telemetry_enabled")), - - EnableCORE: cfg.GetBool(key(spNS, "enable_co_re")), - BTFPath: cfg.GetString(key(spNS, "btf_path")), - - EnableRuntimeCompiler: cfg.GetBool(key(spNS, "enable_runtime_compiler")), - RuntimeCompilerOutputDir: cfg.GetString(key(spNS, "runtime_compiler_output_dir")), - EnableKernelHeaderDownload: cfg.GetBool(key(spNS, "enable_kernel_header_download")), - KernelHeadersDirs: cfg.GetStringSlice(key(spNS, "kernel_header_dirs")), - KernelHeadersDownloadDir: cfg.GetString(key(spNS, "kernel_header_download_dir")), - AptConfigDir: cfg.GetString(key(spNS, "apt_config_dir")), - YumReposDir: cfg.GetString(key(spNS, "yum_repos_dir")), - ZypperReposDir: cfg.GetString(key(spNS, "zypper_repos_dir")), - AllowPrecompiledFallback: cfg.GetBool(key(spNS, "allow_precompiled_fallback")), - AllowRuntimeCompiledFallback: cfg.GetBool(key(spNS, "allow_runtime_compiled_fallback")), - - AttachKprobesWithKprobeEventsABI: cfg.GetBool(key(spNS, "attach_kprobes_with_kprobe_events_abi")), + InternalTelemetryEnabled: cfg.GetBool(sysconfig.FullKeyPath(spNS, "telemetry_enabled")), + + EnableCORE: cfg.GetBool(sysconfig.FullKeyPath(spNS, "enable_co_re")), + BTFPath: cfg.GetString(sysconfig.FullKeyPath(spNS, "btf_path")), + + EnableRuntimeCompiler: cfg.GetBool(sysconfig.FullKeyPath(spNS, "enable_runtime_compiler")), + RuntimeCompilerOutputDir: cfg.GetString(sysconfig.FullKeyPath(spNS, "runtime_compiler_output_dir")), + EnableKernelHeaderDownload: cfg.GetBool(sysconfig.FullKeyPath(spNS, "enable_kernel_header_download")), + KernelHeadersDirs: cfg.GetStringSlice(sysconfig.FullKeyPath(spNS, "kernel_header_dirs")), + KernelHeadersDownloadDir: cfg.GetString(sysconfig.FullKeyPath(spNS, "kernel_header_download_dir")), + AptConfigDir: cfg.GetString(sysconfig.FullKeyPath(spNS, "apt_config_dir")), + YumReposDir: cfg.GetString(sysconfig.FullKeyPath(spNS, "yum_repos_dir")), + ZypperReposDir: cfg.GetString(sysconfig.FullKeyPath(spNS, "zypper_repos_dir")), + AllowPrecompiledFallback: cfg.GetBool(sysconfig.FullKeyPath(spNS, "allow_precompiled_fallback")), + AllowRuntimeCompiledFallback: cfg.GetBool(sysconfig.FullKeyPath(spNS, "allow_runtime_compiled_fallback")), + + AttachKprobesWithKprobeEventsABI: cfg.GetBool(sysconfig.FullKeyPath(spNS, "attach_kprobes_with_kprobe_events_abi")), } return c diff --git a/pkg/ebpf/uprobes/attacher.go b/pkg/ebpf/uprobes/attacher.go index 1c465ccbf05fc..de71ff62a00a6 100644 --- a/pkg/ebpf/uprobes/attacher.go +++ b/pkg/ebpf/uprobes/attacher.go @@ -176,11 +176,10 @@ type AttacherConfig struct { EbpfConfig *ebpf.Config // PerformInitialScan defines if the attacher should perform an initial scan of the processes before starting the monitor + // Note that if processMonitor is being used (i.e., rules are targeting executables), the ProcessMonitor itself + // will perform an initial scan in its Initialize method. PerformInitialScan bool - // ProcessMonitorEventStream defines whether the process monitor is using the event stream - ProcessMonitorEventStream bool - // EnableDetailedLogging makes the attacher log why it's attaching or not attaching to a process // This is useful for debugging purposes, do not enable in production. EnableDetailedLogging bool @@ -383,11 +382,6 @@ func (ua *UprobeAttacher) handlesExecutables() bool { func (ua *UprobeAttacher) Start() error { var cleanupExec, cleanupExit func() procMonitor := monitor.GetProcessMonitor() - err := procMonitor.Initialize(ua.config.ProcessMonitorEventStream) - if err != nil { - return fmt.Errorf("error initializing process monitor: %w", err) - } - if ua.handlesExecutables() { cleanupExec = procMonitor.SubscribeExec(ua.handleProcessStart) } diff --git a/pkg/ebpf/uprobes/attacher_test.go b/pkg/ebpf/uprobes/attacher_test.go index 6ef68c910f514..4297686e0c47b 100644 --- a/pkg/ebpf/uprobes/attacher_test.go +++ b/pkg/ebpf/uprobes/attacher_test.go @@ -273,13 +273,14 @@ func TestMonitor(t *testing.T) { return } + launchProcessMonitor(t, false) + config := AttacherConfig{ Rules: []*AttachRule{{ LibraryNameRegex: regexp.MustCompile(`libssl.so`), Targets: AttachToExecutable | AttachToSharedLibraries, }}, - ProcessMonitorEventStream: false, - EbpfConfig: ebpfCfg, + EbpfConfig: ebpfCfg, } ua, err := NewUprobeAttacher("mock", config, &MockManager{}, nil, nil) require.NoError(t, err) @@ -654,6 +655,8 @@ func TestUprobeAttacher(t *testing.T) { return } + launchProcessMonitor(t, false) + buf, err := bytecode.GetReader(ebpfCfg.BPFDir, "uprobe_attacher-test.o") require.NoError(t, err) t.Cleanup(func() { buf.Close() }) @@ -821,8 +824,10 @@ func (s *SharedLibrarySuite) TestSingleFile() { func() bool { return methodHasBeenCalledTimes(mockRegistry, "Register", 1) }, - func() { - if cmd != nil && cmd.Process != nil { + func(testSuccess bool) { + // Only kill the process if the test failed, if it succeeded we want to kill it later + // to check if the Unregister call was done correctly + if !testSuccess && cmd != nil && cmd.Process != nil { cmd.Process.Kill() } }, diff --git a/pkg/ebpf/uprobes/testutil.go b/pkg/ebpf/uprobes/testutil.go index a7f21c3586de6..0c91c4ef3912f 100644 --- a/pkg/ebpf/uprobes/testutil.go +++ b/pkg/ebpf/uprobes/testutil.go @@ -181,18 +181,24 @@ func checkIfEventually(condition func() bool, checkInterval time.Duration, check } } -// waitAndRetryIfFail is basically a way to do require.Eventually with multiple retries. -// In each retry, it will run the setupFunc, then wait until the condition defined by testFunc is met or the timeout is reached, and then run the retryCleanup function. -// If the condition is met, it will return, otherwise it will retry the same thing again. -// If the condition is not met after maxRetries, it will fail the test. -func waitAndRetryIfFail(t *testing.T, setupFunc func(), testFunc func() bool, retryCleanup func(), maxRetries int, checkInterval time.Duration, maxSingleCheckTime time.Duration, msgAndArgs ...interface{}) { +// waitAndRetryIfFail is basically a way to do require.Eventually with multiple +// retries. In each retry, it will run the setupFunc, then wait until the +// condition defined by testFunc is met or the timeout is reached, and then run +// the retryCleanup function. The retryCleanup function is useful to clean up +// any state that was set up in the setupFunc. It will receive a boolean +// indicating if the test was successful or not, in case the cleanup needs to be +// different depending on the test result (e.g., if the test didn't fail we +// might want to keep some state). If the condition is met, it will return, +// otherwise it will retry the same thing again. If the condition is not met +// after maxRetries, it will fail the test. +func waitAndRetryIfFail(t *testing.T, setupFunc func(), testFunc func() bool, retryCleanup func(testSuccess bool), maxRetries int, checkInterval time.Duration, maxSingleCheckTime time.Duration, msgAndArgs ...interface{}) { for i := 0; i < maxRetries; i++ { if setupFunc != nil { setupFunc() } result := checkIfEventually(testFunc, checkInterval, maxSingleCheckTime) if retryCleanup != nil { - retryCleanup() + retryCleanup(result) } if result { diff --git a/pkg/eventmonitor/config/config.go b/pkg/eventmonitor/config/config.go index 785b1ffd968ef..04248f6460e77 100644 --- a/pkg/eventmonitor/config/config.go +++ b/pkg/eventmonitor/config/config.go @@ -7,8 +7,7 @@ package config import ( - "strings" - + sysconfig "github.com/DataDog/datadog-agent/cmd/system-probe/config" pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" "github.com/DataDog/datadog-agent/pkg/util/log" ) @@ -34,21 +33,17 @@ type Config struct { func NewConfig() *Config { return &Config{ // event server - SocketPath: pkgconfigsetup.SystemProbe().GetString(join(evNS, "socket")), - EventServerBurst: pkgconfigsetup.SystemProbe().GetInt(join(evNS, "event_server.burst")), + SocketPath: pkgconfigsetup.SystemProbe().GetString(sysconfig.FullKeyPath(evNS, "socket")), + EventServerBurst: pkgconfigsetup.SystemProbe().GetInt(sysconfig.FullKeyPath(evNS, "event_server.burst")), // consumers ProcessConsumerEnabled: getBool("process.enabled"), } } -func join(pieces ...string) string { - return strings.Join(pieces, ".") -} - func getAllKeys(key string) (string, string) { - deprecatedKey := strings.Join([]string{rsNS, key}, ".") - newKey := strings.Join([]string{evNS, key}, ".") + deprecatedKey := sysconfig.FullKeyPath(rsNS, key) + newKey := sysconfig.FullKeyPath(evNS, key) return deprecatedKey, newKey } diff --git a/pkg/eventmonitor/eventmonitor.go b/pkg/eventmonitor/eventmonitor.go index a0b4a84e2cc9f..ce93880272057 100644 --- a/pkg/eventmonitor/eventmonitor.go +++ b/pkg/eventmonitor/eventmonitor.go @@ -11,7 +11,6 @@ package eventmonitor import ( "context" "fmt" - "net" "slices" "sync" "time" @@ -55,7 +54,6 @@ type EventMonitor struct { cancelFnc context.CancelFunc sendStatsChan chan chan bool eventConsumers []EventConsumerInterface - netListener net.Listener wg sync.WaitGroup } @@ -108,8 +106,6 @@ func (m *EventMonitor) Start() error { return fmt.Errorf("unable to register event monitoring module: %w", err) } - m.netListener = ln - m.wg.Add(1) go func() { defer m.wg.Done() @@ -169,17 +165,17 @@ func (m *EventMonitor) Close() { m.GRPCServer.Stop() } - if m.netListener != nil { - m.netListener.Close() + if err := m.cleanup(); err != nil { + seclog.Errorf("failed to cleanup event monitor: %v", err) } - m.cleanup() - m.cancelFnc() m.wg.Wait() // all the go routines should be stopped now we can safely call close the probe and remove the eBPF programs - m.Probe.Close() + if err := m.Probe.Close(); err != nil { + seclog.Errorf("failed to close event monitor probe: %v", err) + } } // SendStats send stats diff --git a/pkg/eventmonitor/eventmonitor_linux.go b/pkg/eventmonitor/eventmonitor_linux.go index cae6dff3153df..5ef2576dce7db 100644 --- a/pkg/eventmonitor/eventmonitor_linux.go +++ b/pkg/eventmonitor/eventmonitor_linux.go @@ -26,10 +26,15 @@ func (m *EventMonitor) getListener() (net.Listener, error) { func (m *EventMonitor) init() error { // force socket cleanup of previous socket not cleanup - os.Remove(m.Config.SocketPath) + if err := os.Remove(m.Config.SocketPath); err != nil && !os.IsNotExist(err) { + return err + } return nil } -func (m *EventMonitor) cleanup() { - os.Remove(m.Config.SocketPath) +func (m *EventMonitor) cleanup() error { + if err := os.Remove(m.Config.SocketPath); err != nil && !os.IsNotExist(err) { + return err + } + return nil } diff --git a/pkg/eventmonitor/eventmonitor_windows.go b/pkg/eventmonitor/eventmonitor_windows.go index e6263e7b9a7f1..84d88bf4e4f56 100644 --- a/pkg/eventmonitor/eventmonitor_windows.go +++ b/pkg/eventmonitor/eventmonitor_windows.go @@ -19,4 +19,6 @@ func (m *EventMonitor) init() error { return nil } -func (m *EventMonitor) cleanup() {} +func (m *EventMonitor) cleanup() error { + return nil +} diff --git a/pkg/flare/archive_security_test.go b/pkg/flare/archive_security_test.go index c66d8e52e587a..9e5284359e1cd 100644 --- a/pkg/flare/archive_security_test.go +++ b/pkg/flare/archive_security_test.go @@ -12,7 +12,6 @@ import ( "go.uber.org/fx" - "github.com/DataDog/datadog-agent/cmd/agent/common" flarehelpers "github.com/DataDog/datadog-agent/comp/core/flare/helpers" flaretypes "github.com/DataDog/datadog-agent/comp/core/flare/types" "github.com/DataDog/datadog-agent/comp/core/status" @@ -26,9 +25,7 @@ import ( ) func TestCreateSecurityAgentArchive(t *testing.T) { - common.SetupConfigForTest("./test") mockConfig := configmock.New(t) - statusComponent := fxutil.Test[status.Mock](t, fx.Options( statusimpl.MockModule(), )) diff --git a/pkg/flare/archive_test.go b/pkg/flare/archive_test.go index 6e6036d2ddee6..fb4ee4866a224 100644 --- a/pkg/flare/archive_test.go +++ b/pkg/flare/archive_test.go @@ -22,7 +22,6 @@ import ( procmodel "github.com/DataDog/agent-payload/v5/process" - "github.com/DataDog/datadog-agent/cmd/agent/common" flarehelpers "github.com/DataDog/datadog-agent/comp/core/flare/helpers" "github.com/DataDog/datadog-agent/comp/core/tagger/types" workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def" @@ -44,7 +43,7 @@ func TestGoRoutines(t *testing.T) { } func TestIncludeSystemProbeConfig(t *testing.T) { - common.SetupConfigForTest("./test/datadog-agent.yaml") + configmock.NewFromFile(t, "./test/datadog-agent.yaml") // create system-probe.yaml file because it's in .gitignore _, err := os.Create("./test/system-probe.yaml") require.NoError(t, err, "couldn't create system-probe.yaml") @@ -58,7 +57,7 @@ func TestIncludeSystemProbeConfig(t *testing.T) { } func TestIncludeConfigFiles(t *testing.T) { - common.SetupConfigForTest("./test") + configmock.New(t) mock := flarehelpers.NewFlareBuilderMock(t, false) getConfigFiles(mock.Fb, searchPaths{"": "./test/confd"}) @@ -69,7 +68,7 @@ func TestIncludeConfigFiles(t *testing.T) { } func TestIncludeConfigFilesWithPrefix(t *testing.T) { - common.SetupConfigForTest("./test") + configmock.New(t) mock := flarehelpers.NewFlareBuilderMock(t, false) getConfigFiles(mock.Fb, searchPaths{"prefix": "./test/confd"}) diff --git a/pkg/fleet/daemon/remote_config.go b/pkg/fleet/daemon/remote_config.go index 24289098f5c58..1b34301343cf1 100644 --- a/pkg/fleet/daemon/remote_config.go +++ b/pkg/fleet/daemon/remote_config.go @@ -36,7 +36,7 @@ func newRemoteConfig(rcFetcher client.ConfigFetcher) (*remoteConfig, error) { client, err := client.NewClient( rcFetcher, client.WithUpdater(), - client.WithProducts(state.ProductUpdaterCatalogDD, state.ProductUpdaterTask), + client.WithProducts(state.ProductUpdaterCatalogDD), client.WithoutTufVerification(), ) if err != nil { diff --git a/pkg/fleet/installer/installer.go b/pkg/fleet/installer/installer.go index 9d39d9719e4b6..88a08f12d13cd 100644 --- a/pkg/fleet/installer/installer.go +++ b/pkg/fleet/installer/installer.go @@ -186,6 +186,10 @@ func (i *installerImpl) Install(ctx context.Context, url string, args []string) return fmt.Errorf("could not create temporary directory: %w", err) } defer os.RemoveAll(tmpDir) + err = i.db.DeletePackage(pkg.Name) + if err != nil { + return fmt.Errorf("could not remove package installation in db: %w", err) + } configDir := filepath.Join(i.userConfigsDir, pkg.Name) err = pkg.ExtractLayers(oci.DatadogPackageLayerMediaType, tmpDir) if err != nil { diff --git a/pkg/fleet/installer/installer_test.go b/pkg/fleet/installer/installer_test.go index 069c2e04cf9e8..8a87c4b51e3ee 100644 --- a/pkg/fleet/installer/installer_test.go +++ b/pkg/fleet/installer/installer_test.go @@ -9,8 +9,10 @@ import ( "context" "io/fs" "os" + "path" "path/filepath" "testing" + "time" "github.com/stretchr/testify/assert" @@ -122,3 +124,83 @@ func TestUninstallExperiment(t *testing.T) { // we do not rollback configuration examples to their previous versions currently fixtures.AssertEqualFS(t, s.ConfigFS(fixtures.FixtureSimpleV2), installer.ConfigFS(fixtures.FixtureSimpleV2)) } + +func TestInstallSkippedWhenAlreadyInstalled(t *testing.T) { + s := fixtures.NewServer(t) + installer := newTestPackageManager(t, s, t.TempDir(), t.TempDir()) + defer installer.db.Close() + + err := installer.Install(testCtx, s.PackageURL(fixtures.FixtureSimpleV1), nil) + assert.NoError(t, err) + r := installer.packages.Get(fixtures.FixtureSimpleV1.Package) + lastModTime, err := latestModTimeFS(r.StableFS(), ".") + assert.NoError(t, err) + + err = installer.Install(testCtx, s.PackageURL(fixtures.FixtureSimpleV1), nil) + assert.NoError(t, err) + r = installer.packages.Get(fixtures.FixtureSimpleV1.Package) + newLastModTime, err := latestModTimeFS(r.StableFS(), ".") + assert.NoError(t, err) + assert.Equal(t, lastModTime, newLastModTime) +} + +func TestReinstallAfterDBClean(t *testing.T) { + s := fixtures.NewServer(t) + installer := newTestPackageManager(t, s, t.TempDir(), t.TempDir()) + defer installer.db.Close() + + err := installer.Install(testCtx, s.PackageURL(fixtures.FixtureSimpleV1), nil) + assert.NoError(t, err) + r := installer.packages.Get(fixtures.FixtureSimpleV1.Package) + lastModTime, err := latestModTimeFS(r.StableFS(), ".") + assert.NoError(t, err) + + installer.db.DeletePackage(fixtures.FixtureSimpleV1.Package) + + err = installer.Install(testCtx, s.PackageURL(fixtures.FixtureSimpleV1), nil) + assert.NoError(t, err) + r = installer.packages.Get(fixtures.FixtureSimpleV1.Package) + newLastModTime, err := latestModTimeFS(r.StableFS(), ".") + assert.NoError(t, err) + assert.NotEqual(t, lastModTime, newLastModTime) +} + +func latestModTimeFS(fsys fs.FS, dirPath string) (time.Time, error) { + var latestTime time.Time + + // Read the directory entries + entries, err := fs.ReadDir(fsys, dirPath) + if err != nil { + return latestTime, err + } + + for _, entry := range entries { + // Get full path of the entry + entryPath := path.Join(dirPath, entry.Name()) + + // Get file info to access modification time + info, err := fs.Stat(fsys, entryPath) + if err != nil { + return latestTime, err + } + + // Update the latest modification time + if info.ModTime().After(latestTime) { + latestTime = info.ModTime() + } + + // If the entry is a directory, recurse into it + if entry.IsDir() { + subLatestTime, err := latestModTimeFS(fsys, entryPath) // Recurse into subdirectory + if err != nil { + return latestTime, err + } + // Compare times + if subLatestTime.After(latestTime) { + latestTime = subLatestTime + } + } + } + + return latestTime, nil +} diff --git a/pkg/fleet/installer/service/apm_inject.go b/pkg/fleet/installer/service/apm_inject.go index 8899c17af85f6..f1c8028c803c8 100644 --- a/pkg/fleet/installer/service/apm_inject.go +++ b/pkg/fleet/installer/service/apm_inject.go @@ -153,6 +153,9 @@ func (a *apmInjectorInstaller) Setup(ctx context.Context) error { return err } } + if err := setupAppArmor(ctx); err != nil { + return err + } // Create mandatory dirs err = os.Mkdir("/var/log/datadog/dotnet", 0777) @@ -239,6 +242,8 @@ func (a *apmInjectorInstaller) Uninstrument(ctx context.Context) error { dockerErr := a.uninstrumentDocker(ctx) errs = append(errs, dockerErr) } + appArmorErr := removeAppArmor(ctx) + errs = append(errs, appArmorErr) return multierr.Combine(errs...) } diff --git a/pkg/fleet/installer/service/app_armor.go b/pkg/fleet/installer/service/app_armor.go new file mode 100644 index 0000000000000..fceb30c9171a8 --- /dev/null +++ b/pkg/fleet/installer/service/app_armor.go @@ -0,0 +1,91 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016-present Datadog, Inc. + +//go:build !windows + +// Package service provides a way to interact with os services +package service + +import ( + "context" + "fmt" + "os" + "os/exec" + "path/filepath" + "strings" + + "github.com/DataDog/datadog-agent/pkg/util/log" + "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" +) + +const ( + appArmorConfigPath = "/etc/apparmor.d/abstractions/base.d" + appArmorProfile = `/opt/datadog-packages/** rix, +/proc/@{pid}/** rix,` +) + +var datadogProfilePath = filepath.Join(appArmorConfigPath, "datadog") + +func setupAppArmor(ctx context.Context) (err error) { + _, err = exec.LookPath("aa-status") + if err != nil { + // no-op if apparmor is not installed + return nil + } + span, _ := tracer.StartSpanFromContext(ctx, "setup_app_armor") + defer func() { span.Finish(tracer.WithError(err)) }() + if err = os.MkdirAll(appArmorConfigPath, 0755); err != nil { + return fmt.Errorf("failed to create %s: %w", appArmorConfigPath, err) + } + // unfortunately this isn't an atomic change. All files in that directory can be interpreted + // and I did not implement finding a safe directory to write to in the same partition, to run an atomic move. + // This shouldn't be a problem as we reload app armor right after writing the file. + if err = os.WriteFile(datadogProfilePath, []byte(appArmorProfile), 0644); err != nil { + return err + } + if err = reloadAppArmor(); err != nil { + if rollbackErr := os.Remove(datadogProfilePath); rollbackErr != nil { + log.Warnf("failed to remove apparmor profile: %v", rollbackErr) + } + return err + } + return nil +} + +func removeAppArmor(ctx context.Context) (err error) { + _, err = os.Stat(datadogProfilePath) + if err != nil { + if os.IsNotExist(err) { + return nil + } + return err + } + span, _ := tracer.StartSpanFromContext(ctx, "remove_app_armor") + defer span.Finish(tracer.WithError(err)) + if err = os.Remove(datadogProfilePath); err != nil { + return err + } + return reloadAppArmor() +} + +func reloadAppArmor() error { + if !isAppArmorRunning() { + return nil + } + if running, err := isSystemdRunning(); err != nil { + return err + } else if running { + return exec.Command("systemctl", "reload", "apparmor").Run() + } + return exec.Command("service", "apparmor", "reload").Run() +} + +func isAppArmorRunning() bool { + data, err := os.ReadFile("/sys/module/apparmor/parameters/enabled") + if err != nil { + return false + } + return strings.TrimSpace(string(data)) == "Y" +} diff --git a/pkg/fleet/installer/service/datadog_agent_windows.go b/pkg/fleet/installer/service/datadog_agent_windows.go index 7e3602c5f84d3..12d39230418fc 100644 --- a/pkg/fleet/installer/service/datadog_agent_windows.go +++ b/pkg/fleet/installer/service/datadog_agent_windows.go @@ -108,7 +108,10 @@ func installAgentPackage(target string, args []string) error { } args = append(args, fmt.Sprintf("DDAGENTUSER_NAME=%s", agentUser)) - err = msiexec(target, datadogAgent, "/i", args) + cmd, err := msiexec(target, datadogAgent, "/i", args) + if err == nil { + err = cmd.Run() + } if err != nil { return fmt.Errorf("failed to install Agent %s: %w", target, err) } diff --git a/pkg/fleet/installer/service/datadog_installer_windows.go b/pkg/fleet/installer/service/datadog_installer_windows.go index 4cd2d50fbffb8..3bc775e2efa83 100644 --- a/pkg/fleet/installer/service/datadog_installer_windows.go +++ b/pkg/fleet/installer/service/datadog_installer_windows.go @@ -26,11 +26,16 @@ func SetupInstaller(ctx context.Context) (err error) { } span.Finish(tracer.WithError(err)) }() - err = msiexec("stable", datadogInstaller, "/i", nil) + cmd, err := msiexec("stable", datadogInstaller, "/i", nil) + if err == nil { + // This is the first time that we are installing the installer, + // so we can run it synchronously. + err = cmd.Run() + } return err } -// RemoveInstaller noop +// RemoveInstaller removes the installer func RemoveInstaller(ctx context.Context) (err error) { span, _ := tracer.StartSpanFromContext(ctx, "remove_installer") defer func() { @@ -52,7 +57,11 @@ func StartInstallerExperiment(ctx context.Context) (err error) { } span.Finish(tracer.WithError(err)) }() - err = msiexec("experiment", datadogInstaller, "/i", nil) + cmd, err := msiexec("experiment", datadogInstaller, "/i", nil) + if err == nil { + // Launch the msiexec process asynchronously. + err = cmd.Start() + } return err } @@ -65,7 +74,11 @@ func StopInstallerExperiment(ctx context.Context) (err error) { } span.Finish(tracer.WithError(err)) }() - err = msiexec("stable", datadogInstaller, "/i", nil) + cmd, err := msiexec("stable", datadogInstaller, "/i", nil) + if err == nil { + // Launch the msiexec process asynchronously. + err = cmd.Start() + } return err } diff --git a/pkg/fleet/installer/service/msiexec.go b/pkg/fleet/installer/service/msiexec.go index 4e5ed5897021c..6eb0e0958bd38 100644 --- a/pkg/fleet/installer/service/msiexec.go +++ b/pkg/fleet/installer/service/msiexec.go @@ -16,20 +16,20 @@ import ( "path/filepath" ) -func msiexec(target, product, operation string, args []string) (err error) { +func msiexec(target, product, operation string, args []string) (*exec.Cmd, error) { updaterPath := filepath.Join(paths.PackagesPath, product, target) msis, err := filepath.Glob(filepath.Join(updaterPath, fmt.Sprintf("%s-*-1-x86_64.msi", product))) if err != nil { - return err + return nil, err } if len(msis) > 1 { - return fmt.Errorf("too many MSIs in package") + return nil, fmt.Errorf("too many MSIs in package") } else if len(msis) == 0 { - return fmt.Errorf("no MSIs in package") + return nil, fmt.Errorf("no MSIs in package") } cmd := exec.Command("msiexec", append([]string{operation, msis[0], "/qn", "MSIFASTINSTALL=7"}, args...)...) - return cmd.Run() + return cmd, nil } // Product represents a software from the Windows Registry diff --git a/pkg/fleet/internal/cdn/config_datadog_agent.go b/pkg/fleet/internal/cdn/config_datadog_agent.go index 473e3bc67e843..3699ab216791e 100644 --- a/pkg/fleet/internal/cdn/config_datadog_agent.go +++ b/pkg/fleet/internal/cdn/config_datadog_agent.go @@ -151,25 +151,37 @@ func (a *agentConfig) Write(dir string) error { if a.datadog != nil { err = os.WriteFile(filepath.Join(dir, configDatadogYAML), []byte(a.datadog), 0640) if err != nil { - return fmt.Errorf("could not write datadog.yaml: %w", err) + return fmt.Errorf("could not write %s: %w", configDatadogYAML, err) } if runtime.GOOS != "windows" { err = os.Chown(filepath.Join(dir, configDatadogYAML), ddAgentUID, ddAgentGID) if err != nil { - return fmt.Errorf("could not chown datadog.yaml: %w", err) + return fmt.Errorf("could not chown %s: %w", configDatadogYAML, err) } } } if a.securityAgent != nil { - err = os.WriteFile(filepath.Join(dir, configSecurityAgentYAML), []byte(a.securityAgent), 0600) + err = os.WriteFile(filepath.Join(dir, configSecurityAgentYAML), []byte(a.securityAgent), 0440) if err != nil { - return fmt.Errorf("could not write datadog.yaml: %w", err) + return fmt.Errorf("could not write %s: %w", configSecurityAgentYAML, err) + } + if runtime.GOOS != "windows" { + err = os.Chown(filepath.Join(dir, configSecurityAgentYAML), 0, ddAgentGID) // root:dd-agent + if err != nil { + return fmt.Errorf("could not chown %s: %w", configSecurityAgentYAML, err) + } } } if a.systemProbe != nil { - err = os.WriteFile(filepath.Join(dir, configSystemProbeYAML), []byte(a.systemProbe), 0600) + err = os.WriteFile(filepath.Join(dir, configSystemProbeYAML), []byte(a.systemProbe), 0440) if err != nil { - return fmt.Errorf("could not write datadog.yaml: %w", err) + return fmt.Errorf("could not write %s: %w", configSecurityAgentYAML, err) + } + if runtime.GOOS != "windows" { + err = os.Chown(filepath.Join(dir, configSystemProbeYAML), 0, ddAgentGID) // root:dd-agent + if err != nil { + return fmt.Errorf("could not chown %s: %w", configSecurityAgentYAML, err) + } } } return nil diff --git a/pkg/gohai/go.mod b/pkg/gohai/go.mod index 4ba99d2dc7287..ed6c54f3af0d0 100644 --- a/pkg/gohai/go.mod +++ b/pkg/gohai/go.mod @@ -10,7 +10,7 @@ require ( github.com/moby/sys/mountinfo v0.7.2 github.com/shirou/gopsutil/v3 v3.24.5 github.com/stretchr/testify v1.9.0 - golang.org/x/sys v0.25.0 + golang.org/x/sys v0.26.0 ) require ( diff --git a/pkg/gohai/go.sum b/pkg/gohai/go.sum index fff39bc974d10..a8cc0fb77bea0 100644 --- a/pkg/gohai/go.sum +++ b/pkg/gohai/go.sum @@ -47,8 +47,8 @@ golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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= diff --git a/pkg/gpu/config.go b/pkg/gpu/config.go index 995fbde58cbd9..d8beee7591dff 100644 --- a/pkg/gpu/config.go +++ b/pkg/gpu/config.go @@ -7,26 +7,34 @@ package gpu import ( + sysconfig "github.com/DataDog/datadog-agent/cmd/system-probe/config" + pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" "time" "github.com/DataDog/datadog-agent/pkg/ebpf" ) -// GPUConfigNS is the namespace for the GPU monitoring probe. -const GPUConfigNS = "gpu_monitoring" +// GPUNS is the namespace for the GPU monitoring probe. +const GPUNS = "gpu_monitoring" // Config holds the configuration for the GPU monitoring probe. type Config struct { - *ebpf.Config + ebpf.Config + // ScanTerminatedProcessesInterval is the interval at which the probe scans for terminated processes. ScanTerminatedProcessesInterval time.Duration - InitialProcessSync bool + // InitialProcessSync indicates whether the probe should sync the process list on startup. + InitialProcessSync bool + // NVMLLibraryPath is the path of the native libnvidia-ml.so library + NVMLLibraryPath string } // NewConfig generates a new configuration for the GPU monitoring probe. func NewConfig() *Config { + spCfg := pkgconfigsetup.SystemProbe() return &Config{ - Config: ebpf.NewConfig(), - ScanTerminatedProcessesInterval: 5 * time.Second, - InitialProcessSync: true, + Config: *ebpf.NewConfig(), + ScanTerminatedProcessesInterval: time.Duration(spCfg.GetInt(sysconfig.FullKeyPath(GPUNS, "process_scan_interval_seconds"))) * time.Second, + InitialProcessSync: spCfg.GetBool(sysconfig.FullKeyPath(GPUNS, "initial_process_sync")), + NVMLLibraryPath: spCfg.GetString(sysconfig.FullKeyPath(GPUNS, "nvml_lib_path")), } } diff --git a/pkg/gpu/context.go b/pkg/gpu/context.go new file mode 100644 index 0000000000000..ebd66116b48c2 --- /dev/null +++ b/pkg/gpu/context.go @@ -0,0 +1,59 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016-present Datadog, Inc. + +//go:build linux_bpf + +package gpu + +import ( + "fmt" + + "github.com/NVIDIA/go-nvml/pkg/nvml" + + sectime "github.com/DataDog/datadog-agent/pkg/security/resolvers/time" +) + +// systemContext holds certain attributes about the system that are used by the GPU probe. +type systemContext struct { + // maxGpuThreadsPerDevice maps each device index to the maximum number of threads it can run in parallel + maxGpuThreadsPerDevice map[int]int + + // timeResolver allows to resolve kernel-time timestamps + timeResolver *sectime.Resolver + + // nvmlLib is the NVML library used to query GPU devices + nvmlLib nvml.Interface +} + +func getSystemContext(nvmlLib nvml.Interface) (*systemContext, error) { + ctx := &systemContext{ + maxGpuThreadsPerDevice: make(map[int]int), + nvmlLib: nvmlLib, + } + + if err := ctx.queryDevices(); err != nil { + return nil, fmt.Errorf("error querying devices: %w", err) + } + + return ctx, nil +} + +func (ctx *systemContext) queryDevices() error { + devices, err := getGPUDevices(ctx.nvmlLib) + if err != nil { + return fmt.Errorf("error getting GPU devices: %w", err) + } + + for i, device := range devices { + maxThreads, err := getMaxThreadsForDevice(device) + if err != nil { + return fmt.Errorf("error getting max threads for device %s: %w", device, err) + } + + ctx.maxGpuThreadsPerDevice[i] = maxThreads + } + + return nil +} diff --git a/pkg/gpu/nvml.go b/pkg/gpu/nvml.go new file mode 100644 index 0000000000000..0343701df4167 --- /dev/null +++ b/pkg/gpu/nvml.go @@ -0,0 +1,59 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +//go:build linux_bpf + +// Package gpu defines the agent corecheck for +// the GPU integration +package gpu + +import ( + "errors" + "fmt" + + "github.com/NVIDIA/go-nvml/pkg/nvml" +) + +func wrapNvmlError(ret nvml.Return) error { + if ret == nvml.SUCCESS { + return nil + } + + return errors.New(nvml.ErrorString(ret)) +} + +func getGPUDevices(lib nvml.Interface) ([]nvml.Device, error) { + count, ret := lib.DeviceGetCount() + if err := wrapNvmlError(ret); err != nil { + return nil, fmt.Errorf("cannot get number of GPU devices: %w", err) + } + + var devices []nvml.Device + + for i := 0; i < count; i++ { + device, ret := lib.DeviceGetHandleByIndex(i) + if err := wrapNvmlError(ret); err != nil { + return nil, fmt.Errorf("cannot get handle for GPU device %d: %w", i, err) + } + + devices = append(devices, device) + } + + return devices, nil +} + +// GetMaxThreads returns the maximum number of threads that can be run on the +// GPU. Each GPU core runs a thread, so this is the number of cores. Do not +// confuse the number of cores with the number of streaming multiprocessors +// (SM): the number of cores is equal to the number of SMs multiplied by the +// number of cores per SM. +func getMaxThreadsForDevice(device nvml.Device) (int, error) { + cores, ret := device.GetNumGpuCores() + if err := wrapNvmlError(ret); err != nil { + return 0, fmt.Errorf("cannot get number of GPU cores: %w", err) + } + + return int(cores), nil +} diff --git a/pkg/gpu/probe.go b/pkg/gpu/probe.go index 1f0a287287fdd..905120afc82a0 100644 --- a/pkg/gpu/probe.go +++ b/pkg/gpu/probe.go @@ -13,6 +13,7 @@ import ( "regexp" manager "github.com/DataDog/ebpf-manager" + "github.com/NVIDIA/go-nvml/pkg/nvml" "github.com/cilium/ebpf" "github.com/cilium/ebpf/rlimit" @@ -36,16 +37,27 @@ const ( const consumerChannelSize = 4096 +// ProbeDependencies holds the dependencies for the probe +type ProbeDependencies struct { + // Telemetry is the telemetry component + Telemetry telemetry.Component + + // NvmlLib is the NVML library interface + NvmlLib nvml.Interface +} + // Probe represents the GPU monitoring probe type Probe struct { mgr *ddebpf.Manager cfg *Config consumer *cudaEventConsumer attacher *uprobes.UprobeAttacher + deps ProbeDependencies + sysCtx *systemContext } // NewProbe starts the GPU monitoring probe -func NewProbe(cfg *Config, telemetryComponent telemetry.Component) (*Probe, error) { +func NewProbe(cfg *Config, deps ProbeDependencies) (*Probe, error) { log.Debugf("starting GPU monitoring probe...") kv, err := kernel.HostVersion() if err != nil { @@ -62,7 +74,7 @@ func NewProbe(cfg *Config, telemetryComponent telemetry.Component) (*Probe, erro } err = ddebpf.LoadCOREAsset(filename, func(buf bytecode.AssetReader, opts manager.Options) error { var err error - probe, err = startGPUProbe(buf, opts, telemetryComponent, cfg) + probe, err = startGPUProbe(buf, opts, deps, cfg) if err != nil { return fmt.Errorf("cannot start GPU monitoring probe: %s", err) } @@ -76,7 +88,7 @@ func NewProbe(cfg *Config, telemetryComponent telemetry.Component) (*Probe, erro return probe, nil } -func startGPUProbe(buf bytecode.AssetReader, opts manager.Options, _ telemetry.Component, cfg *Config) (*Probe, error) { +func startGPUProbe(buf bytecode.AssetReader, opts manager.Options, deps ProbeDependencies, cfg *Config) (*Probe, error) { mgr := ddebpf.NewManagerWithDefault(&manager.Manager{ Maps: []*manager.Map{ {Name: cudaAllocCacheMap}, @@ -121,7 +133,7 @@ func startGPUProbe(buf bytecode.AssetReader, opts manager.Options, _ telemetry.C }, }, }, - EbpfConfig: cfg.Config, + EbpfConfig: &cfg.Config, PerformInitialScan: cfg.InitialProcessSync, } @@ -138,6 +150,12 @@ func startGPUProbe(buf bytecode.AssetReader, opts manager.Options, _ telemetry.C mgr: mgr, cfg: cfg, attacher: attacher, + deps: deps, + } + + p.sysCtx, err = getSystemContext(deps.NvmlLib) + if err != nil { + return nil, fmt.Errorf("error getting system context: %w", err) } p.startEventConsumer() diff --git a/pkg/gpu/probe_stub.go b/pkg/gpu/probe_stub.go index 534786a31aba6..f4cbbae2cf57a 100644 --- a/pkg/gpu/probe_stub.go +++ b/pkg/gpu/probe_stub.go @@ -3,21 +3,29 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). // Copyright 2024-present Datadog, Inc. -//go:build !linux_bpf +//go:build !linux_bpf && linux package gpu import ( + "github.com/NVIDIA/go-nvml/pkg/nvml" + "github.com/DataDog/datadog-agent/comp/core/telemetry" "github.com/DataDog/datadog-agent/pkg/collector/corechecks/gpu/model" "github.com/DataDog/datadog-agent/pkg/ebpf" ) +// ProbeDependencies holds the dependencies for the probe +type ProbeDependencies struct { + Telemetry telemetry.Component + NvmlLib nvml.Interface +} + // Probe is not implemented on non-linux systems type Probe struct{} // NewProbe is not implemented on non-linux systems -func NewProbe(_ *Config, _ telemetry.Component) (*Probe, error) { +func NewProbe(_ *Config, _ ProbeDependencies) (*Probe, error) { return nil, ebpf.ErrNotImplemented } diff --git a/pkg/gpu/probe_test.go b/pkg/gpu/probe_test.go index 15cda3b7e76cc..c86a1d0ac11e8 100644 --- a/pkg/gpu/probe_test.go +++ b/pkg/gpu/probe_test.go @@ -15,6 +15,7 @@ import ( "github.com/DataDog/datadog-agent/pkg/gpu/testutil" "github.com/DataDog/datadog-agent/pkg/network/usm/utils" + "github.com/DataDog/datadog-agent/pkg/process/monitor" "github.com/DataDog/datadog-agent/pkg/util/kernel" ) @@ -25,7 +26,8 @@ func TestProbeCanLoad(t *testing.T) { t.Skipf("minimum kernel version %s not met, read %s", minimumKernelVersion, kver) } - probe, err := NewProbe(NewConfig(), nil) + nvmlMock := testutil.GetBasicNvmlMock() + probe, err := NewProbe(NewConfig(), ProbeDependencies{NvmlLib: nvmlMock}) require.NoError(t, err) require.NotNil(t, probe) t.Cleanup(probe.Close) @@ -42,10 +44,18 @@ func TestProbeCanReceiveEvents(t *testing.T) { t.Skipf("minimum kernel version %s not met, read %s", minimumKernelVersion, kver) } + procMon := monitor.GetProcessMonitor() + require.NotNil(t, procMon) + require.NoError(t, procMon.Initialize(false)) + t.Cleanup(procMon.Stop) + cfg := NewConfig() cfg.InitialProcessSync = false cfg.BPFDebug = true - probe, err := NewProbe(cfg, nil) + + nvmlMock := testutil.GetBasicNvmlMock() + + probe, err := NewProbe(cfg, ProbeDependencies{NvmlLib: nvmlMock}) require.NoError(t, err) require.NotNil(t, probe) t.Cleanup(probe.Close) diff --git a/pkg/gpu/stream.go b/pkg/gpu/stream.go index db993b9600e81..a3e494031346a 100644 --- a/pkg/gpu/stream.go +++ b/pkg/gpu/stream.go @@ -139,8 +139,10 @@ func (sh *StreamHandler) getCurrentData(now uint64) *model.StreamData { return nil } - data := &model.StreamData{ - Spans: []*model.KernelSpan{sh.getCurrentKernelSpan(now)}, + data := &model.StreamData{} + span := sh.getCurrentKernelSpan(now) + if span != nil { + data.Spans = append(data.Spans, span) } for _, alloc := range sh.memAllocEvents { diff --git a/pkg/gpu/testutil/mocks.go b/pkg/gpu/testutil/mocks.go new file mode 100644 index 0000000000000..e414973d509c0 --- /dev/null +++ b/pkg/gpu/testutil/mocks.go @@ -0,0 +1,33 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +//go:build linux + +package testutil + +import ( + "github.com/NVIDIA/go-nvml/pkg/nvml" + nvmlmock "github.com/NVIDIA/go-nvml/pkg/nvml/mock" +) + +// DefaultGpuCores is the default number of cores for a GPU device in the mock. +const DefaultGpuCores = 10 + +// GetBasicNvmlMock returns a mock of the nvml.Interface with a single device with 10 cores, +// useful for basic tests that need only the basic interaction with NVML to be working. +func GetBasicNvmlMock() *nvmlmock.Interface { + return &nvmlmock.Interface{ + DeviceGetCountFunc: func() (int, nvml.Return) { + return 1, nvml.SUCCESS + }, + DeviceGetHandleByIndexFunc: func(int) (nvml.Device, nvml.Return) { + return &nvmlmock.Device{ + GetNumGpuCoresFunc: func() (int, nvml.Return) { + return DefaultGpuCores, nvml.SUCCESS + }, + }, nvml.SUCCESS + }, + } +} diff --git a/pkg/linters/components/pkgconfigusage/go.mod b/pkg/linters/components/pkgconfigusage/go.mod index ad22088ebb43b..ebd58ea2986bf 100644 --- a/pkg/linters/components/pkgconfigusage/go.mod +++ b/pkg/linters/components/pkgconfigusage/go.mod @@ -5,7 +5,7 @@ go 1.22.0 require ( github.com/golangci/plugin-module-register v0.1.1 github.com/stretchr/testify v1.9.0 - golang.org/x/tools v0.25.0 + golang.org/x/tools v0.26.0 ) require ( diff --git a/pkg/linters/components/pkgconfigusage/go.sum b/pkg/linters/components/pkgconfigusage/go.sum index c66545688ee7a..0acd9e46905ed 100644 --- a/pkg/linters/components/pkgconfigusage/go.sum +++ b/pkg/linters/components/pkgconfigusage/go.sum @@ -12,8 +12,8 @@ golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/pkg/logs/auditor/go.mod b/pkg/logs/auditor/go.mod index e6870318f519f..350a008e3e91c 100644 --- a/pkg/logs/auditor/go.mod +++ b/pkg/logs/auditor/go.mod @@ -98,12 +98,12 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/logs/auditor/go.sum b/pkg/logs/auditor/go.sum index e92309f06689e..fcbe4c21f6c43 100644 --- a/pkg/logs/auditor/go.sum +++ b/pkg/logs/auditor/go.sum @@ -252,8 +252,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -296,11 +296,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -313,8 +313,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/pkg/logs/client/go.mod b/pkg/logs/client/go.mod index 64ce43b6c1095..58bfdf330a8cb 100644 --- a/pkg/logs/client/go.mod +++ b/pkg/logs/client/go.mod @@ -49,6 +49,7 @@ replace ( require ( github.com/DataDog/datadog-agent/comp/logs/agent/config v0.56.0-rc.3 + github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel github.com/DataDog/datadog-agent/pkg/config/model v0.57.0 github.com/DataDog/datadog-agent/pkg/logs/message v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/logs/metrics v0.56.0-rc.3 @@ -61,7 +62,7 @@ require ( github.com/DataDog/datadog-agent/pkg/util/log v0.57.1 github.com/DataDog/datadog-agent/pkg/version v0.56.0-rc.3 github.com/stretchr/testify v1.9.0 - golang.org/x/net v0.29.0 + golang.org/x/net v0.30.0 ) require ( @@ -135,12 +136,12 @@ require ( go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/pkg/logs/client/go.sum b/pkg/logs/client/go.sum index d0bd498bbfbaa..447b5e01ec8da 100644 --- a/pkg/logs/client/go.sum +++ b/pkg/logs/client/go.sum @@ -260,8 +260,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -281,8 +281,8 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/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.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -306,11 +306,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -323,8 +323,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/pkg/logs/client/http/destination_test.go b/pkg/logs/client/http/destination_test.go index 22f5e2b6aa0c3..085845ff8f2ed 100644 --- a/pkg/logs/client/http/destination_test.go +++ b/pkg/logs/client/http/destination_test.go @@ -9,7 +9,6 @@ import ( "errors" "regexp" "strconv" - "strings" "testing" "time" @@ -19,13 +18,9 @@ import ( "github.com/DataDog/datadog-agent/pkg/logs/message" "github.com/DataDog/datadog-agent/comp/logs/agent/config" - pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" ) -func getNewConfig() pkgconfigmodel.ReaderWriter { - return pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) -} - func TestBuildURLShouldReturnHTTPSWithUseSSL(t *testing.T) { url := buildURL(config.NewEndpoint("bar", "foo", 0, true)) assert.Equal(t, "https://foo/v1/input", url) @@ -50,8 +45,8 @@ func TestBuildURLShouldReturnAddressForVersion2(t *testing.T) { } //nolint:revive // TODO(AML) Fix revive linter -func TestDestinationSend200(_ *testing.T) { - cfg := getNewConfig() +func TestDestinationSend200(t *testing.T) { + cfg := configmock.New(t) server := NewTestServer(200, cfg) input := make(chan *message.Payload) output := make(chan *message.Payload) @@ -78,8 +73,8 @@ func TestNoRetries(t *testing.T) { } //nolint:revive // TODO(AML) Fix revive linter -func testNoRetry(_ *testing.T, statusCode int) { - cfg := getNewConfig() +func testNoRetry(t *testing.T, statusCode int) { + cfg := configmock.New(t) server := NewTestServer(statusCode, cfg) input := make(chan *message.Payload) output := make(chan *message.Payload) @@ -96,7 +91,7 @@ func testNoRetry(_ *testing.T, statusCode int) { } func retryTest(t *testing.T, statusCode int) { - cfg := getNewConfig() + cfg := configmock.New(t) respondChan := make(chan int) server := NewTestServerWithOptions(statusCode, 0, true, respondChan, cfg) input := make(chan *message.Payload) @@ -126,7 +121,7 @@ func retryTest(t *testing.T, statusCode int) { } func TestDestinationContextCancel(t *testing.T) { - cfg := getNewConfig() + cfg := configmock.New(t) respondChan := make(chan int) server := NewTestServerWithOptions(429, 0, true, respondChan, cfg) input := make(chan *message.Payload) @@ -152,7 +147,7 @@ func TestDestinationContextCancel(t *testing.T) { } func TestConnectivityCheck(t *testing.T) { - cfg := getNewConfig() + cfg := configmock.New(t) // Connectivity is ok when server return 200 server := NewTestServer(200, cfg) connectivity := CheckConnectivity(server.Endpoint, cfg) @@ -173,7 +168,7 @@ func TestErrorToTag(t *testing.T) { } func TestDestinationSendsV2Protocol(t *testing.T) { - cfg := getNewConfig() + cfg := configmock.New(t) server := NewTestServer(200, cfg) defer server.httpServer.Close() @@ -184,7 +179,7 @@ func TestDestinationSendsV2Protocol(t *testing.T) { } func TestDestinationDoesntSendEmptyV2Protocol(t *testing.T) { - cfg := getNewConfig() + cfg := configmock.New(t) server := NewTestServer(200, cfg) defer server.httpServer.Close() @@ -194,7 +189,7 @@ func TestDestinationDoesntSendEmptyV2Protocol(t *testing.T) { } func TestDestinationSendsTimestampHeaders(t *testing.T) { - cfg := getNewConfig() + cfg := configmock.New(t) server := NewTestServer(200, cfg) defer server.httpServer.Close() currentTimestamp := time.Now().UnixMilli() @@ -211,7 +206,7 @@ func TestDestinationSendsTimestampHeaders(t *testing.T) { } func TestDestinationSendsUserAgent(t *testing.T) { - cfg := getNewConfig() + cfg := configmock.New(t) server := NewTestServer(200, cfg) defer server.httpServer.Close() @@ -221,7 +216,7 @@ func TestDestinationSendsUserAgent(t *testing.T) { } func TestDestinationConcurrentSends(t *testing.T) { - cfg := getNewConfig() + cfg := configmock.New(t) // make the server return 500, so the payloads get stuck retrying respondChan := make(chan int) server := NewTestServerWithOptions(500, 2, true, respondChan, cfg) @@ -276,7 +271,7 @@ func TestDestinationConcurrentSends(t *testing.T) { // This test ensure the destination's final state is isRetrying = false even if there are pending concurrent sends. func TestDestinationConcurrentSendsShutdownIsHandled(t *testing.T) { - cfg := getNewConfig() + cfg := configmock.New(t) // make the server return 500, so the payloads get stuck retrying respondChan := make(chan int) server := NewTestServerWithOptions(500, 2, true, respondChan, cfg) @@ -325,7 +320,7 @@ func TestDestinationConcurrentSendsShutdownIsHandled(t *testing.T) { } func TestBackoffDelayEnabled(t *testing.T) { - cfg := getNewConfig() + cfg := configmock.New(t) respondChan := make(chan int) server := NewTestServerWithOptions(500, 0, true, respondChan, cfg) input := make(chan *message.Payload) @@ -342,7 +337,7 @@ func TestBackoffDelayEnabled(t *testing.T) { } func TestBackoffDelayDisabled(t *testing.T) { - cfg := getNewConfig() + cfg := configmock.New(t) respondChan := make(chan int) server := NewTestServerWithOptions(500, 0, false, respondChan, cfg) input := make(chan *message.Payload) @@ -365,7 +360,7 @@ func TestDestinationHA(t *testing.T) { } isEndpointMRF := endpoint.IsMRF - dest := NewDestination(endpoint, JSONContentType, client.NewDestinationsContext(), 1, false, "test", getNewConfig()) + dest := NewDestination(endpoint, JSONContentType, client.NewDestinationsContext(), 1, false, "test", configmock.New(t)) isDestMRF := dest.IsMRF() assert.Equal(t, isEndpointMRF, isDestMRF) diff --git a/pkg/logs/diagnostic/go.mod b/pkg/logs/diagnostic/go.mod index d12ed31e3f79d..3a16868bf29c8 100644 --- a/pkg/logs/diagnostic/go.mod +++ b/pkg/logs/diagnostic/go.mod @@ -108,12 +108,12 @@ require ( go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/logs/diagnostic/go.sum b/pkg/logs/diagnostic/go.sum index c4df7b42ad5d0..42636c1b8bc19 100644 --- a/pkg/logs/diagnostic/go.sum +++ b/pkg/logs/diagnostic/go.sum @@ -256,8 +256,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -300,11 +300,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -317,8 +317,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/pkg/logs/launchers/integration/launcher.go b/pkg/logs/launchers/integration/launcher.go index b822e90eabad7..de88863114936 100644 --- a/pkg/logs/launchers/integration/launcher.go +++ b/pkg/logs/launchers/integration/launcher.go @@ -50,7 +50,7 @@ type Launcher struct { // fileInfo stores information about each file that is needed in order to keep // track of the combined and overall disk usage by the logs files type fileInfo struct { - filename string + fileWithPath string lastModified time.Time size int64 } @@ -149,7 +149,7 @@ func (s *Launcher) run() { s.integrationToFile[cfg.IntegrationID] = logFile } - filetypeSource := s.makeFileSource(source, logFile.filename) + filetypeSource := s.makeFileSource(source, logFile.fileWithPath) s.sources.AddSource(filetypeSource) } } @@ -179,8 +179,17 @@ func (s *Launcher) receiveLogs(log integrations.IntegrationLog) { // Ensure the individual file doesn't exceed integrations_logs_files_max_size // Add 1 because we write the \n at the end as well logSize := int64(len(log.Log)) + 1 + + if logSize > s.fileSizeMax { + ddLog.Warnf("Individual log size (%d bytes) is larger than maximum allowable file size (%d bytes), skipping writing to log file: %s", logSize, s.fileSizeMax, log.Log) + return + } else if logSize > s.combinedUsageMax { + ddLog.Warnf("Individual log size (%d bytes) is larger than maximum allowable file size (%d bytes), skipping writing to log file: %s", logSize, s.combinedUsageMax, log.Log) + return + } + if fileToUpdate.size+logSize > s.fileSizeMax { - file, err := os.Create(fileToUpdate.filename) + file, err := os.Create(fileToUpdate.fileWithPath) if err != nil { ddLog.Error("Failed to delete and remake oversize file:", err) return @@ -211,7 +220,7 @@ func (s *Launcher) receiveLogs(log integrations.IntegrationLog) { return } - file, err := os.Create(leastRecentlyModifiedFile.filename) + file, err := os.Create(leastRecentlyModifiedFile.fileWithPath) if err != nil { ddLog.Error("Error creating log file:", err) continue @@ -223,7 +232,7 @@ func (s *Launcher) receiveLogs(log integrations.IntegrationLog) { } } - err := s.writeLogToFileFunction(filepath.Join(s.runPath, fileToUpdate.filename), log.Log) + err := s.writeLogToFileFunction(fileToUpdate.fileWithPath, log.Log) if err != nil { ddLog.Warn("Error writing log to file:", err) return @@ -236,12 +245,11 @@ func (s *Launcher) receiveLogs(log integrations.IntegrationLog) { } func (s *Launcher) deleteFile(file *fileInfo) error { - filename := filepath.Join(s.runPath, file.filename) - err := os.Remove(filename) + err := os.Remove(file.fileWithPath) if err != nil { return err } - ddLog.Info("Successfully deleted log file:", filename) + ddLog.Info("Successfully deleted log file:", file.fileWithPath) s.combinedUsageSize -= file.size @@ -321,7 +329,7 @@ func (s *Launcher) createFile(source string) (*fileInfo, error) { } fileInfo := &fileInfo{ - filename: filepath, + fileWithPath: filepath, lastModified: time.Now(), size: 0, } @@ -349,8 +357,8 @@ func computeMaxDiskUsage(runPath string, logsTotalUsageSetting int64, usageRatio diskReserved := float64(usage.Total) * (1 - usageRatio) diskAvailable := int64(usage.Available) - int64(math.Ceil(diskReserved)) - if diskAvailable < 0 { - ddLog.Warn("Available disk calculated as less than 0: ", diskAvailable, ". Disk reserved:", diskReserved) + if diskAvailable <= 0 { + ddLog.Warnf("Available disk calculated as %d bytes, disk reserved is %f bytes. Check %s and make sure there is enough free space on disk", diskAvailable, diskReserved, "integrations_logs_disk_ratio") diskAvailable = 0 } @@ -370,12 +378,12 @@ func (s *Launcher) scanInitialFiles(dir string) error { } fileInfo := &fileInfo{ - filename: info.Name(), + fileWithPath: filepath.Join(dir, info.Name()), size: info.Size(), lastModified: info.ModTime(), } - integrationID := fileNameToID(fileInfo.filename) + integrationID := fileNameToID(fileInfo.fileWithPath) s.integrationToFile[integrationID] = fileInfo s.combinedUsageSize += info.Size() diff --git a/pkg/logs/launchers/integration/launcher_test.go b/pkg/logs/launchers/integration/launcher_test.go index 4f68b18b81754..652f6479019de 100644 --- a/pkg/logs/launchers/integration/launcher_test.go +++ b/pkg/logs/launchers/integration/launcher_test.go @@ -8,8 +8,8 @@ package integration import ( "os" "path/filepath" - "runtime" "testing" + "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -26,7 +26,6 @@ import ( "github.com/DataDog/datadog-agent/pkg/logs/pipeline/mock" "github.com/DataDog/datadog-agent/pkg/logs/sources" "github.com/DataDog/datadog-agent/pkg/logs/status" - "github.com/DataDog/datadog-agent/pkg/util/testutil/flake" ) type LauncherTestSuite struct { @@ -42,10 +41,6 @@ type LauncherTestSuite struct { } func (suite *LauncherTestSuite) SetupTest() { - if runtime.GOOS == "windows" { - flake.Mark(suite.T()) - } - suite.pipelineProvider = mock.NewMockProvider() suite.outputChan = suite.pipelineProvider.NextPipelineChan() suite.integrationsComp = integrationsmock.Mock() @@ -98,7 +93,7 @@ func (suite *LauncherTestSuite) TestSendLog() { assert.Equal(suite.T(), foundSource.Config.Type, config.FileType) assert.Equal(suite.T(), foundSource.Config.Source, "foo") assert.Equal(suite.T(), foundSource.Config.Service, "bar") - expectedPath := filepath.Join(suite.s.runPath, suite.s.integrationToFile[id].filename) + expectedPath := suite.s.integrationToFile[id].fileWithPath assert.Equal(suite.T(), logSample, <-fileLogChan) assert.Equal(suite.T(), expectedPath, <-filepathChan) @@ -118,8 +113,8 @@ func (suite *LauncherTestSuite) TestZeroCombinedUsageMaxFileCreated() { suite.s.combinedUsageMax = 0 filename := "sample_integration_123.log" - filepath := filepath.Join(suite.s.runPath, filename) - file, err := os.Create(filepath) + fileWithPath := filepath.Join(suite.s.runPath, filename) + file, err := os.Create(fileWithPath) assert.Nil(suite.T(), err) file.Close() @@ -148,11 +143,11 @@ func (suite *LauncherTestSuite) TestZeroCombinedUsageMaxFileNotCreated() { } func (suite *LauncherTestSuite) TestSmallCombinedUsageMax() { - suite.s.combinedUsageMax = 10 + suite.s.combinedUsageMax = 15 filename := "sample_integration_123.log" - filepath := filepath.Join(suite.s.runPath, filename) - file, err := os.Create(filepath) + fileWithPath := filepath.Join(suite.s.runPath, filename) + file, err := os.Create(fileWithPath) assert.Nil(suite.T(), err) file.Close() @@ -160,32 +155,41 @@ func (suite *LauncherTestSuite) TestSmallCombinedUsageMax() { suite.s.Start(nil, nil, nil, nil) // Launcher should write this log - writtenLog := "sample" + shortLog := "sample" integrationLog := integrations.IntegrationLog{ - Log: writtenLog, + Log: shortLog, IntegrationID: "sample_integration:123", } suite.s.receiveLogs(integrationLog) - fileStat, err := os.Stat(filepath) + fileStat, err := os.Stat(fileWithPath) assert.Nil(suite.T(), err) - assert.Equal(suite.T(), fileStat.Size(), int64(len(writtenLog)+1)) + assert.Equal(suite.T(), fileStat.Size(), int64(len(shortLog)+1)) - // Launcher should delete file for this log - unwrittenLog := "sample log two" + // Launcher should delete and remake the log file for this log since it would break combinedUsageMax threshold + longLog := "sample log two" integrationLogTwo := integrations.IntegrationLog{ - Log: unwrittenLog, + Log: longLog, IntegrationID: "sample_integration:123", } suite.s.receiveLogs(integrationLogTwo) + _, err = os.Stat(fileWithPath) + assert.Nil(suite.T(), err) - _, err = os.Stat(filepath) - assert.True(suite.T(), os.IsNotExist(err)) + // Launcher should skip writing this log since it's larger than combinedUsageMax + unwrittenLog := "this log is too long" + unwrittenIntegrationLog := integrations.IntegrationLog{ + Log: unwrittenLog, + IntegrationID: "sample_integration:123", + } + suite.s.receiveLogs(unwrittenIntegrationLog) + _, err = os.Stat(fileWithPath) + assert.Nil(suite.T(), err) // Remake the file suite.s.receiveLogs(integrationLog) - fileStat, err = os.Stat(filepath) + fileStat, err = os.Stat(fileWithPath) assert.Nil(suite.T(), err) - assert.Equal(suite.T(), fileStat.Size(), int64(len(writtenLog)+1)) + assert.Equal(suite.T(), fileStat.Size(), int64(len(shortLog)+1)) } func (suite *LauncherTestSuite) TestWriteLogToFile() { @@ -220,12 +224,12 @@ func (suite *LauncherTestSuite) TestWriteMultipleLogsToFile() { // TestDeleteFile tests that deleteFile properly deletes the correct file func (suite *LauncherTestSuite) TestDeleteFile() { filename := "testfile.log" - filepath := filepath.Join(suite.s.runPath, filename) - file, err := os.Create(filepath) - fileinfo := &fileInfo{filename: filename, size: int64(0)} + fileWithPath := filepath.Join(suite.s.runPath, filename) + file, err := os.Create(fileWithPath) + fileinfo := &fileInfo{fileWithPath: fileWithPath, size: int64(0)} assert.Nil(suite.T(), err) - info, err := os.Stat(filepath) + info, err := os.Stat(fileWithPath) assert.Nil(suite.T(), err) assert.Equal(suite.T(), int64(0), info.Size(), "Newly created file size not zero") @@ -234,14 +238,14 @@ func (suite *LauncherTestSuite) TestDeleteFile() { file.Write(data) file.Close() - info, err = os.Stat(filepath) + info, err = os.Stat(fileWithPath) assert.Nil(suite.T(), err) assert.Equal(suite.T(), int64(2*1024*1024), info.Size()) err = suite.s.deleteFile(fileinfo) assert.Nil(suite.T(), err) - _, err = os.Stat(filepath) + _, err = os.Stat(fileWithPath) assert.True(suite.T(), os.IsNotExist(err)) } @@ -286,8 +290,8 @@ func (suite *LauncherTestSuite) TestFileExceedsSingleFileLimit() { suite.s.fileSizeMax = oneMB filename := "sample_integration_123.log" - filepath := filepath.Join(suite.s.runPath, filename) - file, err := os.Create(filepath) + fileWithPath := filepath.Join(suite.s.runPath, filename) + file, err := os.Create(fileWithPath) assert.Nil(suite.T(), err) file.Write(make([]byte, oneMB)) @@ -313,7 +317,8 @@ func (suite *LauncherTestSuite) TestScanInitialFiles() { filename := "sample_integration_123.log" fileSize := int64(1 * 1024 * 1024) - file, err := os.Create(filepath.Join(suite.s.runPath, filename)) + fileWithPath := filepath.Join(suite.s.runPath, filename) + file, err := os.Create(fileWithPath) assert.Nil(suite.T(), err) data := make([]byte, fileSize) @@ -325,7 +330,7 @@ func (suite *LauncherTestSuite) TestScanInitialFiles() { actualFileInfo := suite.s.integrationToFile[fileID] assert.NotEmpty(suite.T(), suite.s.integrationToFile) - assert.Equal(suite.T(), actualFileInfo.filename, filename) + assert.Equal(suite.T(), actualFileInfo.fileWithPath, fileWithPath) assert.Equal(suite.T(), fileSize, actualFileInfo.size) assert.Equal(suite.T(), fileSize, suite.s.combinedUsageSize) } @@ -336,7 +341,8 @@ func (suite *LauncherTestSuite) TestCreateFileAfterScanInitialFile() { filename := "sample_integration_123.log" fileSize := int64(1 * 1024 * 1024) - file, err := os.Create(filepath.Join(suite.s.runPath, filename)) + fileWithPath := filepath.Join(suite.s.runPath, filename) + file, err := os.Create(fileWithPath) assert.Nil(suite.T(), err) data := make([]byte, fileSize) @@ -348,7 +354,7 @@ func (suite *LauncherTestSuite) TestCreateFileAfterScanInitialFile() { scannedFile := suite.s.integrationToFile[fileID] assert.NotEmpty(suite.T(), suite.s.integrationToFile) - assert.Equal(suite.T(), filename, scannedFile.filename) + assert.Equal(suite.T(), fileWithPath, scannedFile.fileWithPath) assert.Equal(suite.T(), fileSize, scannedFile.size) assert.Equal(suite.T(), fileSize, suite.s.combinedUsageSize) @@ -385,20 +391,29 @@ func (suite *LauncherTestSuite) TestSentLogExceedsTotalUsage() { suite.s.combinedUsageMax = 3 * 1024 * 1024 // Given 3 files exist - filename1 := "sample_integration1_123.log" - filename2 := "sample_integration2_123.log" - filename3 := "sample_integration3_123.log" - files := [3]string{filename1, filename2, filename3} + fileWithPath1 := filepath.Join(suite.s.runPath, "sample_integration1_123.log") + fileWithPath2 := filepath.Join(suite.s.runPath, "sample_integration2_123.log") + fileWithPath3 := filepath.Join(suite.s.runPath, "sample_integration3_123.log") + fileNames := [3]string{fileWithPath1, fileWithPath2, fileWithPath3} // And I write 1Mb to each file in seq order dataOneMB := make([]byte, 1*1024*1024) - for _, filename := range files { - file, err := os.Create(filepath.Join(suite.s.runPath, filename)) + for _, fileWithPath := range fileNames { + file, err := os.Create(fileWithPath) require.NoError(suite.T(), err) _, _ = file.Write(dataOneMB) _ = file.Close() } + // If the files have the same timestamp, scanInitialFiles will detect them in + // random order. Setting their modified time manually allows the + // scanInitialFiles function to detect them in a deterministic manner + modTime := time.Now() + accessTime := time.Now() + os.Chtimes(fileWithPath1, accessTime, modTime.Add(-2*time.Minute)) + os.Chtimes(fileWithPath2, accessTime, modTime.Add(-1*time.Minute)) + os.Chtimes(fileWithPath3, accessTime, modTime) + suite.s.Start(nil, nil, nil, nil) integrationLog := integrations.IntegrationLog{ @@ -410,8 +425,8 @@ func (suite *LauncherTestSuite) TestSentLogExceedsTotalUsage() { suite.s.receiveLogs(integrationLog) var actualSize int64 - for _, filename := range files { - file, err := os.Stat(filepath.Join(suite.s.runPath, filename)) + for _, fileWithPath := range fileNames { + file, err := os.Stat(fileWithPath) require.Nil(suite.T(), err) actualSize += file.Size() } diff --git a/pkg/logs/message/go.mod b/pkg/logs/message/go.mod index 9fc65b78e2517..bf5b00ca5f48e 100644 --- a/pkg/logs/message/go.mod +++ b/pkg/logs/message/go.mod @@ -94,12 +94,12 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/logs/message/go.sum b/pkg/logs/message/go.sum index e92309f06689e..fcbe4c21f6c43 100644 --- a/pkg/logs/message/go.sum +++ b/pkg/logs/message/go.sum @@ -252,8 +252,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -296,11 +296,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -313,8 +313,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/pkg/logs/metrics/go.mod b/pkg/logs/metrics/go.mod index 43eb2146553d8..993d59e4c15c0 100644 --- a/pkg/logs/metrics/go.mod +++ b/pkg/logs/metrics/go.mod @@ -46,7 +46,7 @@ require ( go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/sys v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/logs/metrics/go.sum b/pkg/logs/metrics/go.sum index bbcfc8e62d72c..c930aa256d0e3 100644 --- a/pkg/logs/metrics/go.sum +++ b/pkg/logs/metrics/go.sum @@ -72,8 +72,8 @@ go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN8 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/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/pkg/logs/pipeline/go.mod b/pkg/logs/pipeline/go.mod index 12f52cf246613..bcabc871490b5 100644 --- a/pkg/logs/pipeline/go.mod +++ b/pkg/logs/pipeline/go.mod @@ -156,13 +156,13 @@ require ( go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/pkg/logs/pipeline/go.sum b/pkg/logs/pipeline/go.sum index 82acf8c4755f3..8a8c0a836cd5f 100644 --- a/pkg/logs/pipeline/go.sum +++ b/pkg/logs/pipeline/go.sum @@ -277,8 +277,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U 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/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -301,8 +301,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/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.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -328,12 +328,12 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -350,8 +350,8 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn 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= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= diff --git a/pkg/logs/processor/go.mod b/pkg/logs/processor/go.mod index b55f7c8b50dcb..aed531f08a410 100644 --- a/pkg/logs/processor/go.mod +++ b/pkg/logs/processor/go.mod @@ -135,12 +135,12 @@ require ( go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/pkg/logs/processor/go.sum b/pkg/logs/processor/go.sum index bf8e0cc137317..3bb0e66aa4a99 100644 --- a/pkg/logs/processor/go.sum +++ b/pkg/logs/processor/go.sum @@ -271,8 +271,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U 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/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -320,12 +320,12 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -342,8 +342,8 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn 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= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= diff --git a/pkg/logs/sds/go.mod b/pkg/logs/sds/go.mod index 7d3ffc4d4d8dd..3d969e82d669d 100644 --- a/pkg/logs/sds/go.mod +++ b/pkg/logs/sds/go.mod @@ -131,12 +131,12 @@ require ( go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/pkg/logs/sds/go.sum b/pkg/logs/sds/go.sum index 2cd53318e4d8c..d43a0fdc6389d 100644 --- a/pkg/logs/sds/go.sum +++ b/pkg/logs/sds/go.sum @@ -262,8 +262,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -306,11 +306,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -323,8 +323,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/pkg/logs/sender/destination_sender_test.go b/pkg/logs/sender/destination_sender_test.go index dac5fa6c545f1..d2ab54715a4f0 100644 --- a/pkg/logs/sender/destination_sender_test.go +++ b/pkg/logs/sender/destination_sender_test.go @@ -11,6 +11,7 @@ import ( "github.com/stretchr/testify/assert" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model" "github.com/DataDog/datadog-agent/pkg/logs/message" ) @@ -39,10 +40,10 @@ func (m *mockDestination) Start(input chan *message.Payload, output chan *messag return m.stopChan } -func newDestinationSenderWithBufferSize(bufferSize int) (*mockDestination, *DestinationSender) { +func newDestinationSenderWithBufferSize(t *testing.T, bufferSize int) (*mockDestination, *DestinationSender) { output := make(chan *message.Payload) dest := &mockDestination{} - cfg := getNewConfig() + cfg := configmock.New(t) d := NewDestinationSender(cfg, dest, output, bufferSize) return dest, d } @@ -55,8 +56,8 @@ func newDestinationSenderWithConfigAndBufferSize(cfg pkgconfigmodel.Reader, buff return dest, d } -func TestDestinationSender(_ *testing.T) { - dest, destSender := newDestinationSenderWithBufferSize(1) +func TestDestinationSender(t *testing.T) { + dest, destSender := newDestinationSenderWithBufferSize(t, 1) destSender.Send(&message.Payload{}) @@ -70,7 +71,7 @@ func TestDestinationSender(_ *testing.T) { } func TestDestinationSenderCanBeCanceled(t *testing.T) { - dest, destSender := newDestinationSenderWithBufferSize(0) + dest, destSender := newDestinationSenderWithBufferSize(t, 0) sendSucceeded := make(chan bool) @@ -85,14 +86,14 @@ func TestDestinationSenderCanBeCanceled(t *testing.T) { } func TestDestinationSenderAlreadyRetrying(t *testing.T) { - dest, destSender := newDestinationSenderWithBufferSize(0) + dest, destSender := newDestinationSenderWithBufferSize(t, 0) dest.isRetrying <- true assert.False(t, destSender.Send(&message.Payload{})) } func TestDestinationSenderStopsRetrying(t *testing.T) { - dest, destSender := newDestinationSenderWithBufferSize(0) + dest, destSender := newDestinationSenderWithBufferSize(t, 0) dest.isRetrying <- true assert.False(t, destSender.Send(&message.Payload{})) @@ -113,8 +114,8 @@ func TestDestinationSenderStopsRetrying(t *testing.T) { <-gotPayload } -func TestDestinationSenderDeadlock(_ *testing.T) { - dest, destSender := newDestinationSenderWithBufferSize(100) +func TestDestinationSenderDeadlock(t *testing.T) { + dest, destSender := newDestinationSenderWithBufferSize(t, 100) go func() { for range dest.input { //revive:disable-line:empty-block @@ -147,7 +148,7 @@ func TestDestinationSenderDeadlock(_ *testing.T) { } func TestDestinationSenderDisabled(t *testing.T) { - cfg := getNewConfig() + cfg := configmock.New(t) cfg.SetWithoutSource("multi_region_failover.enabled", true) cfg.SetWithoutSource("multi_region_failover.failover_logs", false) @@ -158,7 +159,7 @@ func TestDestinationSenderDisabled(t *testing.T) { } func TestDestinationSenderDisabledToEnabled(t *testing.T) { - cfg := getNewConfig() + cfg := configmock.New(t) cfg.SetWithoutSource("multi_region_failover.enabled", true) cfg.SetWithoutSource("multi_region_failover.failover_logs", false) @@ -174,7 +175,7 @@ func TestDestinationSenderDisabledToEnabled(t *testing.T) { } func TestDestinationSenderEnabledToDisabled(t *testing.T) { - cfg := getNewConfig() + cfg := configmock.New(t) cfg.SetWithoutSource("multi_region_failover.enabled", true) cfg.SetWithoutSource("multi_region_failover.failover_logs", true) diff --git a/pkg/logs/sender/go.mod b/pkg/logs/sender/go.mod index 0ccb5a58c923c..750b501605d92 100644 --- a/pkg/logs/sender/go.mod +++ b/pkg/logs/sender/go.mod @@ -50,6 +50,7 @@ replace ( require ( github.com/DataDog/datadog-agent/comp/logs/agent/config v0.56.0-rc.3 + github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel github.com/DataDog/datadog-agent/pkg/config/model v0.57.0 github.com/DataDog/datadog-agent/pkg/logs/client v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/logs/message v0.56.0-rc.3 @@ -136,13 +137,13 @@ require ( go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/pkg/logs/sender/go.sum b/pkg/logs/sender/go.sum index 23e63718ff3ed..c486d982207c3 100644 --- a/pkg/logs/sender/go.sum +++ b/pkg/logs/sender/go.sum @@ -262,8 +262,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -283,8 +283,8 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/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.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -308,11 +308,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -325,8 +325,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/pkg/logs/sender/sender_test.go b/pkg/logs/sender/sender_test.go index 6a75884648e4e..5fd09caf501d4 100644 --- a/pkg/logs/sender/sender_test.go +++ b/pkg/logs/sender/sender_test.go @@ -6,13 +6,12 @@ package sender import ( - "strings" "testing" "github.com/stretchr/testify/assert" "github.com/DataDog/datadog-agent/comp/logs/agent/config" - pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" "github.com/DataDog/datadog-agent/pkg/logs/client" "github.com/DataDog/datadog-agent/pkg/logs/client/http" "github.com/DataDog/datadog-agent/pkg/logs/client/mock" @@ -22,10 +21,6 @@ import ( "github.com/DataDog/datadog-agent/pkg/logs/status/statusinterface" ) -func getNewConfig() pkgconfigmodel.ReaderWriter { - return pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) -} - func newMessage(content []byte, source *sources.LogSource, status string) *message.Payload { return &message.Payload{ Messages: []*message.Message{message.NewMessageWithSource(content, status, source, 0)}, @@ -49,7 +44,7 @@ func TestSender(t *testing.T) { destination := tcp.AddrToDestination(l.Addr(), destinationsCtx, statusinterface.NewStatusProviderMock()) destinations := client.NewDestinations([]client.Destination{destination}, nil) - cfg := getNewConfig() + cfg := configmock.New(t) sender := NewSender(cfg, input, output, destinations, 0, nil, nil) sender.Start() @@ -67,8 +62,8 @@ func TestSender(t *testing.T) { } //nolint:revive // TODO(AML) Fix revive linter -func TestSenderSingleDestination(_ *testing.T) { - cfg := getNewConfig() +func TestSenderSingleDestination(t *testing.T) { + cfg := configmock.New(t) input := make(chan *message.Payload, 1) output := make(chan *message.Payload, 1) @@ -95,8 +90,8 @@ func TestSenderSingleDestination(_ *testing.T) { } //nolint:revive // TODO(AML) Fix revive linter -func TestSenderDualReliableDestination(_ *testing.T) { - cfg := getNewConfig() +func TestSenderDualReliableDestination(t *testing.T) { + cfg := configmock.New(t) input := make(chan *message.Payload, 1) output := make(chan *message.Payload, 1) @@ -130,8 +125,8 @@ func TestSenderDualReliableDestination(_ *testing.T) { } //nolint:revive // TODO(AML) Fix revive linter -func TestSenderUnreliableAdditionalDestination(_ *testing.T) { - cfg := getNewConfig() +func TestSenderUnreliableAdditionalDestination(t *testing.T) { + cfg := configmock.New(t) input := make(chan *message.Payload, 1) output := make(chan *message.Payload, 1) @@ -163,7 +158,7 @@ func TestSenderUnreliableAdditionalDestination(_ *testing.T) { } func TestSenderUnreliableStopsWhenMainFails(t *testing.T) { - cfg := getNewConfig() + cfg := configmock.New(t) input := make(chan *message.Payload, 1) output := make(chan *message.Payload, 1) @@ -211,8 +206,8 @@ func TestSenderUnreliableStopsWhenMainFails(t *testing.T) { } //nolint:revive // TODO(AML) Fix revive linter -func TestSenderReliableContinuseWhenOneFails(_ *testing.T) { - cfg := getNewConfig() +func TestSenderReliableContinuseWhenOneFails(t *testing.T) { + cfg := configmock.New(t) input := make(chan *message.Payload, 1) output := make(chan *message.Payload, 1) @@ -257,8 +252,8 @@ func TestSenderReliableContinuseWhenOneFails(_ *testing.T) { } //nolint:revive // TODO(AML) Fix revive linter -func TestSenderReliableWhenOneFailsAndRecovers(_ *testing.T) { - cfg := getNewConfig() +func TestSenderReliableWhenOneFailsAndRecovers(t *testing.T) { + cfg := configmock.New(t) input := make(chan *message.Payload, 1) output := make(chan *message.Payload, 1) diff --git a/pkg/logs/sources/go.mod b/pkg/logs/sources/go.mod index 751f0e820006c..fdff8fe8a14a1 100644 --- a/pkg/logs/sources/go.mod +++ b/pkg/logs/sources/go.mod @@ -92,12 +92,12 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/logs/sources/go.sum b/pkg/logs/sources/go.sum index e92309f06689e..fcbe4c21f6c43 100644 --- a/pkg/logs/sources/go.sum +++ b/pkg/logs/sources/go.sum @@ -252,8 +252,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -296,11 +296,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -313,8 +313,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/pkg/logs/util/testutils/go.mod b/pkg/logs/util/testutils/go.mod index 4e40296f5232b..c526ff6366bdb 100644 --- a/pkg/logs/util/testutils/go.mod +++ b/pkg/logs/util/testutils/go.mod @@ -91,11 +91,11 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/pkg/logs/util/testutils/go.sum b/pkg/logs/util/testutils/go.sum index e92309f06689e..fcbe4c21f6c43 100644 --- a/pkg/logs/util/testutils/go.sum +++ b/pkg/logs/util/testutils/go.sum @@ -252,8 +252,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -296,11 +296,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -313,8 +313,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/pkg/metrics/check_metrics_test.go b/pkg/metrics/check_metrics_test.go index f1249b00b8d58..24f0833fc3650 100644 --- a/pkg/metrics/check_metrics_test.go +++ b/pkg/metrics/check_metrics_test.go @@ -17,7 +17,7 @@ func TestCheckMetrics(t *testing.T) { cm := NewCheckMetrics(true, 1000*time.Second) t0 := 16_0000_0000.0 - cfg := setupConfig() + cfg := setupConfig(t) cm.AddSample(1, &MetricSample{Mtype: GaugeType}, t0, 1, cfg) assert.Contains(t, cm.metrics, ckey.ContextKey(1)) @@ -56,7 +56,7 @@ func TestCheckMetricsNoExpiry(t *testing.T) { cm := NewCheckMetrics(false, 1000*time.Second) t0 := 16_0000_0000.0 - cfg := setupConfig() + cfg := setupConfig(t) cm.AddSample(1, &MetricSample{Mtype: GaugeType}, t0, 1, cfg) assert.Contains(t, cm.metrics, ckey.ContextKey(1)) diff --git a/pkg/metrics/context_metrics_flusher_test.go b/pkg/metrics/context_metrics_flusher_test.go index 2f4c043ece184..101e479e6e5b3 100644 --- a/pkg/metrics/context_metrics_flusher_test.go +++ b/pkg/metrics/context_metrics_flusher_test.go @@ -12,13 +12,16 @@ import ( "testing" "github.com/DataDog/datadog-agent/pkg/aggregator/ckey" + "github.com/DataDog/datadog-agent/pkg/config/model" "github.com/stretchr/testify/require" ) func TestFlushAndClearSingleContextMetrics(t *testing.T) { + c := setupConfig(t) + metrics1 := MakeContextMetrics() - addMetricSample(metrics1, 100, 1) - addMetricSample(metrics1, 200, 2) + addMetricSample(metrics1, 100, 1, c) + addMetricSample(metrics1, 200, 2, c) flusher := NewContextMetricsFlusher() flusher.Append(0, metrics1) @@ -32,18 +35,20 @@ func TestFlushAndClearSingleContextMetrics(t *testing.T) { } func TestFlushAndClear(t *testing.T) { + c := setupConfig(t) + metrics1 := MakeContextMetrics() - addMetricSample(metrics1, 100, 1) - addMetricSample(metrics1, 200, 2) + addMetricSample(metrics1, 100, 1, c) + addMetricSample(metrics1, 200, 2, c) metrics2 := MakeContextMetrics() - addMetricSample(metrics2, 300, 3) - addMetricSample(metrics2, 200, 4) + addMetricSample(metrics2, 300, 3, c) + addMetricSample(metrics2, 200, 4, c) metrics3 := MakeContextMetrics() - addMetricSample(metrics3, 300, 5) - addMetricSample(metrics3, 200, 6) - addMetricSample(metrics3, 400, 7) + addMetricSample(metrics3, 300, 5, c) + addMetricSample(metrics3, 200, 6, c) + addMetricSample(metrics3, 400, 7, c) flusher := NewContextMetricsFlusher() flusher.Append(0, metrics1) @@ -68,12 +73,11 @@ func requireSerie(require *require.Assertions, series []*Serie, contextKey ckey. } } -func addMetricSample(contextMetrics ContextMetrics, contextKey int, value float64) { +func addMetricSample(contextMetrics ContextMetrics, contextKey int, value float64, c model.Config) { mSample := MetricSample{ Value: value, Mtype: GaugeType, } - c := setupConfig() contextMetrics.AddSample(ckey.ContextKey(contextKey), &mSample, 1, 10, nil, c) } diff --git a/pkg/metrics/context_metrics_test.go b/pkg/metrics/context_metrics_test.go index c527207271984..282aeb269ced3 100644 --- a/pkg/metrics/context_metrics_test.go +++ b/pkg/metrics/context_metrics_test.go @@ -23,7 +23,7 @@ func TestContextMetricsGaugeSampling(t *testing.T) { Value: 1, Mtype: GaugeType, } - c := setupConfig() + c := setupConfig(t) metrics.AddSample(contextKey, &mSample, 1, 10, nil, c) series, err := metrics.Flush(12345) @@ -51,7 +51,7 @@ func TestContextMetricsGaugeSamplingNoSample(t *testing.T) { Mtype: GaugeType, } - c := setupConfig() + c := setupConfig(t) metrics.AddSample(contextKey, &mSample, 1, 10, nil, c) series, err := metrics.Flush(12345) @@ -70,7 +70,7 @@ func TestContextMetricsGaugeSamplingInvalidSamples(t *testing.T) { contextKey1 := ckey.ContextKey(0xaaffffffffffffff) contextKey2 := ckey.ContextKey(0xbbffffffffffffff) - c := setupConfig() + c := setupConfig(t) // +/-Inf mSample1 := MetricSample{ Value: math.Inf(1), @@ -121,7 +121,7 @@ func TestContextMetricsSingleRateSampling(t *testing.T) { metrics := MakeContextMetrics() contextKey := ckey.ContextKey(0xffffffffffffffff) - c := setupConfig() + c := setupConfig(t) metrics.AddSample(contextKey, &MetricSample{Mtype: RateType, Value: 1}, 12340, 10, nil, c) series, err := metrics.Flush(12345) @@ -151,7 +151,7 @@ func TestContextMetricsNegativeRateSampling(t *testing.T) { metrics := MakeContextMetrics() contextKey := ckey.ContextKey(0xffffffffffffffff) - c := setupConfig() + c := setupConfig(t) metrics.AddSample(contextKey, &MetricSample{Mtype: RateType, Value: 2}, 12340, 10, nil, c) metrics.AddSample(contextKey, &MetricSample{Mtype: RateType, Value: 1}, 12350, 10, nil, c) series, err := metrics.Flush(12351) @@ -165,7 +165,7 @@ func TestContextMetricsCountSampling(t *testing.T) { metrics := MakeContextMetrics() contextKey := ckey.ContextKey(0xffffffffffffffff) - c := setupConfig() + c := setupConfig(t) metrics.AddSample(contextKey, &MetricSample{Mtype: CountType, Value: 1}, 12340, 10, nil, c) metrics.AddSample(contextKey, &MetricSample{Mtype: CountType, Value: 5}, 12345, 10, nil, c) series, err := metrics.Flush(12350) @@ -186,7 +186,7 @@ func TestContextMetricsCountSampling(t *testing.T) { func TestContextMetricsMonotonicCountSampling(t *testing.T) { metrics := MakeContextMetrics() contextKey := ckey.ContextKey(0xffffffffffffffff) - c := setupConfig() + c := setupConfig(t) metrics.AddSample(contextKey, &MetricSample{Mtype: MonotonicCountType, Value: 1}, 12340, 10, nil, c) metrics.AddSample(contextKey, &MetricSample{Mtype: MonotonicCountType, Value: 5}, 12345, 10, nil, c) @@ -209,7 +209,7 @@ func TestContextMetricsHistogramSampling(t *testing.T) { metrics := MakeContextMetrics() contextKey := ckey.ContextKey(0xffffffffffffffff) - c := setupConfig() + c := setupConfig(t) metrics.AddSample(contextKey, &MetricSample{Mtype: HistogramType, Value: 1}, 12340, 10, nil, c) metrics.AddSample(contextKey, &MetricSample{Mtype: HistogramType, Value: 2}, 12342, 10, nil, c) metrics.AddSample(contextKey, &MetricSample{Mtype: HistogramType, Value: 1}, 12350, 10, nil, c) @@ -261,7 +261,7 @@ func TestContextMetricsHistorateSampling(t *testing.T) { metrics := MakeContextMetrics() contextKey := ckey.ContextKey(0xffffffffffffffff) - c := setupConfig() + c := setupConfig(t) metrics.AddSample(contextKey, &MetricSample{Mtype: HistorateType, Value: 1}, 12340, 10, nil, c) metrics.AddSample(contextKey, &MetricSample{Mtype: HistorateType, Value: 2}, 12341, 10, nil, c) metrics.AddSample(contextKey, &MetricSample{Mtype: HistorateType, Value: 4}, 12342, 10, nil, c) @@ -320,7 +320,7 @@ func TestContextMetricsGaugeWithTimestampSampling(t *testing.T) { metrics := MakeContextMetrics() contextKey := ckey.ContextKey(0xffffffffffffffff) - c := setupConfig() + c := setupConfig(t) metrics.AddSample(contextKey, &MetricSample{Mtype: GaugeWithTimestampType, Value: 1}, 12340, 10, nil, c) metrics.AddSample(contextKey, &MetricSample{Mtype: GaugeWithTimestampType, Value: 5}, 12345, 10, nil, c) series, err := metrics.Flush(12350) @@ -342,7 +342,7 @@ func TestContextMetricsCountWithTimestampSampling(t *testing.T) { metrics := MakeContextMetrics() contextKey := ckey.ContextKey(0xffffffffffffffff) - c := setupConfig() + c := setupConfig(t) metrics.AddSample(contextKey, &MetricSample{Mtype: CountWithTimestampType, Value: 1}, 12340, 10, nil, c) metrics.AddSample(contextKey, &MetricSample{Mtype: CountWithTimestampType, Value: 5}, 12345, 10, nil, c) series, err := metrics.Flush(12350) diff --git a/pkg/metrics/go.mod b/pkg/metrics/go.mod index 969d90fde556d..73eead8a3f829 100644 --- a/pkg/metrics/go.mod +++ b/pkg/metrics/go.mod @@ -3,71 +3,115 @@ module github.com/DataDog/datadog-agent/pkg/metrics go 1.22.0 replace ( + github.com/DataDog/datadog-agent/comp/api/api/def => ../../comp/api/api/def + github.com/DataDog/datadog-agent/comp/core/flare/builder => ../../comp/core/flare/builder + github.com/DataDog/datadog-agent/comp/core/flare/types => ../../comp/core/flare/types + github.com/DataDog/datadog-agent/comp/core/secrets => ../../comp/core/secrets github.com/DataDog/datadog-agent/comp/core/telemetry => ../../comp/core/telemetry/ github.com/DataDog/datadog-agent/comp/def => ../../comp/def/ github.com/DataDog/datadog-agent/pkg/aggregator/ckey => ../aggregator/ckey/ + github.com/DataDog/datadog-agent/pkg/collector/check/defaults => ../../pkg/collector/check/defaults + github.com/DataDog/datadog-agent/pkg/config/env => ../../pkg/config/env + github.com/DataDog/datadog-agent/pkg/config/mock => ../config/mock github.com/DataDog/datadog-agent/pkg/config/model => ../config/model/ + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel => ../config/nodetreemodel + github.com/DataDog/datadog-agent/pkg/config/setup => ../config/setup + github.com/DataDog/datadog-agent/pkg/config/structure => ../config/structure + github.com/DataDog/datadog-agent/pkg/config/teeconfig => ../config/teeconfig github.com/DataDog/datadog-agent/pkg/tagger/types => ../../pkg/tagger/types github.com/DataDog/datadog-agent/pkg/tagset => ../tagset/ github.com/DataDog/datadog-agent/pkg/telemetry => ../telemetry/ github.com/DataDog/datadog-agent/pkg/util/buf => ../util/buf/ + github.com/DataDog/datadog-agent/pkg/util/executable => ../../pkg/util/executable + github.com/DataDog/datadog-agent/pkg/util/filesystem => ../../pkg/util/filesystem github.com/DataDog/datadog-agent/pkg/util/fxutil => ../util/fxutil/ + github.com/DataDog/datadog-agent/pkg/util/hostname/validate => ../../pkg/util/hostname/validate github.com/DataDog/datadog-agent/pkg/util/log => ../util/log/ github.com/DataDog/datadog-agent/pkg/util/optional => ../util/optional + github.com/DataDog/datadog-agent/pkg/util/pointer => ../../pkg/util/pointer github.com/DataDog/datadog-agent/pkg/util/scrubber => ../util/scrubber/ github.com/DataDog/datadog-agent/pkg/util/sort => ../util/sort/ + github.com/DataDog/datadog-agent/pkg/util/system => ../../pkg/util/system github.com/DataDog/datadog-agent/pkg/util/system/socket => ../util/system/socket + github.com/DataDog/datadog-agent/pkg/util/testutil => ../../pkg/util/testutil + github.com/DataDog/datadog-agent/pkg/util/winutil => ../../pkg/util/winutil ) require ( github.com/DataDog/datadog-agent/pkg/aggregator/ckey v0.56.0-rc.3 - github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.3 + github.com/DataDog/datadog-agent/pkg/config/mock v0.57.1 + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 + github.com/DataDog/datadog-agent/pkg/config/structure v0.0.0-00010101000000-000000000000 github.com/DataDog/datadog-agent/pkg/tagger/types v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/tagset v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/telemetry v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/buf v0.56.0-rc.3 - github.com/DataDog/datadog-agent/pkg/util/log v0.56.0-rc.3 + github.com/DataDog/datadog-agent/pkg/util/log v0.57.1 github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.20.0 github.com/stretchr/testify v1.9.0 go.uber.org/atomic v1.11.0 ) require ( - github.com/DataDog/datadog-agent/comp/core/telemetry v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/comp/def v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/fxutil v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/optional v0.55.0 // indirect - github.com/DataDog/datadog-agent/pkg/util/scrubber v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/comp/core/secrets v0.57.1 // indirect + github.com/DataDog/datadog-agent/comp/core/telemetry v0.57.1 // indirect + github.com/DataDog/datadog-agent/comp/def v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/env v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/config/setup v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/util/executable v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/fxutil v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/optional v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/scrubber v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/sort v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/system v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/winutil v0.57.1 // indirect github.com/DataDog/sketches-go v1.4.4 // indirect github.com/DataDog/viper v1.13.5 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/fsnotify/fsnotify v1.4.7 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/magiconair/properties v1.8.1 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mitchellh/mapstructure v1.1.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect github.com/prometheus/client_golang v1.17.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect - github.com/spf13/afero v1.9.5 // indirect - github.com/spf13/cast v1.3.0 // indirect + github.com/shirou/gopsutil/v3 v3.23.12 // indirect + github.com/shoenig/go-m1cpu v0.1.6 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.5.1 // indirect github.com/spf13/cobra v1.7.0 // indirect github.com/spf13/jwalterweatherman v1.0.0 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect github.com/twmb/murmur3 v1.1.8 // indirect + github.com/yusufpapurcu/wmi v1.2.3 // indirect go.opentelemetry.io/otel v1.27.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.42.0 // indirect go.opentelemetry.io/otel/metric v1.27.0 // indirect @@ -78,9 +122,12 @@ require ( go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect + golang.org/x/mod v0.21.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/pkg/metrics/go.sum b/pkg/metrics/go.sum index 80f70b9935008..795a4f2e73f2f 100644 --- a/pkg/metrics/go.sum +++ b/pkg/metrics/go.sum @@ -1,44 +1,6 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/opentelemetry-mapping-go/pkg/internal/sketchtest v0.20.0 h1:e4XT2+v4vgZBCbp5JUbe0Z+PRegh+nsLMp4X+esht9E= github.com/DataDog/opentelemetry-mapping-go/pkg/internal/sketchtest v0.20.0/go.mod h1:66XlN7QpQKqIvw8e2UbCXV5X8wGnEw851nT9BjJ75dY= github.com/DataDog/opentelemetry-mapping-go/pkg/quantile v0.20.0 h1:0OFAPO964qsj6BzKs/hbAkpO/IIHp7vN1klKrohzULA= @@ -47,6 +9,8 @@ github.com/DataDog/sketches-go v1.4.4 h1:dF52vzXRFSPOj2IjXSWLvXq3jubL4CI69kwYjJ1 github.com/DataDog/sketches-go v1.4.4/go.mod h1:XR0ns2RtEEF09mDKXiKZiQg+nfZStrq1ZuL1eezeZe0= github.com/DataDog/viper v1.13.5 h1:SZMcyMknYQN2jRY/40A16gUXexlNJOI8sDs1cWZnI64= github.com/DataDog/viper v1.13.5/go.mod h1:wDdUVJ2SHaMaPrCZrlRCObwkubsX8j5sme3LaR/SGTc= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -63,15 +27,9 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 h1:kHaBemcxl8o/pQ5VM1c8PVE1PubbNx3mjUr09OqWGCs= github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575/go.mod h1:9d6lWj8KzO/fd/NrVaLscBKmPigpZpn5YawRPw+e3Yo= 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/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/bbolt v1.3.3/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -88,18 +46,14 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -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/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= +github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -109,74 +63,36 @@ github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/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-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/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.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 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/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= @@ -184,26 +100,23 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.2.0/go.mod h1:mJzapYve32yjrKlk9G github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.13.0/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95 h1:S4qyfL2sEm5Budr4KVMyEniCy+PbS55651I/a+Kn/NQ= +github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95/go.mod h1:QiyDdbZLaJ/mZP4Zwc9g2QsfaEA4o7XvvgZegSci5/E= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA= +github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= 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/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -212,6 +125,8 @@ 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/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -232,10 +147,10 @@ github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= 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/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= @@ -267,6 +182,12 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shirou/gopsutil/v3 v3.23.12 h1:z90NtUkp3bMtmICZKpC4+WaknU1eXtp5vtbQ11DgpE4= +github.com/shirou/gopsutil/v3 v3.23.12/go.mod h1:1FrWgea594Jp7qmjHUUPlJDTPgcsb9mGnXDxavtikzM= +github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= +github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= +github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= +github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -274,10 +195,11 @@ github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9 github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM= -github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= -github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= +github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= @@ -288,15 +210,22 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.6.2/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= 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/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 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.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/twmb/murmur3 v1.1.8 h1:8Yt9taO/WN3l08xErzjeschgZU2QSrwm1kclYq+0aRg= @@ -306,17 +235,9 @@ github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVM github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= +github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= go.opentelemetry.io/otel/exporters/prometheus v0.42.0 h1:jwV9iQdvp38fxXi8ZC+lNpxjK16MRcZlpDYvbuO1FiA= @@ -351,305 +272,82 @@ go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -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/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -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/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= 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-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/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-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/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-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= 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-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/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-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/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-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 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-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190529164535-6a60838ec259/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/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-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/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-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -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/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= 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/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= @@ -676,12 +374,5 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C 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-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/pkg/metrics/histogram.go b/pkg/metrics/histogram.go index 8798d827e551d..f742e64d3a0cb 100644 --- a/pkg/metrics/histogram.go +++ b/pkg/metrics/histogram.go @@ -11,6 +11,7 @@ import ( "strconv" pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model" + "github.com/DataDog/datadog-agent/pkg/config/structure" "github.com/DataDog/datadog-agent/pkg/util/log" ) @@ -50,13 +51,9 @@ var ( defaultPercentiles = []int(nil) ) -type histogramPercentilesConfig struct { - Percentiles []string `mapstructure:"histogram_percentiles"` -} - -func (h *histogramPercentilesConfig) percentiles() []int { +func parsePercentiles(percentiles []string) []int { res := []int{} - for _, p := range h.Percentiles { + for _, p := range percentiles { i, err := strconv.ParseFloat(p, 64) if err != nil { log.Errorf("Could not parse '%s' from 'histogram_percentiles' (skipping): %s", p, err) @@ -81,12 +78,12 @@ func NewHistogram(interval int64, config pkgconfigmodel.Config) *Histogram { defaultAggregates = config.GetStringSlice("histogram_aggregates") } if defaultPercentiles == nil { - c := histogramPercentilesConfig{} - err := config.Unmarshal(&c) + c := []string{} + err := structure.UnmarshalKey(config, "histogram_percentiles", &c) if err != nil { log.Errorf("Could not Unmarshal histogram configuration: %s", err) } else { - defaultPercentiles = c.percentiles() + defaultPercentiles = parsePercentiles(c) sort.Ints(defaultPercentiles) } } diff --git a/pkg/metrics/histogram_test.go b/pkg/metrics/histogram_test.go index cfe8137f8d372..1c52f51d57b74 100644 --- a/pkg/metrics/histogram_test.go +++ b/pkg/metrics/histogram_test.go @@ -7,27 +7,24 @@ package metrics import ( "math/rand" - "strings" "testing" "time" - pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestHistogramConf(t *testing.T) { - h := histogramPercentilesConfig{Percentiles: []string{"0.95", "0.96", "0.28", "0.57", "0.58"}} - assert.Equal(t, []int{95, 96, 28, 57, 58}, h.percentiles()) + assert.Equal(t, []int{95, 96, 28, 57, 58}, parsePercentiles([]string{"0.95", "0.96", "0.28", "0.57", "0.58"})) } func TestHistogramConfError(t *testing.T) { - h := histogramPercentilesConfig{Percentiles: []string{"0.95", "test", "0.12test", "0.22", "200", "-50"}} - assert.Equal(t, []int{95, 22}, h.percentiles()) + assert.Equal(t, []int{95, 22}, parsePercentiles([]string{"0.95", "test", "0.12test", "0.22", "200", "-50"})) } func TestConfigureDefault(t *testing.T) { - cfg := setupConfig() + cfg := setupConfig(t) hist := NewHistogram(10, cfg) hist.addSample(&MetricSample{Value: 1}, 50) hist.addSample(&MetricSample{Value: 2}, 55) @@ -39,7 +36,7 @@ func TestConfigureDefault(t *testing.T) { } func TestConfigure(t *testing.T) { - mockConfig := pkgconfigmodel.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) + mockConfig := configmock.New(t) defaultAggregates = nil defaultPercentiles = nil @@ -54,7 +51,7 @@ func TestConfigure(t *testing.T) { func TestDefaultHistogramSampling(t *testing.T) { // Initialize default histogram - cfg := setupConfig() + cfg := setupConfig(t) defaultAggregates = nil defaultPercentiles = nil @@ -97,7 +94,7 @@ func TestDefaultHistogramSampling(t *testing.T) { func TestCustomHistogramSampling(t *testing.T) { // Initialize custom histogram, with an invalid aggregate - cfg := setupConfig() + cfg := setupConfig(t) mHistogram := NewHistogram(10, cfg) mHistogram.configure([]string{"min", "sum", "invalid"}, []int{}) @@ -143,7 +140,7 @@ func shuffle(slice []float64) { func TestHistogramPercentiles(t *testing.T) { // Initialize custom histogram - cfg := setupConfig() + cfg := setupConfig(t) mHistogram := NewHistogram(10, cfg) mHistogram.configure([]string{"max", "median", "avg", "count", "min"}, []int{95, 80}) @@ -192,7 +189,7 @@ func TestHistogramPercentiles(t *testing.T) { } func TestHistogramSampleRate(t *testing.T) { - cfg := setupConfig() + cfg := setupConfig(t) mHistogram := NewHistogram(10, cfg) mHistogram.configure([]string{"max", "min", "median", "avg", "sum", "count"}, []int{20, 95, 80}) @@ -233,7 +230,7 @@ func TestHistogramSampleRate(t *testing.T) { } func TestHistogramReset(t *testing.T) { - cfg := setupConfig() + cfg := setupConfig(t) mHistogram := NewHistogram(10, cfg) mHistogram.configure([]string{"max", "min", "median", "avg", "sum", "count"}, []int{20, 95, 80}) @@ -279,7 +276,7 @@ func TestHistogramReset(t *testing.T) { // func benchHistogram(b *testing.B, number int, sampleRate float64) { - cfg := setupConfig() + cfg := setupConfig(b) for n := 0; n < b.N; n++ { h := NewHistogram(1, cfg) h.configure([]string{"max", "min", "median", "avg", "sum", "count"}, []int{20, 95, 80}) diff --git a/pkg/metrics/historate_test.go b/pkg/metrics/historate_test.go index 188abb299ed7b..967b53f691c6e 100644 --- a/pkg/metrics/historate_test.go +++ b/pkg/metrics/historate_test.go @@ -7,23 +7,23 @@ package metrics import ( "fmt" - "strings" "testing" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -func setupConfig() pkgconfigmodel.Config { - c := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) +func setupConfig(t testing.TB) pkgconfigmodel.Config { + c := configmock.New(t) c.SetWithoutSource("histogram_aggregates", []string{"max", "median", "avg", "count"}) c.SetWithoutSource("histogram_percentiles", []string{"0.95"}) return c } func TestHistorateEmptyFlush(t *testing.T) { - c := setupConfig() + c := setupConfig(t) h := NewHistorate(1, c) // Flush w/o samples: error @@ -32,7 +32,7 @@ func TestHistorateEmptyFlush(t *testing.T) { } func TestHistorateAddSampleOnce(t *testing.T) { - c := setupConfig() + c := setupConfig(t) h := NewHistorate(1, c) h.addSample(&MetricSample{Value: 1}, 50) @@ -44,7 +44,7 @@ func TestHistorateAddSampleOnce(t *testing.T) { func TestHistorateAddSample(t *testing.T) { fmt.Printf("### starting testin of TestHistorateAddSample\n") - c := setupConfig() + c := setupConfig(t) h := NewHistorate(1, c) h.addSample(&MetricSample{Value: 1}, 50) diff --git a/pkg/network/config/config.go b/pkg/network/config/config.go index 1b8ef55fb4df8..415f2c289ffdb 100644 --- a/pkg/network/config/config.go +++ b/pkg/network/config/config.go @@ -7,7 +7,6 @@ package config import ( - "strings" "time" cebpf "github.com/cilium/ebpf" @@ -20,11 +19,10 @@ import ( ) const ( - spNS = "system_probe_config" - netNS = "network_config" - smNS = "service_monitoring_config" - evNS = "event_monitoring_config" - smjtNS = smNS + ".tls.java" + spNS = "system_probe_config" + netNS = "network_config" + smNS = "service_monitoring_config" + evNS = "event_monitoring_config" defaultUDPTimeoutSeconds = 30 defaultUDPStreamTimeoutSeconds = 120 @@ -110,10 +108,6 @@ type Config struct { // hooking the system-probe test binary. Defaults to true. GoTLSExcludeSelf bool - // EnableJavaTLSSupport specifies whether the tracer should monitor HTTPS - // traffic done through Java's TLS implementation - EnableJavaTLSSupport bool - // MaxTrackedHTTPConnections max number of http(s) flows that will be concurrently tracked. // value is currently Windows only MaxTrackedHTTPConnections int64 @@ -126,21 +120,6 @@ type Config struct { // Currently Windows only HTTPMaxRequestFragment int64 - // JavaAgentDebug will enable debug output of the injected USM agent - JavaAgentDebug bool - - // JavaAgentArgs arguments pass through injected USM agent - JavaAgentArgs string - - // JavaAgentAllowRegex (Higher priority) define a regex, if matching /proc/pid/cmdline the java agent will be injected - JavaAgentAllowRegex string - - // JavaAgentBlockRegex define a regex, if matching /proc/pid/cmdline the java agent will not be injected - JavaAgentBlockRegex string - - // JavaDir is the directory to load the java agent program from - JavaDir string - // UDPConnTimeout determines the length of traffic inactivity between two // (IP, port)-pairs before declaring a UDP connection as inactive. This is // set to /proc/sys/net/netfilter/nf_conntrack_udp_timeout on Linux by @@ -312,10 +291,6 @@ type Config struct { EnableUSMEventStream bool } -func join(pieces ...string) string { - return strings.Join(pieces, ".") -} - // New creates a config for the network tracer func New() *Config { cfg := pkgconfigsetup.SystemProbe() @@ -324,109 +299,103 @@ func New() *Config { c := &Config{ Config: *ebpf.NewConfig(), - NPMEnabled: cfg.GetBool(join(netNS, "enabled")), - ServiceMonitoringEnabled: cfg.GetBool(join(smNS, "enabled")), + NPMEnabled: cfg.GetBool(sysconfig.FullKeyPath(netNS, "enabled")), + ServiceMonitoringEnabled: cfg.GetBool(sysconfig.FullKeyPath(smNS, "enabled")), - CollectTCPv4Conns: cfg.GetBool(join(netNS, "collect_tcp_v4")), - CollectTCPv6Conns: cfg.GetBool(join(netNS, "collect_tcp_v6")), + CollectTCPv4Conns: cfg.GetBool(sysconfig.FullKeyPath(netNS, "collect_tcp_v4")), + CollectTCPv6Conns: cfg.GetBool(sysconfig.FullKeyPath(netNS, "collect_tcp_v6")), TCPConnTimeout: 2 * time.Minute, - CollectUDPv4Conns: cfg.GetBool(join(netNS, "collect_udp_v4")), - CollectUDPv6Conns: cfg.GetBool(join(netNS, "collect_udp_v6")), + CollectUDPv4Conns: cfg.GetBool(sysconfig.FullKeyPath(netNS, "collect_udp_v4")), + CollectUDPv6Conns: cfg.GetBool(sysconfig.FullKeyPath(netNS, "collect_udp_v6")), UDPConnTimeout: defaultUDPTimeoutSeconds * time.Second, UDPStreamTimeout: defaultUDPStreamTimeoutSeconds * time.Second, - OffsetGuessThreshold: uint64(cfg.GetInt64(join(spNS, "offset_guess_threshold"))), - ExcludedSourceConnections: cfg.GetStringMapStringSlice(join(spNS, "source_excludes")), - ExcludedDestinationConnections: cfg.GetStringMapStringSlice(join(spNS, "dest_excludes")), - - TCPFailedConnectionsEnabled: cfg.GetBool(join(netNS, "enable_tcp_failed_connections")), - MaxTrackedConnections: uint32(cfg.GetInt64(join(spNS, "max_tracked_connections"))), - MaxClosedConnectionsBuffered: uint32(cfg.GetInt64(join(spNS, "max_closed_connections_buffered"))), - MaxFailedConnectionsBuffered: uint32(cfg.GetInt64(join(netNS, "max_failed_connections_buffered"))), - ClosedConnectionFlushThreshold: cfg.GetInt(join(spNS, "closed_connection_flush_threshold")), - ClosedChannelSize: cfg.GetInt(join(spNS, "closed_channel_size")), - MaxConnectionsStateBuffered: cfg.GetInt(join(spNS, "max_connection_state_buffered")), + OffsetGuessThreshold: uint64(cfg.GetInt64(sysconfig.FullKeyPath(spNS, "offset_guess_threshold"))), + ExcludedSourceConnections: cfg.GetStringMapStringSlice(sysconfig.FullKeyPath(spNS, "source_excludes")), + ExcludedDestinationConnections: cfg.GetStringMapStringSlice(sysconfig.FullKeyPath(spNS, "dest_excludes")), + + TCPFailedConnectionsEnabled: cfg.GetBool(sysconfig.FullKeyPath(netNS, "enable_tcp_failed_connections")), + MaxTrackedConnections: uint32(cfg.GetInt64(sysconfig.FullKeyPath(spNS, "max_tracked_connections"))), + MaxClosedConnectionsBuffered: uint32(cfg.GetInt64(sysconfig.FullKeyPath(spNS, "max_closed_connections_buffered"))), + MaxFailedConnectionsBuffered: uint32(cfg.GetInt64(sysconfig.FullKeyPath(netNS, "max_failed_connections_buffered"))), + ClosedConnectionFlushThreshold: cfg.GetInt(sysconfig.FullKeyPath(spNS, "closed_connection_flush_threshold")), + ClosedChannelSize: cfg.GetInt(sysconfig.FullKeyPath(spNS, "closed_channel_size")), + MaxConnectionsStateBuffered: cfg.GetInt(sysconfig.FullKeyPath(spNS, "max_connection_state_buffered")), ClientStateExpiry: 2 * time.Minute, - DNSInspection: !cfg.GetBool(join(spNS, "disable_dns_inspection")), - CollectDNSStats: cfg.GetBool(join(spNS, "collect_dns_stats")), - CollectLocalDNS: cfg.GetBool(join(spNS, "collect_local_dns")), - CollectDNSDomains: cfg.GetBool(join(spNS, "collect_dns_domains")), - MaxDNSStats: cfg.GetInt(join(spNS, "max_dns_stats")), + DNSInspection: !cfg.GetBool(sysconfig.FullKeyPath(spNS, "disable_dns_inspection")), + CollectDNSStats: cfg.GetBool(sysconfig.FullKeyPath(spNS, "collect_dns_stats")), + CollectLocalDNS: cfg.GetBool(sysconfig.FullKeyPath(spNS, "collect_local_dns")), + CollectDNSDomains: cfg.GetBool(sysconfig.FullKeyPath(spNS, "collect_dns_domains")), + MaxDNSStats: cfg.GetInt(sysconfig.FullKeyPath(spNS, "max_dns_stats")), MaxDNSStatsBuffered: 75000, - DNSTimeout: time.Duration(cfg.GetInt(join(spNS, "dns_timeout_in_s"))) * time.Second, - - ProtocolClassificationEnabled: cfg.GetBool(join(netNS, "enable_protocol_classification")), - - NPMRingbuffersEnabled: cfg.GetBool(join(netNS, "enable_ringbuffers")), - - EnableHTTPMonitoring: cfg.GetBool(join(smNS, "enable_http_monitoring")), - EnableHTTP2Monitoring: cfg.GetBool(join(smNS, "enable_http2_monitoring")), - EnableKafkaMonitoring: cfg.GetBool(join(smNS, "enable_kafka_monitoring")), - EnablePostgresMonitoring: cfg.GetBool(join(smNS, "enable_postgres_monitoring")), - EnableRedisMonitoring: cfg.GetBool(join(smNS, "enable_redis_monitoring")), - EnableNativeTLSMonitoring: cfg.GetBool(join(smNS, "tls", "native", "enabled")), - EnableIstioMonitoring: cfg.GetBool(join(smNS, "tls", "istio", "enabled")), - EnvoyPath: cfg.GetString(join(smNS, "tls", "istio", "envoy_path")), - EnableNodeJSMonitoring: cfg.GetBool(join(smNS, "tls", "nodejs", "enabled")), - MaxUSMConcurrentRequests: uint32(cfg.GetInt(join(smNS, "max_concurrent_requests"))), - MaxHTTPStatsBuffered: cfg.GetInt(join(smNS, "max_http_stats_buffered")), - MaxKafkaStatsBuffered: cfg.GetInt(join(smNS, "max_kafka_stats_buffered")), - MaxPostgresStatsBuffered: cfg.GetInt(join(smNS, "max_postgres_stats_buffered")), - MaxPostgresTelemetryBuffer: cfg.GetInt(join(smNS, "max_postgres_telemetry_buffer")), - MaxRedisStatsBuffered: cfg.GetInt(join(smNS, "max_redis_stats_buffered")), - - MaxTrackedHTTPConnections: cfg.GetInt64(join(smNS, "max_tracked_http_connections")), - HTTPNotificationThreshold: cfg.GetInt64(join(smNS, "http_notification_threshold")), - HTTPMaxRequestFragment: cfg.GetInt64(join(smNS, "http_max_request_fragment")), - - EnableConntrack: cfg.GetBool(join(spNS, "enable_conntrack")), - ConntrackMaxStateSize: cfg.GetInt(join(spNS, "conntrack_max_state_size")), - ConntrackRateLimit: cfg.GetInt(join(spNS, "conntrack_rate_limit")), + DNSTimeout: time.Duration(cfg.GetInt(sysconfig.FullKeyPath(spNS, "dns_timeout_in_s"))) * time.Second, + + ProtocolClassificationEnabled: cfg.GetBool(sysconfig.FullKeyPath(netNS, "enable_protocol_classification")), + + NPMRingbuffersEnabled: cfg.GetBool(sysconfig.FullKeyPath(netNS, "enable_ringbuffers")), + + EnableHTTPMonitoring: cfg.GetBool(sysconfig.FullKeyPath(smNS, "enable_http_monitoring")), + EnableHTTP2Monitoring: cfg.GetBool(sysconfig.FullKeyPath(smNS, "enable_http2_monitoring")), + EnableKafkaMonitoring: cfg.GetBool(sysconfig.FullKeyPath(smNS, "enable_kafka_monitoring")), + EnablePostgresMonitoring: cfg.GetBool(sysconfig.FullKeyPath(smNS, "enable_postgres_monitoring")), + EnableRedisMonitoring: cfg.GetBool(sysconfig.FullKeyPath(smNS, "enable_redis_monitoring")), + EnableNativeTLSMonitoring: cfg.GetBool(sysconfig.FullKeyPath(smNS, "tls", "native", "enabled")), + EnableIstioMonitoring: cfg.GetBool(sysconfig.FullKeyPath(smNS, "tls", "istio", "enabled")), + EnvoyPath: cfg.GetString(sysconfig.FullKeyPath(smNS, "tls", "istio", "envoy_path")), + EnableNodeJSMonitoring: cfg.GetBool(sysconfig.FullKeyPath(smNS, "tls", "nodejs", "enabled")), + MaxUSMConcurrentRequests: uint32(cfg.GetInt(sysconfig.FullKeyPath(smNS, "max_concurrent_requests"))), + MaxHTTPStatsBuffered: cfg.GetInt(sysconfig.FullKeyPath(smNS, "max_http_stats_buffered")), + MaxKafkaStatsBuffered: cfg.GetInt(sysconfig.FullKeyPath(smNS, "max_kafka_stats_buffered")), + MaxPostgresStatsBuffered: cfg.GetInt(sysconfig.FullKeyPath(smNS, "max_postgres_stats_buffered")), + MaxPostgresTelemetryBuffer: cfg.GetInt(sysconfig.FullKeyPath(smNS, "max_postgres_telemetry_buffer")), + MaxRedisStatsBuffered: cfg.GetInt(sysconfig.FullKeyPath(smNS, "max_redis_stats_buffered")), + + MaxTrackedHTTPConnections: cfg.GetInt64(sysconfig.FullKeyPath(smNS, "max_tracked_http_connections")), + HTTPNotificationThreshold: cfg.GetInt64(sysconfig.FullKeyPath(smNS, "http_notification_threshold")), + HTTPMaxRequestFragment: cfg.GetInt64(sysconfig.FullKeyPath(smNS, "http_max_request_fragment")), + + EnableConntrack: cfg.GetBool(sysconfig.FullKeyPath(spNS, "enable_conntrack")), + ConntrackMaxStateSize: cfg.GetInt(sysconfig.FullKeyPath(spNS, "conntrack_max_state_size")), + ConntrackRateLimit: cfg.GetInt(sysconfig.FullKeyPath(spNS, "conntrack_rate_limit")), ConntrackRateLimitInterval: 3 * time.Second, - EnableConntrackAllNamespaces: cfg.GetBool(join(spNS, "enable_conntrack_all_namespaces")), - IgnoreConntrackInitFailure: cfg.GetBool(join(netNS, "ignore_conntrack_init_failure")), - ConntrackInitTimeout: cfg.GetDuration(join(netNS, "conntrack_init_timeout")), - EnableEbpfConntracker: cfg.GetBool(join(netNS, "enable_ebpf_conntracker")), + EnableConntrackAllNamespaces: cfg.GetBool(sysconfig.FullKeyPath(spNS, "enable_conntrack_all_namespaces")), + IgnoreConntrackInitFailure: cfg.GetBool(sysconfig.FullKeyPath(netNS, "ignore_conntrack_init_failure")), + ConntrackInitTimeout: cfg.GetDuration(sysconfig.FullKeyPath(netNS, "conntrack_init_timeout")), + EnableEbpfConntracker: cfg.GetBool(sysconfig.FullKeyPath(netNS, "enable_ebpf_conntracker")), - EnableGatewayLookup: cfg.GetBool(join(netNS, "enable_gateway_lookup")), + EnableGatewayLookup: cfg.GetBool(sysconfig.FullKeyPath(netNS, "enable_gateway_lookup")), - EnableMonotonicCount: cfg.GetBool(join(spNS, "windows.enable_monotonic_count")), + EnableMonotonicCount: cfg.GetBool(sysconfig.FullKeyPath(spNS, "windows.enable_monotonic_count")), - RecordedQueryTypes: cfg.GetStringSlice(join(netNS, "dns_recorded_query_types")), + RecordedQueryTypes: cfg.GetStringSlice(sysconfig.FullKeyPath(netNS, "dns_recorded_query_types")), - EnableProcessEventMonitoring: cfg.GetBool(join(evNS, "network_process", "enabled")), - MaxProcessesTracked: cfg.GetInt(join(evNS, "network_process", "max_processes_tracked")), + EnableProcessEventMonitoring: cfg.GetBool(sysconfig.FullKeyPath(evNS, "network_process", "enabled")), + MaxProcessesTracked: cfg.GetInt(sysconfig.FullKeyPath(evNS, "network_process", "max_processes_tracked")), - EnableRootNetNs: cfg.GetBool(join(netNS, "enable_root_netns")), + EnableRootNetNs: cfg.GetBool(sysconfig.FullKeyPath(netNS, "enable_root_netns")), - HTTP2DynamicTableMapCleanerInterval: time.Duration(cfg.GetInt(join(smNS, "http2_dynamic_table_map_cleaner_interval_seconds"))) * time.Second, + HTTP2DynamicTableMapCleanerInterval: time.Duration(cfg.GetInt(sysconfig.FullKeyPath(smNS, "http2_dynamic_table_map_cleaner_interval_seconds"))) * time.Second, - HTTPMapCleanerInterval: time.Duration(cfg.GetInt(join(smNS, "http_map_cleaner_interval_in_s"))) * time.Second, - HTTPIdleConnectionTTL: time.Duration(cfg.GetInt(join(smNS, "http_idle_connection_ttl_in_s"))) * time.Second, + HTTPMapCleanerInterval: time.Duration(cfg.GetInt(sysconfig.FullKeyPath(smNS, "http_map_cleaner_interval_in_s"))) * time.Second, + HTTPIdleConnectionTTL: time.Duration(cfg.GetInt(sysconfig.FullKeyPath(smNS, "http_idle_connection_ttl_in_s"))) * time.Second, - EnableNPMConnectionRollup: cfg.GetBool(join(netNS, "enable_connection_rollup")), + EnableNPMConnectionRollup: cfg.GetBool(sysconfig.FullKeyPath(netNS, "enable_connection_rollup")), - EnableEbpfless: cfg.GetBool(join(netNS, "enable_ebpfless")), + EnableEbpfless: cfg.GetBool(sysconfig.FullKeyPath(netNS, "enable_ebpfless")), // Service Monitoring - EnableJavaTLSSupport: cfg.GetBool(join(smjtNS, "enabled")), - JavaAgentDebug: cfg.GetBool(join(smjtNS, "debug")), - JavaAgentArgs: cfg.GetString(join(smjtNS, "args")), - JavaAgentAllowRegex: cfg.GetString(join(smjtNS, "allow_regex")), - JavaAgentBlockRegex: cfg.GetString(join(smjtNS, "block_regex")), - JavaDir: cfg.GetString(join(smjtNS, "dir")), - EnableGoTLSSupport: cfg.GetBool(join(smNS, "tls", "go", "enabled")), - GoTLSExcludeSelf: cfg.GetBool(join(smNS, "tls", "go", "exclude_self")), - EnableHTTPStatsByStatusCode: cfg.GetBool(join(smNS, "enable_http_stats_by_status_code")), - EnableUSMQuantization: cfg.GetBool(join(smNS, "enable_quantization")), - EnableUSMConnectionRollup: cfg.GetBool(join(smNS, "enable_connection_rollup")), - EnableUSMRingBuffers: cfg.GetBool(join(smNS, "enable_ring_buffers")), - EnableUSMEventStream: cfg.GetBool(join(smNS, "enable_event_stream")), + EnableGoTLSSupport: cfg.GetBool(sysconfig.FullKeyPath(smNS, "tls", "go", "enabled")), + GoTLSExcludeSelf: cfg.GetBool(sysconfig.FullKeyPath(smNS, "tls", "go", "exclude_self")), + EnableHTTPStatsByStatusCode: cfg.GetBool(sysconfig.FullKeyPath(smNS, "enable_http_stats_by_status_code")), + EnableUSMQuantization: cfg.GetBool(sysconfig.FullKeyPath(smNS, "enable_quantization")), + EnableUSMConnectionRollup: cfg.GetBool(sysconfig.FullKeyPath(smNS, "enable_connection_rollup")), + EnableUSMRingBuffers: cfg.GetBool(sysconfig.FullKeyPath(smNS, "enable_ring_buffers")), + EnableUSMEventStream: cfg.GetBool(sysconfig.FullKeyPath(smNS, "enable_event_stream")), } - httpRRKey := join(smNS, "http_replace_rules") + httpRRKey := sysconfig.FullKeyPath(smNS, "http_replace_rules") rr, err := parseReplaceRules(cfg, httpRRKey) if err != nil { log.Errorf("error parsing %q: %v", httpRRKey, err) diff --git a/pkg/network/config/config_test.go b/pkg/network/config/config_test.go index d732160b00b09..50c90c3947b1d 100644 --- a/pkg/network/config/config_test.go +++ b/pkg/network/config/config_test.go @@ -176,25 +176,6 @@ func TestEnableHTTPMonitoring(t *testing.T) { }) } -func TestEnableJavaTLSSupport(t *testing.T) { - t.Run("via YAML", func(t *testing.T) { - mockSystemProbe := mock.NewSystemProbe(t) - mockSystemProbe.SetWithoutSource("service_monitoring_config.tls.java.enabled", true) - cfg := New() - - require.True(t, cfg.EnableJavaTLSSupport) - }) - - t.Run("via ENV variable", func(t *testing.T) { - mock.NewSystemProbe(t) - t.Setenv("DD_SERVICE_MONITORING_CONFIG_TLS_JAVA_ENABLED", "true") - cfg := New() - - require.True(t, cfg.EnableJavaTLSSupport) - }) - -} - func TestEnableHTTP2Monitoring(t *testing.T) { t.Run("via YAML", func(t *testing.T) { mockSystemProbe := mock.NewSystemProbe(t) @@ -293,16 +274,6 @@ func TestEnableRedisMonitoring(t *testing.T) { }) } -func TestDefaultDisabledJavaTLSSupport(t *testing.T) { - mock.NewSystemProbe(t) - cfg := New() - - _, err := sysconfig.New("", "") - require.NoError(t, err) - - assert.False(t, cfg.EnableJavaTLSSupport) -} - func TestDefaultDisabledHTTP2Support(t *testing.T) { mock.NewSystemProbe(t) cfg := New() diff --git a/pkg/network/ebpf/c/prebuilt/usm.c b/pkg/network/ebpf/c/prebuilt/usm.c index d78dd93ab69bc..8b5e62ede108e 100644 --- a/pkg/network/ebpf/c/prebuilt/usm.c +++ b/pkg/network/ebpf/c/prebuilt/usm.c @@ -15,8 +15,6 @@ #include "protocols/postgres/decoding.h" #include "protocols/redis/decoding.h" #include "protocols/sockfd-probes.h" -#include "protocols/tls/java/erpc_dispatcher.h" -#include "protocols/tls/java/erpc_handlers.h" #include "protocols/tls/https.h" #include "protocols/tls/native-tls.h" #include "protocols/tls/tags-types.h" diff --git a/pkg/network/ebpf/c/protocols/tls/java/erpc_dispatcher.h b/pkg/network/ebpf/c/protocols/tls/java/erpc_dispatcher.h deleted file mode 100644 index b947b5468adc4..0000000000000 --- a/pkg/network/ebpf/c/protocols/tls/java/erpc_dispatcher.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef __ERPC_DISPATCHER_H -#define __ERPC_DISPATCHER_H - -#include "bpf_helpers.h" -#include "protocols/tls/java/types.h" -#include "protocols/tls/java/maps.h" - -#define USM_IOCTL_ID 0xda7ad09 - -static int __always_inline is_usm_erpc_request(struct pt_regs *ctx) { - u32 cmd = PT_REGS_PARM3(ctx); - return cmd == USM_IOCTL_ID; -}; - -/* - handle_erpc_request ioctl request format : - - struct { - u8 operation; // see erpc_message_type enum for supported operations - u8 data[]; // payload data - } -*/ - -static void __always_inline handle_erpc_request(struct pt_regs *ctx) { - #ifdef DEBUG - u64 pid_tgid = bpf_get_current_pid_tgid(); - u64 pid = pid_tgid >> 32; - #endif - - void *req = (void *)PT_REGS_PARM4(ctx); - - u8 op = 0; - if (0 != bpf_probe_read_user(&op, sizeof(op), req)){ - log_debug("[java_tls_handle_erpc_request] failed to parse opcode of java tls erpc request for: pid %llu", pid); - return; - } - - //for easier troubleshooting in case we get out of sync between java tracer's side of the erpc and systemprobe's side - #ifdef DEBUG - log_debug("[java_tls_handle_erpc_request] received %d op", op); - if (op >= MAX_MESSAGE_TYPE){ - log_debug("[java_tls_handle_erpc_request] got unsupported erpc request %x for: pid %llu",op, pid); - } - #endif - - bpf_tail_call_compat(ctx, &java_tls_erpc_handlers, op); -} - -SEC("kprobe/do_vfs_ioctl") -int BPF_BYPASSABLE_KPROBE(kprobe__do_vfs_ioctl) { - if (is_usm_erpc_request(ctx)) { - handle_erpc_request(ctx); - } - - return 0; -} - -#endif // __ERPC_DISPATCHER_H diff --git a/pkg/network/ebpf/c/protocols/tls/java/erpc_handlers.h b/pkg/network/ebpf/c/protocols/tls/java/erpc_handlers.h deleted file mode 100644 index 07570f6cbc0d5..0000000000000 --- a/pkg/network/ebpf/c/protocols/tls/java/erpc_handlers.h +++ /dev/null @@ -1,180 +0,0 @@ -#ifndef __ERPC_HANDLERS_H -#define __ERPC_HANDLERS_H - -#include "conn_tuple.h" -#include "protocols/tls/tags-types.h" -#include "protocols/tls/https.h" -#include "port_range.h" - -// macro to get the data pointer from the ctx, we skip the 1st byte as it is the operation byte read by the erpc dispatcher -#define GET_DATA_PTR(ctx) ((void *)(PT_REGS_PARM4(ctx) + 1)) - -/* - handle_sync_payload's pseudo format of *data that contains the http payload - - struct { - conn_tuple_t; - u32 payload_len; - u8 payload_buffer[payload_len]; - } -*/ - -SEC("kprobe/handle_sync_payload") -int kprobe_handle_sync_payload(struct pt_regs *ctx) { - // get connection tuple - conn_tuple_t connection = {0}; - const bool val = true; - u32 bytes_read = 0; - - //interactive pointer to read the data buffer - void* bufferPtr = GET_DATA_PTR(ctx); - - //read the connection tuple from the ioctl buffer - if (0 != bpf_probe_read_user(&connection, sizeof(conn_tuple_t), bufferPtr)){ - log_debug("[handle_sync_payload] failed to parse connection info"); - return 1; - } - normalize_tuple(&connection); - bufferPtr+=sizeof(conn_tuple_t); - - // read the actual length of the message (limited by HTTP_BUFFER_SIZE) - if (0 != bpf_probe_read_user(&bytes_read, sizeof(bytes_read), bufferPtr)){ -#ifdef DEBUG - u64 pid_tgid = bpf_get_current_pid_tgid(); - u64 pid = pid_tgid >> 32; - log_debug("[handle_sync_payload] failed reading message length location for pid %lld", pid); -#endif - return 1; - } - bufferPtr+=sizeof(bytes_read); - - // register the connection in our map - bpf_map_update_elem(&java_tls_connections, &connection, &val, BPF_ANY); - log_debug("[handle_sync_payload] handling tls request of size: %d for connection src addr: %llx; dst address %llx", - bytes_read, connection.saddr_l, connection.daddr_l); - tls_process(ctx, &connection, bufferPtr, bytes_read, JAVA_TLS); - return 0; -} - -/* - handle_close_connection gets only the connection information in form of conn_tuple_t struct from the close event of the socket -*/ -SEC("kprobe/handle_close_connection") -int kprobe_handle_close_connection(struct pt_regs *ctx) { - //interactive pointer to read the data buffer - void* bufferPtr = GET_DATA_PTR(ctx); - //read the connection tuple from the ioctl buffer - conn_tuple_t connection = {0}; - if (0 != bpf_probe_read_user(&connection, sizeof(conn_tuple_t), bufferPtr)){ - log_debug("[java_tls_handle_close] failed to parse connection info"); - return 1; - } - normalize_tuple(&connection); - - void *exists = bpf_map_lookup_elem(&java_tls_connections, &connection); - // if the connection exists in our map, finalize it and remove from the map - // otherwise just ignore - if (exists != NULL){ - // tls_finish can launch a tail call, thus cleanup should be done before. - bpf_map_delete_elem(&java_tls_connections, &connection); - tls_finish(ctx, &connection, false); - } - return 0; -} - -/* - handle_connection_by_peer gets connection information along the peer domain and port information - which helps to correlate later the plain payload with the relevant connection via the peer details -*/ -SEC("kprobe/handle_connection_by_peer") -int kprobe_handle_connection_by_peer(struct pt_regs *ctx) { - - connection_by_peer_key_t peer_key ={0}; - u64 pid_tgid = bpf_get_current_pid_tgid(); - peer_key.pid = pid_tgid >> 32; - - //interactive pointer to read the data buffer - void* bufferPtr = GET_DATA_PTR(ctx); - - //read the connection tuple from the ioctl buffer - conn_tuple_t connection = {0}; - if (0 != bpf_probe_read_user(&connection, sizeof(conn_tuple_t), bufferPtr)){ - log_debug("[handle_connection_by_peer] failed to parse connection info for pid: %d", peer_key.pid); - return 1; - } - normalize_tuple(&connection); - bufferPtr+=sizeof(conn_tuple_t); - - //read the peer tuple (domain string and port) - if (0 != bpf_probe_read_user(&peer_key.peer, sizeof(peer_t), bufferPtr)){ - log_debug("[handle_connection_by_peer] failed reading peer tuple information for pid %d", peer_key.pid); - return 1; - } - - // register the connection in conn_by_peer map - bpf_map_update_elem(&java_conn_tuple_by_peer, &peer_key, &connection, BPF_ANY); - - log_debug("[handle_connection_by_peer] created map entry for pid %d domain %s port: %d", - peer_key.pid, peer_key.peer.domain, peer_key.peer.port); - return 0; -} - -/* - handle_async_payload doesn't contain any transport layer information (connection), - buy instead send the actual payload in its plain form together with peer domain string and peer port. - - We try to locate the relevant connection info from the bpf map using peer information together with pid as a key -*/ -SEC("kprobe/handle_async_payload") -int kprobe_handle_async_payload(struct pt_regs *ctx) { - const bool val = true; - u32 bytes_read = 0; - - //interactive pointer to read the data buffer - void* bufferPtr = GET_DATA_PTR(ctx); - - connection_by_peer_key_t peer_key ={0}; - peer_key.pid = bpf_get_current_pid_tgid() >> 32; - - //read the peer tuple (domain string and port) - if (0 != bpf_probe_read_user(&peer_key.peer, sizeof(peer_t), bufferPtr)){ - log_debug("[handle_async_payload] failed allocating peer tuple struct on heap"); - return 1; - } - bufferPtr+=sizeof(peer_t); - log_debug("[handle_async_payload] pid: %d; peer domain: %s; peer port: %d", - peer_key.pid, - peer_key.peer.domain, - peer_key.peer.port); - - //get connection tuple - conn_tuple_t * actual_connection = bpf_map_lookup_elem(&java_conn_tuple_by_peer, &peer_key); - if (!actual_connection) { - log_debug("[handle_async_payload] couldn't correlate connection"); - return 1; - } - - // we need to copy the connection on the stack to be able to call bpf_map_update_elem on old kernels - conn_tuple_t conn_on_stack = *actual_connection; - log_debug("[handle_async_payload] found correlation conn src port: %d dst port: %d", - actual_connection->sport, - actual_connection->dport); - - // read the actual length of the message (limited to HTTP_BUFFER_SIZE bytes) - if (0 != bpf_probe_read_user(&bytes_read, sizeof(bytes_read), bufferPtr)){ - log_debug("[handle_async_payload] failed reading message length location for pid %d", peer_key.pid); - return 1; - } - bufferPtr+=sizeof(bytes_read); - - // register the connection in our map - bpf_map_update_elem(&java_tls_connections, &conn_on_stack, &val, BPF_ANY); - log_debug("[handle_async_payload] handling tls request of size: %d for connection src addr: %llx; dst address %llx", - bytes_read, - actual_connection->saddr_l, - actual_connection->daddr_l); - tls_process(ctx, actual_connection, bufferPtr, bytes_read, JAVA_TLS); - return 0; -} - -#endif // __ERPC_HANDLERS_H diff --git a/pkg/network/ebpf/c/protocols/tls/java/maps.h b/pkg/network/ebpf/c/protocols/tls/java/maps.h deleted file mode 100644 index 758139b581cff..0000000000000 --- a/pkg/network/ebpf/c/protocols/tls/java/maps.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __JAVA_MAPS_H -#define __JAVA_MAPS_H - -#include "bpf_helpers.h" -#include "map-defs.h" -#include "conn_tuple.h" - -#include "protocols/tls/java/types.h" - -/* A set (map from a key to a const bool value, we care only if the key exists in the map, and not its value) to - mark if we've seen a specific java tls connection. - Map size is set to 1 as javaTLS is optional, this will be overwritten to MaxTrackedConnections - if javaTLS is enabled. */ -BPF_HASH_MAP(java_tls_connections, conn_tuple_t, bool, 1) - -/* map to correlate peer domain and port with the actual conn_tuple - Map size is set to 1 as javaTLS is optional, this will be overwritten to MaxTrackedConnections - if javaTLS is enabled. */ -BPF_HASH_MAP(java_conn_tuple_by_peer, connection_by_peer_key_t, conn_tuple_t, 1) - -/* - Map used to store the sub programs used by eRPC mechanism - This is done to avoid memory limitation when handling different operations sent via ioctl (eRPC) from our dd-java-agent -*/ -BPF_PROG_ARRAY(java_tls_erpc_handlers, MAX_MESSAGE_TYPE) - -#endif // __JAVA_MAPS_H diff --git a/pkg/network/ebpf/c/protocols/tls/java/types.h b/pkg/network/ebpf/c/protocols/tls/java/types.h deleted file mode 100644 index 2203f2a0a20a3..0000000000000 --- a/pkg/network/ebpf/c/protocols/tls/java/types.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __JAVA_TLS_TYPES_H -#define __JAVA_TLS_TYPES_H - -#include "ktypes.h" - -// any change in this const is sensitive to stack limit of kprobe_handle_async_payload ebpf program, -// as it increases the size of structs defined below. -#define MAX_DOMAIN_NAME_LENGTH 48 - -enum erpc_message_type { - SYNCHRONOUS_PAYLOAD, - CLOSE_CONNECTION, - CONNECTION_BY_PEER, - ASYNC_PAYLOAD, - MAX_MESSAGE_TYPE, -}; - -typedef struct{ - __u16 port; - char domain[MAX_DOMAIN_NAME_LENGTH]; -} peer_t; - -typedef struct{ - __u32 pid; - peer_t peer; -} connection_by_peer_key_t; - - -#endif //__JAVA_TLS_TYPES_H diff --git a/pkg/network/ebpf/c/protocols/tls/tags-types.h b/pkg/network/ebpf/c/protocols/tls/tags-types.h index 913a806d626a1..8588558c24509 100644 --- a/pkg/network/ebpf/c/protocols/tls/tags-types.h +++ b/pkg/network/ebpf/c/protocols/tls/tags-types.h @@ -7,10 +7,9 @@ enum static_tags { LIBGNUTLS = (1<<0), LIBSSL = (1<<1), GO = (1<<2), - JAVA_TLS = (1<<3), - CONN_TLS = (1<<4), - ISTIO = (1<<5), - NODEJS = (1<<6), + CONN_TLS = (1<<3), + ISTIO = (1<<4), + NODEJS = (1<<5), }; #endif diff --git a/pkg/network/ebpf/c/runtime/usm.c b/pkg/network/ebpf/c/runtime/usm.c index 2912ea392f306..3cb3f1245a3ab 100644 --- a/pkg/network/ebpf/c/runtime/usm.c +++ b/pkg/network/ebpf/c/runtime/usm.c @@ -23,8 +23,6 @@ #include "protocols/postgres/decoding.h" #include "protocols/redis/decoding.h" #include "protocols/sockfd-probes.h" -#include "protocols/tls/java/erpc_dispatcher.h" -#include "protocols/tls/java/erpc_handlers.h" #include "protocols/tls/go-tls-types.h" #include "protocols/tls/go-tls-goid.h" #include "protocols/tls/go-tls-location.h" diff --git a/pkg/network/encoding/encoding_test.go b/pkg/network/encoding/encoding_test.go index 2e9806ea59297..ed50111ee7c66 100644 --- a/pkg/network/encoding/encoding_test.go +++ b/pkg/network/encoding/encoding_test.go @@ -38,7 +38,7 @@ type connTag = uint64 const ( tagGnuTLS connTag = 0x01 // network.ConnTagGnuTLS tagOpenSSL connTag = 0x02 // network.ConnTagOpenSSL - tagTLS connTag = 0x10 // network.ConnTagTLS + tagTLS connTag = 0x8 // network.ConnTagTLS ) func getBlobWriter(t *testing.T, assert *assert.Assertions, in *network.Connections, marshalerType string) *bytes.Buffer { diff --git a/pkg/network/java/testutil/JavaClientSimulator/Dockerfile b/pkg/network/java/testutil/JavaClientSimulator/Dockerfile deleted file mode 100644 index 295238d0e1884..0000000000000 --- a/pkg/network/java/testutil/JavaClientSimulator/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -# Base image with Java installed -FROM openjdk:11 -MAINTAINER val - -# Set the working directory inside the container -WORKDIR /app - -COPY target/JavaClientSimulator-1.0.jar app.jar -ENTRYPOINT ["sh", "-c", "java -jar app.jar -c \"$JAVA_TEST_CLIENT\" -u \"$JAVA_TARGET_URL\""] diff --git a/pkg/network/java/testutil/JavaClientSimulator/META-INF/MANIFEST.MF b/pkg/network/java/testutil/JavaClientSimulator/META-INF/MANIFEST.MF deleted file mode 100644 index 44f4d81f0c0dc..0000000000000 --- a/pkg/network/java/testutil/JavaClientSimulator/META-INF/MANIFEST.MF +++ /dev/null @@ -1,11 +0,0 @@ -Manifest-Version: 1.0 -Implementation-Title: dd-java-agent -Premain-Class: datadog.trace.bootstrap.AgentBootstrap -Implementation-Version: 1.13.0-SNAPSHOT -Agent-Class: datadog.trace.bootstrap.AgentBootstrap -Can-Redefine-Classes: true -Can-Retransform-Classes: true -Implementation-URL: https://github.com/datadog/dd-trace-java -Implementation-Vendor: Datadog -Main-Class: datadog.trace.bootstrap.AgentBootstrap - diff --git a/pkg/network/java/testutil/JavaClientSimulator/Readme.md b/pkg/network/java/testutil/JavaClientSimulator/Readme.md deleted file mode 100644 index d105d1a4bac66..0000000000000 --- a/pkg/network/java/testutil/JavaClientSimulator/Readme.md +++ /dev/null @@ -1,25 +0,0 @@ -JavaClientSimulator allows testing different java **https** frameworks. -You can run the attached docker or directly by executing the jar package.1 - -This test util was built using JDK 11 - -## Configuration - -you can control -- java client framework to use. Currently supported: ApacheHttp, OkHttp, URLConnection, HttpClient -- target url -- iterations - number of requests to send. By default infinitely -- timeout - interval between each iteration. By default 1 second - -## Standalone: - -Build: `mvn clean package` - -Run: `java -jar ./target/JavaClientSimulator-1.0.jar client= url=` - -## Docker - -Build: `docker build -t java-http-client .` - -Run: `docker run -e JAVA_TEST_CLIENT= -e JAVA_TARGET_URL= java-http-client` - diff --git a/pkg/network/java/testutil/JavaClientSimulator/dependency-reduced-pom.xml b/pkg/network/java/testutil/JavaClientSimulator/dependency-reduced-pom.xml deleted file mode 100644 index 1b733595f00eb..0000000000000 --- a/pkg/network/java/testutil/JavaClientSimulator/dependency-reduced-pom.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - 4.0.0 - JavaClients - JavaClientSimulator - client_example - 1.0 - - - Apache License Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - - - - maven-clean-plugin - 3.1.0 - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.8.0 - - 11 - 11 - - - - maven-surefire-plugin - 2.22.1 - - - maven-jar-plugin - 3.1.0 - - - - true - lib/ - Clients.Main - - - - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - maven-site-plugin - 3.7.1 - - - maven-shade-plugin - 3.4.1 - - - package - - shade - - - - - Clients.Main - - - - - - - - - - - confluent - https://packages.confluent.io/maven/ - - - - UTF-8 - - diff --git a/pkg/network/java/testutil/JavaClientSimulator/pom.xml b/pkg/network/java/testutil/JavaClientSimulator/pom.xml deleted file mode 100644 index fa70437f6a008..0000000000000 --- a/pkg/network/java/testutil/JavaClientSimulator/pom.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - 4.0.0 - - JavaClients - JavaClientSimulator - 1.0 - jar - - client_example - - - UTF-8 - - - - - - http://www.apache.org/licenses/LICENSE-2.0.txt - Apache License Version 2.0 - - - - - - confluent - https://packages.confluent.io/maven/ - - - - - - - - org.apache.httpcomponents - httpclient - 4.5.13 - - - commons-cli - commons-cli - 1.5.0 - - - com.squareup.okhttp3 - okhttp - 4.10.0 - - - - - - - - maven-clean-plugin - 3.1.0 - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - - 11 - 11 - - 3.8.0 - - - maven-surefire-plugin - 2.22.1 - - - org.apache.maven.plugins - maven-jar-plugin - 3.1.0 - - - - true - lib/ - Clients.Main - - - - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - maven-site-plugin - 3.7.1 - - - - org.apache.maven.plugins - maven-shade-plugin - 3.4.1 - - - - package - - shade - - - - - Clients.Main - - - - - - - - - diff --git a/pkg/network/java/testutil/JavaClientSimulator/src/main/java/Clients/ClientManager.java b/pkg/network/java/testutil/JavaClientSimulator/src/main/java/Clients/ClientManager.java deleted file mode 100644 index d2d704623504b..0000000000000 --- a/pkg/network/java/testutil/JavaClientSimulator/src/main/java/Clients/ClientManager.java +++ /dev/null @@ -1,106 +0,0 @@ -package Clients; - -import java.io.IOException; -import java.security.KeyManagementException; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; - -public class ClientManager { - - public enum ClientType{ - apache, - okhttp, - httpclient, - urlconnection, - unsupported, - } - - private static ClientType getClientType(String clientTypeArg) { - try { - return ClientType.valueOf(clientTypeArg.toLowerCase()); - } catch (IllegalArgumentException e) { - return ClientType.unsupported; - } - } - - public static void executeCallback(String clientTypeArg, int iterations, long sleepInterval, String url) throws InterruptedException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException { - - ClientType clientType = getClientType(clientTypeArg); - JavaClients clients = new JavaClients(); - clients.init(); - - System.out.println("Executing handler for " + clientType); - System.out.println("URL: " + url); - System.out.println("Iterations: " + iterations); - System.out.println("Interval: " + sleepInterval); - - Runnable callback; - - // Execute handler based on client type - switch (clientType) { - case apache: - - callback = () -> { - try { - clients.HttpApacheClient(url); - } catch (IOException e) { - throw new RuntimeException(e); - } - }; - break; - case okhttp: - callback = () -> { - try { - clients.OkHttpClient(url); - } catch (IOException e) { - throw new RuntimeException(e); - } - }; - break; - case httpclient: - callback = () -> { - try { - clients.HTTPClient(url); - } catch (IOException e) { - throw new RuntimeException(e); - } - }; - break; - case urlconnection: - callback = () -> { - try { - clients.HttpsURLConnection(url); - } catch (IOException e) { - throw new RuntimeException(e); - } - }; - break; - default: - throw new IllegalArgumentException("Unsupported callback type: " + clientType); - } - executeCallbackLogic(iterations, sleepInterval, callback); - clients.close(); - } - - private static void executeCallbackLogic(int iterations, long sleepInterval, Runnable callback) throws InterruptedException { - if (iterations == -1) { - // Infinite loop - while (true) { - callback.run(); - if (sleepInterval > 0) - { - Thread.sleep(sleepInterval); - } - } - } else { - // Fixed number of iterations - for (int i = 0; i < iterations; i++) { - callback.run(); - if (sleepInterval > 0) - { - Thread.sleep(sleepInterval); - } - } - } - } -} diff --git a/pkg/network/java/testutil/JavaClientSimulator/src/main/java/Clients/JavaClients.java b/pkg/network/java/testutil/JavaClientSimulator/src/main/java/Clients/JavaClients.java deleted file mode 100644 index f7c155d1b6cd6..0000000000000 --- a/pkg/network/java/testutil/JavaClientSimulator/src/main/java/Clients/JavaClients.java +++ /dev/null @@ -1,142 +0,0 @@ -package Clients; - -import okhttp3.Call; -import okhttp3.OkHttpClient; -import okhttp3.Protocol; -import okhttp3.Request; -import okhttp3.Response; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.conn.ssl.NoopHostnameVerifier; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; - -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import java.io.Closeable; -import java.io.IOException; -import java.net.URI; -import java.net.URL; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.security.KeyManagementException; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; -import java.util.Arrays; - -public class JavaClients implements Closeable { - - // Create a custom TrustManager that accepts all certificates - // Create a TrustManager that accepts all certificates - static X509TrustManager trustManager = new X509TrustManager() { - @Override - public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { - // No validation needed, accepting all client certificates - } - - @Override - public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { - // No validation needed, accepting all server certificates - } - - @Override - public X509Certificate[] getAcceptedIssuers() { - // Return an empty array to accept all issuers - return new X509Certificate[0]; - } - }; - private static final TrustManager[] trustAllCerts = new TrustManager[]{trustManager}; - - private static final String URL_SCHEME = "https://"; - - private CloseableHttpClient apacheClient; - private OkHttpClient okHttpClient; - private HttpClient httpClient; - - public void init() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException { - // Create a custom SSLContext to trust all certificates - SSLContext sslContext = SSLContext.getInstance("TLS"); - sslContext.init(null, trustAllCerts, new java.security.SecureRandom()); - - //configure HttpsURLConnection to trust all certificates and ignore host validation - //URLConnection client will be recreated for each request - HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); - HttpsURLConnection.setDefaultHostnameVerifier(NoopHostnameVerifier.INSTANCE); - - //create apache client once and configure it to trust all certificates and ignore host validation - apacheClient = HttpClients.custom() - .setSSLContext(sslContext) - .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) - .build(); - - //create http client once and configure it to trust all certificates and ignore host validation - httpClient = HttpClient.newBuilder().sslContext(sslContext).build(); - - //create okhttp client once and configure it to trust all certificates and ignore host validation - okHttpClient = new OkHttpClient.Builder() - .hostnameVerifier(NoopHostnameVerifier.INSTANCE) - .sslSocketFactory(sslContext.getSocketFactory(),(X509TrustManager) trustAllCerts[0]) - //by default okhttp is using http2.0 - .protocols(Arrays.asList(Protocol.HTTP_1_1)) - .build(); - } - - public void HttpsURLConnection(String url) throws IOException { - HttpsURLConnection urlConnection =(HttpsURLConnection) new URL(URL_SCHEME+url).openConnection(); - String response = urlConnection.getResponseMessage(); - int code = urlConnection.getResponseCode(); - System.out.println("Response code: " + code + " ; Message: " + response); - } - - public void OkHttpClient(String url) throws IOException { - Request request = new Request.Builder() - .url(URL_SCHEME+url) - .build(); - Call call = okHttpClient.newCall(request); - Response response = call.execute(); - System.out.println("Response: " + response); - } - - public void HttpApacheClient(String url) throws IOException { - HttpGet request = new HttpGet("https://"+url); - try { - CloseableHttpResponse response = apacheClient.execute(request); - System.out.println("Response: " + response); - } catch (IOException e) { - e.printStackTrace(); - } - finally { - // TODO: in the future we should support re-using the same connection for apache client, - // currently we are hitting the internal connection pool limit of the apacheclient, - // since we create a new request object for the same route, which in turn tries to use a new connection - // (the default connection limit of the apacheclient for the same route is 2 - request.releaseConnection(); - } - } - - public void HTTPClient(String url) throws IOException { - try { - HttpRequest request = HttpRequest.newBuilder() - .uri(URI.create(URL_SCHEME+url)) - //by default HttpCLient is using http 2.0 - .version(HttpClient.Version.HTTP_1_1) - .build(); - HttpResponse response = httpClient.send(request, HttpResponse.BodyHandlers.ofString()); - System.out.println("Response " + response.toString()); - } catch (IOException | InterruptedException e) { - e.printStackTrace(); - } - } - - @Override - public void close() throws IOException { - apacheClient.close(); - okHttpClient.dispatcher().executorService().shutdown(); - okHttpClient.connectionPool().evictAll(); - } -} diff --git a/pkg/network/java/testutil/JavaClientSimulator/src/main/java/Clients/Main.java b/pkg/network/java/testutil/JavaClientSimulator/src/main/java/Clients/Main.java deleted file mode 100644 index 2841b39052de9..0000000000000 --- a/pkg/network/java/testutil/JavaClientSimulator/src/main/java/Clients/Main.java +++ /dev/null @@ -1,72 +0,0 @@ -package Clients; -import org.apache.commons.cli.*; - -public class Main { - - //in milliseconds - private static final int DEFAULT_TIMEOUT = 1000; - - private static void printHelp(Options options){ - HelpFormatter formatter = new HelpFormatter(); - formatter.printHelp("java -jar JavaClients client= url=\n", - "", - options, - "\nprovide the url WITHOUT the protocol scheme (always using https)"); - } - - public static void main(String[] args) throws Exception { - Options options = new Options(); - options.addRequiredOption("c", "client", true, - "Client type: apache ; okhttp ; urlconnection ; httpclient"); - options.addRequiredOption("u", "url", true, "Target URL"); - Option iterationOption = Option.builder("i") - .longOpt("iterations") - .hasArg() - .desc("Number of iterations. The default is infinitely") - .required(false) - .build(); - iterationOption.setType(Number.class); - options.addOption(iterationOption); - - Option timeoutOption = Option.builder("t") - .longOpt("timeout") - .hasArg() - .desc("Timeout between each call in ms. Default is 1 second, use 0 to send the requests without a timeout") - .required(false) - .build(); - timeoutOption.setType(Number.class); - options.addOption(timeoutOption); - - if (args.length == 0){ - printHelp(options); - return; - } - // Parse command-line arguments - CommandLineParser parser = new DefaultParser(); - try { - CommandLine cmd = parser.parse(options, args); - - // Get arguments - String clientTypeArg = cmd.getOptionValue("c"); - String url = cmd.getOptionValue("u"); - int iterationsValue = -1; - if (cmd.hasOption("i")) { - iterationsValue = ((Number)cmd.getParsedOptionValue("i")).intValue(); - } - - int interval = DEFAULT_TIMEOUT; - if (cmd.hasOption("t")) { - interval = ((Number)cmd.getParsedOptionValue("t")).intValue(); - } - - // Execute the appropriate handler based on client type - ClientManager.executeCallback(clientTypeArg, iterationsValue, interval, url); - } catch (ParseException e) { - System.err.println("Error parsing command-line arguments: " + e.getMessage()); - printHelp(options); - } catch (NumberFormatException e) { - System.err.println("Error parsing iterations argument: " + e.getMessage()); - printHelp(options); - } - } -} diff --git a/pkg/network/protocols/http/tls_counter.go b/pkg/network/protocols/http/tls_counter.go index b6fcccf69bec6..f0dd8534ebb8e 100644 --- a/pkg/network/protocols/http/tls_counter.go +++ b/pkg/network/protocols/http/tls_counter.go @@ -17,7 +17,6 @@ type TLSCounter struct { counterPlain *libtelemetry.Counter counterGnuTLS *libtelemetry.Counter counterOpenSSL *libtelemetry.Counter - counterJavaTLS *libtelemetry.Counter counterGoTLS *libtelemetry.Counter counterIstioTLS *libtelemetry.Counter counterNodeJSTLS *libtelemetry.Counter @@ -30,7 +29,6 @@ func NewTLSCounter(metricGroup *libtelemetry.MetricGroup, metricName string, tag counterPlain: metricGroup.NewCounter(metricName, append(tags, "encrypted:false", "tls_library:none")...), counterGnuTLS: metricGroup.NewCounter(metricName, append(tags, "encrypted:true", "tls_library:gnutls")...), counterOpenSSL: metricGroup.NewCounter(metricName, append(tags, "encrypted:true", "tls_library:openssl")...), - counterJavaTLS: metricGroup.NewCounter(metricName, append(tags, "encrypted:true", "tls_library:java")...), counterGoTLS: metricGroup.NewCounter(metricName, append(tags, "encrypted:true", "tls_library:go")...), counterIstioTLS: metricGroup.NewCounter(metricName, append(tags, "encrypted:true", "tls_library:istio")...), counterNodeJSTLS: metricGroup.NewCounter(metricName, append(tags, "encrypted:true", "tls_library:nodejs")...), diff --git a/pkg/network/protocols/http/tls_counter_linux.go b/pkg/network/protocols/http/tls_counter_linux.go index d217d692b4750..68b80b73e028c 100644 --- a/pkg/network/protocols/http/tls_counter_linux.go +++ b/pkg/network/protocols/http/tls_counter_linux.go @@ -14,8 +14,6 @@ func (t *TLSCounter) Add(tx Transaction) { t.counterGnuTLS.Add(1) case OpenSSL: t.counterOpenSSL.Add(1) - case Java: - t.counterJavaTLS.Add(1) case Go: t.counterGoTLS.Add(1) case Istio: diff --git a/pkg/network/protocols/http/types.go b/pkg/network/protocols/http/types.go index 13620a9bfcba8..3f0eb5c963937 100644 --- a/pkg/network/protocols/http/types.go +++ b/pkg/network/protocols/http/types.go @@ -31,7 +31,6 @@ const ( GnuTLS ConnTag = C.LIBGNUTLS OpenSSL ConnTag = C.LIBSSL Go ConnTag = C.GO - Java ConnTag = C.JAVA_TLS TLS ConnTag = C.CONN_TLS Istio ConnTag = C.ISTIO NodeJS ConnTag = C.NODEJS @@ -42,7 +41,6 @@ var ( GnuTLS: "tls.library:gnutls", OpenSSL: "tls.library:openssl", Go: "tls.library:go", - Java: "tls.library:java", TLS: "tls.connection:encrypted", Istio: "tls.library:istio", NodeJS: "tls.library:nodejs", diff --git a/pkg/network/protocols/http/types_linux.go b/pkg/network/protocols/http/types_linux.go index 0f219b6de1a9c..e4b3a97623457 100644 --- a/pkg/network/protocols/http/types_linux.go +++ b/pkg/network/protocols/http/types_linux.go @@ -49,10 +49,9 @@ const ( GnuTLS ConnTag = 0x1 OpenSSL ConnTag = 0x2 Go ConnTag = 0x4 - Java ConnTag = 0x8 - TLS ConnTag = 0x10 - Istio ConnTag = 0x20 - NodeJS ConnTag = 0x40 + TLS ConnTag = 0x8 + Istio ConnTag = 0x10 + NodeJS ConnTag = 0x20 ) var ( @@ -60,7 +59,6 @@ var ( GnuTLS: "tls.library:gnutls", OpenSSL: "tls.library:openssl", Go: "tls.library:go", - Java: "tls.library:java", TLS: "tls.connection:encrypted", Istio: "tls.library:istio", NodeJS: "tls.library:nodejs", diff --git a/pkg/network/protocols/kafka/statkeeper.go b/pkg/network/protocols/kafka/statkeeper.go index 855b002e5519e..fe2653d84726c 100644 --- a/pkg/network/protocols/kafka/statkeeper.go +++ b/pkg/network/protocols/kafka/statkeeper.go @@ -39,15 +39,24 @@ func NewStatkeeper(c *config.Config, telemetry *Telemetry) *StatKeeper { // Process processes the kafka transaction func (statKeeper *StatKeeper) Process(tx *EbpfTx) { - statKeeper.statsMutex.Lock() - defer statKeeper.statsMutex.Unlock() + latency := tx.RequestLatency() + // Produce requests with acks = 0 do not receive a response, and as a result, have no latency + if tx.APIKey() == FetchAPIKey && latency <= 0 { + statKeeper.telemetry.invalidLatency.Add(1) + return + } + // extractTopicName is an expensive operation but, it is also concurrent safe, so we can do it here + // without holding the lock. key := Key{ RequestAPIKey: tx.APIKey(), RequestVersion: tx.APIVersion(), TopicName: statKeeper.extractTopicName(&tx.Transaction), ConnectionKey: tx.ConnTuple(), } + + statKeeper.statsMutex.Lock() + defer statKeeper.statsMutex.Unlock() requestStats, ok := statKeeper.stats[key] if !ok { if len(statKeeper.stats) >= statKeeper.maxEntries { @@ -58,13 +67,6 @@ func (statKeeper *StatKeeper) Process(tx *EbpfTx) { statKeeper.stats[key] = requestStats } - latency := tx.RequestLatency() - // Produce requests with acks = 0 do not receive a response, and as a result, have no latency - if key.RequestAPIKey == FetchAPIKey && latency <= 0 { - statKeeper.telemetry.invalidLatency.Add(1) - return - } - requestStats.AddRequest(int32(tx.ErrorCode()), int(tx.RecordsCount()), uint64(tx.Transaction.Tags), latency) } diff --git a/pkg/network/protocols/postgres/model_linux.go b/pkg/network/protocols/postgres/model_linux.go index 45881f761204d..8ee158de7b048 100644 --- a/pkg/network/protocols/postgres/model_linux.go +++ b/pkg/network/protocols/postgres/model_linux.go @@ -10,7 +10,6 @@ package postgres import ( "bytes" "fmt" - "regexp" "strings" "github.com/DataDog/go-sqllexer" @@ -26,6 +25,10 @@ const ( EmptyParameters = "EMPTY_PARAMETERS" ) +var ( + postgresDBMS = sqllexer.WithDBMS(sqllexer.DBMSPostgres) +) + // EventWrapper wraps an ebpf event and provides additional methods to extract information from it. // We use this wrapper to avoid recomputing the same values (operation and table name) multiple times. type EventWrapper struct { @@ -72,7 +75,8 @@ func getFragment(e *ebpf.EbpfTx) []byte { // Operation returns the operation of the query (SELECT, INSERT, UPDATE, DROP, etc.) func (e *EventWrapper) Operation() Operation { if !e.operationSet { - e.operation = FromString(string(bytes.SplitN(getFragment(&e.Tx), []byte(" "), 2)[0])) + op, _, _ := bytes.Cut(getFragment(&e.Tx), []byte(" ")) + e.operation = FromString(string(op)) e.operationSet = true } return e.operation @@ -97,17 +101,10 @@ func (e *EventWrapper) extractParameters() string { return string(b[idxParam:]) } -var re = regexp.MustCompile(`(?i)if\s+exists`) - // extractTableName extracts the table name from the query. func (e *EventWrapper) extractTableName() string { - fragment := string(getFragment(&e.Tx)) - // Temp solution for the fact that ObfuscateSQLString does not support "IF EXISTS" or "if exists", so we remove - // it from the fragment if found. - fragment = re.ReplaceAllString(fragment, "") - // Normalize the query without obfuscating it. - _, statementMetadata, err := e.normalizer.Normalize(fragment, sqllexer.WithDBMS(sqllexer.DBMSPostgres)) + _, statementMetadata, err := e.normalizer.Normalize(string(getFragment(&e.Tx)), postgresDBMS) if err != nil { log.Debugf("unable to normalize due to: %s", err) return "UNKNOWN" diff --git a/pkg/network/protocols/tls/java/agent-usm.jar b/pkg/network/protocols/tls/java/agent-usm.jar deleted file mode 100644 index 8132059d52b0d..0000000000000 Binary files a/pkg/network/protocols/tls/java/agent-usm.jar and /dev/null differ diff --git a/pkg/network/protocols/tls/java/hotspot.go b/pkg/network/protocols/tls/java/hotspot.go deleted file mode 100644 index 383652ea4792d..0000000000000 --- a/pkg/network/protocols/tls/java/hotspot.go +++ /dev/null @@ -1,417 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed -// under the Apache License Version 2.0. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2016-present Datadog, Inc. - -//go:build linux - -// Package java contains implementation for JavaTLS support. -package java - -import ( - "bufio" - "bytes" - "errors" - "fmt" - "io" - "io/fs" - "net" - "os" - "path/filepath" - "runtime" - "strconv" - "strings" - "syscall" - "time" - - "github.com/DataDog/datadog-agent/pkg/util/kernel" - "github.com/DataDog/datadog-agent/pkg/util/log" - "golang.org/x/sys/unix" -) - -// Hotspot java has a specific protocol, described here: -// -// o touch .attach_pid -// o kill -SIGQUIT -// o java process check if .attach_pid exit -// o then create a unix socket .java_pid -// o we can write command through the unix socket -// refers to the namespaced pid of the process. -// -// Public documentation https://openjdk.org/groups/hotspot/docs/Serviceability.html#battach -type Hotspot struct { - pid int - nsPid int - root string - cwd string // viewed by the process - conn *net.UnixConn - - socketPath string - uid int - gid int -} - -// NewHotspot create an object to connect to a JVM hotspot -// pid (host pid) and nsPid (within the namespace pid) -// -// NSPid field was introduced in kernel >= 4.1 -// So we can't support container on Centos 7 (kernel 3.10) -func NewHotspot(pid int, nsPid int) (*Hotspot, error) { - h := &Hotspot{ - pid: pid, - nsPid: nsPid, - } - // Centos 7 workaround to support host environment - if h.nsPid == 0 { - h.nsPid = pid - } - - var err error - procPath := fmt.Sprintf("%s/%d", kernel.ProcFSRoot(), pid) - h.root = procPath + "/root" - h.cwd, err = os.Readlink(procPath + "/cwd") - if err != nil { - return nil, err - } - h.socketPath = fmt.Sprintf("%s/.java_pid%d", h.tmpPath(), h.nsPid) - return h, nil -} - -func (h *Hotspot) tmpPath() string { - return fmt.Sprintf("%s/tmp", h.root) -} - -func (h *Hotspot) isSocketExists() bool { - mode, err := os.Stat(h.socketPath) - return err == nil && (mode.Mode()&fs.ModeSocket > 0) -} - -// getPathOwner return the uid/gid pointed by the path -func getPathOwner(path string) (uint32, uint32, error) { - mode, err := os.Stat(path) - if err != nil { - return 0, 0, err - } - stat, ok := mode.Sys().(*syscall.Stat_t) - if stat == nil || !ok { - return 0, 0, fmt.Errorf("stat cast issue on path %s %T", path, mode.Sys()) - } - return stat.Uid, stat.Gid, nil -} - -// findWritableDest looks for a writable destination for agent-usm.jar file. -// The default is to write this file into the working directory of the agent. -// If this is not possible then we try 'root/tmp', and finally fail. -func findWritableDest(cwd, root, agent string) (string, error) { - if unix.Access(cwd, unix.W_OK) == nil { - return filepath.Join(cwd, filepath.Base(agent)), nil - } - - log.Debugf("Current working directory %q is not writable", cwd) - - if unix.Access(filepath.Join(root, "tmp"), unix.W_OK) == nil { - dstPath := filepath.Join(root, "tmp", filepath.Base(agent)) - log.Debugf("Writing agent jar file to %q", dstPath) - return dstPath, nil - } - - return "", errors.New("unable to find writable destionation") -} - -// copyAgent copy the agent-usm.jar to a directory where the running java process can load it. -// the agent-usm.jar file must be readable from java process point of view -// copyAgent return : -// -// o dstPath is path to the copy of agent-usm.jar (from container perspective), this would be pass to the hotspot command -// o cleanup must be called to remove the created file -func (h *Hotspot) copyAgent(agent string, uid int, gid int) (string, func(), error) { - dstPath, err := findWritableDest(h.cwd, h.root, agent) - if err != nil { - return "", nil, err - } - - // path from the host point of view pointing to the process root namespace (/proc/pid/root/usr/...) - nsDstPath := h.root + dstPath - if dst, err := os.Stat(nsDstPath); err == nil { - // if the destination file already exist - // check if it's not the source agent file - if src, err := os.Stat(agent); err == nil { - s, oks := src.Sys().(*syscall.Stat_t) - d, okd := dst.Sys().(*syscall.Stat_t) - if s == nil || d == nil || !oks || !okd { - return "", nil, fmt.Errorf("stat cast issue on path %s %T %s %T", agent, src.Sys(), nsDstPath, dst.Sys()) - } - if s.Dev == d.Dev && s.Ino == d.Ino { - return "", func() {}, nil - } - } - } - - srcAgent, err := os.Open(agent) - if err != nil { - return "", nil, err - } - defer srcAgent.Close() - - dst, err := os.OpenFile(nsDstPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, os.FileMode(0444)) - if err != nil { - return "", nil, err - } - _, copyErr := io.Copy(dst, srcAgent) - dst.Close() // we are closing the file here as Chown will be called just after on the same path - if copyErr != nil { - return "", nil, err - } - if err := syscall.Chown(nsDstPath, uid, gid); err != nil { - os.Remove(nsDstPath) - return "", nil, err - } - - return dstPath, func() { - os.Remove(nsDstPath) - }, nil -} - -func (h *Hotspot) dialunix(raddr *net.UnixAddr, withCredential bool) (*net.UnixConn, error) { - // Hotspot reject connection credentials by checking uid/gid of the client calling connect() - // via getsockopt(SOL_SOCKET/SO_PEERCRED). - // but older hotspot JRE (1.8.0) accept only the same uid/gid and reject root - // - // For go, during the connect() syscall we don't want to fork() and stay on the same pthread - // to avoid side effect (pollution) of set effective uid/gid. - if withCredential { - runtime.LockOSThread() - syscall.ForkLock.Lock() - origeuid := syscall.Geteuid() - origegid := syscall.Getegid() - defer func() { - _ = syscall.Seteuid(origeuid) - _ = syscall.Setegid(origegid) - syscall.ForkLock.Unlock() - runtime.UnlockOSThread() - }() - - if err := syscall.Setegid(h.gid); err != nil { - return nil, err - } - if err := syscall.Seteuid(h.uid); err != nil { - return nil, err - } - } - return net.DialUnix("unix", nil, raddr) -} - -// connect to the previously created hotspot unix socket -// return close function must be call when finished -func (h *Hotspot) connect(withCredential bool) (func(), error) { - h.conn = nil - addr, err := net.ResolveUnixAddr("unix", h.socketPath) - if err != nil { - return nil, err - } - conn, err := h.dialunix(addr, withCredential) - if err != nil { - return nil, err - } - - if err := conn.SetDeadline(time.Now().Add(3 * time.Second)); err != nil { - conn.Close() - return nil, err - } - h.conn = conn - return func() { - if h.conn != nil { - h.conn.Close() - } - }, nil -} - -// parseResponse parse the response from the hotspot command -// JVM will return a command error code and some command have a specific return code -// the response will contain the full message -func (h *Hotspot) parseResponse(buf []byte) (returnCommand int, returnCode int, response string, err error) { - line := 0 - scanner := bufio.NewScanner(bytes.NewReader(buf)) - for scanner.Scan() { - s := string(scanner.Bytes()) - switch line { - case 0: - returnCommand, err = strconv.Atoi(s) - if err != nil { - return 0, 0, "", fmt.Errorf("parsing hotspot response failed %d %s", line, s) - } - case 1: - if strings.HasPrefix(s, "return code: ") { - returnCode, err = strconv.Atoi(s[len("return code: "):]) - if err != nil { - return 0, 0, "", fmt.Errorf("parsing hotspot response failed %d %s", line, s) - } - } - default: - break - } - line++ - } - return returnCommand, returnCode, string(buf), nil -} - -// command: tailingNull is necessary here to flush command -// -// otherwise the JVM is blocked and waiting for more bytes -// This applies only for some command like : 'load agent.so true' -func (h *Hotspot) command(cmd string, tailingNull bool) error { - if err := h.commandWriteRead(cmd, tailingNull); err != nil { - // if we receive EPIPE (write) or ECONNRESET (read) from the kernel may from old hotspot JVM - // let's retry with credentials, see dialunix() for more info - if !errors.Is(err, syscall.EPIPE) && !errors.Is(err, syscall.ECONNRESET) { - return err - } - log.Debugf("java attach hotspot pid %d/%d old hotspot JVM detected, requires credentials", h.pid, h.nsPid) - _ = h.conn.Close() - // we don't need to propagate the cleanConn() callback as it's doing the same thing. - if _, err := h.connect(true); err != nil { - return err - } - - if err := h.commandWriteRead(cmd, tailingNull); err != nil { - return err - } - } - return nil -} - -// commandWriteRead: tailingNull is necessary here to flush command -// -// otherwise the JVM is blocked and waiting for more bytes -// This applies only for some command like : 'load agent.so true' -func (h *Hotspot) commandWriteRead(cmd string, tailingNull bool) error { - if _, err := h.conn.Write([]byte{'1', 0}); err != nil { // Protocol version - return err - } - - // We split by space for at most 4 words, since our longest command is "load instrument false " which is 4 words - for _, c := range strings.SplitN(cmd, " ", 4) { - cmd := append([]byte(c), 0) - if _, err := h.conn.Write(cmd); err != nil { - return err - } - } - if tailingNull { - if _, err := h.conn.Write([]byte{0}); err != nil { - return err - } - } - - buf := make([]byte, 8192) - if _, err := h.conn.Read(buf); err != nil { - return err - } - returnCommand, returnCode, responseText, err := h.parseResponse(buf) - if err != nil { - return err - } - - if returnCommand != 0 { - return fmt.Errorf("command sent to hotspot JVM %q return %d and return code %d, response text:\n%s", cmd, returnCommand, returnCode, responseText) - } - return nil -} - -// attachJVMProtocol use this (short) protocol : -// -// o create a file .attach_pid%d -// o send a SIGQUIT signal -// o wait for socket file to be created by the java process -func (h *Hotspot) attachJVMProtocol(uid int, gid int) error { - attachPIDPath := func(root string) string { - return fmt.Sprintf("%s/.attach_pid%d", root, h.nsPid) - } - - attachPath := attachPIDPath(h.root + h.cwd) - hook, err := os.OpenFile(attachPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0660) - hookUID := uint32(0) - var ownerErr error - if err == nil { - hook.Close() - // we don't check Chown() return error here as it can fail on some filesystems (read below) - _ = syscall.Chown(attachPath, uid, gid) - hookUID, _, ownerErr = getPathOwner(attachPath) - } - if err != nil || ownerErr != nil || hookUID != uint32(uid) { - // We are trying an alternative attach path (in /tmp) - // o if we can't create one in the cwd of the java process (probably read only filesystem) - // o the filesystem changed the owner (id mapped mounts, like nfs force_uid, ...) - - if ownerErr == nil { - os.Remove(attachPath) - } - - attachPath = attachPIDPath(h.tmpPath()) - hook, err = os.OpenFile(attachPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0660) - if err != nil { - return err - } - hook.Close() - } - defer os.Remove(attachPath) - - process, _ := os.FindProcess(h.pid) // os.FindProcess() will never fail on linux - if err := process.Signal(syscall.SIGQUIT); err != nil { - return fmt.Errorf("process %d/%d SIGQUIT failed : %s", h.pid, h.nsPid, err) - } - - end := time.Now().Add(6 * time.Second) - for end.After(time.Now()) { - time.Sleep(200 * time.Millisecond) - if h.isSocketExists() { - return nil - } - } - return fmt.Errorf("the java process %d/%d didn't create a socket file", h.pid, h.nsPid) -} - -// Attach an agent to the hotspot, uid/gid must be accessible read-only by the targeted hotspot -func (h *Hotspot) Attach(agentPath string, args string, uid int, gid int) error { - if !h.isSocketExists() { - // ask JVM to create a socket to communicate - if err := h.attachJVMProtocol(uid, gid); err != nil { - return err - } - } - - // copy the agent in the cwd of the process and change his owner/group - dstAgentPath, agentCleanup, err := h.copyAgent(agentPath, uid, gid) - if err != nil { - return err - } - defer agentCleanup() - - h.uid = uid - h.gid = gid - // connect and ask to load the agent .jar or .so - cleanConn, err := h.connect(false) - if err != nil { - return err - } - defer cleanConn() - - var loadCommand string - isJar := strings.HasSuffix(agentPath, ".jar") - if isJar { // agent is a .jar - loadCommand = fmt.Sprintf("load instrument false %s", dstAgentPath) - if args != "" { - loadCommand += "=" + args - } - } else { - loadCommand = fmt.Sprintf("load %s true", dstAgentPath) - if args != "" { - loadCommand += " " + args - } - } - - if err := h.command(loadCommand, !isJar); err != nil { - log.Debugf("java attach hotspot pid %d/%d command '%s' failed isJar=%v : %s", h.pid, h.nsPid, loadCommand, isJar, err) - return err - } - return nil -} diff --git a/pkg/network/protocols/tls/java/jattach.go b/pkg/network/protocols/tls/java/jattach.go deleted file mode 100644 index 8630a7572a207..0000000000000 --- a/pkg/network/protocols/tls/java/jattach.go +++ /dev/null @@ -1,72 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed -// under the Apache License Version 2.0. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2016-present Datadog, Inc. - -//go:build linux - -package java - -import ( - "time" - - // needs NsPid from fork - "github.com/DataDog/gopsutil/process" - - "github.com/DataDog/datadog-agent/pkg/util/log" -) - -// minJavaAgeToAttachMS is the minimum age of a java process to be able to attach it -// else the java process would crash if he receives the SIGQUIT too early ("Signal Dispatch" thread is not ready) -// In other words that the only reliable safety thing we could check to assume a java process started (System.main execution) -// Looking a proc/pid/status.Thread numbers is not reliable as it depend on numbers of cores and JRE version/implementation -// -// The issue is described here https://bugs.openjdk.org/browse/JDK-8186709 see Kevin Walls comment -// if java received a SIGQUIT and the JVM is not started yet, java will print 'quit (core dumped)' -// SIGQUIT is sent as part of the hotspot protocol handshake -const minJavaAgeToAttachMS = 10000 - -func injectAttach(pid int, agent, args string, nsPid, fsUID, fsGID int) error { - h, err := NewHotspot(pid, nsPid) - if err != nil { - return err - } - - return h.Attach(agent, args, fsUID, fsGID) -} - -// InjectAgent injects the given agent into the given java process -func InjectAgent(pid int, agent, args string) error { - proc, err := process.NewProcess(int32(pid)) - if err != nil { - return err - } - uids, err := proc.Uids() - if err != nil { - return err - } - gids, err := proc.Gids() - if err != nil { - return err - } - // we return the process uid and gid from the filesystem point of view - // as attach file need to be created with uid/gid accessible from the java hotspot - // index 3 here point to the 4th columns of /proc/pid/status Uid/Gid => filesystem uid/gid - fsUID, fsGID := int(uids[3]), int(gids[3]) - - ctime, _ := proc.CreateTime() - ageMs := time.Now().UnixMilli() - ctime - if ageMs < minJavaAgeToAttachMS { - log.Debugf("java attach pid %d will be delayed by %d ms", pid, minJavaAgeToAttachMS-ageMs) - // wait and inject the agent asynchronously - go func() { - time.Sleep(time.Duration(minJavaAgeToAttachMS-ageMs) * time.Millisecond) - if err := injectAttach(pid, agent, args, int(proc.NsPid), fsUID, fsGID); err != nil { - log.Errorf("java attach pid %d failed %s", pid, err) - } - }() - return nil - } - - return injectAttach(pid, agent, args, int(proc.NsPid), fsUID, fsGID) -} diff --git a/pkg/network/protocols/tls/java/jattach_test.go b/pkg/network/protocols/tls/java/jattach_test.go deleted file mode 100644 index 14bdcff71b09f..0000000000000 --- a/pkg/network/protocols/tls/java/jattach_test.go +++ /dev/null @@ -1,145 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed -// under the Apache License Version 2.0. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2016-present Datadog, Inc. - -//go:build linux_bpf - -package java - -import ( - "os" - "path/filepath" - "syscall" - "testing" - "time" - - "github.com/cihub/seelog" - "github.com/stretchr/testify/require" - - javatestutil "github.com/DataDog/datadog-agent/pkg/network/protocols/tls/java/testutil" - "github.com/DataDog/datadog-agent/pkg/network/testutil" - "github.com/DataDog/datadog-agent/pkg/util/kernel" - "github.com/DataDog/datadog-agent/pkg/util/log" -) - -func TestMain(m *testing.M) { - logLevel := os.Getenv("DD_LOG_LEVEL") - if logLevel == "" { - logLevel = "warn" - } - log.SetupLogger(seelog.Default, logLevel) - os.Exit(m.Run()) -} - -func testInject(t *testing.T, prefix string) { - go func() { - o, err := testutil.RunCommand(prefix + "java -cp testdata Wait JustWait") - if err != nil { - t.Logf("%v\n", err) - } - t.Log(o) - }() - - var pids []int - var err error - require.Eventually(t, func() bool { - pids, err = javatestutil.FindProcessByCommandLine("java", "JustWait") - return len(pids) == 1 - }, time.Second*5, time.Millisecond*100) - require.NoError(t, err) - - t.Cleanup(func() { - process, err := os.FindProcess(pids[0]) - if err != nil { - return - } - _ = process.Signal(syscall.SIGKILL) - _, _ = process.Wait() - }) - - tfile, err := os.CreateTemp("", "TestAgentLoaded.agentmain.*") - require.NoError(t, err) - require.NoError(t, tfile.Close()) - require.NoError(t, os.Remove(tfile.Name())) - // equivalent to jattach load instrument false testdata/TestAgentLoaded.jar= - require.NoError(t, InjectAgent(pids[0], filepath.Join("testdata", "TestAgentLoaded.jar"), "testfile="+tfile.Name())) - require.Eventually(t, func() bool { - _, err = os.Stat(tfile.Name()) - return err == nil - }, time.Second*15, time.Millisecond*100) -} - -// We test injection on a java hotspot running -// -// o on the host -// o in the container, _simulated_ by running java in his own PID namespace -func runTestInject(t *testing.T) { - currKernelVersion, err := kernel.HostVersion() - require.NoError(t, err) - if currKernelVersion < kernel.VersionCode(4, 14, 0) { - t.Skip("Java TLS injection tests can run only on USM supported machines.") - } - - javaVersion, err := testutil.RunCommand("java -version") - require.NoErrorf(t, err, "java is not installed") - t.Logf("java version %v", javaVersion) - - t.Run("host", func(t *testing.T) { - testInject(t, "") - }) - - t.Run("PID namespace", func(t *testing.T) { - p := "unshare -p --fork " - _, err = testutil.RunCommand(p + "id") - if err != nil { - t.Skipf("unshare not supported on this platform %s", err) - } - - // running the target process in a new PID namespace - // and testing if the test/platform give enough permission to do that - testInject(t, p) - }) -} - -func TestInject(t *testing.T) { - t.Skip("JavaTLS tests are currently disabled") - runTestInject(t) -} - -func TestInjectInReadOnlyFS(t *testing.T) { - t.Skip("JavaTLS tests are currently disabled") - curDir, err := os.Getwd() - require.NoError(t, err) - rodir := filepath.Join(os.TempDir(), "rodir") - - err = os.Mkdir(rodir, 0766) - require.NoError(t, err) - defer func() { - err = os.RemoveAll(rodir) - if err != nil { - t.Log(err) - } - }() - - err = syscall.Mount(curDir, rodir, "auto", syscall.MS_BIND|syscall.MS_RDONLY, "") - require.NoError(t, err) - err = syscall.Mount("none", rodir, "", syscall.MS_RDONLY|syscall.MS_REMOUNT|syscall.MS_BIND, "") - require.NoError(t, err) - defer func() { - // without the sleep the unmount fails with a 'resource busy' error - time.Sleep(1 * time.Second) - err = syscall.Unmount(rodir, 0) - if err != nil { - t.Log(err) - } - }() - - err = os.Chdir(rodir) - require.NoError(t, err) - - runTestInject(t) - - err = os.Chdir(curDir) - require.NoError(t, err) -} diff --git a/pkg/network/protocols/tls/java/testdata/.gitignore b/pkg/network/protocols/tls/java/testdata/.gitignore deleted file mode 100644 index 24a22407e6e3c..0000000000000 --- a/pkg/network/protocols/tls/java/testdata/.gitignore +++ /dev/null @@ -1 +0,0 @@ -TestAgentLoaded.agentmain.* diff --git a/pkg/network/protocols/tls/java/testdata/META-INF/MANIFEST.MF b/pkg/network/protocols/tls/java/testdata/META-INF/MANIFEST.MF deleted file mode 100644 index eca2e74bb62bb..0000000000000 --- a/pkg/network/protocols/tls/java/testdata/META-INF/MANIFEST.MF +++ /dev/null @@ -1,6 +0,0 @@ -Manifest-Version: 1.0 -Can-Redefine-Classes: true -Can-Retransform-Classes: true -Agent-Class: TestAgentLoaded -Premain-Class: TestAgentLoaded -Created-By: 1.2.3.4 (Private Build) diff --git a/pkg/network/protocols/tls/java/testdata/TestAgentLoaded.class b/pkg/network/protocols/tls/java/testdata/TestAgentLoaded.class deleted file mode 100644 index c47486dfa6ca7..0000000000000 Binary files a/pkg/network/protocols/tls/java/testdata/TestAgentLoaded.class and /dev/null differ diff --git a/pkg/network/protocols/tls/java/testdata/TestAgentLoaded.jar b/pkg/network/protocols/tls/java/testdata/TestAgentLoaded.jar deleted file mode 100644 index 9093502416b34..0000000000000 Binary files a/pkg/network/protocols/tls/java/testdata/TestAgentLoaded.jar and /dev/null differ diff --git a/pkg/network/protocols/tls/java/testdata/TestAgentLoaded.java b/pkg/network/protocols/tls/java/testdata/TestAgentLoaded.java deleted file mode 100644 index 27b84d8b3dd2a..0000000000000 --- a/pkg/network/protocols/tls/java/testdata/TestAgentLoaded.java +++ /dev/null @@ -1,34 +0,0 @@ -/* -Need to be compiled with java7 - -javac TestAgentLoaded.java -jar cvmf META-INF/MANIFEST.MF TestAgentLoaded.jar TestAgentLoaded.class - */ - -import java.lang.instrument.Instrumentation; -import java.io.FileOutputStream; - -public class TestAgentLoaded { - - public static void agentmain(String agentArgs, Instrumentation inst) { - try { - // parsing the argument like agent-usm.jar - if (agentArgs != ""){ - //split arguments by comma character - String[] args = agentArgs.split(","); - for (String arg : args){ - //we only parse the arguments of the form "arg=value" (e.g: dd.debug.enabled=true) - String[] keyValTuple = arg.split("="); - if ((keyValTuple.length == 2) && (keyValTuple[0].equals("testfile"))) { - System.out.println("touch file "+keyValTuple[1]); - new FileOutputStream(keyValTuple[1]).close(); - } - } - } - } catch (Exception ex) { - System.out.println(ex); - } finally { - System.out.println("loading TestAgentLoaded.agentmain("+agentArgs+")"); - } - } -} diff --git a/pkg/network/protocols/tls/java/testdata/Wait.class b/pkg/network/protocols/tls/java/testdata/Wait.class deleted file mode 100644 index 7235400ed0475..0000000000000 Binary files a/pkg/network/protocols/tls/java/testdata/Wait.class and /dev/null differ diff --git a/pkg/network/protocols/tls/java/testdata/Wait.java b/pkg/network/protocols/tls/java/testdata/Wait.java deleted file mode 100644 index 61b3c2b894dc9..0000000000000 --- a/pkg/network/protocols/tls/java/testdata/Wait.java +++ /dev/null @@ -1,41 +0,0 @@ -// Need to be compiled with java7 - -import java.lang.Thread; -import java.lang.management.ManagementFactory; - -class Wait { - private static String getProcessId(final String fallback) { - // Note: may fail in some JVM implementations - // therefore fallback has to be provided - - // something like '@', at least in SUN / Oracle JVMs - final String jvmName = ManagementFactory.getRuntimeMXBean().getName(); - final int index = jvmName.indexOf('@'); - - if (index < 1) { - // part before '@' empty (index = 0) / '@' not found (index = -1) - return fallback; - } - - try { - return Long.toString(Long.parseLong(jvmName.substring(0, index))); - } catch (NumberFormatException e) { - // ignore - } - return fallback; - } - - public static void main(String[] args) { - String progName = args[0]; - String pid = getProcessId(""); - System.out.println(progName + " pid "+ pid); - try { - for(;;) { - Thread.sleep(1000); - } - } catch (Exception ex) { - System.out.println(ex); - } - System.out.println(progName + " pid "+pid+" ended"); - } -} diff --git a/pkg/network/protocols/tls/java/testdata/Wget$1.class b/pkg/network/protocols/tls/java/testdata/Wget$1.class deleted file mode 100644 index d586e3e758256..0000000000000 Binary files a/pkg/network/protocols/tls/java/testdata/Wget$1.class and /dev/null differ diff --git a/pkg/network/protocols/tls/java/testdata/Wget$2.class b/pkg/network/protocols/tls/java/testdata/Wget$2.class deleted file mode 100644 index 4e424dc0efc57..0000000000000 Binary files a/pkg/network/protocols/tls/java/testdata/Wget$2.class and /dev/null differ diff --git a/pkg/network/protocols/tls/java/testdata/Wget$InvalidCertificateHostVerifier.class b/pkg/network/protocols/tls/java/testdata/Wget$InvalidCertificateHostVerifier.class deleted file mode 100644 index c748c2835541b..0000000000000 Binary files a/pkg/network/protocols/tls/java/testdata/Wget$InvalidCertificateHostVerifier.class and /dev/null differ diff --git a/pkg/network/protocols/tls/java/testdata/Wget.class b/pkg/network/protocols/tls/java/testdata/Wget.class deleted file mode 100644 index 2bbd3ec21d053..0000000000000 Binary files a/pkg/network/protocols/tls/java/testdata/Wget.class and /dev/null differ diff --git a/pkg/network/protocols/tls/java/testdata/Wget.java b/pkg/network/protocols/tls/java/testdata/Wget.java deleted file mode 100644 index 4a66711cd6dc0..0000000000000 --- a/pkg/network/protocols/tls/java/testdata/Wget.java +++ /dev/null @@ -1,102 +0,0 @@ -// Need to be compiled with java7 - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.URL; -import javax.net.ssl.HttpsURLConnection; - -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.SSLSession; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import java.security.cert.X509Certificate; -import java.security.cert.CertificateException; -import java.security.NoSuchAlgorithmException; -import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.KeyStoreException; - -public class Wget { - - public static void main(String[] args) { - URL url; - boolean dumpContent = false; - if (args.length == 0) { - System.out.println("Wget "); - System.exit(1); - } - - try { - System.out.println("waiting 11 seconds"); - // sleep 11 seconds before doing the request, as the process need to be injected - Thread.sleep(11000); - } catch (InterruptedException intException) { - intException.printStackTrace(); - System.exit(1); - } - System.out.println("finished waiting"); - - try { - TrustManager[] trustAllCerts = new TrustManager[] { - new X509TrustManager() { - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return null; - } - @Override - public void checkClientTrusted(X509Certificate[] arg0, String arg1) - throws CertificateException {} - - @Override - public void checkServerTrusted(X509Certificate[] arg0, String arg1) - throws CertificateException {} - } - }; - - KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); - trustStore.load(null, null); - - SSLContext sc=null; - try { - sc = SSLContext.getInstance("TLSv1.3"); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } - try { - sc.init(null, trustAllCerts, new java.security.SecureRandom()); - } catch (KeyManagementException e) { - e.printStackTrace(); - } - HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); - - - url = new URL(args[0]); - - HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); - connection.setRequestMethod("GET"); - connection.setConnectTimeout(15 * 1000); - connection.setReadTimeout(15 * 1000); - - // skip certificate validation - connection.setHostnameVerifier(new HostnameVerifier() { - public boolean verify(String s, SSLSession sslSession) { - return true; - } - }); - System.out.println("Response code = " + connection.getResponseCode()); - - BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream())); - String input; - while ((input = br.readLine()) != null) { - if (dumpContent) { - System.out.println(input); - } - } - connection.disconnect(); - } catch (Exception e) { - e.printStackTrace(); - System.exit(1); - } - } -} diff --git a/pkg/network/protocols/tls/java/testdata/docker-compose.yml b/pkg/network/protocols/tls/java/testdata/docker-compose.yml deleted file mode 100644 index 24b6066e510c6..0000000000000 --- a/pkg/network/protocols/tls/java/testdata/docker-compose.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: '3' -name: java -services: - java: - image: ${IMAGE_VERSION} - entrypoint: java -cp /v ${ENTRYCLASS} - extra_hosts: - - ${EXTRA_HOSTS} - # setting the limits here as new os confuse (abort()) old glibc with default big numbers - # https://datadoghq.atlassian.net/browse/USMO-295 - # numbers here are default from /etc/systemd/system.conf - ulimits: - nofile: - soft: 1024 - hard: 524288 - volumes: - - ${TESTDIR}:/v:z diff --git a/pkg/network/protocols/tls/java/testutil/inject.go b/pkg/network/protocols/tls/java/testutil/inject.go deleted file mode 100644 index a9593308435c6..0000000000000 --- a/pkg/network/protocols/tls/java/testutil/inject.go +++ /dev/null @@ -1,152 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed -// under the Apache License Version 2.0. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2016-present Datadog, Inc. - -//go:build linux && test - -// Package testutil provides utilities for testing the java tracer. -package testutil - -import ( - "io" - "regexp" - "strconv" - "strings" - "sync" - "testing" - "time" - - "github.com/cihub/seelog" - "github.com/stretchr/testify/require" - - "github.com/shirou/gopsutil/v3/process" - - "github.com/DataDog/datadog-agent/pkg/network/protocols/http/testutil" - protocolsUtils "github.com/DataDog/datadog-agent/pkg/network/protocols/testutil" - "github.com/DataDog/datadog-agent/pkg/util/kernel" - "github.com/DataDog/datadog-agent/pkg/util/log" -) - -// RunJavaVersion run class under java version -func RunJavaVersion(t testing.TB, version, class string, testdir string, waitForParam ...*regexp.Regexp) error { - t.Helper() - var waitFor *regexp.Regexp - if len(waitForParam) == 0 { - // test if injection happen - waitFor = regexp.MustCompile(`loading TestAgentLoaded\.agentmain.*`) - } else { - waitFor = waitForParam[0] - } - - dir, _ := testutil.CurDir() - addr := "172.17.0.1" // for some reason docker network inspect bridge --format='{{(index .IPAM.Config 0).Gateway}}' is not reliable and doesn't report Gateway ip sometime - env := []string{ - "IMAGE_VERSION=" + version, - "ENTRYCLASS=" + class, - "EXTRA_HOSTS=host.docker.internal:" + addr, - "TESTDIR=" + testdir, - } - - return protocolsUtils.RunDockerServer(t, version, dir+"/../testdata/docker-compose.yml", env, waitFor, protocolsUtils.DefaultTimeout, 3) -} - -// FindProcessByCommandLine gets a proc name and part of its command line, and returns all PIDs matched for those conditions. -func FindProcessByCommandLine(procName, command string) ([]int, error) { - res := make([]int, 0) - fn := func(pid int) error { - proc, err := process.NewProcess(int32(pid)) - if err != nil { - return nil // ignore process that didn't exist anymore - } - - name, err := proc.Name() - if err == nil && name == procName { - cmdline, err := proc.Cmdline() - if err == nil && strings.Contains(cmdline, command) { - res = append(res, pid) - } - } - return nil - } - - if err := kernel.WithAllProcs(kernel.ProcFSRoot(), fn); err != nil { - return nil, err - } - return res, nil -} - -// RunJavaVersionAndWaitForRejection is running a java version program, waiting for it to successfully load, and then -// checking the java TLS program didn't attach to it (rejected the injection). The last part is done using log scanner -// we're registering a new log scanner and looking for a specific log (java pid (\d+) attachment rejected). -func RunJavaVersionAndWaitForRejection(t testing.TB, version, class string, testdir string, waitForCondition *regexp.Regexp) { - t.Helper() - - dir, _ := testutil.CurDir() - addr := "172.17.0.1" // for some reason docker network inspect bridge --format='{{(index .IPAM.Config 0).Gateway}}' is not reliable and doesn't report Gateway ip sometime - env := []string{ - "IMAGE_VERSION=" + version, - "ENTRYCLASS=" + class, - "EXTRA_HOSTS=host.docker.internal:" + addr, - "TESTDIR=" + testdir, - } - - l := javaInjectionRejectionLogger{ - t: t, - lock: sync.RWMutex{}, - rejectedPIDs: make(map[int32]struct{}), - } - configureLoggerForTest(t, &l) - - require.NoError(t, protocolsUtils.RunDockerServer(t, version, dir+"/../testdata/docker-compose.yml", env, waitForCondition, time.Second*15, 3)) - pids, err := FindProcessByCommandLine("java", class) - require.NoError(t, err) - require.Lenf(t, pids, 1, "found more process (%d) than expected (1)", len(pids)) - require.Eventuallyf(t, func() bool { - return l.HasRejectedPID(int32(pids[0])) - }, time.Second*30, time.Millisecond*100, "pid %d was not rejected", pids[0]) -} - -func configureLoggerForTest(t testing.TB, w io.Writer) func() { - logger, err := seelog.LoggerFromWriterWithMinLevel(w, seelog.TraceLvl) - if err != nil { - t.Fatalf("unable to configure logger, err: %v", err) - } - seelog.ReplaceLogger(logger) //nolint:errcheck - log.SetupLogger(logger, "debug") - return log.Flush -} - -type javaInjectionRejectionLogger struct { - t testing.TB - lock sync.RWMutex - rejectedPIDs map[int32]struct{} -} - -var ( - rejectionRegex = regexp.MustCompile(`java pid (\d+) attachment rejected`) -) - -// Write implements the io.Writer interface. -func (l *javaInjectionRejectionLogger) Write(p []byte) (n int, err error) { - res := rejectionRegex.FindAllSubmatch(p, -1) - // We expect to have 1 group (len(res) == 1) and the match (res[0]) should have 2 entries, the first is the full string - // and the second (res[0][1]) is the group (the PID). - if len(res) == 1 && len(res[0]) == 2 { - i, err := strconv.Atoi(string(res[0][1])) - if err == nil { - l.lock.Lock() - l.rejectedPIDs[int32(i)] = struct{}{} - l.lock.Unlock() - } - } - return len(p), nil -} - -// HasRejectedPID returns true if the given pid was rejected by java tls. -func (l *javaInjectionRejectionLogger) HasRejectedPID(pid int32) bool { - l.lock.RLock() - defer l.lock.RUnlock() - _, ok := l.rejectedPIDs[pid] - return ok -} diff --git a/pkg/network/tags_linux.go b/pkg/network/tags_linux.go index 53f350ea8e96e..4f81692cfc31a 100644 --- a/pkg/network/tags_linux.go +++ b/pkg/network/tags_linux.go @@ -18,8 +18,6 @@ const ( ConnTagOpenSSL = http.OpenSSL // ConnTagGo is the tag for GO TLS connections ConnTagGo = http.Go - // ConnTagJava is the tag for Java TLS connections - ConnTagJava = http.Java // ConnTagTLS is the tag for TLS connections in general ConnTagTLS = http.TLS // ConnTagIstio is the tag for Istio TLS connections @@ -40,5 +38,5 @@ func GetStaticTags(staticTags uint64) (tags []string) { // IsTLSTag return if the tag is a TLS tag func IsTLSTag(staticTags uint64) bool { - return staticTags&(ConnTagGnuTLS|ConnTagOpenSSL|ConnTagGo|ConnTagJava|ConnTagTLS|ConnTagIstio|ConnTagNodeJS) > 0 + return staticTags&(ConnTagGnuTLS|ConnTagOpenSSL|ConnTagGo|ConnTagTLS|ConnTagIstio|ConnTagNodeJS) > 0 } diff --git a/pkg/network/usm/config/config.go b/pkg/network/usm/config/config.go index 00a4cc9764c5b..361b23e9325c5 100644 --- a/pkg/network/usm/config/config.go +++ b/pkg/network/usm/config/config.go @@ -78,5 +78,5 @@ func IsUSMSupportedAndEnabled(config *config.Config) bool { // NeedProcessMonitor returns true if the process monitor is needed for the given configuration func NeedProcessMonitor(config *config.Config) bool { - return config.EnableNativeTLSMonitoring || config.EnableGoTLSSupport || config.EnableJavaTLSSupport || config.EnableIstioMonitoring || config.EnableNodeJSMonitoring + return config.EnableNativeTLSMonitoring || config.EnableGoTLSSupport || config.EnableIstioMonitoring || config.EnableNodeJSMonitoring } diff --git a/pkg/network/usm/ebpf_javatls.go b/pkg/network/usm/ebpf_javatls.go deleted file mode 100644 index b2e3f65ac08f6..0000000000000 --- a/pkg/network/usm/ebpf_javatls.go +++ /dev/null @@ -1,329 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed -// under the Apache License Version 2.0. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2022-present Datadog, Inc. - -//go:build linux_bpf - -package usm - -import ( - "bytes" - "fmt" - "io" - "math/rand" - "os" - "path/filepath" - "regexp" - "strconv" - "strings" - "time" - - "github.com/cilium/ebpf" - - manager "github.com/DataDog/ebpf-manager" - - "github.com/DataDog/datadog-agent/pkg/network/config" - "github.com/DataDog/datadog-agent/pkg/network/protocols" - "github.com/DataDog/datadog-agent/pkg/network/protocols/tls/java" - "github.com/DataDog/datadog-agent/pkg/network/usm/buildmode" - usmconfig "github.com/DataDog/datadog-agent/pkg/network/usm/config" - "github.com/DataDog/datadog-agent/pkg/process/monitor" - "github.com/DataDog/datadog-agent/pkg/util/kernel" - "github.com/DataDog/datadog-agent/pkg/util/log" -) - -const ( - agentUSMJar = "agent-usm.jar" - javaTLSConnectionsMap = "java_tls_connections" - javaDomainsToConnectionsMap = "java_conn_tuple_by_peer" - eRPCHandlersMap = "java_tls_erpc_handlers" - - doVfsIoctlKprobeName = "kprobe__do_vfs_ioctl" - handleSyncPayloadKprobeName = "kprobe_handle_sync_payload" - handleCloseConnectionKprobeName = "kprobe_handle_close_connection" - handleConnectionByPeerKprobeName = "kprobe_handle_connection_by_peer" - handleAsyncPayloadKprobeName = "kprobe_handle_async_payload" -) - -const ( - // syncPayload is the key to the program that handles the SYNCHRONOUS_PAYLOAD eRPC operation - syncPayload uint32 = iota - // closeConnection is the key to the program that handles the CLOSE_CONNECTION eRPC operation - closeConnection - // connectionByPeer is the key to the program that handles the CONNECTION_BY_PEER eRPC operation - connectionByPeer - // asyncPayload is the key to the program that handles the ASYNC_PAYLOAD eRPC operation - asyncPayload -) - -var ( - javaProcessName = []byte("java") -) - -type javaTLSProgram struct { - cfg *config.Config - processMonitor *monitor.ProcessMonitor - cleanupExec func() - - // tracerJarPath path to the USM agent TLS tracer. - tracerJarPath string - - // tracerArguments default arguments passed to the injected agent-usm.jar - tracerArguments string - - // injectionAllowRegex is matched against /proc/pid/cmdline, to determine if we should attach to the process. - injectionAllowRegex *regexp.Regexp - // injectionAllowRegex is matched against /proc/pid/cmdline, to determine if we should deny attachment to the process. - injectionBlockRegex *regexp.Regexp - - procRoot string -} - -var javaTLSSpec = &protocols.ProtocolSpec{ - Factory: newJavaTLSProgram, - Maps: []*manager.Map{ - { - Name: javaTLSConnectionsMap, - }, - { - Name: javaDomainsToConnectionsMap, - }, - { - Name: eRPCHandlersMap, - }, - }, - Probes: []*manager.Probe{ - { - ProbeIdentificationPair: manager.ProbeIdentificationPair{ - EBPFFuncName: doVfsIoctlKprobeName, - UID: probeUID, - }, - }, - }, - TailCalls: []manager.TailCallRoute{ - { - ProgArrayName: eRPCHandlersMap, - Key: syncPayload, - ProbeIdentificationPair: manager.ProbeIdentificationPair{ - EBPFFuncName: handleSyncPayloadKprobeName, - }, - }, - { - ProgArrayName: eRPCHandlersMap, - Key: closeConnection, - ProbeIdentificationPair: manager.ProbeIdentificationPair{ - EBPFFuncName: handleCloseConnectionKprobeName, - }, - }, - { - ProgArrayName: eRPCHandlersMap, - Key: connectionByPeer, - ProbeIdentificationPair: manager.ProbeIdentificationPair{ - EBPFFuncName: handleConnectionByPeerKprobeName, - }, - }, - { - ProgArrayName: eRPCHandlersMap, - Key: asyncPayload, - ProbeIdentificationPair: manager.ProbeIdentificationPair{ - EBPFFuncName: handleAsyncPayloadKprobeName, - }, - }, - }, -} - -func newJavaTLSProgram(c *config.Config) (protocols.Protocol, error) { - if !c.EnableJavaTLSSupport || !usmconfig.TLSSupported(c) { - return nil, nil - } - - javaUSMAgentJarPath := filepath.Join(c.JavaDir, agentUSMJar) - // We tried switching os.Open to os.Stat, but it seems it does not guarantee we'll be able to copy the file. - f, err := os.Open(javaUSMAgentJarPath) - if err != nil { - return nil, fmt.Errorf("java TLS can't access java tracer payload %s : %s", javaUSMAgentJarPath, err) - } - // If we managed to open the file, then we close it, as we just needed to check if the file exists. - _ = f.Close() - - return &javaTLSProgram{ - cfg: c, - processMonitor: monitor.GetProcessMonitor(), - tracerArguments: buildTracerArguments(c), - tracerJarPath: javaUSMAgentJarPath, - injectionAllowRegex: buildRegex(c.JavaAgentAllowRegex, "allow"), - injectionBlockRegex: buildRegex(c.JavaAgentBlockRegex, "block"), - procRoot: kernel.ProcFSRoot(), - }, nil -} - -// Name return the program's name. -func (p *javaTLSProgram) Name() string { - return "Java TLS" -} - -// ConfigureOptions changes map attributes to the given options. -func (p *javaTLSProgram) ConfigureOptions(_ *manager.Manager, options *manager.Options) { - options.MapSpecEditors[javaTLSConnectionsMap] = manager.MapSpecEditor{ - MaxEntries: p.cfg.MaxUSMConcurrentRequests, - EditorFlag: manager.EditMaxEntries, - } - options.MapSpecEditors[javaDomainsToConnectionsMap] = manager.MapSpecEditor{ - MaxEntries: p.cfg.MaxUSMConcurrentRequests, - EditorFlag: manager.EditMaxEntries, - } - options.ActivatedProbes = append(options.ActivatedProbes, - &manager.ProbeSelector{ - ProbeIdentificationPair: manager.ProbeIdentificationPair{ - EBPFFuncName: doVfsIoctlKprobeName, - UID: probeUID, - }, - }, - ) -} - -// isJavaProcess checks if the given PID comm's name is java. -// The method is much faster and efficient that using process.NewProcess(pid).Name(). -func (p *javaTLSProgram) isJavaProcess(pid uint32) bool { - filePath := filepath.Join(p.procRoot, strconv.Itoa(int(pid)), "comm") - content, err := os.ReadFile(filePath) - if err != nil { - // Waiting a bit, as we might get the event of process creation before the directory was created. - for i := 0; i < 3; i++ { - time.Sleep(10 * time.Millisecond) - // reading again. - content, err = os.ReadFile(filePath) - if err == nil { - break - } - } - } - - if err != nil { - // short living process can hit here, or slow start of another process. - return false - } - return bytes.Equal(bytes.TrimSpace(content), javaProcessName) -} - -// isAttachmentAllowed will return true if the pid can be attached -// The filter is based on the process command line matching injectionAllowRegex and injectionBlockRegex regex -// injectionAllowRegex has a higher priority -// -// # In case of only one regex (allow or block) is set, the regex will be evaluated as exclusive filter -// / match | not match -// allowRegex only true | false -// blockRegex only false | true -func (p *javaTLSProgram) isAttachmentAllowed(pid uint32) bool { - allowIsSet := p.injectionAllowRegex != nil - blockIsSet := p.injectionBlockRegex != nil - // filter is disabled (default configuration) - if !allowIsSet && !blockIsSet { - return true - } - - procCmdline := fmt.Sprintf("%s/%d/cmdline", p.procRoot, pid) - cmd, err := os.ReadFile(procCmdline) - if err != nil { - log.Debugf("injection filter can't open commandline %q : %s", procCmdline, err) - return false - } - fullCmdline := strings.ReplaceAll(string(cmd), "\000", " ") // /proc/pid/cmdline format : arguments are separated by '\0' - - // Allow to have a higher priority - if allowIsSet && p.injectionAllowRegex.MatchString(fullCmdline) { - return true - } - if blockIsSet && p.injectionBlockRegex.MatchString(fullCmdline) { - return false - } - - // if only one regex is set, allow regex if not match should not attach - if allowIsSet != blockIsSet { // allow xor block - if allowIsSet { - return false - } - } - return true -} - -func (p *javaTLSProgram) newJavaProcess(pid uint32) { - if !p.isJavaProcess(pid) { - return - } - if !p.isAttachmentAllowed(pid) { - log.Debugf("java pid %d attachment rejected", pid) - return - } - - if err := java.InjectAgent(int(pid), p.tracerJarPath, p.tracerArguments); err != nil { - log.Error(err) - } -} - -// PreStart subscribes to the exec events to inject the java agent. -func (p *javaTLSProgram) PreStart(*manager.Manager) error { - p.cleanupExec = p.processMonitor.SubscribeExec(p.newJavaProcess) - return nil -} - -// PostStart is a no-op. -func (p *javaTLSProgram) PostStart(*manager.Manager) error { - return nil -} - -// Stop unsubscribes from the exec events. -func (p *javaTLSProgram) Stop(*manager.Manager) { - if p.cleanupExec != nil { - p.cleanupExec() - } - - if p.processMonitor != nil { - p.processMonitor.Stop() - } -} - -// DumpMaps is a no-op. -func (p *javaTLSProgram) DumpMaps(io.Writer, string, *ebpf.Map) {} - -// GetStats is a no-op. -func (p *javaTLSProgram) GetStats() *protocols.ProtocolStats { - return nil -} - -// buildRegex is similar to regexp.MustCompile, but without panic. -func buildRegex(re, reType string) *regexp.Regexp { - if re == "" { - return nil - } - res, err := regexp.Compile(re) - if err != nil { - log.Errorf("%s regex can't be compiled %s", reType, err) - return nil - } - - return res -} - -// buildTracerArguments returns the command line arguments we'll pass to the injected tracer. -func buildTracerArguments(c *config.Config) string { - // Randomizing the seed to ensure we get a truly random number. - rand.Seed(int64(os.Getpid()) + time.Now().UnixMicro()) - - allArgs := []string{ - c.JavaAgentArgs, - // authID is used here as an identifier, simple proof of authenticity - // between the injected java process and the ebpf ioctl that receive the payload. - fmt.Sprintf("dd.usm.authID=%d", rand.Int63()), - } - if c.JavaAgentDebug { - allArgs = append(allArgs, "dd.trace.debug=true") - } - return strings.Join(allArgs, ",") -} - -// IsBuildModeSupported returns always true, as java tls module is supported by all modes. -func (*javaTLSProgram) IsBuildModeSupported(buildmode.Type) bool { - return true -} diff --git a/pkg/network/usm/ebpf_javatls_test.go b/pkg/network/usm/ebpf_javatls_test.go deleted file mode 100644 index 947bab3e3597e..0000000000000 --- a/pkg/network/usm/ebpf_javatls_test.go +++ /dev/null @@ -1,198 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed -// under the Apache License Version 2.0. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2016-present Datadog, Inc. - -//go:build linux_bpf - -package usm - -import ( - "os" - "path/filepath" - "regexp" - "testing" - - "github.com/stretchr/testify/require" - - networkconfig "github.com/DataDog/datadog-agent/pkg/network/config" - "github.com/DataDog/datadog-agent/pkg/network/protocols/http/testutil" - javatestutil "github.com/DataDog/datadog-agent/pkg/network/protocols/tls/java/testutil" - nettestutil "github.com/DataDog/datadog-agent/pkg/network/testutil" - usmconfig "github.com/DataDog/datadog-agent/pkg/network/usm/config" -) - -func createJavaTempFile(t *testing.T, dir string) string { - tempfile, err := os.CreateTemp(dir, "TestAgentLoaded.agentmain.*") - require.NoError(t, err) - tempfile.Close() - os.Remove(tempfile.Name()) - t.Cleanup(func() { os.Remove(tempfile.Name()) }) - - return tempfile.Name() -} - -func TestJavaInjection(t *testing.T) { - t.Skip("JavaTLS tests are currently disabled") - cfg := networkconfig.New() - cfg.EnableJavaTLSSupport = true - if !usmconfig.TLSSupported(cfg) { - t.Skip("Java injection tests are not supported on this machine") - } - - defaultCfg := cfg - - dir, _ := testutil.CurDir() - testdataDir := filepath.Join(dir, "../protocols/tls/java/testdata") - // create a fake agent-usm.jar based on TestAgentLoaded.jar by forcing cfg.JavaDir - fakeAgentDir, err := os.MkdirTemp("", "fake.agent-usm.jar.") - require.NoError(t, err) - defer os.RemoveAll(fakeAgentDir) - _, err = nettestutil.RunCommand("install -m444 " + filepath.Join(testdataDir, "TestAgentLoaded.jar") + " " + filepath.Join(fakeAgentDir, "agent-usm.jar")) - require.NoError(t, err) - _, err = nettestutil.RunCommand("install -m444 " + filepath.Join(testdataDir, "Wait.class") + " " + filepath.Join(fakeAgentDir, "Wait.class")) - require.NoError(t, err) - - commonTearDown := func(_ *testing.T, ctx map[string]interface{}) { - cfg.JavaAgentArgs = ctx["JavaAgentArgs"].(string) - - testfile := ctx["testfile"].(string) - _, err := os.Stat(testfile) - if err == nil { - os.Remove(testfile) - } - } - - commonValidation := func(t *testing.T, ctx map[string]interface{}) { - testfile := ctx["testfile"].(string) - _, err := os.Stat(testfile) - require.NoError(t, err) - } - - tests := []struct { - name string - context map[string]interface{} - preTracerSetup func(t *testing.T, ctx map[string]interface{}) - postTracerSetup func(t *testing.T, ctx map[string]interface{}) - validation func(t *testing.T, ctx map[string]interface{}) - teardown func(t *testing.T, ctx map[string]interface{}) - }{ - { - // Test the java hotspot injection is working - name: "java_hotspot_injection_8u151", - context: make(map[string]interface{}), - preTracerSetup: func(t *testing.T, ctx map[string]interface{}) { - cfg.JavaDir = fakeAgentDir - ctx["JavaAgentArgs"] = cfg.JavaAgentArgs - ctx["testfile"] = createJavaTempFile(t, fakeAgentDir) - cfg.JavaAgentArgs += ",testfile=/v/" + filepath.Base(ctx["testfile"].(string)) - }, - postTracerSetup: func(t *testing.T, _ map[string]interface{}) { - // if RunJavaVersion failing to start it's probably because the java process has not been injected - require.NoError(t, javatestutil.RunJavaVersion(t, "openjdk:8u151-jre", "Wait JustWait", fakeAgentDir), "Failed running Java version") - }, - validation: commonValidation, - teardown: commonTearDown, - }, - { - // Test the java hotspot injection is working - name: "java_hotspot_injection_21_allow_only", - context: make(map[string]interface{}), - preTracerSetup: func(t *testing.T, ctx map[string]interface{}) { - cfg.JavaDir = fakeAgentDir - ctx["JavaAgentArgs"] = cfg.JavaAgentArgs - ctx["testfile"] = createJavaTempFile(t, fakeAgentDir) - cfg.JavaAgentArgs += ",testfile=/v/" + filepath.Base(ctx["testfile"].(string)) - - // testing allow/block list, as Allow list have higher priority - // this test will pass normally - cfg.JavaAgentAllowRegex = ".*JustWait.*" - cfg.JavaAgentBlockRegex = "" - }, - postTracerSetup: func(t *testing.T, _ map[string]interface{}) { - // if RunJavaVersion failing to start it's probably because the java process has not been injected - require.NoError(t, javatestutil.RunJavaVersion(t, "openjdk:21-oraclelinux8", "Wait JustWait", fakeAgentDir), "Failed running Java version") - javatestutil.RunJavaVersionAndWaitForRejection(t, "openjdk:21-oraclelinux8", "Wait AnotherWait", fakeAgentDir, regexp.MustCompile(`AnotherWait pid.*`)) - }, - validation: commonValidation, - teardown: commonTearDown, - }, - { - // Test the java hotspot injection is working - name: "java_hotspot_injection_21_block_only", - context: make(map[string]interface{}), - preTracerSetup: func(t *testing.T, ctx map[string]interface{}) { - ctx["JavaAgentArgs"] = cfg.JavaAgentArgs - ctx["testfile"] = createJavaTempFile(t, fakeAgentDir) - cfg.JavaAgentArgs += ",testfile=/v/" + filepath.Base(ctx["testfile"].(string)) - - // block the agent attachment - cfg.JavaAgentAllowRegex = "" - cfg.JavaAgentBlockRegex = ".*JustWait.*" - }, - postTracerSetup: func(t *testing.T, _ map[string]interface{}) { - // if RunJavaVersion failing to start it's probably because the java process has not been injected - require.NoError(t, javatestutil.RunJavaVersion(t, "openjdk:21-oraclelinux8", "Wait AnotherWait", fakeAgentDir), "Failed running Java version") - javatestutil.RunJavaVersionAndWaitForRejection(t, "openjdk:21-oraclelinux8", "Wait JustWait", fakeAgentDir, regexp.MustCompile(`JustWait pid.*`)) - }, - validation: commonValidation, - teardown: commonTearDown, - }, - { - name: "java_hotspot_injection_21_allowblock", - context: make(map[string]interface{}), - preTracerSetup: func(t *testing.T, ctx map[string]interface{}) { - ctx["JavaAgentArgs"] = cfg.JavaAgentArgs - ctx["testfile"] = createJavaTempFile(t, fakeAgentDir) - cfg.JavaAgentArgs += ",testfile=/v/" + filepath.Base(ctx["testfile"].(string)) - - // block the agent attachment - cfg.JavaAgentAllowRegex = ".*JustWait.*" - cfg.JavaAgentBlockRegex = ".*AnotherWait.*" - }, - postTracerSetup: func(t *testing.T, _ map[string]interface{}) { - require.NoError(t, javatestutil.RunJavaVersion(t, "openjdk:21-oraclelinux8", "Wait JustWait", fakeAgentDir), "Failed running Java version") - javatestutil.RunJavaVersionAndWaitForRejection(t, "openjdk:21-oraclelinux8", "Wait AnotherWait", fakeAgentDir, regexp.MustCompile(`AnotherWait pid.*`)) - }, - validation: commonValidation, - teardown: commonTearDown, - }, - { - name: "java_hotspot_injection_21_allow_higher_priority", - context: make(map[string]interface{}), - preTracerSetup: func(t *testing.T, ctx map[string]interface{}) { - ctx["JavaAgentArgs"] = cfg.JavaAgentArgs - ctx["testfile"] = createJavaTempFile(t, fakeAgentDir) - cfg.JavaAgentArgs += ",testfile=/v/" + filepath.Base(ctx["testfile"].(string)) - - // allow has a higher priority - cfg.JavaAgentAllowRegex = ".*JustWait.*" - cfg.JavaAgentBlockRegex = ".*JustWait.*" - }, - postTracerSetup: func(t *testing.T, _ map[string]interface{}) { - require.NoError(t, javatestutil.RunJavaVersion(t, "openjdk:21-oraclelinux8", "Wait JustWait", fakeAgentDir), "Failed running Java version") - }, - validation: commonValidation, - teardown: commonTearDown, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - t.Cleanup(func() { - tt.teardown(t, tt.context) - }) - cfg = defaultCfg - tt.preTracerSetup(t, tt.context) - javaTLSProg, err := newJavaTLSProgram(cfg) - require.NoError(t, err) - require.NoError(t, javaTLSProg.PreStart(nil)) - t.Cleanup(func() { - javaTLSProg.Stop(nil) - }) - require.NoError(t, javaTLSProg.(*javaTLSProgram).processMonitor.Initialize(true)) - - tt.postTracerSetup(t, tt.context) - tt.validation(t, tt.context) - }) - } -} diff --git a/pkg/network/usm/ebpf_main.go b/pkg/network/usm/ebpf_main.go index 63137d318ff91..cc1bec4f89bf4 100644 --- a/pkg/network/usm/ebpf_main.go +++ b/pkg/network/usm/ebpf_main.go @@ -51,7 +51,6 @@ var ( kafka.Spec, postgres.Spec, redis.Spec, - javaTLSSpec, // opensslSpec is unique, as we're modifying its factory during runtime to allow getting more parameters in the // factory. opensslSpec, diff --git a/pkg/network/usm/monitor_testutil.go b/pkg/network/usm/monitor_testutil.go index 450081f3fbd78..bbf01267af343 100644 --- a/pkg/network/usm/monitor_testutil.go +++ b/pkg/network/usm/monitor_testutil.go @@ -75,7 +75,7 @@ func (p *protocolMock) Stop(mgr *manager.Manager) { func (p *protocolMock) DumpMaps(io.Writer, string, *ebpf.Map) {} func (p *protocolMock) GetStats() *protocols.ProtocolStats { return nil } -// IsBuildModeSupported returns always true, as java tls module is supported by all modes. +// IsBuildModeSupported returns always true, as the mock is supported by all modes. func (*protocolMock) IsBuildModeSupported(buildmode.Type) bool { return true } // patchProtocolMock updates the map of known protocols to replace the mock diff --git a/pkg/network/usm/monitor_tls_test.go b/pkg/network/usm/monitor_tls_test.go index c706b5fe874d4..d4c012a0747f5 100644 --- a/pkg/network/usm/monitor_tls_test.go +++ b/pkg/network/usm/monitor_tls_test.go @@ -39,9 +39,7 @@ import ( "github.com/DataDog/datadog-agent/pkg/network/protocols/http2" protocolsUtils "github.com/DataDog/datadog-agent/pkg/network/protocols/testutil" gotlstestutil "github.com/DataDog/datadog-agent/pkg/network/protocols/tls/gotls/testutil" - javatestutil "github.com/DataDog/datadog-agent/pkg/network/protocols/tls/java/testutil" "github.com/DataDog/datadog-agent/pkg/network/protocols/tls/nodejs" - nettestutil "github.com/DataDog/datadog-agent/pkg/network/testutil" usmconfig "github.com/DataDog/datadog-agent/pkg/network/usm/config" usmtestutil "github.com/DataDog/datadog-agent/pkg/network/usm/testutil" "github.com/DataDog/datadog-agent/pkg/network/usm/utils" @@ -455,98 +453,6 @@ func isRequestIncluded(allStats map[http.Key]*http.RequestStats, req *nethttp.Re return false } -func (s *tlsSuite) TestJavaInjection() { - t := s.T() - t.Skip("JavaTLS tests are currently disabled") - - cfg := config.New() - cfg.EnableHTTPMonitoring = true - cfg.EnableJavaTLSSupport = true - defaultCfg := cfg - - dir, _ := testutil.CurDir() - testdataDir := filepath.Join(dir, "../protocols/tls/java/testdata") - legacyJavaDir := cfg.JavaDir - // create a fake agent-usm.jar based on TestAgentLoaded.jar by forcing cfg.JavaDir - fakeAgentDir, err := os.MkdirTemp("", "fake.agent-usm.jar.") - require.NoError(t, err) - defer os.RemoveAll(fakeAgentDir) - _, err = nettestutil.RunCommand("install -m444 " + filepath.Join(testdataDir, "TestAgentLoaded.jar") + " " + filepath.Join(fakeAgentDir, "agent-usm.jar")) - require.NoError(t, err) - - tests := []struct { - name string - context testContext - preTracerSetup func(t *testing.T) - postTracerSetup func(t *testing.T) - validation func(t *testing.T, monitor *Monitor) - teardown func(t *testing.T) - }{ - { - // Test the java jdk client https request is working - name: "java_jdk_client_httpbin_docker_withTLSClassification_java15", - preTracerSetup: func(t *testing.T) { - cfg.JavaDir = legacyJavaDir - cfg.ProtocolClassificationEnabled = true - cfg.CollectTCPv4Conns = true - cfg.CollectTCPv6Conns = true - - serverDoneFn := testutil.HTTPServer(t, "0.0.0.0:5443", testutil.Options{ - EnableTLS: true, - }) - t.Cleanup(serverDoneFn) - }, - postTracerSetup: func(t *testing.T) { - require.NoError(t, javatestutil.RunJavaVersion(t, "openjdk:15-oraclelinux8", "Wget https://host.docker.internal:5443/200/anything/java-tls-request", "./", regexp.MustCompile("Response code = .*")), "Failed running Java version") - }, - validation: func(t *testing.T, monitor *Monitor) { - // Iterate through active connections until we find connection created above - require.Eventually(t, func() bool { - stats := getHTTPLikeProtocolStats(monitor, protocols.HTTP) - if stats == nil { - return false - } - for key, stats := range stats { - if key.Path.Content.Get() == "/200/anything/java-tls-request" { - t.Log("path content found") - - req, exists := stats.Data[200] - if !exists { - t.Logf("wrong response, not 200 : %#+v", key) - continue - } - - if req.StaticTags != network.ConnTagJava { - t.Logf("tag not java : %#+v", key) - continue - } - return true - } - } - - return false - }, 4*time.Second, 100*time.Millisecond, "couldn't find http connection matching: https://host.docker.internal:5443/200/anything/java-tls-request") - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if tt.teardown != nil { - t.Cleanup(func() { - tt.teardown(t) - }) - } - cfg = defaultCfg - if tt.preTracerSetup != nil { - tt.preTracerSetup(t) - } - usmMonitor := setupUSMTLSMonitor(t, cfg) - tt.postTracerSetup(t) - tt.validation(t, usmMonitor) - }) - } -} - func TestHTTPGoTLSAttachProbes(t *testing.T) { t.Skip("skipping GoTLS tests while we investigate their flakiness") diff --git a/pkg/networkdevice/metadata/payload.go b/pkg/networkdevice/metadata/payload.go index 8e5efc545770e..54b2f45eb0996 100644 --- a/pkg/networkdevice/metadata/payload.go +++ b/pkg/networkdevice/metadata/payload.go @@ -6,8 +6,6 @@ // Package metadata defines types for describing data about a device. package metadata -import "github.com/DataDog/datadog-agent/pkg/snmp/gosnmplib" - // PayloadMetadataBatchSize is the number of resources per event payload // Resources are devices, interfaces, etc const PayloadMetadataBatchSize = 100 @@ -77,8 +75,10 @@ type DeviceMetadata struct { // DeviceOID device scan oid data type DeviceOID struct { - *gosnmplib.PDU DeviceID string `json:"device_id"` + OID string `json:"oid"` + Type string `json:"type"` + Value string `json:"value"` } // InterfaceMetadata contains interface metadata diff --git a/pkg/networkdevice/metadata/payload_utils.go b/pkg/networkdevice/metadata/payload_utils.go index ca6bf632aafb2..5ae8f5de786c6 100644 --- a/pkg/networkdevice/metadata/payload_utils.go +++ b/pkg/networkdevice/metadata/payload_utils.go @@ -94,6 +94,8 @@ func DeviceOIDFromPDU(deviceID string, snmpPDU *gosnmp.SnmpPDU) (*DeviceOID, err } return &DeviceOID{ DeviceID: deviceID, - PDU: pdu, + OID: pdu.OID, + Type: pdu.Type.String(), + Value: pdu.Value, }, nil } diff --git a/pkg/networkpath/traceroute/tcp/utils.go b/pkg/networkpath/traceroute/tcp/utils.go index 7eb8c5cf45222..be2ed9b6812c7 100644 --- a/pkg/networkpath/traceroute/tcp/utils.go +++ b/pkg/networkpath/traceroute/tcp/utils.go @@ -57,7 +57,7 @@ type ( tcpResponse struct { SrcIP net.IP DstIP net.IP - TCPResponse *layers.TCP + TCPResponse layers.TCP } rawConnWrapper interface { @@ -201,6 +201,7 @@ func listenPackets(icmpConn rawConnWrapper, tcpConn rawConnWrapper, timeout time // timeout or if the listener is canceled, it should return a canceledError func handlePackets(ctx context.Context, conn rawConnWrapper, listener string, localIP net.IP, localPort uint16, remoteIP net.IP, remotePort uint16, seqNum uint32) (net.IP, uint16, layers.ICMPv4TypeCode, time.Time, error) { buf := make([]byte, 1024) + tp := newTCPParser() for { select { case <-ctx.Done(): @@ -230,16 +231,16 @@ func handlePackets(ctx context.Context, conn rawConnWrapper, listener string, lo if listener == "icmp" { icmpResponse, err := parseICMP(header, packet) if err != nil { - log.Tracef("failed to parse ICMP packet: %s", err.Error()) + log.Tracef("failed to parse ICMP packet: %s", err) continue } if icmpMatch(localIP, localPort, remoteIP, remotePort, seqNum, icmpResponse) { return icmpResponse.SrcIP, 0, icmpResponse.TypeCode, received, nil } } else if listener == "tcp" { - tcpResp, err := parseTCP(header, packet) + tcpResp, err := tp.parseTCP(header, packet) if err != nil { - log.Tracef("failed to parse TCP packet: %s", err.Error()) + log.Tracef("failed to parse TCP packet: %s", err) continue } if tcpMatch(localIP, localPort, remoteIP, remotePort, seqNum, tcpResp) { @@ -309,25 +310,37 @@ func parseICMP(header *ipv4.Header, payload []byte) (*icmpResponse, error) { return &icmpResponse, nil } -func parseTCP(header *ipv4.Header, payload []byte) (*tcpResponse, error) { - tcpResponse := tcpResponse{} +type tcpParser struct { + layer layers.TCP + decoded []gopacket.LayerType + decodingLayerParser *gopacket.DecodingLayerParser +} + +func newTCPParser() *tcpParser { + tcpParser := &tcpParser{} + tcpParser.decodingLayerParser = gopacket.NewDecodingLayerParser(layers.LayerTypeTCP, &tcpParser.layer) + return tcpParser +} +func (tp *tcpParser) parseTCP(header *ipv4.Header, payload []byte) (*tcpResponse, error) { if header.Protocol != IPProtoTCP || header.Version != 4 || header.Src == nil || header.Dst == nil { return nil, fmt.Errorf("invalid IP header for TCP packet: %+v", header) } - tcpResponse.SrcIP = header.Src - tcpResponse.DstIP = header.Dst - var tcpLayer layers.TCP - decoded := []gopacket.LayerType{} - tcpParser := gopacket.NewDecodingLayerParser(layers.LayerTypeTCP, &tcpLayer) - if err := tcpParser.DecodeLayers(payload, &decoded); err != nil { + if err := tp.decodingLayerParser.DecodeLayers(payload, &tp.decoded); err != nil { return nil, fmt.Errorf("failed to decode TCP packet: %w", err) } - tcpResponse.TCPResponse = &tcpLayer - return &tcpResponse, nil + resp := &tcpResponse{ + SrcIP: header.Src, + DstIP: header.Dst, + TCPResponse: tp.layer, + } + // make sure the TCP layer is cleared between runs + tp.layer = layers.TCP{} + + return resp, nil } func icmpMatch(localIP net.IP, localPort uint16, remoteIP net.IP, remotePort uint16, seqNum uint32, response *icmpResponse) bool { diff --git a/pkg/networkpath/traceroute/tcp/utils_test.go b/pkg/networkpath/traceroute/tcp/utils_test.go index a7ac53e57cc68..b38d7fd5bc492 100644 --- a/pkg/networkpath/traceroute/tcp/utils_test.go +++ b/pkg/networkpath/traceroute/tcp/utils_test.go @@ -305,15 +305,16 @@ func Test_parseTCP(t *testing.T) { expected: &tcpResponse{ SrcIP: srcIP, DstIP: dstIP, - TCPResponse: encodedTCPLayer, + TCPResponse: *encodedTCPLayer, }, errMsg: "", }, } + tp := newTCPParser() for _, test := range tt { t.Run(test.description, func(t *testing.T) { - actual, err := parseTCP(test.inHeader, test.inPayload) + actual, err := tp.parseTCP(test.inHeader, test.inPayload) if test.errMsg != "" { require.Error(t, err) assert.Contains(t, err.Error(), test.errMsg) @@ -331,6 +332,24 @@ func Test_parseTCP(t *testing.T) { } } +func BenchmarkParseTCP(b *testing.B) { + ipv4Header := createMockIPv4Header(srcIP, dstIP, 6) // 6 is TCP + tcpLayer := createMockTCPLayer(12345, 443, 28394, 12737, true, true, true) + + // full packet + _, fullTCPPacket := createMockTCPPacket(ipv4Header, tcpLayer) + + tp := newTCPParser() + + b.ResetTimer() + for i := 0; i < b.N; i++ { + _, err := tp.parseTCP(ipv4Header, fullTCPPacket) + if err != nil { + b.Fatal(err) + } + } +} + func (m *mockRawConn) SetReadDeadline(t time.Time) error { if m.setReadDeadlineErr != nil { return m.setReadDeadlineErr diff --git a/pkg/obfuscate/go.mod b/pkg/obfuscate/go.mod index a7c0724c78d7a..487bf4de5b631 100644 --- a/pkg/obfuscate/go.mod +++ b/pkg/obfuscate/go.mod @@ -4,7 +4,7 @@ go 1.22.0 require ( github.com/DataDog/datadog-go/v5 v5.5.0 - github.com/DataDog/go-sqllexer v0.0.15 + github.com/DataDog/go-sqllexer v0.0.16 github.com/outcaste-io/ristretto v0.2.1 github.com/stretchr/testify v1.9.0 go.uber.org/atomic v1.10.0 @@ -17,7 +17,7 @@ require ( github.com/dustin/go-humanize v1.0.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/net v0.29.0 // indirect - golang.org/x/sys v0.25.0 // indirect + golang.org/x/net v0.30.0 // indirect + golang.org/x/sys v0.26.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/obfuscate/go.sum b/pkg/obfuscate/go.sum index b0f04b3e03b2f..e58cf0c1e6e5c 100644 --- a/pkg/obfuscate/go.sum +++ b/pkg/obfuscate/go.sum @@ -1,7 +1,7 @@ github.com/DataDog/datadog-go/v5 v5.5.0 h1:G5KHeB8pWBNXT4Jtw0zAkhdxEAWSpWH00geHI6LDrKU= github.com/DataDog/datadog-go/v5 v5.5.0/go.mod h1:K9kcYBlxkcPP8tvvjZZKs/m1edNAUFzBbdpTUKfCsuw= -github.com/DataDog/go-sqllexer v0.0.15 h1:rUUu52dP8EQhJLnUw0MIAxZp0BQx2fOTuMztr3vtHUU= -github.com/DataDog/go-sqllexer v0.0.15/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc= +github.com/DataDog/go-sqllexer v0.0.16 h1:RoSUMS6MECyB3gTUIdydzXwK5NhEhv6GMJkS7ptsgRA= +github.com/DataDog/go-sqllexer v0.0.16/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc= github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/Microsoft/go-winio v0.5.1 h1:aPJp2QD7OOrhO5tQXqQoGSJc+DjDtWTGLOmNyAm6FgY= github.com/Microsoft/go-winio v0.5.1/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= @@ -45,8 +45,8 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 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-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -57,8 +57,8 @@ golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= diff --git a/pkg/process/checks/container.go b/pkg/process/checks/container.go index 590cb8f9ac359..8d9c8330ebd47 100644 --- a/pkg/process/checks/container.go +++ b/pkg/process/checks/container.go @@ -56,7 +56,7 @@ func (c *ContainerCheck) Init(syscfg *SysProbeConfig, info *HostInfo, _ bool) er c.containerProvider = proccontainers.GetSharedContainerProvider(c.wmeta) c.hostInfo = info - var tu *net.RemoteSysProbeUtil + var tu net.SysProbeUtil var err error if syscfg.NetworkTracerModuleEnabled { // Calling the remote tracer will cause it to initialize and check connectivity diff --git a/pkg/process/checks/net.go b/pkg/process/checks/net.go index 13b33d87f9dca..816ae56a42134 100644 --- a/pkg/process/checks/net.go +++ b/pkg/process/checks/net.go @@ -505,7 +505,7 @@ func convertAndEnrichWithServiceCtx(tags []string, tagOffsets []uint32, serviceC } // fetches network_id from the current netNS or from the system probe if necessary, where the root netNS is used -func retryGetNetworkID(sysProbeUtil *net.RemoteSysProbeUtil) (string, error) { +func retryGetNetworkID(sysProbeUtil net.SysProbeUtil) (string, error) { networkID, err := cloudproviders.GetNetworkID(context.TODO()) if err != nil && sysProbeUtil != nil { log.Infof("no network ID detected. retrying via system-probe: %s", err) diff --git a/pkg/process/checks/process.go b/pkg/process/checks/process.go index 5d905a135702c..05a7ac5c72d28 100644 --- a/pkg/process/checks/process.go +++ b/pkg/process/checks/process.go @@ -136,7 +136,7 @@ func (p *ProcessCheck) Init(syscfg *SysProbeConfig, info *HostInfo, oneShot bool p.notInitializedLogLimit = log.NewLogLimit(1, time.Minute*10) - var tu *net.RemoteSysProbeUtil + var tu net.SysProbeUtil var err error if syscfg.NetworkTracerModuleEnabled { // Calling the remote tracer will cause it to initialize and check connectivity @@ -657,7 +657,7 @@ func skipProcess( return false } -func (p *ProcessCheck) getRemoteSysProbeUtil() *net.RemoteSysProbeUtil { +func (p *ProcessCheck) getRemoteSysProbeUtil() net.SysProbeUtil { if !p.sysProbeConfig.ProcessModuleEnabled { return nil } diff --git a/pkg/process/checks/process_rt.go b/pkg/process/checks/process_rt.go index 9fd866a735ce6..33bf93f06a793 100644 --- a/pkg/process/checks/process_rt.go +++ b/pkg/process/checks/process_rt.go @@ -160,7 +160,7 @@ func calculateRate(cur, prev uint64, before time.Time) float32 { } // mergeStatWithSysprobeStats takes a process by PID map and fill the stats from system probe into the processes in the map -func mergeStatWithSysprobeStats(pids []int32, stats map[int32]*procutil.Stats, pu *net.RemoteSysProbeUtil) { +func mergeStatWithSysprobeStats(pids []int32, stats map[int32]*procutil.Stats, pu net.SysProbeUtil) { pStats, err := pu.GetProcStats(pids) if err == nil { for pid, stats := range stats { diff --git a/pkg/process/net/check.go b/pkg/process/net/check.go index 6ff1c50dc259c..748c3dacd52cf 100644 --- a/pkg/process/net/check.go +++ b/pkg/process/net/check.go @@ -19,6 +19,7 @@ import ( ebpfcheck "github.com/DataDog/datadog-agent/pkg/collector/corechecks/ebpf/probe/ebpfcheck/model" oomkill "github.com/DataDog/datadog-agent/pkg/collector/corechecks/ebpf/probe/oomkill/model" tcpqueuelength "github.com/DataDog/datadog-agent/pkg/collector/corechecks/ebpf/probe/tcpqueuelength/model" + gpu "github.com/DataDog/datadog-agent/pkg/collector/corechecks/gpu/model" ) const ( @@ -67,6 +68,13 @@ func (r *RemoteSysProbeUtil) GetCheck(module sysconfigtypes.ModuleName) (interfa return nil, err } return stats, nil + } else if module == sysconfig.GPUMonitoringModule { + var stats gpu.GPUStats + err = json.Unmarshal(body, &stats) + if err != nil { + return nil, err + } + return stats, nil } return nil, fmt.Errorf("invalid check name: %s", module) diff --git a/pkg/process/net/common.go b/pkg/process/net/common.go index 252361f6d8983..8af3c4e7e65bb 100644 --- a/pkg/process/net/common.go +++ b/pkg/process/net/common.go @@ -65,8 +65,11 @@ type RemoteSysProbeUtil struct { tracerouteClient http.Client } +// ensure that GetRemoteSystemProbeUtil implements SysProbeUtilGetter +var _ SysProbeUtilGetter = GetRemoteSystemProbeUtil + // GetRemoteSystemProbeUtil returns a ready to use RemoteSysProbeUtil. It is backed by a shared singleton. -func GetRemoteSystemProbeUtil(path string) (*RemoteSysProbeUtil, error) { +func GetRemoteSystemProbeUtil(path string) (SysProbeUtil, error) { err := CheckPath(path) if err != nil { return nil, fmt.Errorf("error setting up remote system probe util, %v", err) diff --git a/pkg/process/net/common_unsupported.go b/pkg/process/net/common_unsupported.go index af7eaef555926..0d0a502236ad5 100644 --- a/pkg/process/net/common_unsupported.go +++ b/pkg/process/net/common_unsupported.go @@ -9,12 +9,18 @@ package net import ( + "time" + model "github.com/DataDog/agent-payload/v5/process" + sysconfigtypes "github.com/DataDog/datadog-agent/cmd/system-probe/config/types" + discoverymodel "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/model" "github.com/DataDog/datadog-agent/pkg/languagedetection/languagemodels" + nppayload "github.com/DataDog/datadog-agent/pkg/networkpath/payload" ) var _ SysProbeUtil = &RemoteSysProbeUtil{} +var _ SysProbeUtilGetter = GetRemoteSystemProbeUtil // RemoteSysProbeUtil is not supported type RemoteSysProbeUtil struct{} @@ -29,7 +35,7 @@ func CheckPath(_ string) error { // GetRemoteSystemProbeUtil is not supported // //nolint:revive // TODO(PROC) Fix revive linter -func GetRemoteSystemProbeUtil(_ string) (*RemoteSysProbeUtil, error) { +func GetRemoteSystemProbeUtil(_ string) (SysProbeUtil, error) { return &RemoteSysProbeUtil{}, ErrNotImplemented } @@ -76,3 +82,19 @@ func (r *RemoteSysProbeUtil) GetPprof(_ string) ([]byte, error) { // GetTelemetry is not supported func (r *RemoteSysProbeUtil) GetTelemetry() ([]byte, error) { return nil, ErrNotImplemented } + +func (r *RemoteSysProbeUtil) GetDiscoveryServices() (*discoverymodel.ServicesResponse, error) { + return nil, ErrNotImplemented +} + +func (r *RemoteSysProbeUtil) GetCheck(module sysconfigtypes.ModuleName) (interface{}, error) { + return nil, ErrNotImplemented +} + +func (r *RemoteSysProbeUtil) GetPing(clientID string, host string, count int, interval time.Duration, timeout time.Duration) ([]byte, error) { + return nil, ErrNotImplemented +} + +func (r *RemoteSysProbeUtil) GetTraceroute(clientID string, host string, port uint16, protocol nppayload.Protocol, maxTTL uint8, timeout time.Duration) ([]byte, error) { + return nil, ErrNotImplemented +} diff --git a/pkg/process/net/mocks/sys_probe_util.go b/pkg/process/net/mocks/sys_probe_util.go index c4a1bc3492645..1e623aac6cc23 100644 --- a/pkg/process/net/mocks/sys_probe_util.go +++ b/pkg/process/net/mocks/sys_probe_util.go @@ -3,9 +3,18 @@ package mocks import ( + languagemodels "github.com/DataDog/datadog-agent/pkg/languagedetection/languagemodels" mock "github.com/stretchr/testify/mock" + model "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/model" + + payload "github.com/DataDog/datadog-agent/pkg/networkpath/payload" + process "github.com/DataDog/agent-payload/v5/process" + + time "time" + + types "github.com/DataDog/datadog-agent/cmd/system-probe/config/types" ) // SysProbeUtil is an autogenerated mock type for the SysProbeUtil type @@ -13,6 +22,130 @@ type SysProbeUtil struct { mock.Mock } +type SysProbeUtil_Expecter struct { + mock *mock.Mock +} + +func (_m *SysProbeUtil) EXPECT() *SysProbeUtil_Expecter { + return &SysProbeUtil_Expecter{mock: &_m.Mock} +} + +// DetectLanguage provides a mock function with given fields: pids +func (_m *SysProbeUtil) DetectLanguage(pids []int32) ([]languagemodels.Language, error) { + ret := _m.Called(pids) + + if len(ret) == 0 { + panic("no return value specified for DetectLanguage") + } + + var r0 []languagemodels.Language + var r1 error + if rf, ok := ret.Get(0).(func([]int32) ([]languagemodels.Language, error)); ok { + return rf(pids) + } + if rf, ok := ret.Get(0).(func([]int32) []languagemodels.Language); ok { + r0 = rf(pids) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]languagemodels.Language) + } + } + + if rf, ok := ret.Get(1).(func([]int32) error); ok { + r1 = rf(pids) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SysProbeUtil_DetectLanguage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DetectLanguage' +type SysProbeUtil_DetectLanguage_Call struct { + *mock.Call +} + +// DetectLanguage is a helper method to define mock.On call +// - pids []int32 +func (_e *SysProbeUtil_Expecter) DetectLanguage(pids interface{}) *SysProbeUtil_DetectLanguage_Call { + return &SysProbeUtil_DetectLanguage_Call{Call: _e.mock.On("DetectLanguage", pids)} +} + +func (_c *SysProbeUtil_DetectLanguage_Call) Run(run func(pids []int32)) *SysProbeUtil_DetectLanguage_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]int32)) + }) + return _c +} + +func (_c *SysProbeUtil_DetectLanguage_Call) Return(_a0 []languagemodels.Language, _a1 error) *SysProbeUtil_DetectLanguage_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SysProbeUtil_DetectLanguage_Call) RunAndReturn(run func([]int32) ([]languagemodels.Language, error)) *SysProbeUtil_DetectLanguage_Call { + _c.Call.Return(run) + return _c +} + +// GetCheck provides a mock function with given fields: module +func (_m *SysProbeUtil) GetCheck(module types.ModuleName) (interface{}, error) { + ret := _m.Called(module) + + if len(ret) == 0 { + panic("no return value specified for GetCheck") + } + + var r0 interface{} + var r1 error + if rf, ok := ret.Get(0).(func(types.ModuleName) (interface{}, error)); ok { + return rf(module) + } + if rf, ok := ret.Get(0).(func(types.ModuleName) interface{}); ok { + r0 = rf(module) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(interface{}) + } + } + + if rf, ok := ret.Get(1).(func(types.ModuleName) error); ok { + r1 = rf(module) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SysProbeUtil_GetCheck_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCheck' +type SysProbeUtil_GetCheck_Call struct { + *mock.Call +} + +// GetCheck is a helper method to define mock.On call +// - module types.ModuleName +func (_e *SysProbeUtil_Expecter) GetCheck(module interface{}) *SysProbeUtil_GetCheck_Call { + return &SysProbeUtil_GetCheck_Call{Call: _e.mock.On("GetCheck", module)} +} + +func (_c *SysProbeUtil_GetCheck_Call) Run(run func(module types.ModuleName)) *SysProbeUtil_GetCheck_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(types.ModuleName)) + }) + return _c +} + +func (_c *SysProbeUtil_GetCheck_Call) Return(_a0 interface{}, _a1 error) *SysProbeUtil_GetCheck_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SysProbeUtil_GetCheck_Call) RunAndReturn(run func(types.ModuleName) (interface{}, error)) *SysProbeUtil_GetCheck_Call { + _c.Call.Return(run) + return _c +} + // GetConnections provides a mock function with given fields: clientID func (_m *SysProbeUtil) GetConnections(clientID string) (*process.Connections, error) { ret := _m.Called(clientID) @@ -43,6 +176,91 @@ func (_m *SysProbeUtil) GetConnections(clientID string) (*process.Connections, e return r0, r1 } +// SysProbeUtil_GetConnections_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetConnections' +type SysProbeUtil_GetConnections_Call struct { + *mock.Call +} + +// GetConnections is a helper method to define mock.On call +// - clientID string +func (_e *SysProbeUtil_Expecter) GetConnections(clientID interface{}) *SysProbeUtil_GetConnections_Call { + return &SysProbeUtil_GetConnections_Call{Call: _e.mock.On("GetConnections", clientID)} +} + +func (_c *SysProbeUtil_GetConnections_Call) Run(run func(clientID string)) *SysProbeUtil_GetConnections_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *SysProbeUtil_GetConnections_Call) Return(_a0 *process.Connections, _a1 error) *SysProbeUtil_GetConnections_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SysProbeUtil_GetConnections_Call) RunAndReturn(run func(string) (*process.Connections, error)) *SysProbeUtil_GetConnections_Call { + _c.Call.Return(run) + return _c +} + +// GetDiscoveryServices provides a mock function with given fields: +func (_m *SysProbeUtil) GetDiscoveryServices() (*model.ServicesResponse, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetDiscoveryServices") + } + + var r0 *model.ServicesResponse + var r1 error + if rf, ok := ret.Get(0).(func() (*model.ServicesResponse, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() *model.ServicesResponse); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*model.ServicesResponse) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SysProbeUtil_GetDiscoveryServices_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDiscoveryServices' +type SysProbeUtil_GetDiscoveryServices_Call struct { + *mock.Call +} + +// GetDiscoveryServices is a helper method to define mock.On call +func (_e *SysProbeUtil_Expecter) GetDiscoveryServices() *SysProbeUtil_GetDiscoveryServices_Call { + return &SysProbeUtil_GetDiscoveryServices_Call{Call: _e.mock.On("GetDiscoveryServices")} +} + +func (_c *SysProbeUtil_GetDiscoveryServices_Call) Run(run func()) *SysProbeUtil_GetDiscoveryServices_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SysProbeUtil_GetDiscoveryServices_Call) Return(_a0 *model.ServicesResponse, _a1 error) *SysProbeUtil_GetDiscoveryServices_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SysProbeUtil_GetDiscoveryServices_Call) RunAndReturn(run func() (*model.ServicesResponse, error)) *SysProbeUtil_GetDiscoveryServices_Call { + _c.Call.Return(run) + return _c +} + // GetNetworkID provides a mock function with given fields: func (_m *SysProbeUtil) GetNetworkID() (string, error) { ret := _m.Called() @@ -71,6 +289,153 @@ func (_m *SysProbeUtil) GetNetworkID() (string, error) { return r0, r1 } +// SysProbeUtil_GetNetworkID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetNetworkID' +type SysProbeUtil_GetNetworkID_Call struct { + *mock.Call +} + +// GetNetworkID is a helper method to define mock.On call +func (_e *SysProbeUtil_Expecter) GetNetworkID() *SysProbeUtil_GetNetworkID_Call { + return &SysProbeUtil_GetNetworkID_Call{Call: _e.mock.On("GetNetworkID")} +} + +func (_c *SysProbeUtil_GetNetworkID_Call) Run(run func()) *SysProbeUtil_GetNetworkID_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SysProbeUtil_GetNetworkID_Call) Return(_a0 string, _a1 error) *SysProbeUtil_GetNetworkID_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SysProbeUtil_GetNetworkID_Call) RunAndReturn(run func() (string, error)) *SysProbeUtil_GetNetworkID_Call { + _c.Call.Return(run) + return _c +} + +// GetPing provides a mock function with given fields: clientID, host, count, interval, timeout +func (_m *SysProbeUtil) GetPing(clientID string, host string, count int, interval time.Duration, timeout time.Duration) ([]byte, error) { + ret := _m.Called(clientID, host, count, interval, timeout) + + if len(ret) == 0 { + panic("no return value specified for GetPing") + } + + var r0 []byte + var r1 error + if rf, ok := ret.Get(0).(func(string, string, int, time.Duration, time.Duration) ([]byte, error)); ok { + return rf(clientID, host, count, interval, timeout) + } + if rf, ok := ret.Get(0).(func(string, string, int, time.Duration, time.Duration) []byte); ok { + r0 = rf(clientID, host, count, interval, timeout) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]byte) + } + } + + if rf, ok := ret.Get(1).(func(string, string, int, time.Duration, time.Duration) error); ok { + r1 = rf(clientID, host, count, interval, timeout) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SysProbeUtil_GetPing_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPing' +type SysProbeUtil_GetPing_Call struct { + *mock.Call +} + +// GetPing is a helper method to define mock.On call +// - clientID string +// - host string +// - count int +// - interval time.Duration +// - timeout time.Duration +func (_e *SysProbeUtil_Expecter) GetPing(clientID interface{}, host interface{}, count interface{}, interval interface{}, timeout interface{}) *SysProbeUtil_GetPing_Call { + return &SysProbeUtil_GetPing_Call{Call: _e.mock.On("GetPing", clientID, host, count, interval, timeout)} +} + +func (_c *SysProbeUtil_GetPing_Call) Run(run func(clientID string, host string, count int, interval time.Duration, timeout time.Duration)) *SysProbeUtil_GetPing_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(int), args[3].(time.Duration), args[4].(time.Duration)) + }) + return _c +} + +func (_c *SysProbeUtil_GetPing_Call) Return(_a0 []byte, _a1 error) *SysProbeUtil_GetPing_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SysProbeUtil_GetPing_Call) RunAndReturn(run func(string, string, int, time.Duration, time.Duration) ([]byte, error)) *SysProbeUtil_GetPing_Call { + _c.Call.Return(run) + return _c +} + +// GetPprof provides a mock function with given fields: path +func (_m *SysProbeUtil) GetPprof(path string) ([]byte, error) { + ret := _m.Called(path) + + if len(ret) == 0 { + panic("no return value specified for GetPprof") + } + + var r0 []byte + var r1 error + if rf, ok := ret.Get(0).(func(string) ([]byte, error)); ok { + return rf(path) + } + if rf, ok := ret.Get(0).(func(string) []byte); ok { + r0 = rf(path) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]byte) + } + } + + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(path) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SysProbeUtil_GetPprof_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPprof' +type SysProbeUtil_GetPprof_Call struct { + *mock.Call +} + +// GetPprof is a helper method to define mock.On call +// - path string +func (_e *SysProbeUtil_Expecter) GetPprof(path interface{}) *SysProbeUtil_GetPprof_Call { + return &SysProbeUtil_GetPprof_Call{Call: _e.mock.On("GetPprof", path)} +} + +func (_c *SysProbeUtil_GetPprof_Call) Run(run func(path string)) *SysProbeUtil_GetPprof_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *SysProbeUtil_GetPprof_Call) Return(_a0 []byte, _a1 error) *SysProbeUtil_GetPprof_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SysProbeUtil_GetPprof_Call) RunAndReturn(run func(string) ([]byte, error)) *SysProbeUtil_GetPprof_Call { + _c.Call.Return(run) + return _c +} + // GetProcStats provides a mock function with given fields: pids func (_m *SysProbeUtil) GetProcStats(pids []int32) (*process.ProcStatsWithPermByPID, error) { ret := _m.Called(pids) @@ -101,6 +466,34 @@ func (_m *SysProbeUtil) GetProcStats(pids []int32) (*process.ProcStatsWithPermBy return r0, r1 } +// SysProbeUtil_GetProcStats_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetProcStats' +type SysProbeUtil_GetProcStats_Call struct { + *mock.Call +} + +// GetProcStats is a helper method to define mock.On call +// - pids []int32 +func (_e *SysProbeUtil_Expecter) GetProcStats(pids interface{}) *SysProbeUtil_GetProcStats_Call { + return &SysProbeUtil_GetProcStats_Call{Call: _e.mock.On("GetProcStats", pids)} +} + +func (_c *SysProbeUtil_GetProcStats_Call) Run(run func(pids []int32)) *SysProbeUtil_GetProcStats_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]int32)) + }) + return _c +} + +func (_c *SysProbeUtil_GetProcStats_Call) Return(_a0 *process.ProcStatsWithPermByPID, _a1 error) *SysProbeUtil_GetProcStats_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SysProbeUtil_GetProcStats_Call) RunAndReturn(run func([]int32) (*process.ProcStatsWithPermByPID, error)) *SysProbeUtil_GetProcStats_Call { + _c.Call.Return(run) + return _c +} + // GetStats provides a mock function with given fields: func (_m *SysProbeUtil) GetStats() (map[string]interface{}, error) { ret := _m.Called() @@ -131,6 +524,33 @@ func (_m *SysProbeUtil) GetStats() (map[string]interface{}, error) { return r0, r1 } +// SysProbeUtil_GetStats_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetStats' +type SysProbeUtil_GetStats_Call struct { + *mock.Call +} + +// GetStats is a helper method to define mock.On call +func (_e *SysProbeUtil_Expecter) GetStats() *SysProbeUtil_GetStats_Call { + return &SysProbeUtil_GetStats_Call{Call: _e.mock.On("GetStats")} +} + +func (_c *SysProbeUtil_GetStats_Call) Run(run func()) *SysProbeUtil_GetStats_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SysProbeUtil_GetStats_Call) Return(_a0 map[string]interface{}, _a1 error) *SysProbeUtil_GetStats_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SysProbeUtil_GetStats_Call) RunAndReturn(run func() (map[string]interface{}, error)) *SysProbeUtil_GetStats_Call { + _c.Call.Return(run) + return _c +} + // GetTelemetry provides a mock function with given fields: func (_m *SysProbeUtil) GetTelemetry() ([]byte, error) { ret := _m.Called() @@ -161,6 +581,96 @@ func (_m *SysProbeUtil) GetTelemetry() ([]byte, error) { return r0, r1 } +// SysProbeUtil_GetTelemetry_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTelemetry' +type SysProbeUtil_GetTelemetry_Call struct { + *mock.Call +} + +// GetTelemetry is a helper method to define mock.On call +func (_e *SysProbeUtil_Expecter) GetTelemetry() *SysProbeUtil_GetTelemetry_Call { + return &SysProbeUtil_GetTelemetry_Call{Call: _e.mock.On("GetTelemetry")} +} + +func (_c *SysProbeUtil_GetTelemetry_Call) Run(run func()) *SysProbeUtil_GetTelemetry_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SysProbeUtil_GetTelemetry_Call) Return(_a0 []byte, _a1 error) *SysProbeUtil_GetTelemetry_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SysProbeUtil_GetTelemetry_Call) RunAndReturn(run func() ([]byte, error)) *SysProbeUtil_GetTelemetry_Call { + _c.Call.Return(run) + return _c +} + +// GetTraceroute provides a mock function with given fields: clientID, host, port, protocol, maxTTL, timeout +func (_m *SysProbeUtil) GetTraceroute(clientID string, host string, port uint16, protocol payload.Protocol, maxTTL uint8, timeout time.Duration) ([]byte, error) { + ret := _m.Called(clientID, host, port, protocol, maxTTL, timeout) + + if len(ret) == 0 { + panic("no return value specified for GetTraceroute") + } + + var r0 []byte + var r1 error + if rf, ok := ret.Get(0).(func(string, string, uint16, payload.Protocol, uint8, time.Duration) ([]byte, error)); ok { + return rf(clientID, host, port, protocol, maxTTL, timeout) + } + if rf, ok := ret.Get(0).(func(string, string, uint16, payload.Protocol, uint8, time.Duration) []byte); ok { + r0 = rf(clientID, host, port, protocol, maxTTL, timeout) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]byte) + } + } + + if rf, ok := ret.Get(1).(func(string, string, uint16, payload.Protocol, uint8, time.Duration) error); ok { + r1 = rf(clientID, host, port, protocol, maxTTL, timeout) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SysProbeUtil_GetTraceroute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTraceroute' +type SysProbeUtil_GetTraceroute_Call struct { + *mock.Call +} + +// GetTraceroute is a helper method to define mock.On call +// - clientID string +// - host string +// - port uint16 +// - protocol payload.Protocol +// - maxTTL uint8 +// - timeout time.Duration +func (_e *SysProbeUtil_Expecter) GetTraceroute(clientID interface{}, host interface{}, port interface{}, protocol interface{}, maxTTL interface{}, timeout interface{}) *SysProbeUtil_GetTraceroute_Call { + return &SysProbeUtil_GetTraceroute_Call{Call: _e.mock.On("GetTraceroute", clientID, host, port, protocol, maxTTL, timeout)} +} + +func (_c *SysProbeUtil_GetTraceroute_Call) Run(run func(clientID string, host string, port uint16, protocol payload.Protocol, maxTTL uint8, timeout time.Duration)) *SysProbeUtil_GetTraceroute_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(uint16), args[3].(payload.Protocol), args[4].(uint8), args[5].(time.Duration)) + }) + return _c +} + +func (_c *SysProbeUtil_GetTraceroute_Call) Return(_a0 []byte, _a1 error) *SysProbeUtil_GetTraceroute_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SysProbeUtil_GetTraceroute_Call) RunAndReturn(run func(string, string, uint16, payload.Protocol, uint8, time.Duration) ([]byte, error)) *SysProbeUtil_GetTraceroute_Call { + _c.Call.Return(run) + return _c +} + // Register provides a mock function with given fields: clientID func (_m *SysProbeUtil) Register(clientID string) error { ret := _m.Called(clientID) @@ -179,6 +689,34 @@ func (_m *SysProbeUtil) Register(clientID string) error { return r0 } +// SysProbeUtil_Register_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Register' +type SysProbeUtil_Register_Call struct { + *mock.Call +} + +// Register is a helper method to define mock.On call +// - clientID string +func (_e *SysProbeUtil_Expecter) Register(clientID interface{}) *SysProbeUtil_Register_Call { + return &SysProbeUtil_Register_Call{Call: _e.mock.On("Register", clientID)} +} + +func (_c *SysProbeUtil_Register_Call) Run(run func(clientID string)) *SysProbeUtil_Register_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *SysProbeUtil_Register_Call) Return(_a0 error) *SysProbeUtil_Register_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SysProbeUtil_Register_Call) RunAndReturn(run func(string) error) *SysProbeUtil_Register_Call { + _c.Call.Return(run) + return _c +} + // NewSysProbeUtil creates a new instance of SysProbeUtil. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewSysProbeUtil(t interface { diff --git a/pkg/process/net/shared.go b/pkg/process/net/shared.go index b54f7ab7087e7..4ebc5bd45a294 100644 --- a/pkg/process/net/shared.go +++ b/pkg/process/net/shared.go @@ -5,7 +5,20 @@ package net -import model "github.com/DataDog/agent-payload/v5/process" +import ( + "time" + + model "github.com/DataDog/agent-payload/v5/process" + + sysconfigtypes "github.com/DataDog/datadog-agent/cmd/system-probe/config/types" + discoverymodel "github.com/DataDog/datadog-agent/pkg/collector/corechecks/servicediscovery/model" + "github.com/DataDog/datadog-agent/pkg/languagedetection/languagemodels" + nppayload "github.com/DataDog/datadog-agent/pkg/networkpath/payload" +) + +// SysProbeUtilGetter is a function that returns a SysProbeUtil for the given path +// The standard implementation is GetRemoteSysProbeUtil +type SysProbeUtilGetter func(string) (SysProbeUtil, error) // SysProbeUtil fetches info from the SysProbe running remotely type SysProbeUtil interface { @@ -15,4 +28,10 @@ type SysProbeUtil interface { Register(clientID string) error GetNetworkID() (string, error) GetTelemetry() ([]byte, error) + DetectLanguage(pids []int32) ([]languagemodels.Language, error) + GetPprof(path string) ([]byte, error) + GetDiscoveryServices() (*discoverymodel.ServicesResponse, error) + GetCheck(module sysconfigtypes.ModuleName) (interface{}, error) + GetPing(clientID string, host string, count int, interval time.Duration, timeout time.Duration) ([]byte, error) + GetTraceroute(clientID string, host string, port uint16, protocol nppayload.Protocol, maxTTL uint8, timeout time.Duration) ([]byte, error) } diff --git a/pkg/process/util/api/go.mod b/pkg/process/util/api/go.mod index c1c198ad5405b..1bcc96b677c36 100644 --- a/pkg/process/util/api/go.mod +++ b/pkg/process/util/api/go.mod @@ -51,7 +51,7 @@ require ( go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/sys v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/process/util/api/go.sum b/pkg/process/util/api/go.sum index 3eaa77954a6b5..31bb57e5c15c3 100644 --- a/pkg/process/util/api/go.sum +++ b/pkg/process/util/api/go.sum @@ -101,8 +101,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ 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-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/pkg/proto/datadog/model/v1/model.proto b/pkg/proto/datadog/model/v1/model.proto index aae1416c47c8c..506f90fa95702 100644 --- a/pkg/proto/datadog/model/v1/model.proto +++ b/pkg/proto/datadog/model/v1/model.proto @@ -31,8 +31,10 @@ message CaptureTriggerResponse { message StreamTagsRequest { TagCardinality cardinality = 1; - Filter includeFilter = 2; - Filter excludeFilter = 3; + DeprecatedFilter includeFilter = 2; + DeprecatedFilter excludeFilter = 3; + repeated string prefixes = 4; + string streamingID = 5; } message StreamTagsResponse { @@ -56,7 +58,7 @@ enum TagCardinality { HIGH = 2; } -message Filter { +message DeprecatedFilter { string kubeNamespace = 1; string image = 2; string containerName = 3; diff --git a/pkg/proto/go.mod b/pkg/proto/go.mod index 6e5b0027d7733..e9ce81cfdd31d 100644 --- a/pkg/proto/go.mod +++ b/pkg/proto/go.mod @@ -23,9 +23,9 @@ require ( github.com/philhofer/fwd v1.1.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/vmihailenco/tagparser v0.1.1 // indirect - golang.org/x/net v0.29.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/net v0.30.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect diff --git a/pkg/proto/go.sum b/pkg/proto/go.sum index 8a46487cfe547..7b63b9dd847a2 100644 --- a/pkg/proto/go.sum +++ b/pkg/proto/go.sum @@ -78,8 +78,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -100,8 +100,8 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= @@ -110,8 +110,8 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= 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= diff --git a/pkg/proto/pbgo/core/model.pb.go b/pkg/proto/pbgo/core/model.pb.go index 7e5838a862438..cd3ae8350b00d 100644 --- a/pkg/proto/pbgo/core/model.pb.go +++ b/pkg/proto/pbgo/core/model.pb.go @@ -320,9 +320,11 @@ type StreamTagsRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Cardinality TagCardinality `protobuf:"varint,1,opt,name=cardinality,proto3,enum=datadog.model.v1.TagCardinality" json:"cardinality,omitempty"` - IncludeFilter *Filter `protobuf:"bytes,2,opt,name=includeFilter,proto3" json:"includeFilter,omitempty"` - ExcludeFilter *Filter `protobuf:"bytes,3,opt,name=excludeFilter,proto3" json:"excludeFilter,omitempty"` + Cardinality TagCardinality `protobuf:"varint,1,opt,name=cardinality,proto3,enum=datadog.model.v1.TagCardinality" json:"cardinality,omitempty"` + IncludeFilter *DeprecatedFilter `protobuf:"bytes,2,opt,name=includeFilter,proto3" json:"includeFilter,omitempty"` + ExcludeFilter *DeprecatedFilter `protobuf:"bytes,3,opt,name=excludeFilter,proto3" json:"excludeFilter,omitempty"` + Prefixes []string `protobuf:"bytes,4,rep,name=prefixes,proto3" json:"prefixes,omitempty"` + StreamingID string `protobuf:"bytes,5,opt,name=streamingID,proto3" json:"streamingID,omitempty"` } func (x *StreamTagsRequest) Reset() { @@ -364,20 +366,34 @@ func (x *StreamTagsRequest) GetCardinality() TagCardinality { return TagCardinality_LOW } -func (x *StreamTagsRequest) GetIncludeFilter() *Filter { +func (x *StreamTagsRequest) GetIncludeFilter() *DeprecatedFilter { if x != nil { return x.IncludeFilter } return nil } -func (x *StreamTagsRequest) GetExcludeFilter() *Filter { +func (x *StreamTagsRequest) GetExcludeFilter() *DeprecatedFilter { if x != nil { return x.ExcludeFilter } return nil } +func (x *StreamTagsRequest) GetPrefixes() []string { + if x != nil { + return x.Prefixes + } + return nil +} + +func (x *StreamTagsRequest) GetStreamingID() string { + if x != nil { + return x.StreamingID + } + return "" +} + type StreamTagsResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -480,7 +496,7 @@ func (x *StreamTagsEvent) GetEntity() *Entity { return nil } -type Filter struct { +type DeprecatedFilter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -490,8 +506,8 @@ type Filter struct { ContainerName string `protobuf:"bytes,3,opt,name=containerName,proto3" json:"containerName,omitempty"` } -func (x *Filter) Reset() { - *x = Filter{} +func (x *DeprecatedFilter) Reset() { + *x = DeprecatedFilter{} if protoimpl.UnsafeEnabled { mi := &file_datadog_model_v1_model_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -499,13 +515,13 @@ func (x *Filter) Reset() { } } -func (x *Filter) String() string { +func (x *DeprecatedFilter) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Filter) ProtoMessage() {} +func (*DeprecatedFilter) ProtoMessage() {} -func (x *Filter) ProtoReflect() protoreflect.Message { +func (x *DeprecatedFilter) ProtoReflect() protoreflect.Message { mi := &file_datadog_model_v1_model_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -517,26 +533,26 @@ func (x *Filter) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Filter.ProtoReflect.Descriptor instead. -func (*Filter) Descriptor() ([]byte, []int) { +// Deprecated: Use DeprecatedFilter.ProtoReflect.Descriptor instead. +func (*DeprecatedFilter) Descriptor() ([]byte, []int) { return file_datadog_model_v1_model_proto_rawDescGZIP(), []int{7} } -func (x *Filter) GetKubeNamespace() string { +func (x *DeprecatedFilter) GetKubeNamespace() string { if x != nil { return x.KubeNamespace } return "" } -func (x *Filter) GetImage() string { +func (x *DeprecatedFilter) GetImage() string { if x != nil { return x.Image } return "" } -func (x *Filter) GetContainerName() string { +func (x *DeprecatedFilter) GetContainerName() string { if x != nil { return x.ContainerName } @@ -1013,120 +1029,126 @@ var file_datadog_model_v1_model_proto_rawDesc = []byte{ 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x2c, 0x0a, 0x16, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0xd7, 0x01, 0x0a, 0x11, 0x53, 0x74, 0x72, 0x65, + 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x22, 0xa9, 0x02, 0x0a, 0x11, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, 0x61, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x0b, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x67, 0x43, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0b, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, - 0x79, 0x12, 0x3e, 0x0a, 0x0d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x46, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, - 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x52, 0x0d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x12, 0x3e, 0x0a, 0x0d, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x46, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, - 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x52, 0x0d, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x22, 0x4f, 0x0a, 0x12, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, 0x61, 0x67, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, - 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x54, 0x61, 0x67, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, - 0x74, 0x73, 0x22, 0x74, 0x0a, 0x0f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, 0x61, 0x67, 0x73, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, - 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, - 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x52, 0x06, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x22, 0x6a, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, - 0x65, 0x72, 0x12, 0x24, 0x0a, 0x0d, 0x6b, 0x75, 0x62, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6b, 0x75, 0x62, 0x65, 0x4e, - 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x24, - 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, - 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x90, 0x02, 0x0a, 0x06, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, - 0x2a, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x64, 0x61, - 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x45, - 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x64, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x68, - 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, - 0x30, 0x0a, 0x13, 0x68, 0x69, 0x67, 0x68, 0x43, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, - 0x74, 0x79, 0x54, 0x61, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x13, 0x68, 0x69, - 0x67, 0x68, 0x43, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x54, 0x61, 0x67, - 0x73, 0x12, 0x40, 0x0a, 0x1b, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x6f, - 0x72, 0x43, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x54, 0x61, 0x67, 0x73, - 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x1b, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, - 0x61, 0x74, 0x6f, 0x72, 0x43, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x54, - 0x61, 0x67, 0x73, 0x12, 0x2e, 0x0a, 0x12, 0x6c, 0x6f, 0x77, 0x43, 0x61, 0x72, 0x64, 0x69, 0x6e, - 0x61, 0x6c, 0x69, 0x74, 0x79, 0x54, 0x61, 0x67, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x12, 0x6c, 0x6f, 0x77, 0x43, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x54, - 0x61, 0x67, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x54, - 0x61, 0x67, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x74, 0x61, 0x6e, 0x64, - 0x61, 0x72, 0x64, 0x54, 0x61, 0x67, 0x73, 0x22, 0x84, 0x01, 0x0a, 0x12, 0x46, 0x65, 0x74, 0x63, - 0x68, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x64, 0x61, 0x74, - 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, - 0x74, 0x69, 0x74, 0x79, 0x49, 0x64, 0x52, 0x02, 0x69, 0x64, 0x12, 0x42, 0x0a, 0x0b, 0x63, 0x61, - 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x20, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, - 0x76, 0x31, 0x2e, 0x54, 0x61, 0x67, 0x43, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, - 0x79, 0x52, 0x0b, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x22, 0x99, - 0x01, 0x0a, 0x13, 0x46, 0x65, 0x74, 0x63, 0x68, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, - 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x64, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x42, 0x0a, 0x0b, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, - 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, - 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x67, 0x43, 0x61, - 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0b, 0x63, 0x61, 0x72, 0x64, 0x69, - 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x22, 0x34, 0x0a, 0x08, 0x45, 0x6e, - 0x74, 0x69, 0x74, 0x79, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x10, - 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, - 0x22, 0xc2, 0x01, 0x0a, 0x10, 0x55, 0x6e, 0x69, 0x78, 0x44, 0x6f, 0x67, 0x73, 0x74, 0x61, 0x74, - 0x73, 0x64, 0x4d, 0x73, 0x67, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x69, - 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, - 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x70, 0x69, - 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x6e, 0x63, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x79, 0x53, 0x69, - 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x61, 0x6e, 0x63, 0x69, 0x6c, 0x6c, - 0x61, 0x72, 0x79, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6e, 0x63, 0x69, 0x6c, - 0x6c, 0x61, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x61, 0x6e, 0x63, 0x69, - 0x6c, 0x6c, 0x61, 0x72, 0x79, 0x22, 0x9f, 0x02, 0x0a, 0x0b, 0x54, 0x61, 0x67, 0x67, 0x65, 0x72, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3e, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, - 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x67, 0x67, 0x65, 0x72, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, - 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x41, 0x0a, 0x06, 0x70, 0x69, 0x64, 0x4d, 0x61, 0x70, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, - 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x67, 0x67, 0x65, 0x72, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x2e, 0x50, 0x69, 0x64, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x06, 0x70, 0x69, 0x64, 0x4d, 0x61, 0x70, 0x1a, 0x52, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2e, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, + 0x79, 0x12, 0x48, 0x0a, 0x0d, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x46, 0x69, 0x6c, 0x74, + 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, + 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x70, 0x72, + 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0d, 0x69, 0x6e, + 0x63, 0x6c, 0x75, 0x64, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x48, 0x0a, 0x0d, 0x65, + 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, + 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x52, 0x0d, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x46, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, + 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, + 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x49, 0x44, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, + 0x67, 0x49, 0x44, 0x22, 0x4f, 0x0a, 0x12, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, 0x61, 0x67, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x06, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x64, 0x61, 0x74, 0x61, + 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x54, 0x61, 0x67, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x73, 0x22, 0x74, 0x0a, 0x0f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, 0x61, + 0x67, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, + 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, + 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x52, 0x06, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x22, 0x74, 0x0a, 0x10, 0x44, 0x65, + 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x24, + 0x0a, 0x0d, 0x6b, 0x75, 0x62, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6b, 0x75, 0x62, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, + 0x70, 0x61, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6f, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, + 0x22, 0x90, 0x02, 0x0a, 0x06, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x2a, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, - 0x50, 0x69, 0x64, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x2d, 0x0a, 0x13, 0x54, 0x61, 0x67, 0x67, 0x65, - 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, - 0x0a, 0x06, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, - 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x2a, 0x31, 0x0a, 0x09, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x44, 0x44, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, - 0x0a, 0x08, 0x4d, 0x4f, 0x44, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, - 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x02, 0x2a, 0x35, 0x0a, 0x0e, 0x54, 0x61, 0x67, - 0x43, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x07, 0x0a, 0x03, 0x4c, - 0x4f, 0x57, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x52, 0x43, 0x48, 0x45, 0x53, 0x54, 0x52, - 0x41, 0x54, 0x4f, 0x52, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x49, 0x47, 0x48, 0x10, 0x02, - 0x42, 0x15, 0x5a, 0x13, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x62, - 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x79, 0x49, 0x64, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x30, 0x0a, 0x13, 0x68, + 0x69, 0x67, 0x68, 0x43, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x54, 0x61, + 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x13, 0x68, 0x69, 0x67, 0x68, 0x43, 0x61, + 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x54, 0x61, 0x67, 0x73, 0x12, 0x40, 0x0a, + 0x1b, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x43, 0x61, 0x72, + 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x54, 0x61, 0x67, 0x73, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x1b, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x6f, 0x72, + 0x43, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x54, 0x61, 0x67, 0x73, 0x12, + 0x2e, 0x0a, 0x12, 0x6c, 0x6f, 0x77, 0x43, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, + 0x79, 0x54, 0x61, 0x67, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x6c, 0x6f, 0x77, + 0x43, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x54, 0x61, 0x67, 0x73, 0x12, + 0x22, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x54, 0x61, 0x67, 0x73, 0x18, + 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x54, + 0x61, 0x67, 0x73, 0x22, 0x84, 0x01, 0x0a, 0x12, 0x46, 0x65, 0x74, 0x63, 0x68, 0x45, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, + 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x49, 0x64, 0x52, 0x02, 0x69, 0x64, 0x12, 0x42, 0x0a, 0x0b, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, + 0x61, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x64, 0x61, + 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x54, + 0x61, 0x67, 0x43, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0b, 0x63, + 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x22, 0x99, 0x01, 0x0a, 0x13, 0x46, + 0x65, 0x74, 0x63, 0x68, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x76, + 0x31, 0x2e, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x64, 0x52, 0x02, 0x69, 0x64, 0x12, 0x42, + 0x0a, 0x0b, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x67, 0x43, 0x61, 0x72, 0x64, 0x69, 0x6e, + 0x61, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0b, 0x63, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x6c, 0x69, + 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x22, 0x34, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0xc2, 0x01, 0x0a, + 0x10, 0x55, 0x6e, 0x69, 0x78, 0x44, 0x6f, 0x67, 0x73, 0x74, 0x61, 0x74, 0x73, 0x64, 0x4d, 0x73, + 0x67, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, + 0x20, 0x0a, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x69, 0x7a, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x70, + 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x70, 0x69, 0x64, 0x12, 0x24, 0x0a, + 0x0d, 0x61, 0x6e, 0x63, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x79, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x61, 0x6e, 0x63, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x79, 0x53, + 0x69, 0x7a, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6e, 0x63, 0x69, 0x6c, 0x6c, 0x61, 0x72, 0x79, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x61, 0x6e, 0x63, 0x69, 0x6c, 0x6c, 0x61, 0x72, + 0x79, 0x22, 0x9f, 0x02, 0x0a, 0x0b, 0x54, 0x61, 0x67, 0x67, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x12, 0x3e, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x28, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, + 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x67, 0x67, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x2e, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x12, 0x41, 0x0a, 0x06, 0x70, 0x69, 0x64, 0x4d, 0x61, 0x70, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x29, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x61, 0x67, 0x67, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x2e, 0x50, 0x69, 0x64, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x70, 0x69, + 0x64, 0x4d, 0x61, 0x70, 0x1a, 0x52, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2e, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x50, 0x69, 0x64, 0x4d, + 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x22, 0x2d, 0x0a, 0x13, 0x54, 0x61, 0x67, 0x67, 0x65, 0x72, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x6f, + 0x61, 0x64, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6c, 0x6f, 0x61, 0x64, + 0x65, 0x64, 0x2a, 0x31, 0x0a, 0x09, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x09, 0x0a, 0x05, 0x41, 0x44, 0x44, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x4d, 0x4f, + 0x44, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, 0x4c, 0x45, + 0x54, 0x45, 0x44, 0x10, 0x02, 0x2a, 0x35, 0x0a, 0x0e, 0x54, 0x61, 0x67, 0x43, 0x61, 0x72, 0x64, + 0x69, 0x6e, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x07, 0x0a, 0x03, 0x4c, 0x4f, 0x57, 0x10, 0x00, + 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x52, 0x43, 0x48, 0x45, 0x53, 0x54, 0x52, 0x41, 0x54, 0x4f, 0x52, + 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x49, 0x47, 0x48, 0x10, 0x02, 0x42, 0x15, 0x5a, 0x13, + 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x62, 0x67, 0x6f, 0x2f, 0x63, + 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1153,7 +1175,7 @@ var file_datadog_model_v1_model_proto_goTypes = []interface{}{ (*StreamTagsRequest)(nil), // 6: datadog.model.v1.StreamTagsRequest (*StreamTagsResponse)(nil), // 7: datadog.model.v1.StreamTagsResponse (*StreamTagsEvent)(nil), // 8: datadog.model.v1.StreamTagsEvent - (*Filter)(nil), // 9: datadog.model.v1.Filter + (*DeprecatedFilter)(nil), // 9: datadog.model.v1.DeprecatedFilter (*Entity)(nil), // 10: datadog.model.v1.Entity (*FetchEntityRequest)(nil), // 11: datadog.model.v1.FetchEntityRequest (*FetchEntityResponse)(nil), // 12: datadog.model.v1.FetchEntityResponse @@ -1166,8 +1188,8 @@ var file_datadog_model_v1_model_proto_goTypes = []interface{}{ } var file_datadog_model_v1_model_proto_depIdxs = []int32{ 1, // 0: datadog.model.v1.StreamTagsRequest.cardinality:type_name -> datadog.model.v1.TagCardinality - 9, // 1: datadog.model.v1.StreamTagsRequest.includeFilter:type_name -> datadog.model.v1.Filter - 9, // 2: datadog.model.v1.StreamTagsRequest.excludeFilter:type_name -> datadog.model.v1.Filter + 9, // 1: datadog.model.v1.StreamTagsRequest.includeFilter:type_name -> datadog.model.v1.DeprecatedFilter + 9, // 2: datadog.model.v1.StreamTagsRequest.excludeFilter:type_name -> datadog.model.v1.DeprecatedFilter 8, // 3: datadog.model.v1.StreamTagsResponse.events:type_name -> datadog.model.v1.StreamTagsEvent 0, // 4: datadog.model.v1.StreamTagsEvent.type:type_name -> datadog.model.v1.EventType 10, // 5: datadog.model.v1.StreamTagsEvent.entity:type_name -> datadog.model.v1.Entity @@ -1277,7 +1299,7 @@ func file_datadog_model_v1_model_proto_init() { } } file_datadog_model_v1_model_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Filter); i { + switch v := v.(*DeprecatedFilter); i { case 0: return &v.state case 1: diff --git a/pkg/proto/pbgo/core/remoteconfig.pb.go b/pkg/proto/pbgo/core/remoteconfig.pb.go index 3320b1a82e6f4..c5910deb8fe1f 100644 --- a/pkg/proto/pbgo/core/remoteconfig.pb.go +++ b/pkg/proto/pbgo/core/remoteconfig.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 -// protoc v3.21.7 +// protoc-gen-go v1.34.0 +// protoc v5.26.1 // source: datadog/remoteconfig/remoteconfig.proto package core diff --git a/pkg/proto/pbgo/trace/span_gen.go b/pkg/proto/pbgo/trace/span_gen.go index c1b148714d3ce..f08192b31b01b 100644 --- a/pkg/proto/pbgo/trace/span_gen.go +++ b/pkg/proto/pbgo/trace/span_gen.go @@ -273,7 +273,7 @@ func (z *Span) UnmarshalMsg(bts []byte) (o []byte, err error) { err = msgp.WrapError(err, "Metrics") return } - if z.Metrics == nil && zb0003 > 0 { + if z.Metrics == nil && zb0003 > 0{ z.Metrics = make(map[string]float64, zb0003) } else if len(z.Metrics) > 0 { for key := range z.Metrics { diff --git a/pkg/remoteconfig/state/go.mod b/pkg/remoteconfig/state/go.mod index 1a8fceac8c34e..61276dc0bfa1d 100644 --- a/pkg/remoteconfig/state/go.mod +++ b/pkg/remoteconfig/state/go.mod @@ -12,6 +12,6 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.27.0 // indirect + golang.org/x/crypto v0.28.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/remoteconfig/state/go.sum b/pkg/remoteconfig/state/go.sum index e33e862c686bb..3235ddeb45913 100644 --- a/pkg/remoteconfig/state/go.sum +++ b/pkg/remoteconfig/state/go.sum @@ -16,10 +16,10 @@ github.com/secure-systems-lab/go-securesystemslib v0.7.0 h1:OwvJ5jQf9LnIAS83waAj github.com/secure-systems-lab/go-securesystemslib v0.7.0/go.mod h1:/2gYnlnHVQ6xeGtfIqFy7Do03K4cdCY0A/GlJLDKLHI= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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= diff --git a/pkg/sbom/scanner/scanner_test.go b/pkg/sbom/scanner/scanner_test.go index e10743f19828d..06b0cc1e6a588 100644 --- a/pkg/sbom/scanner/scanner_test.go +++ b/pkg/sbom/scanner/scanner_test.go @@ -11,7 +11,6 @@ package scanner import ( "context" "errors" - "strings" "testing" "time" @@ -21,6 +20,7 @@ import ( workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def" workloadmetafxmock "github.com/DataDog/datadog-agent/comp/core/workloadmeta/fx-mock" workloadmetamock "github.com/DataDog/datadog-agent/comp/core/workloadmeta/mock" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" "github.com/DataDog/datadog-agent/pkg/config/model" "github.com/DataDog/datadog-agent/pkg/sbom" "github.com/DataDog/datadog-agent/pkg/sbom/collectors" @@ -105,6 +105,8 @@ func TestRetryLogic_Error(t *testing.T) { }, } { t.Run(tt.name, func(t *testing.T) { + cfg := configmock.New(t) + // Create a mock collector collName := "mock" mockCollector := collectors.NewMockCollector() @@ -120,7 +122,6 @@ func TestRetryLogic_Error(t *testing.T) { mockCollector.On("Type").Return(tt.st) // Set up the configuration as the default one is too slow - cfg := model.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) cfg.Set("sbom.scan_queue.base_backoff", "200ms", model.SourceAgentRuntime) cfg.Set("sbom.scan_queue.max_backoff", "600ms", model.SourceAgentRuntime) cfg.Set("sbom.cache.clean_interval", "10s", model.SourceAgentRuntime) // Required for the ticker @@ -155,6 +156,8 @@ func TestRetryLogic_Error(t *testing.T) { } func TestRetryLogic_ImageDeleted(t *testing.T) { + cfg := configmock.New(t) + // Create a workload meta global store workloadmetaStore := fxutil.Test[workloadmetamock.Mock](t, fx.Options( fx.Provide(func() log.Component { return logmock.New(t) }), @@ -185,7 +188,6 @@ func TestRetryLogic_ImageDeleted(t *testing.T) { mockCollector.On("Type").Return(collectors.ContainerImageScanType) // Set up the configuration as the default one is too slow - cfg := model.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) cfg.Set("sbom.scan_queue.base_backoff", "200ms", model.SourceAgentRuntime) cfg.Set("sbom.scan_queue.max_backoff", "600ms", model.SourceAgentRuntime) cfg.Set("sbom.cache.clean_interval", "10s", model.SourceAgentRuntime) // Required for the ticker @@ -221,6 +223,7 @@ func TestRetryLogic_ImageDeleted(t *testing.T) { // Test retry handling in case of an error when sending the result to a full channel func TestRetryChannelFull(t *testing.T) { + cfg := configmock.New(t) // Create a workload meta global store workloadmetaStore := fxutil.Test[workloadmetamock.Mock](t, fx.Options( fx.Provide(func() log.Component { return logmock.New(t) }), @@ -250,7 +253,6 @@ func TestRetryChannelFull(t *testing.T) { mockCollector.On("Type").Return(collectors.ContainerImageScanType) // Set up the configuration - cfg := model.NewConfig("datadog", "DD", strings.NewReplacer(".", "_")) cfg.Set("sbom.scan_queue.base_backoff", "200ms", model.SourceAgentRuntime) cfg.Set("sbom.scan_queue.max_backoff", "600ms", model.SourceAgentRuntime) cfg.Set("sbom.cache.clean_interval", "10s", model.SourceAgentRuntime) // Required for the ticker diff --git a/pkg/security/ebpf/c/include/helpers/activity_dump.h b/pkg/security/ebpf/c/include/helpers/activity_dump.h index be6ff4a927f0f..82ed6834e10fb 100644 --- a/pkg/security/ebpf/c/include/helpers/activity_dump.h +++ b/pkg/security/ebpf/c/include/helpers/activity_dump.h @@ -100,10 +100,11 @@ __attribute__((always_inline)) u64 trace_new_cgroup(void *ctx, u64 now, containe return 0; } - if (cgroup->cgroup_flags != 0 && ((cgroup->cgroup_flags & 0b111) != CGROUP_MANAGER_SYSTEMD)) { - copy_container_id(container_id, evt->container.container_id); + if ((cgroup->cgroup_flags & 0b111) == CGROUP_MANAGER_SYSTEMD) { + return 0; } + copy_container_id(container_id, evt->container.container_id); evt->container.cgroup_context = *cgroup; evt->cookie = cookie; evt->config = config; diff --git a/pkg/security/ebpf/c/include/maps.h b/pkg/security/ebpf/c/include/maps.h index 4dea16af729fd..2d567c8e2c0c5 100644 --- a/pkg/security/ebpf/c/include/maps.h +++ b/pkg/security/ebpf/c/include/maps.h @@ -98,6 +98,5 @@ BPF_PROG_ARRAY(dentry_resolver_kprobe_or_fentry_progs, 6) BPF_PROG_ARRAY(dentry_resolver_tracepoint_progs, 3) BPF_PROG_ARRAY(classifier_router, 100) BPF_PROG_ARRAY(sys_exit_progs, 64) -BPF_PROG_ARRAY(raw_packet_filters, 10) #endif diff --git a/pkg/security/ebpf/probes/event_types.go b/pkg/security/ebpf/probes/event_types.go index 2c3d19d637464..af983f34329b0 100644 --- a/pkg/security/ebpf/probes/event_types.go +++ b/pkg/security/ebpf/probes/event_types.go @@ -12,6 +12,7 @@ import ( manager "github.com/DataDog/ebpf-manager" "github.com/DataDog/datadog-agent/pkg/security/secl/compiler/eval" + "github.com/DataDog/datadog-agent/pkg/security/secl/model" "github.com/DataDog/datadog-agent/pkg/security/utils" ) @@ -449,24 +450,6 @@ func GetSelectorsPerEventType(fentry bool) map[eval.EventType][]manager.ProbesSe &manager.BestEffort{Selectors: ExpandSyscallProbesSelector(SecurityAgentUID, "bind", fentry, EntryAndExit)}, }, - // List of probes required to capture DNS events - "dns": { - &manager.AllOf{Selectors: []manager.ProbesSelector{ - &manager.AllOf{Selectors: NetworkSelectors()}, - &manager.AllOf{Selectors: NetworkVethSelectors()}, - kprobeOrFentry("security_socket_bind"), - }}, - }, - - // List of probes required to capture IMDS events - "imds": { - &manager.AllOf{Selectors: []manager.ProbesSelector{ - &manager.AllOf{Selectors: NetworkSelectors()}, - &manager.AllOf{Selectors: NetworkVethSelectors()}, - kprobeOrFentry("security_socket_bind"), - }}, - }, - // List of probes required to capture chdir events "chdir": { &manager.AllOf{Selectors: []manager.ProbesSelector{ @@ -477,11 +460,25 @@ func GetSelectorsPerEventType(fentry bool) map[eval.EventType][]manager.ProbesSe }, } + // Add probes required to track network interfaces and map network flows to processes + // networkEventTypes: dns, imds, packet + networkEventTypes := model.GetEventTypePerCategory(model.NetworkCategory)[model.NetworkCategory] + for _, networkEventType := range networkEventTypes { + selectorsPerEventTypeStore[networkEventType] = []manager.ProbesSelector{ + &manager.AllOf{Selectors: []manager.ProbesSelector{ + &manager.AllOf{Selectors: NetworkSelectors()}, + &manager.AllOf{Selectors: NetworkVethSelectors()}, + }}, + } + } + // add probes depending on loaded modules loadedModules, err := utils.FetchLoadedModules() if err == nil { if _, ok := loadedModules["nf_nat"]; ok { - selectorsPerEventTypeStore["dns"] = append(selectorsPerEventTypeStore["dns"], NetworkNFNatSelectors()...) + for _, networkEventType := range networkEventTypes { + selectorsPerEventTypeStore[networkEventType] = append(selectorsPerEventTypeStore[networkEventType], NetworkNFNatSelectors()...) + } } } diff --git a/pkg/security/events/rate_limiter.go b/pkg/security/events/rate_limiter.go index 2c800f00565f1..77d1999349043 100644 --- a/pkg/security/events/rate_limiter.go +++ b/pkg/security/events/rate_limiter.go @@ -35,14 +35,14 @@ const ( ) var ( - defaultPerRuleLimiters = map[eval.RuleID]Limiter{ - RulesetLoadedRuleID: NewStdLimiter(rate.Inf, 1), // No limit on ruleset loaded - HeartbeatRuleID: NewStdLimiter(rate.Inf, 1), // No limit on heartbeat - AbnormalPathRuleID: NewStdLimiter(rate.Every(30*time.Second), 1), - NoProcessContextErrorRuleID: NewStdLimiter(rate.Every(30*time.Second), 1), - BrokenProcessLineageErrorRuleID: NewStdLimiter(rate.Every(30*time.Second), 1), - EBPFLessHelloMessageRuleID: NewStdLimiter(rate.Inf, 1), // No limit on hello message - InternalCoreDumpRuleID: NewStdLimiter(rate.Every(30*time.Second), 1), + defaultPerRuleLimiters = map[eval.RuleID]rate.Limit{ + RulesetLoadedRuleID: rate.Inf, // No limit on ruleset loaded + HeartbeatRuleID: rate.Inf, // No limit on heartbeat + AbnormalPathRuleID: rate.Every(30 * time.Second), + NoProcessContextErrorRuleID: rate.Every(30 * time.Second), + BrokenProcessLineageErrorRuleID: rate.Every(30 * time.Second), + EBPFLessHelloMessageRuleID: rate.Inf, // No limit on hello message + InternalCoreDumpRuleID: rate.Every(30 * time.Second), } ) @@ -72,8 +72,8 @@ func NewRateLimiter(config *config.RuntimeSecurityConfig, client statsd.ClientIn } func (rl *RateLimiter) applyBaseLimitersFromDefault(limiters map[string]Limiter) { - for id, limiter := range defaultPerRuleLimiters { - limiters[id] = limiter + for id, rate := range defaultPerRuleLimiters { + limiters[id] = NewStdLimiter(rate, 1) } limiter, err := NewAnomalyDetectionLimiter(rl.config.AnomalyDetectionRateLimiterNumKeys, rl.config.AnomalyDetectionRateLimiterNumEventsAllowed, rl.config.AnomalyDetectionRateLimiterPeriod) diff --git a/pkg/security/module/cws.go b/pkg/security/module/cws.go index 1ec45284e524d..e27a7c80d8da3 100644 --- a/pkg/security/module/cws.go +++ b/pkg/security/module/cws.go @@ -10,10 +10,12 @@ import ( "context" "errors" "fmt" + "runtime" "sync" "time" "github.com/DataDog/datadog-go/v5/statsd" + "go.uber.org/atomic" workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def" "github.com/DataDog/datadog-agent/pkg/eventmonitor" @@ -30,6 +32,12 @@ import ( "github.com/DataDog/datadog-agent/pkg/security/seclog" "github.com/DataDog/datadog-agent/pkg/security/serializers" "github.com/DataDog/datadog-agent/pkg/security/telemetry" + "github.com/DataDog/datadog-agent/pkg/security/utils" +) + +const ( + maxSelftestRetry = 3 + selftestDelay = 5 * time.Second ) // CWSConsumer represents the system-probe module for the runtime security agent @@ -50,6 +58,7 @@ type CWSConsumer struct { grpcServer *GRPCServer ruleEngine *rulesmodule.RuleEngine selfTester *selftests.SelfTester + selfTestRetry *atomic.Int32 reloader ReloaderInterface crtelemetry *telemetry.ContainersRunningTelemetry } @@ -90,6 +99,7 @@ func NewCWSConsumer(evm *eventmonitor.EventMonitor, cfg *config.RuntimeSecurityC sendStatsChan: make(chan chan bool, 1), grpcServer: NewGRPCServer(family, address), selfTester: selfTester, + selfTestRetry: atomic.NewInt32(0), reloader: NewReloader(), crtelemetry: crtelemetry, } @@ -170,11 +180,22 @@ func (c *CWSConsumer) Start() error { // we can now wait for self test events cb := func(success []eval.RuleID, fails []eval.RuleID, testEvents map[eval.RuleID]*serializers.EventSerializer) { + seclog.Debugf("self-test results : success : %v, failed : %v, retry %d/%d", success, fails, c.selfTestRetry.Load()+1, maxSelftestRetry) + + if len(fails) > 0 && c.selfTestRetry.Load() < maxSelftestRetry { + c.selfTestRetry.Inc() + + time.Sleep(selftestDelay) + + if _, err := c.RunSelfTest(false); err != nil { + seclog.Errorf("self-test error: %s", err) + } + return + } + if c.config.SelfTestSendReport { c.reportSelfTest(success, fails, testEvents) } - - seclog.Debugf("self-test results : success : %v, failed : %v", success, fails) } if c.selfTester != nil { go c.selfTester.WaitForResult(cb) @@ -226,6 +247,9 @@ func (c *CWSConsumer) reportSelfTest(success []eval.RuleID, fails []eval.RuleID, tags := []string{ fmt.Sprintf("success:%d", len(success)), fmt.Sprintf("fails:%d", len(fails)), + fmt.Sprintf("os:%s", runtime.GOOS), + fmt.Sprintf("arch:%s", utils.RuntimeArch()), + fmt.Sprintf("origin:%s", c.probe.Origin()), } if err := c.statsdClient.Count(metrics.MetricSelfTest, 1, tags, 1.0); err != nil { seclog.Errorf("failed to send self_test metric: %s", err) diff --git a/pkg/security/module/grpc.go b/pkg/security/module/grpc.go index 7320713cc9fe6..c2b7f1e6c8be3 100644 --- a/pkg/security/module/grpc.go +++ b/pkg/security/module/grpc.go @@ -19,18 +19,19 @@ import ( // GRPCServer defines a gRPC server type GRPCServer struct { - server *grpc.Server - netListener net.Listener - wg sync.WaitGroup - family string - address string + server *grpc.Server + wg sync.WaitGroup + family string + address string } // NewGRPCServer returns a new gRPC server func NewGRPCServer(family string, address string) *GRPCServer { // force socket cleanup of previous socket not cleanup if family == "unix" { - _ = os.Remove(address) + if err := os.Remove(address); err != nil && !os.IsNotExist(err) { + seclog.Errorf("error removing the previous runtime security socket: %v", err) + } } return &GRPCServer{ @@ -53,8 +54,6 @@ func (g *GRPCServer) Start() error { } } - g.netListener = ln - g.wg.Add(1) go func() { defer g.wg.Done() @@ -73,10 +72,9 @@ func (g *GRPCServer) Stop() { g.server.Stop() } - if g.netListener != nil { - g.netListener.Close() - if g.family == "unix" { - _ = os.Remove(g.address) + if g.family == "unix" { + if err := os.Remove(g.address); err != nil && !os.IsNotExist(err) { + seclog.Errorf("error removing the runtime security socket: %v", err) } } diff --git a/pkg/security/probe/actions.go b/pkg/security/probe/actions.go index 4f1ac2a46621e..3e53dcc77c6a8 100644 --- a/pkg/security/probe/actions.go +++ b/pkg/security/probe/actions.go @@ -17,19 +17,31 @@ import ( "github.com/DataDog/datadog-agent/pkg/security/utils" ) +// KillActionStatus defines the status of a kill action +type KillActionStatus string + +const ( + // KillActionStatusPerformed indicates the kill action was performed + KillActionStatusPerformed KillActionStatus = "performed" + // KillActionStatusRuleDisarmed indicates the kill action was skipped because the rule was disarmed + KillActionStatusRuleDisarmed KillActionStatus = "rule_disarmed" +) + // KillActionReport defines a kill action reports type KillActionReport struct { sync.RWMutex - Signal string - Scope string - Pid uint32 - CreatedAt time.Time - DetectedAt time.Time - KilledAt time.Time - ExitedAt time.Time + Signal string + Scope string + Status KillActionStatus + CreatedAt time.Time + DetectedAt time.Time + KilledAt time.Time + ExitedAt time.Time + DisarmerType string // internal + Pid uint32 resolved bool rule *rules.Rule } @@ -37,14 +49,16 @@ type KillActionReport struct { // JKillActionReport used to serialize date // easyjson:json type JKillActionReport struct { - Type string `json:"type"` - Signal string `json:"signal"` - Scope string `json:"scope"` - CreatedAt utils.EasyjsonTime `json:"created_at"` - DetectedAt utils.EasyjsonTime `json:"detected_at"` - KilledAt utils.EasyjsonTime `json:"killed_at"` - ExitedAt *utils.EasyjsonTime `json:"exited_at,omitempty"` - TTR string `json:"ttr,omitempty"` + Type string `json:"type"` + Signal string `json:"signal"` + Scope string `json:"scope"` + Status string `json:"status"` + DisarmerType string `json:"disarmer_type,omitempty"` + CreatedAt utils.EasyjsonTime `json:"created_at"` + DetectedAt utils.EasyjsonTime `json:"detected_at"` + KilledAt *utils.EasyjsonTime `json:"killed_at,omitempty"` + ExitedAt *utils.EasyjsonTime `json:"exited_at,omitempty"` + TTR string `json:"ttr,omitempty"` } // IsResolved return if the action is resolved @@ -53,7 +67,7 @@ func (k *KillActionReport) IsResolved() bool { defer k.RUnlock() // for sigkill wait for exit - return k.Signal != "SIGKILL" || k.resolved + return k.Signal != "SIGKILL" || k.resolved || k.Status == KillActionStatusRuleDisarmed } // ToJSON marshal the action @@ -62,13 +76,15 @@ func (k *KillActionReport) ToJSON() ([]byte, error) { defer k.RUnlock() jk := JKillActionReport{ - Type: rules.KillAction, - Signal: k.Signal, - Scope: k.Scope, - CreatedAt: utils.NewEasyjsonTime(k.CreatedAt), - DetectedAt: utils.NewEasyjsonTime(k.DetectedAt), - KilledAt: utils.NewEasyjsonTime(k.KilledAt), - ExitedAt: utils.NewEasyjsonTimeIfNotZero(k.ExitedAt), + Type: rules.KillAction, + Signal: k.Signal, + Scope: k.Scope, + Status: string(k.Status), + DisarmerType: k.DisarmerType, + CreatedAt: utils.NewEasyjsonTime(k.CreatedAt), + DetectedAt: utils.NewEasyjsonTime(k.DetectedAt), + KilledAt: utils.NewEasyjsonTimeIfNotZero(k.KilledAt), + ExitedAt: utils.NewEasyjsonTimeIfNotZero(k.ExitedAt), } if !k.ExitedAt.IsZero() { diff --git a/pkg/security/probe/actions_easyjson.go b/pkg/security/probe/actions_easyjson.go index 7229f234dc676..059c4bcf38117 100644 --- a/pkg/security/probe/actions_easyjson.go +++ b/pkg/security/probe/actions_easyjson.go @@ -43,6 +43,10 @@ func easyjsonB97b45a3DecodeGithubComDataDogDatadogAgentPkgSecurityProbe(in *jlex out.Signal = string(in.String()) case "scope": out.Scope = string(in.String()) + case "status": + out.Status = string(in.String()) + case "disarmer_type": + out.DisarmerType = string(in.String()) case "created_at": if data := in.Raw(); in.Ok() { in.AddError((out.CreatedAt).UnmarshalJSON(data)) @@ -52,8 +56,16 @@ func easyjsonB97b45a3DecodeGithubComDataDogDatadogAgentPkgSecurityProbe(in *jlex in.AddError((out.DetectedAt).UnmarshalJSON(data)) } case "killed_at": - if data := in.Raw(); in.Ok() { - in.AddError((out.KilledAt).UnmarshalJSON(data)) + if in.IsNull() { + in.Skip() + out.KilledAt = nil + } else { + if out.KilledAt == nil { + out.KilledAt = new(utils.EasyjsonTime) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.KilledAt).UnmarshalJSON(data)) + } } case "exited_at": if in.IsNull() { @@ -98,6 +110,16 @@ func easyjsonB97b45a3EncodeGithubComDataDogDatadogAgentPkgSecurityProbe(out *jwr out.RawString(prefix) out.String(string(in.Scope)) } + { + const prefix string = ",\"status\":" + out.RawString(prefix) + out.String(string(in.Status)) + } + if in.DisarmerType != "" { + const prefix string = ",\"disarmer_type\":" + out.RawString(prefix) + out.String(string(in.DisarmerType)) + } { const prefix string = ",\"created_at\":" out.RawString(prefix) @@ -108,10 +130,10 @@ func easyjsonB97b45a3EncodeGithubComDataDogDatadogAgentPkgSecurityProbe(out *jwr out.RawString(prefix) (in.DetectedAt).MarshalEasyJSON(out) } - { + if in.KilledAt != nil { const prefix string = ",\"killed_at\":" out.RawString(prefix) - (in.KilledAt).MarshalEasyJSON(out) + (*in.KilledAt).MarshalEasyJSON(out) } if in.ExitedAt != nil { const prefix string = ",\"exited_at\":" diff --git a/pkg/security/probe/constantfetch/btfhub/constants.json b/pkg/security/probe/constantfetch/btfhub/constants.json index f656a0ec99242..192841c9f4c6a 100644 --- a/pkg/security/probe/constantfetch/btfhub/constants.json +++ b/pkg/security/probe/constantfetch/btfhub/constants.json @@ -11869,6 +11869,13 @@ "uname_release": "4.14.352-268.568.amzn2.aarch64", "cindex": 3 }, + { + "distrib": "amzn", + "version": "2", + "arch": "arm64", + "uname_release": "4.14.352-268.569.amzn2.aarch64", + "cindex": 3 + }, { "distrib": "amzn", "version": "2", @@ -12681,6 +12688,13 @@ "uname_release": "4.14.352-268.568.amzn2.x86_64", "cindex": 8 }, + { + "distrib": "amzn", + "version": "2", + "arch": "x86_64", + "uname_release": "4.14.352-268.569.amzn2.x86_64", + "cindex": 8 + }, { "distrib": "amzn", "version": "2", @@ -18281,6 +18295,20 @@ "uname_release": "4.14.35-2047.540.4.1.el7uek.aarch64", "cindex": 89 }, + { + "distrib": "ol", + "version": "7", + "arch": "arm64", + "uname_release": "4.14.35-2047.540.4.2.el7uek.aarch64", + "cindex": 89 + }, + { + "distrib": "ol", + "version": "7", + "arch": "arm64", + "uname_release": "4.14.35-2047.541.4.1.el7uek.aarch64", + "cindex": 89 + }, { "distrib": "ol", "version": "7", @@ -20871,6 +20899,13 @@ "uname_release": "4.1.12-124.89.4.el7uek.x86_64", "cindex": 94 }, + { + "distrib": "ol", + "version": "7", + "arch": "x86_64", + "uname_release": "4.1.12-124.90.3.1.el7uek.x86_64", + "cindex": 94 + }, { "distrib": "ol", "version": "7", @@ -23734,6 +23769,13 @@ "uname_release": "4.14.35-2047.540.4.1.el7uek.x86_64", "cindex": 96 }, + { + "distrib": "ol", + "version": "7", + "arch": "x86_64", + "uname_release": "4.14.35-2047.540.4.2.el7uek.x86_64", + "cindex": 96 + }, { "distrib": "ol", "version": "7", @@ -23762,6 +23804,20 @@ "uname_release": "4.14.35-2047.541.3.el7uek.x86_64", "cindex": 96 }, + { + "distrib": "ol", + "version": "7", + "arch": "x86_64", + "uname_release": "4.14.35-2047.541.4.1.el7uek.x86_64", + "cindex": 96 + }, + { + "distrib": "ol", + "version": "7", + "arch": "x86_64", + "uname_release": "4.14.35-2047.542.1.el7uek.x86_64", + "cindex": 96 + }, { "distrib": "ol", "version": "7", diff --git a/pkg/security/probe/field_handlers_ebpf.go b/pkg/security/probe/field_handlers_ebpf.go index 6e391707cb57d..0f3d8d66b1d05 100644 --- a/pkg/security/probe/field_handlers_ebpf.go +++ b/pkg/security/probe/field_handlers_ebpf.go @@ -423,21 +423,27 @@ func (fh *EBPFFieldHandlers) ResolveAsync(ev *model.Event) bool { return ev.Async } +func (fh *EBPFFieldHandlers) resolveSBOMFields(ev *model.Event, f *model.FileEvent) { + // Force the resolution of file path to be able to map to a package provided file + if fh.ResolveFilePath(ev, f) == "" { + return + } + + if fh.resolvers.SBOMResolver == nil { + return + } + + if pkg := fh.resolvers.SBOMResolver.ResolvePackage(string(ev.ContainerContext.ContainerID), f); pkg != nil { + f.PkgName = pkg.Name + f.PkgVersion = pkg.Version + f.PkgSrcVersion = pkg.SrcVersion + } +} + // ResolvePackageName resolves the name of the package providing this file func (fh *EBPFFieldHandlers) ResolvePackageName(ev *model.Event, f *model.FileEvent) string { if f.PkgName == "" { - // Force the resolution of file path to be able to map to a package provided file - if fh.ResolveFilePath(ev, f) == "" { - return "" - } - - if fh.resolvers.SBOMResolver == nil { - return "" - } - - if pkg := fh.resolvers.SBOMResolver.ResolvePackage(string(ev.ContainerContext.ContainerID), f); pkg != nil { - f.PkgName = pkg.Name - } + fh.resolveSBOMFields(ev, f) } return f.PkgName } @@ -445,18 +451,7 @@ func (fh *EBPFFieldHandlers) ResolvePackageName(ev *model.Event, f *model.FileEv // ResolvePackageVersion resolves the version of the package providing this file func (fh *EBPFFieldHandlers) ResolvePackageVersion(ev *model.Event, f *model.FileEvent) string { if f.PkgVersion == "" { - // Force the resolution of file path to be able to map to a package provided file - if fh.ResolveFilePath(ev, f) == "" { - return "" - } - - if fh.resolvers.SBOMResolver == nil { - return "" - } - - if pkg := fh.resolvers.SBOMResolver.ResolvePackage(string(ev.ContainerContext.ContainerID), f); pkg != nil { - f.PkgVersion = pkg.Version - } + fh.resolveSBOMFields(ev, f) } return f.PkgVersion } @@ -464,18 +459,7 @@ func (fh *EBPFFieldHandlers) ResolvePackageVersion(ev *model.Event, f *model.Fil // ResolvePackageSourceVersion resolves the version of the source package of the package providing this file func (fh *EBPFFieldHandlers) ResolvePackageSourceVersion(ev *model.Event, f *model.FileEvent) string { if f.PkgSrcVersion == "" { - // Force the resolution of file path to be able to map to a package provided file - if fh.ResolveFilePath(ev, f) == "" { - return "" - } - - if fh.resolvers.SBOMResolver == nil { - return "" - } - - if pkg := fh.resolvers.SBOMResolver.ResolvePackage(string(ev.ContainerContext.ContainerID), f); pkg != nil { - f.PkgSrcVersion = pkg.SrcVersion - } + fh.resolveSBOMFields(ev, f) } return f.PkgSrcVersion } diff --git a/pkg/security/probe/kfilters/approvers.go b/pkg/security/probe/kfilters/approvers.go index 1314a54e958bb..7910f06771d78 100644 --- a/pkg/security/probe/kfilters/approvers.go +++ b/pkg/security/probe/kfilters/approvers.go @@ -162,7 +162,7 @@ func fimKFiltersGetter(eventType model.EventType, fields []eval.Field) kfiltersG fieldHandled = append(fieldHandled, handled...) } - kfs, handled, err := getProcessKFilters(model.FileOpenEventType, approvers) + kfs, handled, err := getProcessKFilters(eventType, approvers) if err != nil { return nil, nil, err } diff --git a/pkg/security/probe/kfilters/process.go b/pkg/security/probe/kfilters/process.go index 14d538765d882..84d65b3db9d3a 100644 --- a/pkg/security/probe/kfilters/process.go +++ b/pkg/security/probe/kfilters/process.go @@ -62,9 +62,10 @@ func getProcessKFilters(eventType model.EventType, approvers rules.Approvers) ([ switch value.Type { case eval.ScalarValueType: kfilters = append(kfilters, &eventMaskEntry{ - tableName: auidApproversTable, - tableKey: ebpf.Uint32MapItem(value.Value.(int)), - eventMask: uint64(1 << (eventType - 1)), + approverType: AUIDApproverType, + tableName: auidApproversTable, + tableKey: ebpf.Uint32MapItem(value.Value.(int)), + eventMask: uint64(1 << (eventType - 1)), }) case eval.RangeValueType: min, max := value.Value.(rules.RangeFilterValue).Min, value.Value.(rules.RangeFilterValue).Max diff --git a/pkg/security/probe/probe.go b/pkg/security/probe/probe.go index 0f550b77dec2c..18c91108643e7 100644 --- a/pkg/security/probe/probe.go +++ b/pkg/security/probe/probe.go @@ -47,6 +47,7 @@ type PlatformProbe interface { DumpDiscarders() (string, error) FlushDiscarders() error ApplyRuleSet(_ *rules.RuleSet) (*kfilters.ApplyRuleSetReport, error) + OnNewRuleSetLoaded(_ *rules.RuleSet) OnNewDiscarder(_ *rules.RuleSet, _ *model.Event, _ eval.Field, _ eval.EventType) HandleActions(_ *eval.Context, _ *rules.Rule) NewEvent() *model.Event @@ -229,10 +230,15 @@ func (p *Probe) FlushDiscarders() error { // ApplyRuleSet setup the probes for the provided set of rules and returns the policy report. func (p *Probe) ApplyRuleSet(rs *rules.RuleSet) (*kfilters.ApplyRuleSetReport, error) { + return p.PlatformProbe.ApplyRuleSet(rs) +} + +// OnNewRuleSetLoaded resets statistics and states once a new rule set is loaded +func (p *Probe) OnNewRuleSetLoaded(rs *rules.RuleSet) { p.ruleActionStatsLock.Lock() clear(p.ruleActionStats) p.ruleActionStatsLock.Unlock() - return p.PlatformProbe.ApplyRuleSet(rs) + p.PlatformProbe.OnNewRuleSetLoaded(rs) } // Snapshot runs the different snapshot functions of the resolvers that @@ -431,6 +437,11 @@ func (p *Probe) IsNetworkEnabled() bool { return p.Config.Probe.NetworkEnabled } +// IsNetworkRawPacketEnabled returns whether network raw packet is enabled +func (p *Probe) IsNetworkRawPacketEnabled() bool { + return p.IsNetworkEnabled() && p.Config.Probe.NetworkRawPacketEnabled +} + // IsActivityDumpEnabled returns whether activity dump is enabled func (p *Probe) IsActivityDumpEnabled() bool { return p.Config.RuntimeSecurity.ActivityDumpEnabled diff --git a/pkg/security/probe/probe_ebpf.go b/pkg/security/probe/probe_ebpf.go index 8e8ddff3d4142..f8bef7a775874 100644 --- a/pkg/security/probe/probe_ebpf.go +++ b/pkg/security/probe/probe_ebpf.go @@ -395,7 +395,7 @@ func (p *EBPFProbe) Setup() error { p.profileManagers.Start(p.ctx, &p.wg) - if p.config.Probe.NetworkRawPacketEnabled { + if p.probe.IsNetworkRawPacketEnabled() { if err := p.setupRawPacketProgs(); err != nil { return err } @@ -545,7 +545,7 @@ func (p *EBPFProbe) unmarshalContexts(data []byte, event *model.Event) (int, err } func eventWithNoProcessContext(eventType model.EventType) bool { - return eventType == model.DNSEventType || eventType == model.IMDSEventType || eventType == model.LoadModuleEventType || eventType == model.UnloadModuleEventType + return eventType == model.DNSEventType || eventType == model.IMDSEventType || eventType == model.RawPacketEventType || eventType == model.LoadModuleEventType || eventType == model.UnloadModuleEventType } func (p *EBPFProbe) unmarshalProcessCacheEntry(ev *model.Event, data []byte) (int, error) { @@ -1255,11 +1255,13 @@ func (p *EBPFProbe) isNeededForSecurityProfile(eventType eval.EventType) bool { } func (p *EBPFProbe) validEventTypeForConfig(eventType string) bool { - if eventType == "dns" && !p.config.Probe.NetworkEnabled { - return false - } - if eventType == "imds" && (!p.config.Probe.NetworkEnabled || !p.config.Probe.NetworkIngressEnabled) { - return false + switch eventType { + case "dns": + return p.probe.IsNetworkEnabled() + case "imds": + return p.probe.IsNetworkEnabled() && p.config.Probe.NetworkIngressEnabled + case "packet": + return p.probe.IsNetworkRawPacketEnabled() } return true } @@ -1648,8 +1650,6 @@ func (p *EBPFProbe) ApplyRuleSet(rs *rules.RuleSet) (*kfilters.ApplyRuleSetRepor // activity dump & security profiles needRawSyscalls := p.isNeededForActivityDump(model.SyscallsEventType.String()) - p.processKiller.Apply(rs) - // kill action if p.config.RuntimeSecurity.EnforcementEnabled && isKillActionPresent(rs) { if !p.config.RuntimeSecurity.EnforcementRawSyscallEnabled { @@ -1687,6 +1687,11 @@ func (p *EBPFProbe) ApplyRuleSet(rs *rules.RuleSet) (*kfilters.ApplyRuleSetRepor return ars, nil } +// OnNewRuleSetLoaded resets statistics and states once a new rule set is loaded +func (p *EBPFProbe) OnNewRuleSetLoaded(rs *rules.RuleSet) { + p.processKiller.Reset(rs) +} + // NewEvent returns a new event func (p *EBPFProbe) NewEvent() *model.Event { return NewEBPFEvent(p.fieldHandlers) diff --git a/pkg/security/probe/probe_ebpfless.go b/pkg/security/probe/probe_ebpfless.go index 8cdd164cb3655..ec7a807e2360a 100644 --- a/pkg/security/probe/probe_ebpfless.go +++ b/pkg/security/probe/probe_ebpfless.go @@ -580,11 +580,15 @@ func (p *EBPFLessProbe) FlushDiscarders() error { } // ApplyRuleSet applies the new ruleset -func (p *EBPFLessProbe) ApplyRuleSet(rs *rules.RuleSet) (*kfilters.ApplyRuleSetReport, error) { - p.processKiller.Apply(rs) +func (p *EBPFLessProbe) ApplyRuleSet(_ *rules.RuleSet) (*kfilters.ApplyRuleSetReport, error) { return &kfilters.ApplyRuleSetReport{}, nil } +// OnNewRuleSetLoaded resets statistics and states once a new rule set is loaded +func (p *EBPFLessProbe) OnNewRuleSetLoaded(rs *rules.RuleSet) { + p.processKiller.Reset(rs) +} + // HandleActions handles the rule actions func (p *EBPFLessProbe) HandleActions(ctx *eval.Context, rule *rules.Rule) { ev := ctx.Event.(*model.Event) diff --git a/pkg/security/probe/probe_others.go b/pkg/security/probe/probe_others.go index 5e12a021aa871..c3f168ab03414 100644 --- a/pkg/security/probe/probe_others.go +++ b/pkg/security/probe/probe_others.go @@ -67,6 +67,10 @@ func (p *Probe) ApplyRuleSet(_ *rules.RuleSet) (*kfilters.ApplyRuleSetReport, er return nil, nil } +// OnNewRuleSetLoaded resets statistics and states once a new rule set is loaded +func (p *Probe) OnNewRuleSetLoaded(_ *rules.RuleSet) { +} + // OnNewDiscarder is called when a new discarder is found. We currently don't generate discarders on Windows. func (p *Probe) OnNewDiscarder(_ *rules.RuleSet, _ *model.Event, _ eval.Field, _ eval.EventType) { } @@ -86,6 +90,11 @@ func (p *Probe) IsNetworkEnabled() bool { return p.Config.Probe.NetworkEnabled } +// IsNetworkRawPacketEnabled returns whether network raw packet is enabled +func (p *Probe) IsNetworkRawPacketEnabled() bool { + return p.IsNetworkEnabled() && p.Config.Probe.NetworkRawPacketEnabled +} + // IsActivityDumpEnabled returns whether activity dump is enabled func (p *Probe) IsActivityDumpEnabled() bool { return p.Config.RuntimeSecurity.ActivityDumpEnabled diff --git a/pkg/security/probe/probe_windows.go b/pkg/security/probe/probe_windows.go index c17df3529adf1..600551cf9d646 100644 --- a/pkg/security/probe/probe_windows.go +++ b/pkg/security/probe/probe_windows.go @@ -1265,8 +1265,6 @@ func (p *WindowsProbe) ApplyRuleSet(rs *rules.RuleSet) (*kfilters.ApplyRuleSetRe } } - p.processKiller.Apply(rs) - ars, err := kfilters.NewApplyRuleSetReport(p.config.Probe, rs) if err != nil { return nil, err @@ -1291,6 +1289,11 @@ func (p *WindowsProbe) ApplyRuleSet(rs *rules.RuleSet) (*kfilters.ApplyRuleSetRe return ars, nil } +// OnNewRuleSetLoaded resets statistics and states once a new rule set is loaded +func (p *WindowsProbe) OnNewRuleSetLoaded(rs *rules.RuleSet) { + p.processKiller.Reset(rs) +} + // FlushDiscarders invalidates all the discarders func (p *WindowsProbe) FlushDiscarders() error { p.discardedPaths.Purge() diff --git a/pkg/security/probe/process_killer.go b/pkg/security/probe/process_killer.go index ab0c9c5333000..72912286c76f5 100644 --- a/pkg/security/probe/process_killer.go +++ b/pkg/security/probe/process_killer.go @@ -174,6 +174,12 @@ func (p *ProcessKiller) KillAndReport(kill *rules.KillDefinition, rule *rules.Ru return false } + scope := "process" + switch kill.Scope { + case "container", "process": + scope = kill.Scope + } + if p.useDisarmers.Load() { var disarmer *ruleDisarmer p.ruleDisarmersLock.Lock() @@ -184,13 +190,27 @@ func (p *ProcessKiller) KillAndReport(kill *rules.KillDefinition, rule *rules.Ru } p.ruleDisarmersLock.Unlock() + onActionBlockedByDisarmer := func(dt disarmerType) { + seclog.Warnf("skipping kill action of rule `%s` because it has been disarmed", rule.ID) + ev.ActionReports = append(ev.ActionReports, &KillActionReport{ + Scope: scope, + Signal: kill.Signal, + Status: KillActionStatusRuleDisarmed, + DisarmerType: string(dt), + CreatedAt: ev.ProcessContext.ExecTime, + DetectedAt: ev.ResolveEventTime(), + Pid: ev.ProcessContext.Pid, + rule: rule, + }) + } + if disarmer.container.enabled { if containerID := ev.FieldHandlers.ResolveContainerID(ev, ev.ContainerContext); containerID != "" { if !disarmer.allow(disarmer.containerCache, containerID, func() { disarmer.disarmedCount[containerDisarmerType]++ seclog.Warnf("disarming kill action of rule `%s` because more than %d different containers triggered it in the last %s", rule.ID, disarmer.container.capacity, disarmer.container.period) }) { - seclog.Warnf("skipping kill action of rule `%s` because it has been disarmed", rule.ID) + onActionBlockedByDisarmer(containerDisarmerType) return false } } @@ -202,18 +222,12 @@ func (p *ProcessKiller) KillAndReport(kill *rules.KillDefinition, rule *rules.Ru disarmer.disarmedCount[executableDisarmerType]++ seclog.Warnf("disarmed kill action of rule `%s` because more than %d different executables triggered it in the last %s", rule.ID, disarmer.executable.capacity, disarmer.executable.period) }) { - seclog.Warnf("skipping kill action of rule `%s` because it has been disarmed", rule.ID) + onActionBlockedByDisarmer(executableDisarmerType) return false } } } - scope := "process" - switch kill.Scope { - case "container", "process": - scope = kill.Scope - } - pids, paths, err := p.getProcesses(scope, ev, entry) if err != nil { log.Errorf("unable to kill: %s", err) @@ -255,10 +269,11 @@ func (p *ProcessKiller) KillAndReport(kill *rules.KillDefinition, rule *rules.Ru report := &KillActionReport{ Scope: scope, Signal: kill.Signal, - Pid: ev.ProcessContext.Pid, + Status: KillActionStatusPerformed, CreatedAt: ev.ProcessContext.ExecTime, DetectedAt: ev.ResolveEventTime(), KilledAt: killedAt, + Pid: ev.ProcessContext.Pid, rule: rule, } ev.ActionReports = append(ev.ActionReports, report) @@ -267,8 +282,8 @@ func (p *ProcessKiller) KillAndReport(kill *rules.KillDefinition, rule *rules.Ru return true } -// Apply applies to ruleset to the process killer -func (p *ProcessKiller) Apply(rs *rules.RuleSet) { +// Reset the state and statistics of the process killer +func (p *ProcessKiller) Reset(rs *rules.RuleSet) { if p.cfg.RuntimeSecurity.EnforcementEnabled { var ruleSetHasKillAction bool var rulesetHasKillDisarmer bool @@ -440,8 +455,8 @@ const ( type disarmerType string const ( - containerDisarmerType = disarmerType("container") - executableDisarmerType = disarmerType("executable") + containerDisarmerType disarmerType = "container" + executableDisarmerType disarmerType = "executable" ) type ruleDisarmer struct { diff --git a/pkg/security/probe/selftests/chmod.go b/pkg/security/probe/selftests/chmod.go index 0f98c08e9b86a..aaf9d3b7e0dd7 100644 --- a/pkg/security/probe/selftests/chmod.go +++ b/pkg/security/probe/selftests/chmod.go @@ -31,6 +31,7 @@ func (o *ChmodSelfTest) GetRuleDefinition() *rules.RuleDefinition { return &rules.RuleDefinition{ ID: o.ruleID, Expression: fmt.Sprintf(`chmod.file.path == "%s"`, o.filename), + Silent: true, } } diff --git a/pkg/security/probe/selftests/chown.go b/pkg/security/probe/selftests/chown.go index 558857de69a01..edf775fe4c2c2 100644 --- a/pkg/security/probe/selftests/chown.go +++ b/pkg/security/probe/selftests/chown.go @@ -32,6 +32,7 @@ func (o *ChownSelfTest) GetRuleDefinition() *rules.RuleDefinition { return &rules.RuleDefinition{ ID: o.ruleID, Expression: fmt.Sprintf(`chown.file.path == "%s"`, o.filename), + Silent: true, } } diff --git a/pkg/security/probe/selftests/create_file_windows.go b/pkg/security/probe/selftests/create_file_windows.go index eb713a5c926ff..eebc878f61b24 100644 --- a/pkg/security/probe/selftests/create_file_windows.go +++ b/pkg/security/probe/selftests/create_file_windows.go @@ -38,6 +38,7 @@ func (o *WindowsCreateFileSelfTest) GetRuleDefinition() *rules.RuleDefinition { return &rules.RuleDefinition{ ID: o.ruleID, Expression: fmt.Sprintf(`create.file.name == "%s" && create.file.device_path =~ "%s" && process.pid == %d`, basename, filepath.ToSlash(devicePath), os.Getpid()), + Silent: true, } } diff --git a/pkg/security/probe/selftests/ebpfless.go b/pkg/security/probe/selftests/ebpfless.go index 578143231e490..cd5b692fb5070 100644 --- a/pkg/security/probe/selftests/ebpfless.go +++ b/pkg/security/probe/selftests/ebpfless.go @@ -31,6 +31,7 @@ func (o *EBPFLessSelfTest) GetRuleDefinition() *rules.RuleDefinition { ID: o.ruleID, Expression: `exec.file.path != "" && process.parent.pid == 0 && process.ppid == 0`, Every: time.Duration(math.MaxInt64), + Silent: true, } } diff --git a/pkg/security/probe/selftests/open.go b/pkg/security/probe/selftests/open.go index 272ec1e1c3b55..e5ddf92d76dfa 100644 --- a/pkg/security/probe/selftests/open.go +++ b/pkg/security/probe/selftests/open.go @@ -31,6 +31,7 @@ func (o *OpenSelfTest) GetRuleDefinition() *rules.RuleDefinition { return &rules.RuleDefinition{ ID: o.ruleID, Expression: fmt.Sprintf(`open.file.path == "%s" && open.flags & O_CREAT > 0`, o.filename), + Silent: true, } } diff --git a/pkg/security/probe/selftests/open_registry_key_windows.go b/pkg/security/probe/selftests/open_registry_key_windows.go index 7b87fa69c483a..f405e0ace0e0f 100644 --- a/pkg/security/probe/selftests/open_registry_key_windows.go +++ b/pkg/security/probe/selftests/open_registry_key_windows.go @@ -34,6 +34,7 @@ func (o *WindowsOpenRegistryKeyTest) GetRuleDefinition() *rules.RuleDefinition { return &rules.RuleDefinition{ ID: o.ruleID, Expression: fmt.Sprintf(`open.registry.key_name == "%s" && process.pid == %d`, filepath.Base(o.keyPath), os.Getpid()), + Silent: true, } } diff --git a/pkg/security/ptracer/exec.go b/pkg/security/ptracer/exec.go index 52a3ac1e4d34d..2c6ef4344407e 100644 --- a/pkg/security/ptracer/exec.go +++ b/pkg/security/ptracer/exec.go @@ -24,7 +24,6 @@ func runtimeAfterFork() func runtimeAfterForkInChild() //go:norace -//nolint:unused func forkExec(argv0 string, argv []string, envv []string, creds Creds, prog *syscall.SockFprog) (int, error) { argv0p, err := syscall.BytePtrFromString(argv0) if err != nil { @@ -41,6 +40,20 @@ func forkExec(argv0 string, argv []string, envv []string, creds Creds, prog *sys return 0, err } + pid, errno := forkExec1(argv0p, argvp, envvp, creds, prog) + if errno != 0 { + exit(errno) + } + + return pid, nil +} + +// forkExec1 does the actual forking and execing, it should have the smallest possible stack to not overflow +// because of the `nosplit` +// +//go:norace +//go:nosplit +func forkExec1(argv0 *byte, argv []*byte, envv []*byte, creds Creds, prog *syscall.SockFprog) (int, syscall.Errno) { syscall.ForkLock.Lock() // no more go runtime calls @@ -52,11 +65,7 @@ func forkExec(argv0 string, argv []string, envv []string, creds Creds, prog *sys runtimeAfterFork() syscall.ForkLock.Unlock() - - if errno != 0 { - err = errno - } - return int(pid), err + return int(pid), errno } // in the child, no more go runtime calls @@ -64,17 +73,17 @@ func forkExec(argv0 string, argv []string, envv []string, creds Creds, prog *sys pid, _, errno = syscall.RawSyscall(syscall.SYS_GETPID, 0, 0, 0) if errno != 0 { - exit(errno) + return 0, errno } _, _, errno = syscall.RawSyscall(syscall.SYS_PTRACE, uintptr(syscall.PTRACE_TRACEME), 0, 0) if errno != 0 { - exit(errno) + return 0, errno } _, _, errno = syscall.RawSyscall6(syscall.SYS_PRCTL, unix.PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0, 0) if errno != 0 { - exit(errno) + return 0, errno } const ( @@ -85,19 +94,19 @@ func forkExec(argv0 string, argv []string, envv []string, creds Creds, prog *sys if prog != nil { _, _, errno = syscall.RawSyscall(unix.SYS_SECCOMP, mode, tsync, uintptr(unsafe.Pointer(prog))) if errno != 0 { - exit(errno) + return 0, errno } } _, _, errno = syscall.RawSyscall(syscall.SYS_KILL, pid, uintptr(syscall.SIGSTOP), 0) if errno != 0 { - exit(errno) + return 0, errno } if creds.GID != nil { _, _, errno = syscall.RawSyscall(syscall.SYS_SETGID, uintptr(*creds.GID), 0, 0) if errno != 0 { - exit(errno) + return 0, errno } } @@ -105,21 +114,18 @@ func forkExec(argv0 string, argv []string, envv []string, creds Creds, prog *sys if creds.UID != nil { _, _, errno = syscall.RawSyscall(syscall.SYS_SETUID, uintptr(*creds.UID), 0, 0) if errno != 0 { - exit(errno) + return 0, errno } } - _, _, err = syscall.RawSyscall(syscall.SYS_EXECVE, - uintptr(unsafe.Pointer(argv0p)), - uintptr(unsafe.Pointer(&argvp[0])), - uintptr(unsafe.Pointer(&envvp[0]))) + _, _, errno = syscall.RawSyscall(syscall.SYS_EXECVE, + uintptr(unsafe.Pointer(argv0)), + uintptr(unsafe.Pointer(&argv[0])), + uintptr(unsafe.Pointer(&envv[0]))) - return 0, err + return 0, errno } -//nolint:unused func exit(errno syscall.Errno) { - for { - _, _, _ = syscall.RawSyscall(syscall.SYS_EXIT, uintptr(errno), 0, 0) - } + _, _, _ = syscall.RawSyscall(syscall.SYS_EXIT, uintptr(errno), 0, 0) } diff --git a/pkg/security/resolvers/process/resolver_ebpf.go b/pkg/security/resolvers/process/resolver_ebpf.go index 8b5e87c94c656..e35c3cb725633 100644 --- a/pkg/security/resolvers/process/resolver_ebpf.go +++ b/pkg/security/resolvers/process/resolver_ebpf.go @@ -352,9 +352,6 @@ func (p *EBPFResolver) enrichEventFromProc(entry *model.ProcessCacheEntry, proc entry.FileEvent.MountOrigin = model.MountOriginProcfs entry.FileEvent.MountSource = model.MountSourceSnapshot - var id containerutils.CGroupID - id, entry.Process.ContainerID = containerutils.GetCGroupContext(containerID, containerFlags) - entry.Process.CGroup.CGroupID = id entry.Process.CGroup.CGroupFlags = containerFlags var fileStats unix.Statx_t @@ -372,6 +369,21 @@ func (p *EBPFResolver) enrichEventFromProc(entry *model.ProcessCacheEntry, proc } } + if cgroupFileContent, err := os.ReadFile(taskPath); err == nil { + lines := strings.Split(string(cgroupFileContent), "\n") + for _, line := range lines { + parts := strings.SplitN(line, ":", 3) + + // Skip potentially malformed lines + if len(parts) != 3 { + continue + } + + entry.Process.CGroup.CGroupID = containerutils.CGroupID(parts[2]) + break + } + } + if entry.FileEvent.IsFileless() { entry.FileEvent.Filesystem = model.TmpFS } else { diff --git a/pkg/security/resolvers/sbom/file_querier.go b/pkg/security/resolvers/sbom/file_querier.go new file mode 100644 index 0000000000000..e1831cfbeaf05 --- /dev/null +++ b/pkg/security/resolvers/sbom/file_querier.go @@ -0,0 +1,157 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016-present Datadog, Inc. + +//go:build linux && trivy + +// Package sbom holds sbom related files +package sbom + +import ( + "slices" + "strings" + + "github.com/DataDog/datadog-agent/pkg/security/seclog" + "github.com/DataDog/datadog-agent/pkg/util/trivy" + "github.com/twmb/murmur3" +) + +type fileQuerier struct { + files []uint64 + pkgs []*Package + + lastNegativeCache *fixedSizeQueue[uint64] +} + +/* +files are stored in the following format: + +| partSize | hash1 | hash2 | ... | partSize | hash3 | hash4 | ... | partSize | hash5 | hash6 | ... | + +where partSize is the number of hashes in the part +and each part group is at the index of the given package +for example here hash5 would match pkgs[2] +*/ + +func newFileQuerier(report *trivy.Report) fileQuerier { + fileCount := 0 + pkgCount := 0 + for _, result := range report.Results { + for _, resultPkg := range result.Packages { + fileCount += 2 + len(resultPkg.InstalledFiles) + pkgCount++ + } + } + + files := make([]uint64, 0, fileCount) + pkgs := make([]*Package, 0, pkgCount) + + for _, result := range report.Results { + for _, resultPkg := range result.Packages { + pkg := &Package{ + Name: resultPkg.Name, + Version: resultPkg.Version, + SrcVersion: resultPkg.SrcVersion, + } + pkgs = append(pkgs, pkg) + + files = append(files, uint64(len(resultPkg.InstalledFiles))) + + for _, file := range resultPkg.InstalledFiles { + seclog.Tracef("indexing %s as %+v", file, pkg) + + hash := murmur3.StringSum64(file) + files = append(files, hash) + } + } + } + + return fileQuerier{files: files, pkgs: pkgs, lastNegativeCache: newFixedSizeQueue[uint64](2)} +} + +func (fq *fileQuerier) queryHash(hash uint64) *Package { + // fast path, if no package in the report contains the file + if !slices.Contains(fq.files, hash) { + return nil + } + + var i, pkgIndex uint64 + for i < uint64(len(fq.files)) { + partSize := fq.files[i] + + for offset := uint64(0); offset < partSize; offset++ { + if fq.files[i+1+offset] == hash { + return fq.pkgs[pkgIndex] + } + } + + i += partSize + 1 + pkgIndex++ + } + + return nil +} + +func (fq *fileQuerier) queryHashWithNegativeCache(hash uint64) *Package { + if fq.lastNegativeCache.contains(hash) { + return nil + } + + pkg := fq.queryHash(hash) + if pkg == nil { + if fq.lastNegativeCache == nil { + fq.lastNegativeCache = newFixedSizeQueue[uint64](2) + } + fq.lastNegativeCache.push(hash) + } + + return pkg +} + +func (fq *fileQuerier) queryFile(path string) *Package { + if pkg := fq.queryHashWithNegativeCache(murmur3.StringSum64(path)); pkg != nil { + return pkg + } + + if strings.HasPrefix(path, "/usr") { + return fq.queryHashWithNegativeCache(murmur3.StringSum64(path[4:])) + } + + return nil +} + +func (fq *fileQuerier) len() int { + return len(fq.files) +} + +type fixedSizeQueue[T comparable] struct { + queue []T + maxSize int +} + +func newFixedSizeQueue[T comparable](maxSize int) *fixedSizeQueue[T] { + return &fixedSizeQueue[T]{maxSize: maxSize} +} + +func (q *fixedSizeQueue[T]) push(value T) { + if len(q.queue) == q.maxSize { + q.queue = q.queue[1:] + } + + q.queue = append(q.queue, value) +} + +func (q *fixedSizeQueue[T]) contains(value T) bool { + if q == nil { + return false + } + + for _, v := range q.queue { + if v == value { + return true + } + } + + return false +} diff --git a/pkg/security/resolvers/sbom/resolver.go b/pkg/security/resolvers/sbom/resolver.go index 8b03e0831f76a..d67f3bffa0bb9 100644 --- a/pkg/security/resolvers/sbom/resolver.go +++ b/pkg/security/resolvers/sbom/resolver.go @@ -22,7 +22,6 @@ import ( "github.com/avast/retry-go/v4" "github.com/hashicorp/golang-lru/v2/simplelru" "github.com/skydive-project/go-debouncer" - "github.com/twmb/murmur3" "go.uber.org/atomic" workloadmeta "github.com/DataDog/datadog-agent/comp/core/workloadmeta/def" @@ -51,7 +50,7 @@ type SBOM struct { sync.RWMutex report *trivy.Report - files map[uint64]*Package + files fileQuerier Host string Source string @@ -77,23 +76,8 @@ func (s *SBOM) IsComputed() bool { // SetReport sets the SBOM report func (s *SBOM) SetReport(report *trivy.Report) { - // cleanup file cache - s.files = make(map[uint64]*Package) - // build file cache - for _, result := range report.Results { - for _, resultPkg := range result.Packages { - pkg := &Package{ - Name: resultPkg.Name, - Version: resultPkg.Version, - SrcVersion: resultPkg.SrcVersion, - } - for _, file := range resultPkg.InstalledFiles { - seclog.Tracef("indexing %s as %+v", file, pkg) - s.files[murmur3.StringSum64(file)] = pkg - } - } - } + s.files = newFileQuerier(report) } // reset (thread unsafe) cleans up internal fields before a SBOM is inserted in cache, the goal is to save space and delete references @@ -114,7 +98,7 @@ func (s *SBOM) reset() { // NewSBOM returns a new empty instance of SBOM func NewSBOM(host string, source string, id string, cgroup *cgroupModel.CacheEntry, workloadKey string) (*SBOM, error) { sbom := &SBOM{ - files: make(map[uint64]*Package), + files: fileQuerier{}, Host: host, Source: source, ContainerID: id, @@ -395,23 +379,8 @@ func (r *Resolver) analyzeWorkload(sbom *SBOM) error { return err } - // cleanup file cache - sbom.files = make(map[uint64]*Package) - // build file cache - for _, result := range report.Results { - for _, resultPkg := range result.Packages { - pkg := &Package{ - Name: resultPkg.Name, - Version: resultPkg.Version, - SrcVersion: resultPkg.SrcVersion, - } - for _, file := range resultPkg.InstalledFiles { - seclog.Tracef("indexing %s as %+v", file, pkg) - sbom.files[murmur3.StringSum64(file)] = pkg - } - } - } + sbom.files = newFileQuerier(report) // we can get rid of the report now that we've generate the file mapping sbom.report = nil @@ -424,7 +393,7 @@ func (r *Resolver) analyzeWorkload(sbom *SBOM) error { r.sbomsCache.Add(sbom.workloadKey, sbom) r.sbomsCacheLock.Unlock() - seclog.Infof("new sbom generated for '%s': %d files added", sbom.ContainerID, len(sbom.files)) + seclog.Infof("new sbom generated for '%s': %d files added", sbom.ContainerID, sbom.files.len()) return nil } @@ -450,12 +419,7 @@ func (r *Resolver) ResolvePackage(containerID string, file *model.FileEvent) *Pa sbom.Lock() defer sbom.Unlock() - pkg := sbom.files[murmur3.StringSum64(file.PathnameStr)] - if pkg == nil && strings.HasPrefix(file.PathnameStr, "/usr") { - pkg = sbom.files[murmur3.StringSum64(file.PathnameStr[4:])] - } - - return pkg + return sbom.files.queryFile(file.PathnameStr) } // newWorkloadEntry (thread unsafe) creates a new SBOM entry for the sbom designated by the provided process cache diff --git a/pkg/security/resolvers/tags/resolver.go b/pkg/security/resolvers/tags/resolver.go index caa06d60626cf..e62736f1e5afa 100644 --- a/pkg/security/resolvers/tags/resolver.go +++ b/pkg/security/resolvers/tags/resolver.go @@ -108,7 +108,7 @@ func NewResolver(config *config.Config, telemetry telemetry.Component) Resolver log.Errorf("unable to configure the remote tagger: %s", err) } else { return &DefaultResolver{ - tagger: remote.NewTagger(options, pkgconfigsetup.Datadog(), taggerTelemetry.NewStore(telemetry)), + tagger: remote.NewTagger(options, pkgconfigsetup.Datadog(), taggerTelemetry.NewStore(telemetry), types.NewMatchAllFilter()), } } } diff --git a/pkg/security/rules/engine.go b/pkg/security/rules/engine.go index 6992f83dc23a6..00ad1233946d1 100644 --- a/pkg/security/rules/engine.go +++ b/pkg/security/rules/engine.go @@ -333,6 +333,9 @@ func (e *RuleEngine) LoadPolicies(providers []rules.PolicyProvider, sendLoadedRe return fmt.Errorf("failed to flush discarders: %w", err) } + // reset the probe process killer state once the new ruleset is loaded + e.probe.OnNewRuleSetLoaded(rs) + content, _ := json.Marshal(report) seclog.Debugf("Policy report: %s", content) @@ -481,7 +484,12 @@ func (e *RuleEngine) getEventTypeEnabled() map[eval.EventType]bool { if e.probe.IsNetworkEnabled() { if eventTypes, exists := categories[model.NetworkCategory]; exists { for _, eventType := range eventTypes { - enabled[eventType] = true + switch eventType { + case model.RawPacketEventType.String(): + enabled[eventType] = e.probe.IsNetworkRawPacketEnabled() + default: + enabled[eventType] = true + } } } } diff --git a/pkg/security/secl/compiler/eval/context.go b/pkg/security/secl/compiler/eval/context.go index 874cafa9d72d1..f8775862623be 100644 --- a/pkg/security/secl/compiler/eval/context.go +++ b/pkg/security/secl/compiler/eval/context.go @@ -11,6 +11,12 @@ import ( "time" ) +// RegisterCacheEntry used to track the value +type RegisterCacheEntry struct { + Pos int + Value interface{} +} + // Context describes the context used during a rule evaluation type Context struct { Event Event @@ -20,6 +26,12 @@ type Context struct { IntCache map[string][]int BoolCache map[string][]bool + // iterator register cache. used to cache entry within a single rule evaluation + RegisterCache map[RegisterID]*RegisterCacheEntry + + // rule register + Registers map[RegisterID]int + now time.Time } @@ -41,25 +53,22 @@ func (c *Context) Reset() { c.Event = nil c.now = time.Time{} - // as the cache should be low in entry, prefer to delete than re-alloc - for key := range c.StringCache { - delete(c.StringCache, key) - } - for key := range c.IntCache { - delete(c.IntCache, key) - } - for key := range c.BoolCache { - delete(c.BoolCache, key) - } + clear(c.StringCache) + clear(c.IntCache) + clear(c.BoolCache) + clear(c.Registers) + clear(c.RegisterCache) } // NewContext return a new Context func NewContext(evt Event) *Context { return &Context{ - Event: evt, - StringCache: make(map[string][]string), - IntCache: make(map[string][]int), - BoolCache: make(map[string][]bool), + Event: evt, + StringCache: make(map[string][]string), + IntCache: make(map[string][]int), + BoolCache: make(map[string][]bool), + Registers: make(map[RegisterID]int), + RegisterCache: make(map[RegisterID]*RegisterCacheEntry), } } diff --git a/pkg/security/secl/compiler/eval/errors.go b/pkg/security/secl/compiler/eval/errors.go index 3c76bf0c86f9f..1be678c4b9fad 100644 --- a/pkg/security/secl/compiler/eval/errors.go +++ b/pkg/security/secl/compiler/eval/errors.go @@ -177,3 +177,12 @@ type ErrValueOutOfRange struct { func (e ErrValueOutOfRange) Error() string { return fmt.Sprintf("incorrect value for type `%s`, out of range", e.Field) } + +// ErrIteratorVariable error when the iterator variable constraints are reached +type ErrIteratorVariable struct { + Err error +} + +func (e ErrIteratorVariable) Error() string { + return fmt.Sprintf("iterator variable error: %s", e.Err) +} diff --git a/pkg/security/secl/compiler/eval/eval.go b/pkg/security/secl/compiler/eval/eval.go index cf2ccab373ad3..f417cbd82ee05 100644 --- a/pkg/security/secl/compiler/eval/eval.go +++ b/pkg/security/secl/compiler/eval/eval.go @@ -12,6 +12,7 @@ import ( "fmt" "reflect" "regexp" + "slices" "strconv" "strings" @@ -75,7 +76,7 @@ func identToEvaluator(obj *ident, opts *Opts, state *State) (interface{}, lexer. } } - field, _, regID, err := extractField(*obj.Ident, state) + field, itField, regID, err := extractField(*obj.Ident, state) if err != nil { return nil, obj.Pos, err } @@ -94,6 +95,26 @@ func identToEvaluator(obj *ident, opts *Opts, state *State) (interface{}, lexer. state.UpdateFields(field) + if regID != "" { + // avoid wildcard register for the moment + if regID == "_" { + return nil, obj.Pos, NewError(obj.Pos, "`_` can't be used as a iterator variable name") + } + + // avoid using the same register on two different fields + if slices.ContainsFunc(state.registers, func(r Register) bool { + return r.ID == regID && r.Field != itField + }) { + return nil, obj.Pos, NewError(obj.Pos, "iterator variable used by different fields '%s'", regID) + } + + if !slices.ContainsFunc(state.registers, func(r Register) bool { + return r.ID == regID + }) { + state.registers = append(state.registers, Register{ID: regID, Field: itField}) + } + } + return accessor, obj.Pos, nil } diff --git a/pkg/security/secl/compiler/eval/eval_test.go b/pkg/security/secl/compiler/eval/eval_test.go index f99e6df8816b5..86dd87126133d 100644 --- a/pkg/security/secl/compiler/eval/eval_test.go +++ b/pkg/security/secl/compiler/eval/eval_test.go @@ -817,13 +817,15 @@ func TestRegisterSyntaxError(t *testing.T) { Expr string Expected bool }{ - {Expr: `process.list[_].key == 10 && process.list[_].value == "AAA"`, Expected: true}, + {Expr: `process.list[_].key == 10 && process.list[_].value == "AAA"`, Expected: false}, + {Expr: `process.list[A].key == 10 && process.list[A].value == "AAA"`, Expected: true}, + {Expr: `process.list[A].key == 10 && process.list[B].value == "AAA"`, Expected: false}, + {Expr: `process.list[A].key == 10 && process.array[A].value == "AAA"`, Expected: false}, {Expr: `process.list[].key == 10 && process.list.value == "AAA"`, Expected: false}, - {Expr: `process.list[_].key == 10 && process.list.value == "AAA"`, Expected: true}, + {Expr: `process.list[A].key == 10 && process.list.value == "AAA"`, Expected: true}, {Expr: `process.list.key[] == 10 && process.list.value == "AAA"`, Expected: false}, {Expr: `process[].list.key == 10 && process.list.value == "AAA"`, Expected: false}, {Expr: `[]process.list.key == 10 && process.list.value == "AAA"`, Expected: false}, - //{Expr: `process.list[A].key == 10 && process.list[A].value == "AAA" && process.array[B].key == 10 && process.array[B].value == "AAA"`, Expected: false}, } for _, test := range tests { @@ -853,85 +855,90 @@ func TestRegister(t *testing.T) { Expr string Expected bool }{ - {Expr: `process.list[_].key == 10`, Expected: true}, - {Expr: `process.list[_].key == 9999`, Expected: false}, - {Expr: `process.list[_].key != 10`, Expected: false}, - {Expr: `process.list[_].key != 9999`, Expected: true}, - - {Expr: `process.list[_].key >= 200`, Expected: true}, - {Expr: `process.list[_].key > 100`, Expected: true}, - {Expr: `process.list[_].key <= 200`, Expected: true}, - {Expr: `process.list[_].key < 100`, Expected: true}, - - {Expr: `10 == process.list[_].key`, Expected: true}, - {Expr: `9999 == process.list[_].key`, Expected: false}, - {Expr: `10 != process.list[_].key`, Expected: false}, - {Expr: `9999 != process.list[_].key`, Expected: true}, - - {Expr: `9999 in process.list[_].key`, Expected: false}, - {Expr: `9999 not in process.list[_].key`, Expected: true}, - {Expr: `10 in process.list[_].key`, Expected: true}, - {Expr: `10 not in process.list[_].key`, Expected: false}, - - {Expr: `process.list[_].key > 10`, Expected: true}, - {Expr: `process.list[_].key > 9999`, Expected: false}, - {Expr: `process.list[_].key < 10`, Expected: false}, - {Expr: `process.list[_].key < 9999`, Expected: true}, - - {Expr: `5 < process.list[_].key`, Expected: true}, - {Expr: `9999 < process.list[_].key`, Expected: false}, - {Expr: `10 > process.list[_].key`, Expected: false}, - {Expr: `9999 > process.list[_].key`, Expected: true}, - - {Expr: `true in process.array[_].flag`, Expected: true}, - {Expr: `false not in process.array[_].flag`, Expected: false}, - - {Expr: `process.array[_].flag == true`, Expected: true}, - {Expr: `process.array[_].flag != false`, Expected: false}, - - {Expr: `"AAA" in process.list[_].value`, Expected: true}, - {Expr: `"ZZZ" in process.list[_].value`, Expected: false}, - {Expr: `"AAA" not in process.list[_].value`, Expected: false}, - {Expr: `"ZZZ" not in process.list[_].value`, Expected: true}, - - {Expr: `~"AA*" in process.list[_].value`, Expected: true}, - {Expr: `~"ZZ*" in process.list[_].value`, Expected: false}, - {Expr: `~"AA*" not in process.list[_].value`, Expected: false}, - {Expr: `~"ZZ*" not in process.list[_].value`, Expected: true}, - - {Expr: `r"[A]{1,3}" in process.list[_].value`, Expected: true}, - {Expr: `process.list[_].value in [r"[A]{1,3}", "nnnnn"]`, Expected: true}, - - {Expr: `process.list[_].value == ~"AA*"`, Expected: true}, - {Expr: `process.list[_].value == ~"ZZ*"`, Expected: false}, - {Expr: `process.list[_].value != ~"AA*"`, Expected: false}, - {Expr: `process.list[_].value != ~"ZZ*"`, Expected: true}, - - {Expr: `process.list[_].value =~ "AA*"`, Expected: true}, - {Expr: `process.list[_].value =~ "ZZ*"`, Expected: false}, - {Expr: `process.list[_].value !~ "AA*"`, Expected: false}, - {Expr: `process.list[_].value !~ "ZZ*"`, Expected: true}, - - {Expr: `process.list[_].value in ["~zzzz", ~"AA*", "nnnnn"]`, Expected: true}, - {Expr: `process.list[_].value in ["~zzzz", ~"AA*", "nnnnn"]`, Expected: true}, - {Expr: `process.list[_].value in ["~zzzz", "AAA", "nnnnn"]`, Expected: true}, - {Expr: `process.list[_].value in ["~zzzz", "AA*", "nnnnn"]`, Expected: false}, - - {Expr: `process.list[_].value in [~"ZZ*", "nnnnn"]`, Expected: false}, - {Expr: `process.list[_].value not in [~"AA*", "nnnnn"]`, Expected: false}, - {Expr: `process.list[_].value not in [~"ZZ*", "nnnnn"]`, Expected: true}, - {Expr: `process.list[_].value not in [~"ZZ*", "AAA", "nnnnn"]`, Expected: false}, - {Expr: `process.list[_].value not in [~"ZZ*", ~"AA*", "nnnnn"]`, Expected: false}, - - {Expr: `process.list[_].key == 10 && process.list[_].value == "AAA"`, Expected: true}, - {Expr: `process.list[_].key == 9999 && process.list[_].value == "AAA"`, Expected: false}, - {Expr: `process.list[_].key == 100 && process.list[_].value == "BBB"`, Expected: true}, - {Expr: `process.list[_].key == 200 && process.list[_].value == "CCC"`, Expected: true}, + {Expr: `process.list[A].key == 10`, Expected: true}, + {Expr: `process.list[A].key == 9999`, Expected: false}, + {Expr: `process.list[A].key != 10`, Expected: true}, + {Expr: `process.list.key != 10`, Expected: false}, + {Expr: `process.list[A].key != 9999`, Expected: true}, + {Expr: `process.list[A].key >= 200`, Expected: true}, + {Expr: `process.list[A].key > 100`, Expected: true}, + {Expr: `process.list[A].key <= 200`, Expected: true}, + {Expr: `process.list[A].key < 100`, Expected: true}, + + {Expr: `10 == process.list[A].key`, Expected: true}, + {Expr: `9999 == process.list[A].key`, Expected: false}, + {Expr: `10 != process.list[A].key`, Expected: true}, + {Expr: `9999 != process.list[A].key`, Expected: true}, + + {Expr: `9999 in process.list[A].key`, Expected: false}, + {Expr: `9999 not in process.list[A].key`, Expected: true}, + {Expr: `10 in process.list[A].key`, Expected: true}, + {Expr: `10 not in process.list[A].key`, Expected: true}, + + {Expr: `process.list[A].key > 10`, Expected: true}, + {Expr: `process.list[A].key > 9999`, Expected: false}, + {Expr: `process.list[A].key < 10`, Expected: false}, + {Expr: `process.list[A].key < 9999`, Expected: true}, + + {Expr: `5 < process.list[A].key`, Expected: true}, + {Expr: `9999 < process.list[A].key`, Expected: false}, + {Expr: `10 > process.list[A].key`, Expected: false}, + {Expr: `9999 > process.list[A].key`, Expected: true}, + + {Expr: `true in process.array[A].flag`, Expected: true}, + {Expr: `false not in process.array[A].flag`, Expected: false}, + + {Expr: `process.array[A].flag == true`, Expected: true}, + {Expr: `process.array[A].flag != false`, Expected: false}, + + {Expr: `"AAA" in process.list[A].value`, Expected: true}, + {Expr: `"ZZZ" in process.list[A].value`, Expected: false}, + {Expr: `"AAA" not in process.list[A].value`, Expected: true}, + {Expr: `"ZZZ" not in process.list[A].value`, Expected: true}, + + {Expr: `~"AA*" in process.list[A].value`, Expected: true}, + {Expr: `~"ZZ*" in process.list[A].value`, Expected: false}, + {Expr: `~"AA*" not in process.list[A].value`, Expected: true}, + {Expr: `~"ZZ*" not in process.list[A].value`, Expected: true}, + + {Expr: `r"[A]{1,3}" in process.list[A].value`, Expected: true}, + {Expr: `process.list[A].value in [r"[A]{1,3}", "nnnnn"]`, Expected: true}, + + {Expr: `process.list[A].value == ~"AA*"`, Expected: true}, + {Expr: `process.list[A].value == ~"ZZ*"`, Expected: false}, + {Expr: `process.list[A].value != ~"AA*"`, Expected: true}, + {Expr: `process.list[A].value != ~"ZZ*"`, Expected: true}, + + {Expr: `process.list[A].value =~ "AA*"`, Expected: true}, + {Expr: `process.list[A].value =~ "ZZ*"`, Expected: false}, + {Expr: `process.list[A].value !~ "AA*"`, Expected: true}, + {Expr: `process.list[A].value !~ "ZZ*"`, Expected: true}, + + {Expr: `process.list[A].value in ["~zzzz", ~"AA*", "nnnnn"]`, Expected: true}, + {Expr: `process.list[A].value in ["~zzzz", ~"AA*", "nnnnn"]`, Expected: true}, + {Expr: `process.list[A].value in ["~zzzz", "AAA", "nnnnn"]`, Expected: true}, + {Expr: `process.list[A].value in ["~zzzz", "AA*", "nnnnn"]`, Expected: false}, + + {Expr: `process.list[A].value in [~"ZZ*", "nnnnn"]`, Expected: false}, + {Expr: `process.list[A].value not in [~"AA*", "nnnnn"]`, Expected: true}, + {Expr: `process.list[A].value not in [~"ZZ*", "nnnnn"]`, Expected: true}, + {Expr: `process.list[A].value not in [~"ZZ*", "AAA", "nnnnn"]`, Expected: true}, + {Expr: `process.list[A].value not in [~"ZZ*", ~"AA*", "nnnnn"]`, Expected: true}, + + {Expr: `process.list[A].key == 10 && process.list[A].value == "AAA"`, Expected: true}, + {Expr: `process.list[A].key == 9999 && process.list[A].value == "AAA"`, Expected: false}, + {Expr: `process.list[A].key == 100 && process.list[A].value == "BBB"`, Expected: true}, + {Expr: `process.list[A].key == 200 && process.list[A].value == "CCC"`, Expected: true}, {Expr: `process.list.key == 200 && process.list.value == "AAA"`, Expected: true}, - {Expr: `process.list[_].key == 10 && process.list.value == "AAA"`, Expected: true}, + {Expr: `process.list[A].key == 10 && process.list[A].value == "AAA"`, Expected: true}, + {Expr: `process.list[A].key == 10 && process.list[A].value == "BBB"`, Expected: false}, + {Expr: `process.list[A].key == 100 && process.list[A].value == "BBB"`, Expected: true}, + {Expr: `process.list.key == 10 && process.list.value == "BBB"`, Expected: true}, - {Expr: `process.array[_].key == 1000 && process.array[_].value == "EEEE"`, Expected: true}, - {Expr: `process.array[_].key == 1002 && process.array[_].value == "EEEE"`, Expected: true}, + {Expr: `process.array[A].key == 1000 && process.array[A].value == "EEEE"`, Expected: true}, + {Expr: `process.array[A].key == 1002 && process.array[A].value == "EEEE"`, Expected: false}, + + {Expr: `process.array[A].key == 1000`, Expected: true}, } for _, test := range tests { @@ -966,12 +973,11 @@ func TestRegisterPartial(t *testing.T) { Field Field IsDiscarder bool }{ - {Expr: `process.list[_].key == 10 && process.list[_].value == "AA"`, Field: "process.list.key", IsDiscarder: false}, - {Expr: `process.list[_].key == 55 && process.list[_].value == "AA"`, Field: "process.list.key", IsDiscarder: true}, - {Expr: `process.list[_].key == 55 && process.list[_].value == "AA"`, Field: "process.list.value", IsDiscarder: false}, - {Expr: `process.list[_].key == 10 && process.list[_].value == "ZZZ"`, Field: "process.list.value", IsDiscarder: true}, - //{Expr: `process.list[A].key == 10 && process.list[B].value == "ZZZ"`, Field: "process.list.key", IsDiscarder: false}, - //{Expr: `process.list[A].key == 55 && process.list[B].value == "AA"`, Field: "process.list.key", IsDiscarder: true}, + {Expr: `process.list[A].key == 10 && process.list[A].value == "AA"`, Field: "process.list.key", IsDiscarder: false}, + {Expr: `process.list[A].key == 55 && process.list[A].value == "AA"`, Field: "process.list.key", IsDiscarder: true}, + {Expr: `process.list[A].key in [55, 10] && process.list[A].value == "AA"`, Field: "process.list.key", IsDiscarder: false}, + {Expr: `process.list[A].key == 55 && process.list[A].value == "AA"`, Field: "process.list.value", IsDiscarder: false}, + {Expr: `process.list[A].key == 10 && process.list[A].value == "ZZZ"`, Field: "process.list.value", IsDiscarder: true}, } ctx := NewContext(event) @@ -1012,8 +1018,8 @@ func TestOptimizer(t *testing.T) { Expr string Evaluated func() bool }{ - {Expr: `process.list[_].key == 44 && process.gid == 55`, Evaluated: func() bool { return event.listEvaluated }}, - {Expr: `process.gid == 55 && process.list[_].key == 44`, Evaluated: func() bool { return event.listEvaluated }}, + {Expr: `process.list[A].key == 44 && process.gid == 55`, Evaluated: func() bool { return event.listEvaluated }}, + {Expr: `process.gid == 55 && process.list[A].key == 44`, Evaluated: func() bool { return event.listEvaluated }}, {Expr: `process.uid in [66, 77, 88] && process.gid == 55`, Evaluated: func() bool { return event.uidEvaluated }}, {Expr: `process.gid == 55 && process.uid in [66, 77, 88]`, Evaluated: func() bool { return event.uidEvaluated }}, } diff --git a/pkg/security/secl/compiler/eval/model.go b/pkg/security/secl/compiler/eval/model.go index de27aa6422f0b..ae8ea4bf2e790 100644 --- a/pkg/security/secl/compiler/eval/model.go +++ b/pkg/security/secl/compiler/eval/model.go @@ -11,8 +11,6 @@ type Model interface { GetEvaluator(field Field, regID RegisterID) (Evaluator, error) // ValidateField returns whether the value use against the field is valid, ex: for constant ValidateField(field Field, value FieldValue) error - // GetIterator return an iterator - //GetIterator(field Field) (Iterator, error) // NewEvent returns a new event instance NewEvent() Event // GetFieldRestrictions returns the event type for which the field is available diff --git a/pkg/security/secl/compiler/eval/model_test.go b/pkg/security/secl/compiler/eval/model_test.go index 337c5190e7ef3..6b8e0ed0f1ba8 100644 --- a/pkg/security/secl/compiler/eval/model_test.go +++ b/pkg/security/secl/compiler/eval/model_test.go @@ -111,7 +111,22 @@ func (m *testModel) GetFieldRestrictions(_ Field) []EventType { return nil } -func (m *testModel) GetEvaluator(field Field, _ RegisterID) (Evaluator, error) { +func (m *testModel) GetIteratorLen(field Field) (func(ctx *Context) int, error) { + switch field { + + case "process.list": + return func(ctx *Context) int { + return ctx.Event.(*testEvent).process.list.Len() + }, nil + case "process.array": + return func(ctx *Context) int { + return len(ctx.Event.(*testEvent).process.array) + }, nil + } + return nil, &ErrFieldNotFound{Field: field} +} + +func (m *testModel) GetEvaluator(field Field, regID RegisterID) (Evaluator, error) { switch field { case "network.ip": @@ -209,8 +224,39 @@ func (m *testModel) GetEvaluator(field Field, _ RegisterID) (Evaluator, error) { Field: field, }, nil + case "process.list.length": + return &IntEvaluator{ + EvalFnc: func(ctx *Context) int { + return ctx.Event.(*testEvent).process.list.Len() + }, + Field: field, + }, nil + case "process.list.key": + if regID != "" { + return &IntArrayEvaluator{ + EvalFnc: func(ctx *Context) []int { + idx := ctx.Registers[regID] + + var i int + + el := ctx.Event.(*testEvent).process.list.Front() + for el != nil { + if i == idx { + return []int{el.Value.(*testItem).key} + } + el = el.Next() + i++ + } + + return nil + }, + Field: field, + Weight: IteratorWeight, + }, nil + } + return &IntArrayEvaluator{ EvalFnc: func(ctx *Context) []int { // to test optimisation @@ -232,6 +278,29 @@ func (m *testModel) GetEvaluator(field Field, _ RegisterID) (Evaluator, error) { case "process.list.value": + if regID != "" { + return &StringArrayEvaluator{ + EvalFnc: func(ctx *Context) []string { + idx := ctx.Registers[regID] + + var i int + + el := ctx.Event.(*testEvent).process.list.Front() + for el != nil { + if i == idx { + return []string{el.Value.(*testItem).value} + } + el = el.Next() + i++ + } + + return nil + }, + Field: field, + Weight: IteratorWeight, + }, nil + } + return &StringArrayEvaluator{ EvalFnc: func(ctx *Context) []string { // to test optimisation @@ -253,6 +322,29 @@ func (m *testModel) GetEvaluator(field Field, _ RegisterID) (Evaluator, error) { case "process.list.flag": + if regID != "" { + return &BoolArrayEvaluator{ + EvalFnc: func(ctx *Context) []bool { + idx := ctx.Registers[regID] + + var i int + + el := ctx.Event.(*testEvent).process.list.Front() + for el != nil { + if i == idx { + return []bool{el.Value.(*testItem).flag} + } + el = el.Next() + i++ + } + + return nil + }, + Field: field, + Weight: IteratorWeight, + }, nil + } + return &BoolArrayEvaluator{ EvalFnc: func(ctx *Context) []bool { // to test optimisation @@ -272,8 +364,28 @@ func (m *testModel) GetEvaluator(field Field, _ RegisterID) (Evaluator, error) { Weight: IteratorWeight, }, nil + case "process.array.length": + return &IntEvaluator{ + EvalFnc: func(ctx *Context) int { + return len(ctx.Event.(*testEvent).process.array) + }, + Field: field, + }, nil + case "process.array.key": + if regID != "" { + return &IntArrayEvaluator{ + EvalFnc: func(ctx *Context) []int { + idx := ctx.Registers[regID] + + return []int{ctx.Event.(*testEvent).process.array[idx].key} + }, + Field: field, + Weight: IteratorWeight, + }, nil + } + return &IntArrayEvaluator{ EvalFnc: func(ctx *Context) []int { var result []int @@ -290,6 +402,18 @@ func (m *testModel) GetEvaluator(field Field, _ RegisterID) (Evaluator, error) { case "process.array.value": + if regID != "" { + return &StringArrayEvaluator{ + EvalFnc: func(ctx *Context) []string { + idx := ctx.Registers[regID] + + return []string{ctx.Event.(*testEvent).process.array[idx].value} + }, + Field: field, + Weight: IteratorWeight, + }, nil + } + return &StringArrayEvaluator{ EvalFnc: func(ctx *Context) []string { var values []string diff --git a/pkg/security/secl/compiler/eval/registers.go b/pkg/security/secl/compiler/eval/registers.go index af7adebf69416..71892d02cc498 100644 --- a/pkg/security/secl/compiler/eval/registers.go +++ b/pkg/security/secl/compiler/eval/registers.go @@ -7,3 +7,9 @@ package eval // RegisterID identify a register ID type RegisterID = string + +// Register defines an eval register +type Register struct { + ID RegisterID + Field Field +} diff --git a/pkg/security/secl/compiler/eval/rule.go b/pkg/security/secl/compiler/eval/rule.go index 14509112fc847..cb130f767676b 100644 --- a/pkg/security/secl/compiler/eval/rule.go +++ b/pkg/security/secl/compiler/eval/rule.go @@ -7,6 +7,7 @@ package eval import ( + "errors" "fmt" "reflect" "slices" @@ -15,6 +16,10 @@ import ( "github.com/DataDog/datadog-agent/pkg/security/secl/utils" ) +const ( + maxRegisterIteration = 100 +) + // RuleID - ID of a Rule type RuleID = string @@ -43,6 +48,8 @@ type RuleEvaluator struct { fields []Field partialEvals map[Field]BoolEvalFnc + + registers []Register } // NewRule returns a new rule @@ -217,11 +224,52 @@ func NewRuleEvaluator(rule *ast.Rule, model Model, opts *Opts) (*RuleEvaluator, } } + // handle rule with iterator registers + if len(state.registers) > 0 { + // NOTE: limit to only one register for now to avoid computation and evaluation + // of all the combination + if len(state.registers) > 1 { + return nil, &ErrIteratorVariable{Err: errors.New("iterator variable limit to one per rule")} + } + + regID, field := state.registers[0].ID, state.registers[0].Field + lenEval, err := model.GetEvaluator(field+".length", regID) + if err != nil { + return nil, &ErrIteratorVariable{Err: err} + } + + evalBoolFnc := evalBool.EvalFnc + + // eval with each possible value of the registers + evalBool.EvalFnc = func(ctx *Context) bool { + size := lenEval.Eval(ctx).(int) + if size > maxRegisterIteration { + size = maxRegisterIteration + } + + for i := 0; i != size; i++ { + ctx.Registers[regID] = i + if evalBoolFnc(ctx) { + // invalidate the cache + clear(ctx.RegisterCache) + + return true + } + + // invalidate the cache + clear(ctx.RegisterCache) + } + + return false + } + } + return &RuleEvaluator{ Eval: evalBool.EvalFnc, EventType: eventType, fieldValues: state.fieldValues, fields: KeysOfMap(state.fieldValues), + registers: state.registers, }, nil } diff --git a/pkg/security/secl/compiler/eval/state.go b/pkg/security/secl/compiler/eval/state.go index a893419c15706..b50fb42d7fe7c 100644 --- a/pkg/security/secl/compiler/eval/state.go +++ b/pkg/security/secl/compiler/eval/state.go @@ -20,10 +20,10 @@ type StateRegexpCache struct { type State struct { model Model field Field - events map[EventType]bool fieldValues map[Field][]FieldValue macros map[MacroID]*MacroEvaluator regexpCache StateRegexpCache + registers []Register } // UpdateFields updates the fields used in the rule @@ -60,7 +60,6 @@ func NewState(model Model, field Field, macros map[MacroID]*MacroEvaluator) *Sta field: field, macros: macros, model: model, - events: make(map[EventType]bool), fieldValues: make(map[Field][]FieldValue), } } diff --git a/pkg/security/secl/compiler/generators/accessors/accessors.go b/pkg/security/secl/compiler/generators/accessors/accessors.go index fa03839b3bba2..f1cc6fe601060 100644 --- a/pkg/security/secl/compiler/generators/accessors/accessors.go +++ b/pkg/security/secl/compiler/generators/accessors/accessors.go @@ -248,6 +248,23 @@ func handleNonEmbedded(module *common.Module, field seclField, prefixedFieldName } } +func addLengthOpField(module *common.Module, alias string, field *common.StructField) *common.StructField { + lengthField := *field + lengthField.IsLength = true + lengthField.Name += ".length" + lengthField.OrigType = "int" + lengthField.BasicType = "int" + lengthField.ReturnType = "int" + lengthField.Struct = "string" + lengthField.AliasPrefix = alias + lengthField.Alias = alias + ".length" + lengthField.CommentText = doc.SECLDocForLength + + module.Fields[lengthField.Alias] = &lengthField + + return &lengthField +} + // handleIterator adds iterator to list of exposed SECL iterators of the module func handleIterator(module *common.Module, field seclField, fieldType, iterator, aliasPrefix, prefixedFieldName, event string, restrictedTo []string, fieldCommentText, opOverrides string, isPointer, isArray bool) *common.StructField { alias := field.name @@ -272,6 +289,10 @@ func handleIterator(module *common.Module, field seclField, fieldType, iterator, RestrictedTo: restrictedTo, } + lengthField := addLengthOpField(module, alias, module.Iterators[alias]) + lengthField.Iterator = module.Iterators[alias] + lengthField.IsIterator = true + return module.Iterators[alias] } @@ -311,22 +332,10 @@ func handleFieldWithHandler(module *common.Module, field seclField, aliasPrefix, Ref: field.ref, RestrictedTo: restrictedTo, } - module.Fields[alias] = newStructField if field.lengthField { - var lengthField = *module.Fields[alias] - lengthField.IsLength = true - lengthField.Name += ".length" - lengthField.OrigType = "int" - lengthField.BasicType = "int" - lengthField.ReturnType = "int" - lengthField.Struct = "string" - lengthField.AliasPrefix = alias - lengthField.Alias = alias + ".length" - lengthField.CommentText = doc.SECLDocForLength - - module.Fields[lengthField.Alias] = &lengthField + addLengthOpField(module, alias, module.Fields[alias]) } if _, ok := module.EventTypes[event]; !ok { diff --git a/pkg/security/secl/compiler/generators/accessors/accessors.tmpl b/pkg/security/secl/compiler/generators/accessors/accessors.tmpl index dc1d890541ab3..c9c256021d3b5 100644 --- a/pkg/security/secl/compiler/generators/accessors/accessors.tmpl +++ b/pkg/security/secl/compiler/generators/accessors/accessors.tmpl @@ -65,7 +65,7 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval {{- if $Field.OpOverrides}} OpOverrides: {{$Field.OpOverrides}}, {{- end}} - {{- if $Field.Iterator}} + {{- if and $Field.Iterator (not $Field.IsIterator) }} EvalFnc: func(ctx *eval.Context) []{{$Field.ReturnType}} { {{if $Field.Handler}} ev := ctx.Event.(*Event) @@ -81,6 +81,56 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval iterator := &{{$Field.Iterator.ReturnType}}{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + + {{if $Field.Iterator.IsOrigTypePtr}} + element := value + {{else}} + element := *value + {{end}} + + {{range $Check := $Checks}} + {{if $Field.Iterator.Name | HasPrefix $Check}} + {{$SubName := $Field.Iterator.Name | TrimPrefix $Check}} + {{$Check = $SubName | printf "element%s"}} + if !{{$Check}}() { + return append(results, {{$Field.GetDefaultScalarReturnValue}}) + } + {{end}} + {{end}} + + {{$SubName := $Field.Iterator.Name | TrimPrefix $Field.Name}} + + {{$Return := $SubName | printf "element%s"}} + {{if $Field.Handler }} + {{$SubName = $Field.Iterator.Name | TrimPrefix $Field.Prefix}} + {{$Handler := $Field.Iterator.Name | TrimPrefix $Field.Handler}} + {{$Return = print "ev.FieldHandlers." $Handler "(ev, &element" $SubName ")"}} + {{end}} + + {{if eq $Field.ReturnType "int"}} + {{if $Field.IsLength}} + result := len({{".length" | TrimSuffix $Return}}) + {{else}} + result := int({{$Return}}) + {{end}} + {{else}} + result := {{$Return}} + {{end}} + + {{if not $Field.GetArrayPrefix}} + results = append(results, result) + {{else}} + results = append(results, result...) + {{end}} + + return results + } + value := iterator.Front(ctx) for value != nil { {{if $Field.Iterator.IsOrigTypePtr}} @@ -112,9 +162,9 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval {{if eq $Field.ReturnType "int"}} {{if $Field.IsLength}} - result := len({{".length" | TrimSuffix $Return}}) + result := len({{".length" | TrimSuffix $Return}}) {{else}} - result := int({{$Return}}) + result := int({{$Return}}) {{end}} {{else}} result := {{$Return}} @@ -136,7 +186,9 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval {{- else}} {{- $ReturnType := $Field.ReturnType}} EvalFnc: func(ctx *eval.Context) {{$Field.GetArrayPrefix}}{{$ReturnType}} { - ev := ctx.Event.(*Event) + {{- if not (and $Field.IsLength $Field.IsIterator)}} + ev := ctx.Event.(*Event) + {{end}} {{$Return := $Field.Name | printf "ev.%s"}} @@ -175,7 +227,12 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval return int({{$Return}}) {{- else}} {{- if $Field.IsLength }} - {{$Return = ".length" | TrimSuffix $Return | printf "len(%s)"}} + {{- if $Field.IsIterator}} + iterator := &{{$Field.Iterator.ReturnType}}{} + {{$Return = "iterator.Len(ctx)"}} + {{else}} + {{$Return = ".length" | TrimSuffix $Return | printf "len(%s)"}} + {{end}} {{end}} return {{$Return}} {{end -}} @@ -235,7 +292,7 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { {{end}} case "{{$Name}}": - {{if $Field.Iterator}} + {{- if and $Field.Iterator (not $Field.IsLength)}} var values []{{$Field.ReturnType}} ctx := eval.NewContext(ev) @@ -260,7 +317,7 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { {{end}} {{if $Field.IsLength}} - {{$Return = ".length" | TrimSuffix $Return}} + {{$Return = ".length" | TrimSuffix $Return}} {{end}} {{if and (eq $Field.ReturnType "int") (ne $Field.OrigType "int")}} @@ -295,7 +352,13 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { {{end}} {{if $Field.IsLength}} - {{$Return = ".length" | TrimSuffix $Field.Name | printf "len(ev.%s)"}} + {{- if $Field.IsIterator}} + ctx := eval.NewContext(ev) + iterator := &{{$Field.Iterator.ReturnType}}{} + {{$Return = "iterator.Len(ctx)"}} + {{else}} + {{$Return = ".length" | TrimSuffix $Return | printf "len(%s)"}} + {{end}} {{end}} {{if $Field.Handler}} {{$Ptr := "&"}} diff --git a/pkg/security/secl/compiler/generators/accessors/common/types.go b/pkg/security/secl/compiler/generators/accessors/common/types.go index 3730f54f4f545..3e9f3ebef05f6 100644 --- a/pkg/security/secl/compiler/generators/accessors/common/types.go +++ b/pkg/security/secl/compiler/generators/accessors/common/types.go @@ -71,12 +71,15 @@ type StructField struct { GettersOnly bool Ref string RestrictedTo []string + IsIterator bool } // GetEvaluatorType returns the evaluator type name func (sf *StructField) GetEvaluatorType() string { var evaluatorType string - if sf.ReturnType == "int" { + if sf.IsLength && sf.IsIterator { + evaluatorType = "eval.IntEvaluator" + } else if sf.ReturnType == "int" { evaluatorType = "eval.IntEvaluator" if sf.Iterator != nil || sf.IsArray { evaluatorType = "eval.IntArrayEvaluator" diff --git a/pkg/security/secl/compiler/generators/accessors/doc/doc.go b/pkg/security/secl/compiler/generators/accessors/doc/doc.go index f0f77a7e6be7d..69a2068684a54 100644 --- a/pkg/security/secl/compiler/generators/accessors/doc/doc.go +++ b/pkg/security/secl/compiler/generators/accessors/doc/doc.go @@ -23,7 +23,8 @@ import ( const ( generateConstantsAnnotationPrefix = "// generate_constants:" - SECLDocForLength = "SECLDoc[length] Definition:`Length of the corresponding string`" // SECLDocForLength defines SECL doc for length + SECLDocForLength = "SECLDoc[length] Definition:`Length of the corresponding element`" // SECLDocForLength defines SECL doc for length + ) type documentation struct { diff --git a/pkg/security/secl/compiler/generators/accessors/field_accessors.tmpl b/pkg/security/secl/compiler/generators/accessors/field_accessors.tmpl index 358f7729c5c9d..02eff112541d7 100644 --- a/pkg/security/secl/compiler/generators/accessors/field_accessors.tmpl +++ b/pkg/security/secl/compiler/generators/accessors/field_accessors.tmpl @@ -33,7 +33,7 @@ import ( {{$accessorReturnType = $Field.ReturnType}} {{ end }} -{{ if or ($Field.Iterator) ($Field.IsArray) }} +{{ if or (and $Field.Iterator (not $Field.IsIterator)) ($Field.IsArray) }} {{$accessorReturnType = $accessorReturnType | printf "[]%s" }} {{ end }} @@ -47,7 +47,7 @@ func (ev *Event) Get{{$pascalCaseName}}() {{ $accessorReturnType }} { {{$Field | GeneratePrefixNilChecks $.AllFields $accessorReturnType}} - {{if $Field.Iterator}} + {{if and $Field.Iterator (not $Field.IsIterator)}} var values {{ $accessorReturnType }} ctx := eval.NewContext(ev) @@ -109,7 +109,13 @@ func (ev *Event) Get{{$pascalCaseName}}() {{ $accessorReturnType }} { {{end}} {{if $Field.IsLength}} - {{$Return = ".length" | TrimSuffix $Field.Name | printf "len(ev.%s)"}} + {{- if $Field.IsIterator}} + ctx := eval.NewContext(ev) + iterator := &{{$Field.Iterator.ReturnType}}{} + {{$Return = "iterator.Len(ctx)"}} + {{else}} + {{$Return = ".length" | TrimSuffix $Field.Name | printf "len(ev.%s)"}} + {{end}} {{end}} {{if $Field.Handler}} diff --git a/pkg/security/secl/go.mod b/pkg/security/secl/go.mod index 986835aac2f6c..f4705fc5ba55a 100644 --- a/pkg/security/secl/go.mod +++ b/pkg/security/secl/go.mod @@ -40,7 +40,7 @@ require ( github.com/shopspring/decimal v1.4.0 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect - golang.org/x/crypto v0.27.0 // indirect + golang.org/x/crypto v0.28.0 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect diff --git a/pkg/security/secl/go.sum b/pkg/security/secl/go.sum index 509f1984f155e..478b6c14eec12 100644 --- a/pkg/security/secl/go.sum +++ b/pkg/security/secl/go.sum @@ -73,8 +73,8 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= 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.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= diff --git a/pkg/security/secl/model/accessors_unix.go b/pkg/security/secl/model/accessors_unix.go index fd8872ed29c9c..1b4a61d764a83 100644 --- a/pkg/security/secl/model/accessors_unix.go +++ b/pkg/security/secl/model/accessors_unix.go @@ -4501,6 +4501,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgs(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4522,6 +4532,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgsFlags(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4543,6 +4563,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgsOptions(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4564,6 +4594,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgsTruncated(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4585,6 +4625,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgv(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4606,6 +4656,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgv0(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4626,6 +4686,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.AUID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4646,6 +4716,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.CapEffective) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4666,6 +4746,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.CapPermitted) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4686,6 +4776,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.CGroup.CGroupFile.Inode) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4706,6 +4806,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.CGroup.CGroupFile.MountID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4727,6 +4837,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveCGroupID(ev, &element.ProcessContext.Process.CGroup) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4748,6 +4868,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveCGroupManager(ev, &element.ProcessContext.Process.CGroup) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4768,6 +4898,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Comm + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4789,6 +4929,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessContainerID(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4810,6 +4960,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(ev.FieldHandlers.ResolveProcessCreatedAt(ev, &element.ProcessContext.Process)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4830,6 +4990,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.EGID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4850,6 +5020,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.EGroup + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4871,6 +5051,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessEnvp(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4892,6 +5082,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessEnvs(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4913,6 +5113,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessEnvsTruncated(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4933,6 +5143,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.EUID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4953,6 +5173,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.EUser + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4973,6 +5203,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.CTime) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -4999,6 +5242,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFilesystem(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5024,6 +5280,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.GID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5050,6 +5319,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFieldsGroup(ev, &element.ProcessContext.Process.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5076,6 +5358,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveHashesFromEvent(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5102,6 +5397,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, false) + } + result := ev.FieldHandlers.ResolveFileFieldsInUpperLayer(ev, &element.ProcessContext.Process.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5127,6 +5435,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.PathKey.Inode) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5152,6 +5473,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.Mode) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5177,6 +5511,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.MTime) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5202,6 +5549,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.PathKey.MountID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5229,6 +5589,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5256,6 +5629,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := len(ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.FileEvent)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5277,6 +5660,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageName(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5303,6 +5699,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageSourceVersion(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5329,6 +5738,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageVersion(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5356,6 +5778,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5383,6 +5818,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := len(ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.FileEvent)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5404,6 +5849,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(ev.FieldHandlers.ResolveRights(ev, &element.ProcessContext.Process.FileEvent.FileFields)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5429,6 +5887,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.UID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5455,6 +5926,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFieldsUser(ev, &element.ProcessContext.Process.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5480,6 +5964,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.FSGID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5500,6 +5994,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.FSGroup + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5520,6 +6024,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.FSUID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5540,6 +6054,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.FSUser + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5560,6 +6084,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.GID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5580,6 +6114,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.Group + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5600,6 +6144,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.CTime) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5626,6 +6183,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFilesystem(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5651,6 +6221,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.GID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5677,6 +6260,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFieldsGroup(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5703,6 +6299,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveHashesFromEvent(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5729,6 +6338,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, false) + } + result := ev.FieldHandlers.ResolveFileFieldsInUpperLayer(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5754,6 +6376,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.PathKey.Inode) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5779,6 +6414,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.Mode) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5804,6 +6452,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.MTime) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5829,6 +6490,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.PathKey.MountID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5856,6 +6530,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5883,6 +6570,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := len(ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5904,6 +6601,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageName(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5930,6 +6640,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageSourceVersion(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5956,6 +6679,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageVersion(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -5983,6 +6719,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -6010,6 +6759,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := len(ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -6031,6 +6790,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(ev.FieldHandlers.ResolveRights(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -6056,6 +6828,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.UID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -6082,6 +6867,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFieldsUser(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -6107,6 +6905,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.PIDContext.IsKworker + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -6127,6 +6935,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.IsThread + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -6139,6 +6957,15 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval }, Field: field, Weight: eval.IteratorWeight, }, nil + case "process.ancestors.length": + return &eval.IntEvaluator{ + EvalFnc: func(ctx *eval.Context) int { + iterator := &ProcessAncestorsIterator{} + return iterator.Len(ctx) + }, + Field: field, + Weight: eval.IteratorWeight, + }, nil case "process.ancestors.pid": return &eval.IntArrayEvaluator{ EvalFnc: func(ctx *eval.Context) []int { @@ -6147,6 +6974,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.PIDContext.Pid) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -6167,6 +7004,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.PPid) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -6187,6 +7034,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.PIDContext.Tid) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -6207,6 +7064,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.TTYName + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -6227,6 +7094,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.UID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -6247,6 +7124,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.User + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -6268,6 +7155,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveK8SGroups(ev, &element.ProcessContext.Process.UserSession) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -6289,6 +7186,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveK8SUID(ev, &element.ProcessContext.Process.UserSession) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -6310,6 +7217,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveK8SUsername(ev, &element.ProcessContext.Process.UserSession) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8249,6 +9166,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgs(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8270,6 +9197,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgsFlags(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8291,6 +9228,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgsOptions(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8312,6 +9259,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgsTruncated(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8333,6 +9290,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgv(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8354,6 +9321,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgv0(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8374,6 +9351,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.AUID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8394,6 +9381,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.CapEffective) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8414,6 +9411,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.CapPermitted) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8434,6 +9441,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.CGroup.CGroupFile.Inode) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8454,6 +9471,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.CGroup.CGroupFile.MountID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8475,6 +9502,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveCGroupID(ev, &element.ProcessContext.Process.CGroup) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8496,6 +9533,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveCGroupManager(ev, &element.ProcessContext.Process.CGroup) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8516,6 +9563,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Comm + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8537,6 +9594,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessContainerID(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8558,6 +9625,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(ev.FieldHandlers.ResolveProcessCreatedAt(ev, &element.ProcessContext.Process)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8578,6 +9655,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.EGID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8598,6 +9685,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.EGroup + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8619,6 +9716,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessEnvp(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8640,6 +9747,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessEnvs(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8661,6 +9778,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessEnvsTruncated(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8681,6 +9808,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.EUID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8701,6 +9838,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.EUser + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8721,6 +9868,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.CTime) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8747,6 +9907,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFilesystem(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8772,6 +9945,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.GID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8798,6 +9984,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFieldsGroup(ev, &element.ProcessContext.Process.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8824,6 +10023,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveHashesFromEvent(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8850,6 +10062,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, false) + } + result := ev.FieldHandlers.ResolveFileFieldsInUpperLayer(ev, &element.ProcessContext.Process.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8875,6 +10100,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.PathKey.Inode) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8900,6 +10138,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.Mode) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8925,6 +10176,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.MTime) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8950,6 +10214,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.PathKey.MountID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -8977,6 +10254,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9004,6 +10294,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := len(ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.FileEvent)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9025,6 +10325,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageName(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9051,6 +10364,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageSourceVersion(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9077,6 +10403,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageVersion(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9104,6 +10443,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9131,6 +10483,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := len(ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.FileEvent)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9152,6 +10514,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(ev.FieldHandlers.ResolveRights(ev, &element.ProcessContext.Process.FileEvent.FileFields)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9177,6 +10552,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.UID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9203,6 +10591,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFieldsUser(ev, &element.ProcessContext.Process.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9228,6 +10629,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.FSGID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9248,6 +10659,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.FSGroup + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9268,6 +10689,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.FSUID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9288,6 +10719,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.FSUser + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9308,6 +10749,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.GID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9328,6 +10779,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.Group + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9348,6 +10809,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.CTime) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9374,6 +10848,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFilesystem(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9399,6 +10886,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.GID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9425,6 +10925,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFieldsGroup(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9451,6 +10964,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveHashesFromEvent(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9477,6 +11003,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, false) + } + result := ev.FieldHandlers.ResolveFileFieldsInUpperLayer(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9502,6 +11041,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.PathKey.Inode) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9527,6 +11079,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.Mode) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9552,6 +11117,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.MTime) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9577,6 +11155,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.PathKey.MountID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9604,6 +11195,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9631,6 +11235,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := len(ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9652,6 +11266,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageName(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9678,6 +11305,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageSourceVersion(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9704,6 +11344,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageVersion(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9731,6 +11384,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9758,6 +11424,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := len(ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9779,6 +11455,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(ev.FieldHandlers.ResolveRights(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9804,6 +11493,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.UID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9830,6 +11532,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFieldsUser(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9855,6 +11570,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.PIDContext.IsKworker + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9875,6 +11600,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.IsThread + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9887,6 +11622,15 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval }, Field: field, Weight: eval.IteratorWeight, }, nil + case "ptrace.tracee.ancestors.length": + return &eval.IntEvaluator{ + EvalFnc: func(ctx *eval.Context) int { + iterator := &ProcessAncestorsIterator{} + return iterator.Len(ctx) + }, + Field: field, + Weight: eval.IteratorWeight, + }, nil case "ptrace.tracee.ancestors.pid": return &eval.IntArrayEvaluator{ EvalFnc: func(ctx *eval.Context) []int { @@ -9895,6 +11639,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.PIDContext.Pid) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9915,6 +11669,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.PPid) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9935,6 +11699,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.PIDContext.Tid) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9955,6 +11729,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.TTYName + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9975,6 +11759,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.UID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -9995,6 +11789,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.User + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -10016,6 +11820,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveK8SGroups(ev, &element.ProcessContext.Process.UserSession) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -10037,6 +11851,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveK8SUID(ev, &element.ProcessContext.Process.UserSession) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -10058,6 +11882,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveK8SUsername(ev, &element.ProcessContext.Process.UserSession) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13151,6 +14985,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgs(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13172,6 +15016,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgsFlags(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13193,6 +15047,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgsOptions(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13214,6 +15078,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgsTruncated(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13235,6 +15109,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgv(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13256,6 +15140,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessArgv0(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13276,6 +15170,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.AUID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13296,6 +15200,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.CapEffective) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13316,6 +15230,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.CapPermitted) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13336,6 +15260,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.CGroup.CGroupFile.Inode) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13356,6 +15290,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.CGroup.CGroupFile.MountID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13377,6 +15321,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveCGroupID(ev, &element.ProcessContext.Process.CGroup) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13398,6 +15352,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveCGroupManager(ev, &element.ProcessContext.Process.CGroup) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13418,6 +15382,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Comm + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13439,6 +15413,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessContainerID(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13460,6 +15444,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(ev.FieldHandlers.ResolveProcessCreatedAt(ev, &element.ProcessContext.Process)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13480,6 +15474,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.EGID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13500,6 +15504,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.EGroup + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13521,6 +15535,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessEnvp(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13542,6 +15566,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessEnvs(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13563,6 +15597,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessEnvsTruncated(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13583,6 +15627,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.EUID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13603,6 +15657,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.EUser + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13623,6 +15687,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.CTime) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13649,6 +15726,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFilesystem(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13674,6 +15764,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.GID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13700,6 +15803,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFieldsGroup(ev, &element.ProcessContext.Process.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13726,6 +15842,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveHashesFromEvent(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13752,6 +15881,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, false) + } + result := ev.FieldHandlers.ResolveFileFieldsInUpperLayer(ev, &element.ProcessContext.Process.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13777,6 +15919,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.PathKey.Inode) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13802,6 +15957,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.Mode) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13827,6 +15995,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.MTime) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13852,6 +16033,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.PathKey.MountID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13879,6 +16073,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13906,6 +16113,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := len(ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.FileEvent)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13927,6 +16144,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageName(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13953,6 +16183,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageSourceVersion(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -13979,6 +16222,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageVersion(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14006,6 +16262,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14033,6 +16302,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := len(ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.FileEvent)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14054,6 +16333,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(ev.FieldHandlers.ResolveRights(ev, &element.ProcessContext.Process.FileEvent.FileFields)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14079,6 +16371,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.FileEvent.FileFields.UID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14105,6 +16410,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.IsNotKworker() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFieldsUser(ev, &element.ProcessContext.Process.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14130,6 +16448,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.FSGID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14150,6 +16478,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.FSGroup + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14170,6 +16508,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.FSUID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14190,6 +16538,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.FSUser + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14210,6 +16568,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.GID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14230,6 +16598,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.Group + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14250,6 +16628,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.CTime) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14276,6 +16667,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFilesystem(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14301,6 +16705,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.GID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14327,6 +16744,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFieldsGroup(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14353,6 +16783,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveHashesFromEvent(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14379,6 +16822,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, false) + } + result := ev.FieldHandlers.ResolveFileFieldsInUpperLayer(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14404,6 +16860,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.PathKey.Inode) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14429,6 +16898,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.Mode) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14454,6 +16936,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.MTime) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14479,6 +16974,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.PathKey.MountID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14506,6 +17014,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14533,6 +17054,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := len(ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14554,6 +17085,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageName(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14580,6 +17124,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageSourceVersion(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14606,6 +17163,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolvePackageVersion(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14633,6 +17203,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14660,6 +17243,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := len(ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14681,6 +17274,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(ev.FieldHandlers.ResolveRights(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14706,6 +17312,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, 0) + } + result := int(element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields.UID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14732,6 +17351,19 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + if !element.ProcessContext.Process.HasInterpreter() { + return append(results, "") + } + result := ev.FieldHandlers.ResolveFileFieldsUser(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent.FileFields) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14757,6 +17389,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.PIDContext.IsKworker + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14777,6 +17419,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []bool iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.IsThread + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14789,6 +17441,15 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval }, Field: field, Weight: eval.IteratorWeight, }, nil + case "signal.target.ancestors.length": + return &eval.IntEvaluator{ + EvalFnc: func(ctx *eval.Context) int { + iterator := &ProcessAncestorsIterator{} + return iterator.Len(ctx) + }, + Field: field, + Weight: eval.IteratorWeight, + }, nil case "signal.target.ancestors.pid": return &eval.IntArrayEvaluator{ EvalFnc: func(ctx *eval.Context) []int { @@ -14797,6 +17458,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.PIDContext.Pid) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14817,6 +17488,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.PPid) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14837,6 +17518,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.PIDContext.Tid) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14857,6 +17548,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.TTYName + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14877,6 +17578,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.Credentials.UID) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14897,6 +17608,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.Credentials.User + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14918,6 +17639,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveK8SGroups(ev, &element.ProcessContext.Process.UserSession) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14939,6 +17670,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveK8SUID(ev, &element.ProcessContext.Process.UserSession) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -14960,6 +17701,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveK8SUsername(ev, &element.ProcessContext.Process.UserSession) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -18077,6 +20828,7 @@ func (ev *Event) GetFields() []eval.Field { "process.ancestors.interpreter.file.user", "process.ancestors.is_kworker", "process.ancestors.is_thread", + "process.ancestors.length", "process.ancestors.pid", "process.ancestors.ppid", "process.ancestors.tid", @@ -18319,6 +21071,7 @@ func (ev *Event) GetFields() []eval.Field { "ptrace.tracee.ancestors.interpreter.file.user", "ptrace.tracee.ancestors.is_kworker", "ptrace.tracee.ancestors.is_thread", + "ptrace.tracee.ancestors.length", "ptrace.tracee.ancestors.pid", "ptrace.tracee.ancestors.ppid", "ptrace.tracee.ancestors.tid", @@ -18687,6 +21440,7 @@ func (ev *Event) GetFields() []eval.Field { "signal.target.ancestors.interpreter.file.user", "signal.target.ancestors.is_kworker", "signal.target.ancestors.is_thread", + "signal.target.ancestors.length", "signal.target.ancestors.pid", "signal.target.ancestors.ppid", "signal.target.ancestors.tid", @@ -20482,17 +23236,7 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { } return values, nil case "process.ancestors.file.name.length": - var values []int - ctx := eval.NewContext(ev) - iterator := &ProcessAncestorsIterator{} - ptr := iterator.Front(ctx) - for ptr != nil { - element := ptr - result := len(ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.FileEvent)) - values = append(values, result) - ptr = iterator.Next() - } - return values, nil + return ev.FieldHandlers.ResolveFileBasename(ev, &ev.BaseEvent.ProcessContext.Ancestor.ProcessContext.Process.FileEvent), nil case "process.ancestors.file.package.name": var values []string ctx := eval.NewContext(ev) @@ -20542,17 +23286,7 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { } return values, nil case "process.ancestors.file.path.length": - var values []int - ctx := eval.NewContext(ev) - iterator := &ProcessAncestorsIterator{} - ptr := iterator.Front(ctx) - for ptr != nil { - element := ptr - result := len(ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.FileEvent)) - values = append(values, result) - ptr = iterator.Next() - } - return values, nil + return ev.FieldHandlers.ResolveFilePath(ev, &ev.BaseEvent.ProcessContext.Ancestor.ProcessContext.Process.FileEvent), nil case "process.ancestors.file.rights": var values []int ctx := eval.NewContext(ev) @@ -20794,17 +23528,7 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { } return values, nil case "process.ancestors.interpreter.file.name.length": - var values []int - ctx := eval.NewContext(ev) - iterator := &ProcessAncestorsIterator{} - ptr := iterator.Front(ctx) - for ptr != nil { - element := ptr - result := len(ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent)) - values = append(values, result) - ptr = iterator.Next() - } - return values, nil + return ev.FieldHandlers.ResolveFileBasename(ev, &ev.BaseEvent.ProcessContext.Ancestor.ProcessContext.Process.LinuxBinprm.FileEvent), nil case "process.ancestors.interpreter.file.package.name": var values []string ctx := eval.NewContext(ev) @@ -20854,17 +23578,7 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { } return values, nil case "process.ancestors.interpreter.file.path.length": - var values []int - ctx := eval.NewContext(ev) - iterator := &ProcessAncestorsIterator{} - ptr := iterator.Front(ctx) - for ptr != nil { - element := ptr - result := len(ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent)) - values = append(values, result) - ptr = iterator.Next() - } - return values, nil + return ev.FieldHandlers.ResolveFilePath(ev, &ev.BaseEvent.ProcessContext.Ancestor.ProcessContext.Process.LinuxBinprm.FileEvent), nil case "process.ancestors.interpreter.file.rights": var values []int ctx := eval.NewContext(ev) @@ -20925,6 +23639,10 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { ptr = iterator.Next() } return values, nil + case "process.ancestors.length": + ctx := eval.NewContext(ev) + iterator := &ProcessAncestorsIterator{} + return iterator.Len(ctx), nil case "process.ancestors.pid": var values []int ctx := eval.NewContext(ev) @@ -22210,17 +24928,7 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { } return values, nil case "ptrace.tracee.ancestors.file.name.length": - var values []int - ctx := eval.NewContext(ev) - iterator := &ProcessAncestorsIterator{} - ptr := iterator.Front(ctx) - for ptr != nil { - element := ptr - result := len(ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.FileEvent)) - values = append(values, result) - ptr = iterator.Next() - } - return values, nil + return ev.FieldHandlers.ResolveFileBasename(ev, &ev.PTrace.Tracee.Ancestor.ProcessContext.Process.FileEvent), nil case "ptrace.tracee.ancestors.file.package.name": var values []string ctx := eval.NewContext(ev) @@ -22270,17 +24978,7 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { } return values, nil case "ptrace.tracee.ancestors.file.path.length": - var values []int - ctx := eval.NewContext(ev) - iterator := &ProcessAncestorsIterator{} - ptr := iterator.Front(ctx) - for ptr != nil { - element := ptr - result := len(ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.FileEvent)) - values = append(values, result) - ptr = iterator.Next() - } - return values, nil + return ev.FieldHandlers.ResolveFilePath(ev, &ev.PTrace.Tracee.Ancestor.ProcessContext.Process.FileEvent), nil case "ptrace.tracee.ancestors.file.rights": var values []int ctx := eval.NewContext(ev) @@ -22522,17 +25220,7 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { } return values, nil case "ptrace.tracee.ancestors.interpreter.file.name.length": - var values []int - ctx := eval.NewContext(ev) - iterator := &ProcessAncestorsIterator{} - ptr := iterator.Front(ctx) - for ptr != nil { - element := ptr - result := len(ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent)) - values = append(values, result) - ptr = iterator.Next() - } - return values, nil + return ev.FieldHandlers.ResolveFileBasename(ev, &ev.PTrace.Tracee.Ancestor.ProcessContext.Process.LinuxBinprm.FileEvent), nil case "ptrace.tracee.ancestors.interpreter.file.package.name": var values []string ctx := eval.NewContext(ev) @@ -22582,17 +25270,7 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { } return values, nil case "ptrace.tracee.ancestors.interpreter.file.path.length": - var values []int - ctx := eval.NewContext(ev) - iterator := &ProcessAncestorsIterator{} - ptr := iterator.Front(ctx) - for ptr != nil { - element := ptr - result := len(ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent)) - values = append(values, result) - ptr = iterator.Next() - } - return values, nil + return ev.FieldHandlers.ResolveFilePath(ev, &ev.PTrace.Tracee.Ancestor.ProcessContext.Process.LinuxBinprm.FileEvent), nil case "ptrace.tracee.ancestors.interpreter.file.rights": var values []int ctx := eval.NewContext(ev) @@ -22653,6 +25331,10 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { ptr = iterator.Next() } return values, nil + case "ptrace.tracee.ancestors.length": + ctx := eval.NewContext(ev) + iterator := &ProcessAncestorsIterator{} + return iterator.Len(ctx), nil case "ptrace.tracee.ancestors.pid": var values []int ctx := eval.NewContext(ev) @@ -24190,17 +26872,7 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { } return values, nil case "signal.target.ancestors.file.name.length": - var values []int - ctx := eval.NewContext(ev) - iterator := &ProcessAncestorsIterator{} - ptr := iterator.Front(ctx) - for ptr != nil { - element := ptr - result := len(ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.FileEvent)) - values = append(values, result) - ptr = iterator.Next() - } - return values, nil + return ev.FieldHandlers.ResolveFileBasename(ev, &ev.Signal.Target.Ancestor.ProcessContext.Process.FileEvent), nil case "signal.target.ancestors.file.package.name": var values []string ctx := eval.NewContext(ev) @@ -24250,17 +26922,7 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { } return values, nil case "signal.target.ancestors.file.path.length": - var values []int - ctx := eval.NewContext(ev) - iterator := &ProcessAncestorsIterator{} - ptr := iterator.Front(ctx) - for ptr != nil { - element := ptr - result := len(ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.FileEvent)) - values = append(values, result) - ptr = iterator.Next() - } - return values, nil + return ev.FieldHandlers.ResolveFilePath(ev, &ev.Signal.Target.Ancestor.ProcessContext.Process.FileEvent), nil case "signal.target.ancestors.file.rights": var values []int ctx := eval.NewContext(ev) @@ -24502,17 +27164,7 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { } return values, nil case "signal.target.ancestors.interpreter.file.name.length": - var values []int - ctx := eval.NewContext(ev) - iterator := &ProcessAncestorsIterator{} - ptr := iterator.Front(ctx) - for ptr != nil { - element := ptr - result := len(ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent)) - values = append(values, result) - ptr = iterator.Next() - } - return values, nil + return ev.FieldHandlers.ResolveFileBasename(ev, &ev.Signal.Target.Ancestor.ProcessContext.Process.LinuxBinprm.FileEvent), nil case "signal.target.ancestors.interpreter.file.package.name": var values []string ctx := eval.NewContext(ev) @@ -24562,17 +27214,7 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { } return values, nil case "signal.target.ancestors.interpreter.file.path.length": - var values []int - ctx := eval.NewContext(ev) - iterator := &ProcessAncestorsIterator{} - ptr := iterator.Front(ctx) - for ptr != nil { - element := ptr - result := len(ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.LinuxBinprm.FileEvent)) - values = append(values, result) - ptr = iterator.Next() - } - return values, nil + return ev.FieldHandlers.ResolveFilePath(ev, &ev.Signal.Target.Ancestor.ProcessContext.Process.LinuxBinprm.FileEvent), nil case "signal.target.ancestors.interpreter.file.rights": var values []int ctx := eval.NewContext(ev) @@ -24633,6 +27275,10 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { ptr = iterator.Next() } return values, nil + case "signal.target.ancestors.length": + ctx := eval.NewContext(ev) + iterator := &ProcessAncestorsIterator{} + return iterator.Len(ctx), nil case "signal.target.ancestors.pid": var values []int ctx := eval.NewContext(ev) @@ -26718,6 +29364,8 @@ func (ev *Event) GetFieldEventType(field eval.Field) (eval.EventType, error) { return "", nil case "process.ancestors.is_thread": return "", nil + case "process.ancestors.length": + return "", nil case "process.ancestors.pid": return "", nil case "process.ancestors.ppid": @@ -27202,6 +29850,8 @@ func (ev *Event) GetFieldEventType(field eval.Field) (eval.EventType, error) { return "ptrace", nil case "ptrace.tracee.ancestors.is_thread": return "ptrace", nil + case "ptrace.tracee.ancestors.length": + return "ptrace", nil case "ptrace.tracee.ancestors.pid": return "ptrace", nil case "ptrace.tracee.ancestors.ppid": @@ -27938,6 +30588,8 @@ func (ev *Event) GetFieldEventType(field eval.Field) (eval.EventType, error) { return "signal", nil case "signal.target.ancestors.is_thread": return "signal", nil + case "signal.target.ancestors.length": + return "signal", nil case "signal.target.ancestors.pid": return "signal", nil case "signal.target.ancestors.ppid": @@ -29489,6 +32141,8 @@ func (ev *Event) GetFieldType(field eval.Field) (reflect.Kind, error) { return reflect.Bool, nil case "process.ancestors.is_thread": return reflect.Bool, nil + case "process.ancestors.length": + return reflect.Int, nil case "process.ancestors.pid": return reflect.Int, nil case "process.ancestors.ppid": @@ -29973,6 +32627,8 @@ func (ev *Event) GetFieldType(field eval.Field) (reflect.Kind, error) { return reflect.Bool, nil case "ptrace.tracee.ancestors.is_thread": return reflect.Bool, nil + case "ptrace.tracee.ancestors.length": + return reflect.Int, nil case "ptrace.tracee.ancestors.pid": return reflect.Int, nil case "ptrace.tracee.ancestors.ppid": @@ -30709,6 +33365,8 @@ func (ev *Event) GetFieldType(field eval.Field) (reflect.Kind, error) { return reflect.Bool, nil case "signal.target.ancestors.is_thread": return reflect.Bool, nil + case "signal.target.ancestors.length": + return reflect.Int, nil case "signal.target.ancestors.pid": return reflect.Int, nil case "signal.target.ancestors.ppid": @@ -35923,6 +38581,14 @@ func (ev *Event) SetFieldValue(field eval.Field, value interface{}) error { } ev.BaseEvent.ProcessContext.Ancestor.ProcessContext.Process.IsThread = rv return nil + case "process.ancestors.length": + if ev.BaseEvent.ProcessContext == nil { + ev.BaseEvent.ProcessContext = &ProcessContext{} + } + if ev.BaseEvent.ProcessContext.Ancestor == nil { + ev.BaseEvent.ProcessContext.Ancestor = &ProcessCacheEntry{} + } + return &eval.ErrFieldReadOnly{Field: "process.ancestors.length"} case "process.ancestors.pid": if ev.BaseEvent.ProcessContext == nil { ev.BaseEvent.ProcessContext = &ProcessContext{} @@ -38865,6 +41531,14 @@ func (ev *Event) SetFieldValue(field eval.Field, value interface{}) error { } ev.PTrace.Tracee.Ancestor.ProcessContext.Process.IsThread = rv return nil + case "ptrace.tracee.ancestors.length": + if ev.PTrace.Tracee == nil { + ev.PTrace.Tracee = &ProcessContext{} + } + if ev.PTrace.Tracee.Ancestor == nil { + ev.PTrace.Tracee.Ancestor = &ProcessCacheEntry{} + } + return &eval.ErrFieldReadOnly{Field: "ptrace.tracee.ancestors.length"} case "ptrace.tracee.ancestors.pid": if ev.PTrace.Tracee == nil { ev.PTrace.Tracee = &ProcessContext{} @@ -42684,6 +45358,14 @@ func (ev *Event) SetFieldValue(field eval.Field, value interface{}) error { } ev.Signal.Target.Ancestor.ProcessContext.Process.IsThread = rv return nil + case "signal.target.ancestors.length": + if ev.Signal.Target == nil { + ev.Signal.Target = &ProcessContext{} + } + if ev.Signal.Target.Ancestor == nil { + ev.Signal.Target.Ancestor = &ProcessCacheEntry{} + } + return &eval.ErrFieldReadOnly{Field: "signal.target.ancestors.length"} case "signal.target.ancestors.pid": if ev.Signal.Target == nil { ev.Signal.Target = &ProcessContext{} diff --git a/pkg/security/secl/model/accessors_windows.go b/pkg/security/secl/model/accessors_windows.go index 9d946ba35751c..2cc1f461e6a14 100644 --- a/pkg/security/secl/model/accessors_windows.go +++ b/pkg/security/secl/model/accessors_windows.go @@ -795,6 +795,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessCmdLine(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -815,6 +825,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.ContainerID + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -836,6 +856,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(ev.FieldHandlers.ResolveProcessCreatedAt(ev, &element.ProcessContext.Process)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -857,6 +887,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessEnvp(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -878,6 +918,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessEnvs(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -900,6 +950,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -922,6 +982,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := len(ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.FileEvent)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -944,6 +1014,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -966,6 +1046,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := len(ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.FileEvent)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -978,6 +1068,15 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval }, Field: field, Weight: eval.IteratorWeight, }, nil + case "process.ancestors.length": + return &eval.IntEvaluator{ + EvalFnc: func(ctx *eval.Context) int { + iterator := &ProcessAncestorsIterator{} + return iterator.Len(ctx) + }, + Field: field, + Weight: eval.IteratorWeight, + }, nil case "process.ancestors.pid": return &eval.IntArrayEvaluator{ EvalFnc: func(ctx *eval.Context) []int { @@ -986,6 +1085,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.PIDContext.Pid) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -1006,6 +1115,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.PPid) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -1027,6 +1146,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveUser(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -1047,6 +1176,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.OwnerSidString + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -1739,6 +1878,7 @@ func (ev *Event) GetFields() []eval.Field { "process.ancestors.file.name.length", "process.ancestors.file.path", "process.ancestors.file.path.length", + "process.ancestors.length", "process.ancestors.pid", "process.ancestors.ppid", "process.ancestors.user", @@ -2036,17 +2176,7 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { } return values, nil case "process.ancestors.file.name.length": - var values []int - ctx := eval.NewContext(ev) - iterator := &ProcessAncestorsIterator{} - ptr := iterator.Front(ctx) - for ptr != nil { - element := ptr - result := len(ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.FileEvent)) - values = append(values, result) - ptr = iterator.Next() - } - return values, nil + return ev.FieldHandlers.ResolveFileBasename(ev, &ev.BaseEvent.ProcessContext.Ancestor.ProcessContext.Process.FileEvent), nil case "process.ancestors.file.path": var values []string ctx := eval.NewContext(ev) @@ -2060,17 +2190,11 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { } return values, nil case "process.ancestors.file.path.length": - var values []int + return ev.FieldHandlers.ResolveFilePath(ev, &ev.BaseEvent.ProcessContext.Ancestor.ProcessContext.Process.FileEvent), nil + case "process.ancestors.length": ctx := eval.NewContext(ev) iterator := &ProcessAncestorsIterator{} - ptr := iterator.Front(ctx) - for ptr != nil { - element := ptr - result := len(ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.FileEvent)) - values = append(values, result) - ptr = iterator.Next() - } - return values, nil + return iterator.Len(ctx), nil case "process.ancestors.pid": var values []int ctx := eval.NewContext(ev) @@ -2449,6 +2573,8 @@ func (ev *Event) GetFieldEventType(field eval.Field) (eval.EventType, error) { return "", nil case "process.ancestors.file.path.length": return "", nil + case "process.ancestors.length": + return "", nil case "process.ancestors.pid": return "", nil case "process.ancestors.ppid": @@ -2754,6 +2880,8 @@ func (ev *Event) GetFieldType(field eval.Field) (reflect.Kind, error) { return reflect.String, nil case "process.ancestors.file.path.length": return reflect.Int, nil + case "process.ancestors.length": + return reflect.Int, nil case "process.ancestors.pid": return reflect.Int, nil case "process.ancestors.ppid": @@ -3544,6 +3672,14 @@ func (ev *Event) SetFieldValue(field eval.Field, value interface{}) error { ev.BaseEvent.ProcessContext.Ancestor = &ProcessCacheEntry{} } return &eval.ErrFieldReadOnly{Field: "process.ancestors.file.path.length"} + case "process.ancestors.length": + if ev.BaseEvent.ProcessContext == nil { + ev.BaseEvent.ProcessContext = &ProcessContext{} + } + if ev.BaseEvent.ProcessContext.Ancestor == nil { + ev.BaseEvent.ProcessContext.Ancestor = &ProcessCacheEntry{} + } + return &eval.ErrFieldReadOnly{Field: "process.ancestors.length"} case "process.ancestors.pid": if ev.BaseEvent.ProcessContext == nil { ev.BaseEvent.ProcessContext = &ProcessContext{} diff --git a/pkg/security/secl/model/events.go b/pkg/security/secl/model/events.go index 5804216d60297..8e44b9aa1e97c 100644 --- a/pkg/security/secl/model/events.go +++ b/pkg/security/secl/model/events.go @@ -269,6 +269,8 @@ func (t EventType) String() string { return "change_permission" case LoginUIDWriteEventType: return "login_uid_write" + case CgroupWriteEventType: + return "cgroup_write" default: return "unknown" } diff --git a/pkg/security/secl/model/field_accessors_unix.go b/pkg/security/secl/model/field_accessors_unix.go index 2398cbdbd6b7f..71e1fbaab29bc 100644 --- a/pkg/security/secl/model/field_accessors_unix.go +++ b/pkg/security/secl/model/field_accessors_unix.go @@ -6358,6 +6358,19 @@ func (ev *Event) GetProcessAncestorsIsThread() []bool { return values } +// GetProcessAncestorsLength returns the value of the field, resolving if necessary +func (ev *Event) GetProcessAncestorsLength() int { + if ev.BaseEvent.ProcessContext == nil { + return 0 + } + if ev.BaseEvent.ProcessContext.Ancestor == nil { + return 0 + } + ctx := eval.NewContext(ev) + iterator := &ProcessAncestorsIterator{} + return iterator.Len(ctx) +} + // GetProcessAncestorsPid returns the value of the field, resolving if necessary func (ev *Event) GetProcessAncestorsPid() []uint32 { if ev.BaseEvent.ProcessContext == nil { @@ -10393,6 +10406,22 @@ func (ev *Event) GetPtraceTraceeAncestorsIsThread() []bool { return values } +// GetPtraceTraceeAncestorsLength returns the value of the field, resolving if necessary +func (ev *Event) GetPtraceTraceeAncestorsLength() int { + if ev.GetEventType().String() != "ptrace" { + return 0 + } + if ev.PTrace.Tracee == nil { + return 0 + } + if ev.PTrace.Tracee.Ancestor == nil { + return 0 + } + ctx := eval.NewContext(ev) + iterator := &ProcessAncestorsIterator{} + return iterator.Len(ctx) +} + // GetPtraceTraceeAncestorsPid returns the value of the field, resolving if necessary func (ev *Event) GetPtraceTraceeAncestorsPid() []uint32 { if ev.GetEventType().String() != "ptrace" { @@ -16018,6 +16047,22 @@ func (ev *Event) GetSignalTargetAncestorsIsThread() []bool { return values } +// GetSignalTargetAncestorsLength returns the value of the field, resolving if necessary +func (ev *Event) GetSignalTargetAncestorsLength() int { + if ev.GetEventType().String() != "signal" { + return 0 + } + if ev.Signal.Target == nil { + return 0 + } + if ev.Signal.Target.Ancestor == nil { + return 0 + } + ctx := eval.NewContext(ev) + iterator := &ProcessAncestorsIterator{} + return iterator.Len(ctx) +} + // GetSignalTargetAncestorsPid returns the value of the field, resolving if necessary func (ev *Event) GetSignalTargetAncestorsPid() []uint32 { if ev.GetEventType().String() != "signal" { diff --git a/pkg/security/secl/model/field_accessors_windows.go b/pkg/security/secl/model/field_accessors_windows.go index d1cfc889afacb..1ed3130e6951e 100644 --- a/pkg/security/secl/model/field_accessors_windows.go +++ b/pkg/security/secl/model/field_accessors_windows.go @@ -984,6 +984,19 @@ func (ev *Event) GetProcessAncestorsFilePathLength() []int { return values } +// GetProcessAncestorsLength returns the value of the field, resolving if necessary +func (ev *Event) GetProcessAncestorsLength() int { + if ev.BaseEvent.ProcessContext == nil { + return 0 + } + if ev.BaseEvent.ProcessContext.Ancestor == nil { + return 0 + } + ctx := eval.NewContext(ev) + iterator := &ProcessAncestorsIterator{} + return iterator.Len(ctx) +} + // GetProcessAncestorsPid returns the value of the field, resolving if necessary func (ev *Event) GetProcessAncestorsPid() []uint32 { if ev.BaseEvent.ProcessContext == nil { diff --git a/pkg/security/secl/model/model.go b/pkg/security/secl/model/model.go index 5593d1502a45b..e438c1b0d8ec7 100644 --- a/pkg/security/secl/model/model.go +++ b/pkg/security/secl/model/model.go @@ -506,6 +506,43 @@ func (it *ProcessAncestorsIterator) Next() *ProcessCacheEntry { return nil } +// At returns the element at the given position +func (it *ProcessAncestorsIterator) At(ctx *eval.Context, regID eval.RegisterID, pos int) *ProcessCacheEntry { + if entry := ctx.RegisterCache[regID]; entry != nil && entry.Pos == pos { + return entry.Value.(*ProcessCacheEntry) + } + + var i int + + ancestor := ctx.Event.(*Event).ProcessContext.Ancestor + for ancestor != nil { + if i == pos { + ctx.RegisterCache[regID] = &eval.RegisterCacheEntry{ + Pos: pos, + Value: ancestor, + } + return ancestor + } + ancestor = ancestor.Ancestor + i++ + } + + return nil +} + +// Len returns the len +func (it *ProcessAncestorsIterator) Len(ctx *eval.Context) int { + var size int + + ancestor := ctx.Event.(*Event).ProcessContext.Ancestor + for ancestor != nil { + size++ + ancestor = ancestor.Ancestor + } + + return size +} + // HasParent returns whether the process has a parent func (p *ProcessContext) HasParent() bool { return p.Parent != nil diff --git a/pkg/security/secl/model/unmarshallers_linux.go b/pkg/security/secl/model/unmarshallers_linux.go index 6b5e95d61006c..ab0955abc6195 100644 --- a/pkg/security/secl/model/unmarshallers_linux.go +++ b/pkg/security/secl/model/unmarshallers_linux.go @@ -1332,13 +1332,13 @@ func (e *RawPacketEvent) UnmarshalBinary(data []byte) (int, error) { if layer := packet.Layer(layers.LayerTypeUDP); layer != nil { if rl, ok := layer.(*layers.UDP); ok { - e.L4Protocol = uint16(layers.LayerTypeUDP) + e.L4Protocol = unix.IPPROTO_UDP e.Source.Port = uint16(rl.SrcPort) e.Destination.Port = uint16(rl.DstPort) } } else if layer := packet.Layer(layers.LayerTypeTCP); layer != nil { if rl, ok := layer.(*layers.TCP); ok { - e.L4Protocol = uint16(layers.IPProtocolTCP) + e.L4Protocol = unix.IPPROTO_TCP e.Source.Port = uint16(rl.SrcPort) e.Destination.Port = uint16(rl.DstPort) } diff --git a/pkg/security/secl/rules/rule_filters.go b/pkg/security/secl/rules/rule_filters.go index 5c4088295bf60..8f116d4d175f5 100644 --- a/pkg/security/secl/rules/rule_filters.go +++ b/pkg/security/secl/rules/rule_filters.go @@ -82,17 +82,13 @@ func (r *AgentVersionFilter) IsMacroAccepted(macro *MacroDefinition) (bool, erro // SECLRuleFilter defines a SECL rule filter type SECLRuleFilter struct { model eval.Model - context *eval.Context parsingContext *ast.ParsingContext } // NewSECLRuleFilter returns a new agent version based rule filter func NewSECLRuleFilter(model eval.Model) *SECLRuleFilter { return &SECLRuleFilter{ - model: model, - context: &eval.Context{ - Event: model.NewEvent(), - }, + model: model, parsingContext: ast.NewParsingContext(), } } @@ -107,6 +103,12 @@ func mergeFilterExpressions(filters []string) (expression string) { return } +func (r *SECLRuleFilter) newEvalContext() eval.Context { + return eval.Context{ + Event: r.model.NewEvent(), + } +} + // IsRuleAccepted checks whether the rule is accepted func (r *SECLRuleFilter) IsRuleAccepted(rule *RuleDefinition) (bool, error) { if len(rule.Filters) == 0 { @@ -128,7 +130,8 @@ func (r *SECLRuleFilter) IsRuleAccepted(rule *RuleDefinition) (bool, error) { return false, err } - return evaluator.Eval(r.context), nil + ctx := r.newEvalContext() + return evaluator.Eval(&ctx), nil } // IsMacroAccepted checks whether the macro is accepted @@ -148,5 +151,6 @@ func (r *SECLRuleFilter) IsMacroAccepted(macro *MacroDefinition) (bool, error) { return false, err } - return evaluator.Eval(r.context), nil + ctx := r.newEvalContext() + return evaluator.Eval(&ctx), nil } diff --git a/pkg/security/secl/rules/ruleset.go b/pkg/security/secl/rules/ruleset.go index 981109f7ad02e..061e9d230c5a5 100644 --- a/pkg/security/secl/rules/ruleset.go +++ b/pkg/security/secl/rules/ruleset.go @@ -340,7 +340,7 @@ func (rs *RuleSet) AddRule(parsingContext *ast.ParsingContext, pRule *PolicyRule // ignore event types not supported if _, exists := rs.opts.EventTypeEnabled["*"]; !exists { - if _, exists := rs.opts.EventTypeEnabled[eventType]; !exists { + if enabled, exists := rs.opts.EventTypeEnabled[eventType]; !exists || !enabled { return nil, &ErrRuleLoad{Rule: pRule, Err: ErrEventTypeNotEnabled} } } diff --git a/pkg/security/seclwin/model/accessors_win.go b/pkg/security/seclwin/model/accessors_win.go index 0183570889f98..c6e0e7b3bb650 100644 --- a/pkg/security/seclwin/model/accessors_win.go +++ b/pkg/security/seclwin/model/accessors_win.go @@ -793,6 +793,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessCmdLine(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -813,6 +823,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.ContainerID + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -834,6 +854,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(ev.FieldHandlers.ResolveProcessCreatedAt(ev, &element.ProcessContext.Process)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -855,6 +885,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessEnvp(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -876,6 +916,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveProcessEnvs(ev, &element.ProcessContext.Process) + results = append(results, result...) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -898,6 +948,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -920,6 +980,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := len(ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.FileEvent)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -942,6 +1012,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.FileEvent) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -964,6 +1044,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := len(ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.FileEvent)) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -976,6 +1066,15 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval }, Field: field, Weight: eval.IteratorWeight, }, nil + case "process.ancestors.length": + return &eval.IntEvaluator{ + EvalFnc: func(ctx *eval.Context) int { + iterator := &ProcessAncestorsIterator{} + return iterator.Len(ctx) + }, + Field: field, + Weight: eval.IteratorWeight, + }, nil case "process.ancestors.pid": return &eval.IntArrayEvaluator{ EvalFnc: func(ctx *eval.Context) []int { @@ -984,6 +1083,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.PIDContext.Pid) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -1004,6 +1113,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []int iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := int(element.ProcessContext.Process.PPid) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -1025,6 +1144,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := ev.FieldHandlers.ResolveUser(ev, &element.ProcessContext.Process) + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -1045,6 +1174,16 @@ func (m *Model) GetEvaluator(field eval.Field, regID eval.RegisterID) (eval.Eval } var results []string iterator := &ProcessAncestorsIterator{} + if regID != "" { + value := iterator.At(ctx, regID, ctx.Registers[regID]) + if value == nil { + return results + } + element := value + result := element.ProcessContext.Process.OwnerSidString + results = append(results, result) + return results + } value := iterator.Front(ctx) for value != nil { element := value @@ -1737,6 +1876,7 @@ func (ev *Event) GetFields() []eval.Field { "process.ancestors.file.name.length", "process.ancestors.file.path", "process.ancestors.file.path.length", + "process.ancestors.length", "process.ancestors.pid", "process.ancestors.ppid", "process.ancestors.user", @@ -2034,17 +2174,7 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { } return values, nil case "process.ancestors.file.name.length": - var values []int - ctx := eval.NewContext(ev) - iterator := &ProcessAncestorsIterator{} - ptr := iterator.Front(ctx) - for ptr != nil { - element := ptr - result := len(ev.FieldHandlers.ResolveFileBasename(ev, &element.ProcessContext.Process.FileEvent)) - values = append(values, result) - ptr = iterator.Next() - } - return values, nil + return ev.FieldHandlers.ResolveFileBasename(ev, &ev.BaseEvent.ProcessContext.Ancestor.ProcessContext.Process.FileEvent), nil case "process.ancestors.file.path": var values []string ctx := eval.NewContext(ev) @@ -2058,17 +2188,11 @@ func (ev *Event) GetFieldValue(field eval.Field) (interface{}, error) { } return values, nil case "process.ancestors.file.path.length": - var values []int + return ev.FieldHandlers.ResolveFilePath(ev, &ev.BaseEvent.ProcessContext.Ancestor.ProcessContext.Process.FileEvent), nil + case "process.ancestors.length": ctx := eval.NewContext(ev) iterator := &ProcessAncestorsIterator{} - ptr := iterator.Front(ctx) - for ptr != nil { - element := ptr - result := len(ev.FieldHandlers.ResolveFilePath(ev, &element.ProcessContext.Process.FileEvent)) - values = append(values, result) - ptr = iterator.Next() - } - return values, nil + return iterator.Len(ctx), nil case "process.ancestors.pid": var values []int ctx := eval.NewContext(ev) @@ -2447,6 +2571,8 @@ func (ev *Event) GetFieldEventType(field eval.Field) (eval.EventType, error) { return "", nil case "process.ancestors.file.path.length": return "", nil + case "process.ancestors.length": + return "", nil case "process.ancestors.pid": return "", nil case "process.ancestors.ppid": @@ -2752,6 +2878,8 @@ func (ev *Event) GetFieldType(field eval.Field) (reflect.Kind, error) { return reflect.String, nil case "process.ancestors.file.path.length": return reflect.Int, nil + case "process.ancestors.length": + return reflect.Int, nil case "process.ancestors.pid": return reflect.Int, nil case "process.ancestors.ppid": @@ -3542,6 +3670,14 @@ func (ev *Event) SetFieldValue(field eval.Field, value interface{}) error { ev.BaseEvent.ProcessContext.Ancestor = &ProcessCacheEntry{} } return &eval.ErrFieldReadOnly{Field: "process.ancestors.file.path.length"} + case "process.ancestors.length": + if ev.BaseEvent.ProcessContext == nil { + ev.BaseEvent.ProcessContext = &ProcessContext{} + } + if ev.BaseEvent.ProcessContext.Ancestor == nil { + ev.BaseEvent.ProcessContext.Ancestor = &ProcessCacheEntry{} + } + return &eval.ErrFieldReadOnly{Field: "process.ancestors.length"} case "process.ancestors.pid": if ev.BaseEvent.ProcessContext == nil { ev.BaseEvent.ProcessContext = &ProcessContext{} diff --git a/pkg/security/seclwin/model/events.go b/pkg/security/seclwin/model/events.go index 5804216d60297..8e44b9aa1e97c 100644 --- a/pkg/security/seclwin/model/events.go +++ b/pkg/security/seclwin/model/events.go @@ -269,6 +269,8 @@ func (t EventType) String() string { return "change_permission" case LoginUIDWriteEventType: return "login_uid_write" + case CgroupWriteEventType: + return "cgroup_write" default: return "unknown" } diff --git a/pkg/security/seclwin/model/model.go b/pkg/security/seclwin/model/model.go index 5593d1502a45b..e438c1b0d8ec7 100644 --- a/pkg/security/seclwin/model/model.go +++ b/pkg/security/seclwin/model/model.go @@ -506,6 +506,43 @@ func (it *ProcessAncestorsIterator) Next() *ProcessCacheEntry { return nil } +// At returns the element at the given position +func (it *ProcessAncestorsIterator) At(ctx *eval.Context, regID eval.RegisterID, pos int) *ProcessCacheEntry { + if entry := ctx.RegisterCache[regID]; entry != nil && entry.Pos == pos { + return entry.Value.(*ProcessCacheEntry) + } + + var i int + + ancestor := ctx.Event.(*Event).ProcessContext.Ancestor + for ancestor != nil { + if i == pos { + ctx.RegisterCache[regID] = &eval.RegisterCacheEntry{ + Pos: pos, + Value: ancestor, + } + return ancestor + } + ancestor = ancestor.Ancestor + i++ + } + + return nil +} + +// Len returns the len +func (it *ProcessAncestorsIterator) Len(ctx *eval.Context) int { + var size int + + ancestor := ctx.Event.(*Event).ProcessContext.Ancestor + for ancestor != nil { + size++ + ancestor = ancestor.Ancestor + } + + return size +} + // HasParent returns whether the process has a parent func (p *ProcessContext) HasParent() bool { return p.Parent != nil diff --git a/pkg/security/security_profile/dump/activity_dump.go b/pkg/security/security_profile/dump/activity_dump.go index 0f345ddf77d31..b9b0f34e00e71 100644 --- a/pkg/security/security_profile/dump/activity_dump.go +++ b/pkg/security/security_profile/dump/activity_dump.go @@ -615,7 +615,8 @@ func (ad *ActivityDump) ResolveTags() error { // resolveTags thread unsafe version ot ResolveTags func (ad *ActivityDump) resolveTags() error { - if len(ad.Tags) >= 10 || len(ad.Metadata.ContainerID) == 0 { + selector := ad.GetWorkloadSelector() + if selector != nil { return nil } diff --git a/pkg/security/security_profile/dump/load_controller.go b/pkg/security/security_profile/dump/load_controller.go index fcce3b6de6a51..3d0148f168232 100644 --- a/pkg/security/security_profile/dump/load_controller.go +++ b/pkg/security/security_profile/dump/load_controller.go @@ -87,6 +87,7 @@ func (lc *ActivityDumpLoadController) NextPartialDump(ad *ActivityDump) *Activit newDump.Metadata.ContainerID = ad.Metadata.ContainerID newDump.Metadata.DifferentiateArgs = ad.Metadata.DifferentiateArgs newDump.Tags = ad.Tags + newDump.selector = ad.selector // copy storage requests for _, reqList := range ad.StorageRequests { @@ -101,7 +102,7 @@ func (lc *ActivityDumpLoadController) NextPartialDump(ad *ActivityDump) *Activit } // compute the duration it took to reach the dump size threshold - timeToThreshold := ad.End.Sub(ad.Start) + timeToThreshold := time.Since(ad.Start) // set new load parameters newDump.SetTimeout(ad.LoadConfig.Timeout - timeToThreshold) diff --git a/pkg/security/security_profile/dump/manager.go b/pkg/security/security_profile/dump/manager.go index 10af2f9d787f7..a0b8c490b965e 100644 --- a/pkg/security/security_profile/dump/manager.go +++ b/pkg/security/security_profile/dump/manager.go @@ -852,6 +852,9 @@ func (adm *ActivityDumpManager) triggerLoadController() { // handle overweight dumps for _, ad := range dumps { + // restart a new dump for the same workload + newDump := adm.loadController.NextPartialDump(ad) + // stop the dump but do not release the cgroup ad.Finalize(false) seclog.Infof("tracing paused for [%s]", ad.GetSelectorStr()) @@ -867,9 +870,6 @@ func (adm *ActivityDumpManager) triggerLoadController() { adm.emptyDropped.Inc() } - // restart a new dump for the same workload - newDump := adm.loadController.NextPartialDump(ad) - adm.Lock() if err := adm.insertActivityDump(newDump); err != nil { seclog.Errorf("couldn't resume tracing [%s]: %v", newDump.GetSelectorStr(), err) diff --git a/pkg/security/security_profile/profile/profile.go b/pkg/security/security_profile/profile/profile.go index 83272e911901d..65f62db7c9568 100644 --- a/pkg/security/security_profile/profile/profile.go +++ b/pkg/security/security_profile/profile/profile.go @@ -11,7 +11,6 @@ package profile import ( "errors" "fmt" - "io" "math" "os" "slices" @@ -188,13 +187,7 @@ func (p *SecurityProfile) NewProcessNodeCallback(_ *activity_tree.ProcessNode) { // LoadProtoFromFile loads proto profile from file func LoadProtoFromFile(filepath string) (*proto.SecurityProfile, error) { - f, err := os.Open(filepath) - if err != nil { - return nil, fmt.Errorf("couldn't open profile: %w", err) - } - defer f.Close() - - raw, err := io.ReadAll(f) + raw, err := os.ReadFile(filepath) if err != nil { return nil, fmt.Errorf("couldn't read profile: %w", err) } diff --git a/pkg/security/tests/action_test.go b/pkg/security/tests/action_test.go index 07d959e88bec4..cd8a081530ad9 100644 --- a/pkg/security/tests/action_test.go +++ b/pkg/security/tests/action_test.go @@ -127,6 +127,9 @@ func TestActionKill(t *testing.T) { if el, err := jsonpath.JsonPathLookup(obj, `$.agent.rule_actions[?(@.signal == 'SIGUSR2')]`); err != nil || el == nil || len(el.([]interface{})) == 0 { t.Errorf("element not found %s => %v", string(msg.Data), err) } + if el, err := jsonpath.JsonPathLookup(obj, `$.agent.rule_actions[?(@.status == 'performed')]`); err != nil || el == nil || len(el.([]interface{})) == 0 { + t.Errorf("element not found %s => %v", string(msg.Data), err) + } }) return nil @@ -182,6 +185,9 @@ func TestActionKill(t *testing.T) { if el, err := jsonpath.JsonPathLookup(obj, `$.agent.rule_actions[?(@.exited_at =~ /20.*/)]`); err != nil || el == nil || len(el.([]interface{})) == 0 { t.Errorf("element not found %s => %v", string(msg.Data), err) } + if el, err := jsonpath.JsonPathLookup(obj, `$.agent.rule_actions[?(@.status == 'performed')]`); err != nil || el == nil || len(el.([]interface{})) == 0 { + t.Errorf("element not found %s => %v", string(msg.Data), err) + } }) return nil @@ -331,6 +337,9 @@ func TestActionKillRuleSpecific(t *testing.T) { if el, err := jsonpath.JsonPathLookup(obj, `$.agent.rule_actions[?(@.exited_at =~ /20.*/)]`); err != nil || el == nil || len(el.([]interface{})) == 0 { t.Errorf("element not found %s => %v", string(msg.Data), err) } + if el, err := jsonpath.JsonPathLookup(obj, `$.agent.rule_actions[?(@.status == 'performed')]`); err != nil || el == nil || len(el.([]interface{})) == 0 { + t.Errorf("element not found %s => %v", string(msg.Data), err) + } }) return nil @@ -399,6 +408,9 @@ func testActionKillDisarm(t *testing.T, test *testModule, sleep, syscallTester s if el, err := jsonpath.JsonPathLookup(obj, `$.agent.rule_actions[?(@.exited_at =~ /20.*/)]`); err != nil || el == nil || len(el.([]interface{})) == 0 { t.Errorf("element not found %s => %v", string(msg.Data), err) } + if el, err := jsonpath.JsonPathLookup(obj, `$.agent.rule_actions[?(@.status == 'performed')]`); err != nil || el == nil || len(el.([]interface{})) == 0 { + t.Errorf("element not found %s => %v", string(msg.Data), err) + } }) return nil @@ -406,7 +418,7 @@ func testActionKillDisarm(t *testing.T, test *testModule, sleep, syscallTester s assert.NoError(t, err) } - testKillActionIgnored := func(t *testing.T, ruleID string, cmdFunc func(context.Context)) { + testKillActionDisarmed := func(t *testing.T, ruleID string, cmdFunc func(context.Context)) { test.msgSender.flush() err := test.GetEventSent(t, func() error { cmdFunc(nil) @@ -426,8 +438,11 @@ func testActionKillDisarm(t *testing.T, test *testModule, sleep, syscallTester s validateMessageSchema(t, string(msg.Data)) jsonPathValidation(test, msg.Data, func(_ *testModule, obj interface{}) { - if _, err := jsonpath.JsonPathLookup(obj, `$.agent.rule_actions`); err == nil { - t.Errorf("unexpected rule action %s", string(msg.Data)) + if el, err := jsonpath.JsonPathLookup(obj, `$.agent.rule_actions[?(@.signal == 'SIGKILL')]`); err != nil || el == nil || len(el.([]interface{})) == 0 { + t.Errorf("element not found %s => %v", string(msg.Data), err) + } + if el, err := jsonpath.JsonPathLookup(obj, `$.agent.rule_actions[?(@.status == 'rule_disarmed')]`); err != nil || el == nil || len(el.([]interface{})) == 0 { + t.Errorf("element not found %s => %v", string(msg.Data), err) } }) @@ -447,8 +462,8 @@ func testActionKillDisarm(t *testing.T, test *testModule, sleep, syscallTester s }) } - // test that another executable dismars the kill action - testKillActionIgnored(t, "kill_action_disarm_executable", func(_ context.Context) { + // test that another executable disarms the kill action + testKillActionDisarmed(t, "kill_action_disarm_executable", func(_ context.Context) { cmd := exec.Command(sleep, "1") cmd.Env = []string{"TARGETTOKILL=1"} _ = cmd.Run() @@ -486,8 +501,8 @@ func testActionKillDisarm(t *testing.T, test *testModule, sleep, syscallTester s } defer newDockerInstance.stop() - // test that another container dismars the kill action - testKillActionIgnored(t, "kill_action_disarm_container", func(_ context.Context) { + // test that another container disarms the kill action + testKillActionDisarmed(t, "kill_action_disarm_container", func(_ context.Context) { cmd := newDockerInstance.Command("env", []string{"-i", "-", "TARGETTOKILL=1", "sleep", "1"}, []string{}) _ = cmd.Run() }) diff --git a/pkg/security/tests/event_test.go b/pkg/security/tests/event_test.go index bf567e41d29d2..e1f9280d204da 100644 --- a/pkg/security/tests/event_test.go +++ b/pkg/security/tests/event_test.go @@ -10,6 +10,7 @@ package tests import ( "context" + "fmt" "os" "path" "path/filepath" @@ -24,6 +25,7 @@ import ( "github.com/DataDog/datadog-agent/pkg/security/metrics" "github.com/DataDog/datadog-agent/pkg/security/secl/model" "github.com/DataDog/datadog-agent/pkg/security/secl/rules" + "github.com/DataDog/datadog-agent/pkg/security/utils" ) func TestEventRulesetLoaded(t *testing.T) { @@ -219,6 +221,64 @@ func TestEventRaleLimiters(t *testing.T) { }) } +func TestEventIteratorRegister(t *testing.T) { + SkipIfNotAvailable(t) + + pid1ExePath := utils.ProcExePath(1) + pid1Path, err := os.Readlink(pid1ExePath) + if err != nil { + t.Fatal(err) + } + + ruleDefs := []*rules.RuleDefinition{ + { + ID: "test_register_1", + Expression: `open.file.path == "{{.Root}}/test-register" && process.ancestors[A].name == "syscall_tester" && process.ancestors[A].argv in ["span-exec"]`, + }, + { + ID: "test_register_2", + Expression: fmt.Sprintf(`open.file.path == "{{.Root}}/test-register" && process.ancestors[A].file.path == "%s" && process.ancestors[A].pid == 1`, pid1Path), + }, + } + + test, err := newTestModule(t, nil, ruleDefs) + if err != nil { + t.Fatal(err) + } + defer test.Close() + + testFile, _, err := test.Path("test-register") + if err != nil { + t.Fatal(err) + } + defer os.Remove(testFile) + + syscallTester, err := loadSyscallTester(t, test, "syscall_tester") + if err != nil { + t.Fatal(err) + } + + t.Run("std", func(t *testing.T) { + test.WaitSignal(t, func() error { + return runSyscallTesterFunc(context.Background(), t, syscallTester, "span-exec", "123", "456", "/usr/bin/touch", testFile) + }, func(event *model.Event, rule *rules.Rule) { + assertTriggeredRule(t, rule, "test_register_1") + }) + }) + + t.Run("pid1", func(t *testing.T) { + test.WaitSignal(t, func() error { + f, err := os.Create(testFile) + if err != nil { + return err + } + return f.Close() + }, func(event *model.Event, rule *rules.Rule) { + assertTriggeredRule(t, rule, "test_register_2") + }) + }) +} + func truncatedParents(t *testing.T, staticOpts testOpts, dynamicOpts dynamicTestOpts) { var truncatedParents string for i := 0; i < model.MaxPathDepth; i++ { diff --git a/pkg/security/tests/fake_tags_resolver.go b/pkg/security/tests/fake_tags_resolver.go index 45d1d9c548450..9c97502c8d266 100644 --- a/pkg/security/tests/fake_tags_resolver.go +++ b/pkg/security/tests/fake_tags_resolver.go @@ -40,7 +40,6 @@ func (fr *FakeResolver) Stop() error { func (fr *FakeResolver) Resolve(containerID string) []string { fakeTags := []string{ "image_tag:latest", - "container_id:" + containerID, } fr.Lock() defer fr.Unlock() diff --git a/pkg/security/tests/filters_test.go b/pkg/security/tests/filters_test.go index 8c4116980a7fe..78841d2305f50 100644 --- a/pkg/security/tests/filters_test.go +++ b/pkg/security/tests/filters_test.go @@ -341,7 +341,7 @@ func TestFilterOpenGrandParentDiscarder(t *testing.T) { testFilterOpenParentDiscarder(t, "grandparent", "parent") } -func runAUIDTest(t *testing.T, test *testModule, goSyscallTester, auidOK, auidKO string) { +func runAUIDTest(t *testing.T, test *testModule, goSyscallTester string, eventType model.EventType, field eval.Field, path string, auidOK, auidKO string) { var cmdWrapper *dockerCmdWrapper cmdWrapper, err := test.StartADocker() if err != nil { @@ -352,16 +352,20 @@ func runAUIDTest(t *testing.T, test *testModule, goSyscallTester, auidOK, auidKO // reset stats test.statsdClient.Flush() - if err := waitForOpenProbeEvent(test, func() error { + if err := waitForProbeEvent(test, func() error { args := []string{ - "-login-uid-open-test", - "-login-uid-open-path", "/tmp/test-auid", - "-login-uid-open-uid", auidOK, + "-login-uid-test", + "-login-uid-event-type", eventType.String(), + "-login-uid-path", "/tmp/test-auid", + "-login-uid-value", auidOK, } cmd := cmdWrapper.Command(goSyscallTester, args, []string{}) return cmd.Run() - }, "/tmp/test-auid"); err != nil { + }, eventType, eventKeyValueFilter{ + key: field, + value: path, + }); err != nil { t.Fatal(err) } @@ -372,7 +376,7 @@ func runAUIDTest(t *testing.T, test *testModule, goSyscallTester, auidOK, auidKO return fmt.Errorf("expected metrics not found: %+v", test.statsdClient.GetByPrefix(metrics.MetricEventApproved)) } - if count := test.statsdClient.Get(metrics.MetricEventApproved + ":event_type:open"); count == 0 { + if count := test.statsdClient.Get(metrics.MetricEventApproved + ":event_type:" + eventType.String()); count == 0 { return fmt.Errorf("expected metrics not found: %+v", test.statsdClient.GetByPrefix(metrics.MetricEventApproved)) } @@ -380,16 +384,20 @@ func runAUIDTest(t *testing.T, test *testModule, goSyscallTester, auidOK, auidKO }, retry.Delay(1*time.Second), retry.Attempts(5), retry.DelayType(retry.FixedDelay)) assert.NoError(t, err) - if err := waitForOpenProbeEvent(test, func() error { + if err := waitForProbeEvent(test, func() error { args := []string{ - "-login-uid-open-test", - "-login-uid-open-path", "/tmp/test-auid", - "-login-uid-open-uid", auidKO, + "-login-uid-test", + "-login-uid-event-type", eventType.String(), + "-login-uid-path", "/tmp/test-auid", + "-login-uid-value", auidKO, } cmd := cmdWrapper.Command(goSyscallTester, args, []string{}) return cmd.Run() - }, "/tmp/test-auid"); err == nil { + }, eventType, eventKeyValueFilter{ + key: field, + value: path, + }); err == nil { t.Fatal("shouldn't get an event") } } @@ -432,15 +440,15 @@ func TestFilterOpenAUIDEqualApprover(t *testing.T) { } t.Run("equal-fixed-value", func(t *testing.T) { - runAUIDTest(t, test, goSyscallTester, "1005", "6000") + runAUIDTest(t, test, goSyscallTester, model.FileOpenEventType, "open.file.path", "/tmp/test-auid", "1005", "6000") }) t.Run("equal-zero", func(t *testing.T) { - runAUIDTest(t, test, goSyscallTester, "0", "6000") + runAUIDTest(t, test, goSyscallTester, model.FileOpenEventType, "open.file.path", "/tmp/test-auid", "0", "6000") }) t.Run("equal-unset", func(t *testing.T) { - runAUIDTest(t, test, goSyscallTester, "-1", "6000") + runAUIDTest(t, test, goSyscallTester, model.FileOpenEventType, "open.file.path", "/tmp/test-auid", "-1", "6000") }) } @@ -473,7 +481,7 @@ func TestFilterOpenAUIDLesserApprover(t *testing.T) { t.Fatal(err) } - runAUIDTest(t, test, goSyscallTester, "450", "605") + runAUIDTest(t, test, goSyscallTester, model.FileOpenEventType, "open.file.path", "/tmp/test-auid", "450", "605") } func TestFilterOpenAUIDGreaterApprover(t *testing.T) { @@ -505,7 +513,7 @@ func TestFilterOpenAUIDGreaterApprover(t *testing.T) { t.Fatal(err) } - runAUIDTest(t, test, goSyscallTester, "1500", "605") + runAUIDTest(t, test, goSyscallTester, model.FileOpenEventType, "open.file.path", "/tmp/test-auid", "1500", "605") } func TestFilterOpenAUIDNotEqualUnsetApprover(t *testing.T) { @@ -537,7 +545,41 @@ func TestFilterOpenAUIDNotEqualUnsetApprover(t *testing.T) { t.Fatal(err) } - runAUIDTest(t, test, goSyscallTester, "6000", "-1") + runAUIDTest(t, test, goSyscallTester, model.FileOpenEventType, "open.file.path", "/tmp/test-auid", "6000", "-1") +} + +func TestFilterUnlinkAUIDEqualApprover(t *testing.T) { + SkipIfNotAvailable(t) + + // skip test that are about to be run on docker (to avoid trying spawning docker in docker) + if testEnvironment == DockerEnvironment { + t.Skip("Skip test spawning docker containers on docker") + } + if _, err := whichNonFatal("docker"); err != nil { + t.Skip("Skip test where docker is unavailable") + } + + ruleDefs := []*rules.RuleDefinition{ + { + ID: "test_equal_1", + Expression: `unlink.file.path =~ "/tmp/test-auid" && process.auid == 1009`, + }, + } + + test, err := newTestModule(t, nil, ruleDefs) + if err != nil { + t.Fatal(err) + } + defer test.Close() + + goSyscallTester, err := loadSyscallTester(t, test, "syscall_go_tester") + if err != nil { + t.Fatal(err) + } + + t.Run("equal-fixed-value", func(t *testing.T) { + runAUIDTest(t, test, goSyscallTester, model.FileUnlinkEventType, "unlink.file.path", "/tmp/test-auid", "1009", "6000") + }) } func TestFilterDiscarderMask(t *testing.T) { diff --git a/pkg/security/tests/login_uid_test.go b/pkg/security/tests/login_uid_test.go index 5e1e65c9d784f..31d548788e349 100644 --- a/pkg/security/tests/login_uid_test.go +++ b/pkg/security/tests/login_uid_test.go @@ -55,12 +55,13 @@ func TestLoginUID(t *testing.T) { } defer dockerInstance.stop() - t.Run("login-uid-open-test", func(t *testing.T) { + t.Run("open", func(t *testing.T) { test.WaitSignal(t, func() error { args := []string{ - "-login-uid-open-test", - "-login-uid-open-path", "/tmp/test-auid", - "-login-uid-open-uid", "1005", + "-login-uid-test", + "-login-uid-event-type", "open", + "-login-uid-path", "/tmp/test-auid", + "-login-uid-value", "1005", } cmd := dockerInstance.Command(goSyscallTester, args, []string{}) @@ -72,11 +73,13 @@ func TestLoginUID(t *testing.T) { }) }) - t.Run("login-uid-exec-test", func(t *testing.T) { + t.Run("exec", func(t *testing.T) { test.WaitSignal(t, func() error { args := []string{ - "-login-uid-exec-test", - "-login-uid-exec-path", goSyscallTester, + "-login-uid-test", + "-login-uid-event-type", "exec", + "-login-uid-path", goSyscallTester, + "-login-uid-value", "1005", } cmd := dockerInstance.Command(goSyscallTester, args, []string{}) diff --git a/pkg/security/tests/module_tester_linux.go b/pkg/security/tests/module_tester_linux.go index 024ee1933ffc0..6b87b85df6bc0 100644 --- a/pkg/security/tests/module_tester_linux.go +++ b/pkg/security/tests/module_tester_linux.go @@ -71,8 +71,6 @@ system_probe_config: event_monitoring_config: socket: /tmp/test-event-monitor.sock - runtime_compilation: - enabled: true remote_tagger: false custom_sensitive_words: - "*custom*" @@ -793,17 +791,6 @@ func newTestModuleWithOnDemandProbes(t testing.TB, onDemandHooks []rules.OnDeman return nil, fmt.Errorf("failed to init module: %w", err) } - kv, _ := kernel.NewKernelVersion() - - var isRuntimeCompiled bool - if p, ok := testMod.eventMonitor.Probe.PlatformProbe.(*sprobe.EBPFProbe); ok { - isRuntimeCompiled = p.IsRuntimeCompiled() - } - - if os.Getenv("DD_TESTS_RUNTIME_COMPILED") == "1" && secconfig.Probe.RuntimeCompilationEnabled && !isRuntimeCompiled && !kv.IsSuseKernel() { - return nil, errors.New("failed to runtime compile module") - } - if opts.staticOpts.preStartCallback != nil { opts.staticOpts.preStartCallback(testMod) } diff --git a/pkg/security/tests/process_test.go b/pkg/security/tests/process_test.go index 518a2f929bd6b..405db99859fc0 100644 --- a/pkg/security/tests/process_test.go +++ b/pkg/security/tests/process_test.go @@ -141,7 +141,7 @@ func TestProcessContext(t *testing.T) { }, { ID: "test_rule_ancestors", - Expression: `open.file.path == "{{.Root}}/test-process-ancestors" && process.ancestors[_].file.name in ["sh", "dash", "bash"]`, + Expression: `open.file.path == "{{.Root}}/test-process-ancestors" && process.ancestors[A].file.name in ["sh", "dash", "bash"]`, }, { ID: "test_rule_parent", @@ -149,7 +149,7 @@ func TestProcessContext(t *testing.T) { }, { ID: "test_rule_pid1", - Expression: `open.file.path == "{{.Root}}/test-process-pid1" && process.ancestors[_].pid == 1`, + Expression: `open.file.path == "{{.Root}}/test-process-pid1" && process.ancestors[A].pid == 1`, }, { ID: "test_rule_args_envs", diff --git a/pkg/security/tests/schemas/kill.schema.json b/pkg/security/tests/schemas/kill.schema.json index ccf7fcb3ff192..7b91ef1008a18 100644 --- a/pkg/security/tests/schemas/kill.schema.json +++ b/pkg/security/tests/schemas/kill.schema.json @@ -33,30 +33,56 @@ "properties": { "signal": { "const": "SIGKILL" + }, + "status": { + "const": "performed" } }, "required": [ "type", "signal", + "scope", + "status", "created_at", "detected_at", "killed_at", - "exited_at" + "exited_at", + "ttr" ] }, { "properties": { "signal": { "const": "SIGUSR2" + }, + "status": { + "const": "performed" } }, "required": [ "type", "signal", + "scope", + "status", "created_at", "detected_at", "killed_at" ] + }, + { + "properties": { + "status": { + "const": "rule_disarmed" + } + }, + "required": [ + "type", + "signal", + "scope", + "status", + "created_at", + "detected_at" + ] } ] } \ No newline at end of file diff --git a/pkg/security/tests/syscall_tester/go/syscall_go_tester.go b/pkg/security/tests/syscall_tester/go/syscall_go_tester.go index c8c72ff67831b..ef5833f48e406 100644 --- a/pkg/security/tests/syscall_tester/go/syscall_go_tester.go +++ b/pkg/security/tests/syscall_tester/go/syscall_go_tester.go @@ -42,11 +42,10 @@ var ( userSessionExecutable string userSessionOpenPath string syscallDriftTest bool - loginUIDOpenTest bool - loginUIDOpenPath string - loginUIDOpenUID int - loginUIDExecTest bool - loginUIDExecPath string + loginUIDTest bool + loginUIDPath string + loginUIDEventType string + loginUIDValue int ) //go:embed ebpf_probe.o @@ -232,35 +231,39 @@ func setSelfLoginUID(uid int) error { return nil } -func RunLoginUIDOpenTest() error { - if loginUIDOpenUID != -1 { - if err := setSelfLoginUID(loginUIDOpenUID); err != nil { +func RunLoginUIDTest() error { + if loginUIDValue != -1 { + if err := setSelfLoginUID(loginUIDValue); err != nil { return err } } - // open test file to trigger an event - f, err := os.OpenFile(loginUIDOpenPath, os.O_RDWR|os.O_CREATE, 0755) - if err != nil { - return fmt.Errorf("couldn't create test-auid file: %v", err) - } - defer os.Remove(loginUIDOpenPath) - - if err = f.Close(); err != nil { - return fmt.Errorf("couldn't close test file: %v", err) - } - return nil -} - -func RunLoginUIDExecTest() error { - if err := setSelfLoginUID(1005); err != nil { - return err - } + switch loginUIDEventType { + case "open": + // open test file to trigger an event + f, err := os.OpenFile(loginUIDPath, os.O_RDWR|os.O_CREATE, 0755) + if err != nil { + return fmt.Errorf("couldn't create test-auid file: %v", err) + } + defer os.Remove(loginUIDPath) - // exec ls to trigger an execution with auid = 1005 - cmd := exec.Command(loginUIDExecPath) - if err := cmd.Run(); err != nil { - return fmt.Errorf("'%s' execution returned an error: %v", loginUIDExecPath, err) + if err = f.Close(); err != nil { + return fmt.Errorf("couldn't close test file: %v", err) + } + case "exec": + cmd := exec.Command(loginUIDPath) + if err := cmd.Run(); err != nil { + return fmt.Errorf("'%s' execution returned an error: %v", loginUIDPath, err) + } + case "unlink": + f, err := os.OpenFile(loginUIDPath, os.O_RDWR|os.O_CREATE, 0755) + if err != nil { + return fmt.Errorf("couldn't create test-auid file: %v", err) + } + f.Close() + os.Remove(loginUIDPath) + default: + panic("unknown event type") } return nil } @@ -277,11 +280,10 @@ func main() { flag.BoolVar(&cleanupIMDSTest, "cleanup-imds-test", false, "when set, removes the dummy interface of the IMDS test") flag.BoolVar(&runIMDSTest, "run-imds-test", false, "when set, binds an IMDS server locally and sends a query to it") flag.BoolVar(&syscallDriftTest, "syscall-drift-test", false, "when set, runs the syscall drift test") - flag.BoolVar(&loginUIDOpenTest, "login-uid-open-test", false, "when set, runs the login_uid open test") - flag.StringVar(&loginUIDOpenPath, "login-uid-open-path", "", "file used for the login_uid open test") - flag.IntVar(&loginUIDOpenUID, "login-uid-open-uid", 0, "uid used for the login_uid open test") - flag.BoolVar(&loginUIDExecTest, "login-uid-exec-test", false, "when set, runs the login_uid exec test") - flag.StringVar(&loginUIDExecPath, "login-uid-exec-path", "", "path to the executable to run during the login_uid exec test") + flag.BoolVar(&loginUIDTest, "login-uid-test", false, "when set, runs the login_uid open test") + flag.StringVar(&loginUIDPath, "login-uid-path", "", "file used for the login_uid open test") + flag.StringVar(&loginUIDEventType, "login-uid-event-type", "", "event type used for the login_uid open test") + flag.IntVar(&loginUIDValue, "login-uid-value", 0, "uid used for the login_uid open test") flag.Parse() @@ -337,14 +339,8 @@ func main() { } } - if loginUIDOpenTest { - if err := RunLoginUIDOpenTest(); err != nil { - panic(err) - } - } - - if loginUIDExecTest { - if err := RunLoginUIDExecTest(); err != nil { + if loginUIDTest { + if err := RunLoginUIDTest(); err != nil { panic(err) } } diff --git a/pkg/security/utils/cgroup.go b/pkg/security/utils/cgroup.go index 2059e587333e9..2e4214e5290c6 100644 --- a/pkg/security/utils/cgroup.go +++ b/pkg/security/utils/cgroup.go @@ -89,9 +89,9 @@ func GetProcContainerContext(tgid, pid uint32) (containerutils.ContainerID, cont } for _, cgroup := range cgroups { - if containerID, runtime := cgroup.GetContainerContext(); containerID != "" { - return containerID, runtime, nil - } + containerID, runtime := cgroup.GetContainerContext() + return containerID, runtime, nil } + return "", 0, nil } diff --git a/pkg/serializer/go.mod b/pkg/serializer/go.mod index eed0ccd272a58..dd628a0dd43c2 100644 --- a/pkg/serializer/go.mod +++ b/pkg/serializer/go.mod @@ -24,6 +24,7 @@ replace ( github.com/DataDog/datadog-agent/pkg/config/model => ../config/model github.com/DataDog/datadog-agent/pkg/config/nodetreemodel => ../../pkg/config/nodetreemodel github.com/DataDog/datadog-agent/pkg/config/setup => ../config/setup/ + github.com/DataDog/datadog-agent/pkg/config/structure => ../../pkg/config/structure github.com/DataDog/datadog-agent/pkg/config/teeconfig => ../../pkg/config/teeconfig github.com/DataDog/datadog-agent/pkg/config/utils => ../config/utils/ github.com/DataDog/datadog-agent/pkg/metrics => ../metrics/ @@ -68,7 +69,7 @@ require ( github.com/DataDog/datadog-agent/comp/serializer/compression v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/aggregator/ckey v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel - github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.3 + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 github.com/DataDog/datadog-agent/pkg/metrics v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/process/util/api v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/tagger/types v0.56.0-rc.3 @@ -90,15 +91,16 @@ require ( github.com/DataDog/datadog-agent/comp/core/flare/builder v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/core/flare/types v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/core/log/def v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/comp/core/secrets v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/comp/core/secrets v0.57.1 // indirect github.com/DataDog/datadog-agent/comp/core/status v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/comp/core/telemetry v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/comp/def v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/env v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/pkg/config/setup v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/comp/core/telemetry v0.57.1 // indirect + github.com/DataDog/datadog-agent/comp/def v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/env v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.60.0-devel // indirect + github.com/DataDog/datadog-agent/pkg/config/setup v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/structure v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.60.0-devel // indirect github.com/DataDog/datadog-agent/pkg/config/utils v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/orchestrator/model v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/status/health v0.56.0-rc.3 // indirect @@ -106,16 +108,16 @@ require ( github.com/DataDog/datadog-agent/pkg/util/buf v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/common v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/executable v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/filesystem v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/fxutil v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/fxutil v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/http v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/optional v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/pointer v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/optional v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/sort v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system/socket v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/pkg/util/system v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/winutil v0.57.1 // indirect github.com/DataDog/mmh3 v0.0.0-20210722141835-012dc69a9e49 // indirect github.com/DataDog/sketches-go v1.4.4 // indirect @@ -179,13 +181,13 @@ require ( go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/serializer/go.sum b/pkg/serializer/go.sum index fdd38534f8e0a..89d628b2491c6 100644 --- a/pkg/serializer/go.sum +++ b/pkg/serializer/go.sum @@ -322,8 +322,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U 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/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -346,8 +346,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/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.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -375,12 +375,12 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -397,8 +397,8 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn 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= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= diff --git a/pkg/serializer/internal/metrics/events_test.go b/pkg/serializer/internal/metrics/events_test.go index 8809ee39b5571..ef4013a778c60 100644 --- a/pkg/serializer/internal/metrics/events_test.go +++ b/pkg/serializer/internal/metrics/events_test.go @@ -14,7 +14,6 @@ import ( "math" "reflect" "strconv" - "strings" "testing" agentpayload "github.com/DataDog/agent-payload/v5/gogen" @@ -23,8 +22,7 @@ import ( "github.com/stretchr/testify/require" "github.com/DataDog/datadog-agent/comp/serializer/compression/compressionimpl" - mock "github.com/DataDog/datadog-agent/pkg/config/mock" - pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" "github.com/DataDog/datadog-agent/pkg/metrics/event" "github.com/DataDog/datadog-agent/pkg/serializer/internal/stream" taggertypes "github.com/DataDog/datadog-agent/pkg/tagger/types" @@ -179,7 +177,7 @@ func TestEventsSeveralPayloadsCreateSingleMarshaler(t *testing.T) { } for name, tc := range tests { t.Run(name, func(t *testing.T) { - mockConfig := mock.New(t) + mockConfig := configmock.New(t) mockConfig.SetWithoutSource("serializer_max_payload_size", 500) mockConfig.SetWithoutSource("serializer_compressor_kind", tc.kind) events := createEvents("3", "3", "2", "2", "1", "1") @@ -203,7 +201,7 @@ func TestEventsSeveralPayloadsCreateMarshalersBySourceType(t *testing.T) { } for name, tc := range tests { t.Run(name, func(t *testing.T) { - mockConfig := mock.New(t) + mockConfig := configmock.New(t) mockConfig.SetWithoutSource("serializer_max_payload_size", 300) mockConfig.SetWithoutSource("serializer_compressor_kind", tc.kind) events := createEvents("3", "3", "2", "2", "1", "1") @@ -265,7 +263,7 @@ func assertEqualEventsToMarshalJSON(t *testing.T, events Events) { } for name, tc := range tests { t.Run(name, func(t *testing.T) { - mockConfig := mock.New(t) + mockConfig := configmock.New(t) mockConfig.SetWithoutSource("serializer_compressor_kind", tc.kind) json, err := events.MarshalJSON() assert.NoError(t, err) @@ -371,7 +369,7 @@ func BenchmarkCreateSingleMarshalerOneEventBySource(b *testing.B) { func benchmarkCreateSingleMarshaler(b *testing.B, createEvents func(numberOfItem int) Events) { runBenchmark(b, func(b *testing.B, numberOfItem int) { - cfg := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + cfg := configmock.New(b) payloadBuilder := stream.NewJSONPayloadBuilder(true, cfg, compressionimpl.NewCompressor(cfg)) events := createEvents(numberOfItem) @@ -385,7 +383,7 @@ func benchmarkCreateSingleMarshaler(b *testing.B, createEvents func(numberOfItem func BenchmarkCreateMarshalersBySourceType(b *testing.B) { runBenchmark(b, func(b *testing.B, numberOfItem int) { - cfg := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + cfg := configmock.New(b) payloadBuilder := stream.NewJSONPayloadBuilder(true, cfg, compressionimpl.NewCompressor(cfg)) events := createBenchmarkEvents(numberOfItem) @@ -401,7 +399,7 @@ func BenchmarkCreateMarshalersBySourceType(b *testing.B) { func BenchmarkCreateMarshalersSeveralSourceTypes(b *testing.B) { runBenchmark(b, func(b *testing.B, numberOfItem int) { - cfg := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + cfg := configmock.New(b) payloadBuilder := stream.NewJSONPayloadBuilder(true, cfg, compressionimpl.NewCompressor(cfg)) events := Events{} diff --git a/pkg/telemetry/go.mod b/pkg/telemetry/go.mod index 513d7a8cadbf1..976075552b7f2 100644 --- a/pkg/telemetry/go.mod +++ b/pkg/telemetry/go.mod @@ -44,7 +44,7 @@ require ( go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/sys v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/telemetry/go.sum b/pkg/telemetry/go.sum index bbcfc8e62d72c..c930aa256d0e3 100644 --- a/pkg/telemetry/go.sum +++ b/pkg/telemetry/go.sum @@ -72,8 +72,8 @@ go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN8 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/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= diff --git a/pkg/trace/api/evp_proxy.go b/pkg/trace/api/evp_proxy.go index 4ab15b70ab36f..452d73017aa8d 100644 --- a/pkg/trace/api/evp_proxy.go +++ b/pkg/trace/api/evp_proxy.go @@ -181,9 +181,9 @@ func (t *evpProxyTransport) RoundTrip(req *http.Request) (rresp *http.Response, timeout := getConfiguredEVPRequestTimeoutDuration(t.conf) req.Header.Set("X-Datadog-Timeout", strconv.Itoa((int(timeout.Seconds())))) deadline := time.Now().Add(timeout) - ctx, ctxCancel := context.WithDeadline(req.Context(), deadline) + //nolint:govet,lostcancel we don't need to manually cancel this context, we can rely on the parent context being cancelled + ctx, _ := context.WithDeadline(req.Context(), deadline) req = req.WithContext(ctx) - defer ctxCancel() // Set target URL and API key header (per domain) req.URL.Scheme = "https" diff --git a/pkg/trace/api/evp_proxy_test.go b/pkg/trace/api/evp_proxy_test.go index 3016b6e5ef53c..8f9afc4cb2570 100644 --- a/pkg/trace/api/evp_proxy_test.go +++ b/pkg/trace/api/evp_proxy_test.go @@ -505,4 +505,30 @@ func TestE2E(t *testing.T) { require.Equal(t, http.StatusBadGateway, resp.StatusCode, "Got: ", fmt.Sprint(resp.StatusCode)) assert.Equal(t, "http: proxy error: context deadline exceeded\n", logs) }) + + t.Run("chunked-response", func(t *testing.T) { + conf := newTestReceiverConfig() + conf.Site = "us3.datadoghq.com" + conf.Endpoints[0].APIKey = "test_api_key" + conf.EVPProxy.ReceiverTimeout = 1 // in seconds + + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { + w.Header().Set("Transfer-Encoding", "chunked") + w.Write([]byte(`Hello`)) + w.(http.Flusher).Flush() + time.Sleep(200 * time.Millisecond) + w.Write([]byte(`World`)) // this will be discarded if the context was cancelled + })) + + req := httptest.NewRequest("POST", "/mypath/mysubpath?arg=test", bytes.NewReader(randBodyBuf)) + req.Header.Set("X-Datadog-EVP-Subdomain", "my.subdomain") + resp, logs := sendRequestThroughForwarderAgainstDummyServer(conf, req, stats, strings.TrimPrefix(server.URL, "http://")) + + resp.Body.Close() + require.Equal(t, http.StatusOK, resp.StatusCode, "Got: ", fmt.Sprint(resp.StatusCode)) + assert.Equal(t, "", logs) + body, err := io.ReadAll(resp.Body) + assert.NoError(t, err) + assert.Equal(t, "HelloWorld", string(body)) + }) } diff --git a/pkg/trace/go.mod b/pkg/trace/go.mod index 03a28afdd26be..958e3c3243fbc 100644 --- a/pkg/trace/go.mod +++ b/pkg/trace/go.mod @@ -41,11 +41,11 @@ require ( go.opentelemetry.io/collector/pdata v1.11.0 go.opentelemetry.io/collector/processor v0.104.0 go.opentelemetry.io/collector/semconv v0.104.0 - go.opentelemetry.io/otel v1.30.0 - go.opentelemetry.io/otel/metric v1.30.0 + go.opentelemetry.io/otel v1.31.0 + go.opentelemetry.io/otel/metric v1.31.0 go.uber.org/atomic v1.11.0 - golang.org/x/sys v0.25.0 - golang.org/x/time v0.6.0 + golang.org/x/sys v0.26.0 + golang.org/x/time v0.7.0 google.golang.org/grpc v1.64.0 google.golang.org/protobuf v1.34.2 gopkg.in/ini.v1 v1.67.0 @@ -53,7 +53,7 @@ require ( ) require ( - github.com/DataDog/go-sqllexer v0.0.15 // indirect + github.com/DataDog/go-sqllexer v0.0.16 // indirect github.com/DataDog/go-tuf v1.1.0-0.5.2 // indirect github.com/DataDog/zstd v1.5.5 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -98,14 +98,14 @@ require ( go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect go.opentelemetry.io/otel/sdk v1.27.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.27.0 // indirect - go.opentelemetry.io/otel/trace v1.30.0 // indirect + go.opentelemetry.io/otel/trace v1.31.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/pkg/trace/go.sum b/pkg/trace/go.sum index 618e0a9680a35..40a1eafcd4fc9 100644 --- a/pkg/trace/go.sum +++ b/pkg/trace/go.sum @@ -2,8 +2,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/datadog-go/v5 v5.5.0 h1:G5KHeB8pWBNXT4Jtw0zAkhdxEAWSpWH00geHI6LDrKU= github.com/DataDog/datadog-go/v5 v5.5.0/go.mod h1:K9kcYBlxkcPP8tvvjZZKs/m1edNAUFzBbdpTUKfCsuw= -github.com/DataDog/go-sqllexer v0.0.15 h1:rUUu52dP8EQhJLnUw0MIAxZp0BQx2fOTuMztr3vtHUU= -github.com/DataDog/go-sqllexer v0.0.15/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc= +github.com/DataDog/go-sqllexer v0.0.16 h1:RoSUMS6MECyB3gTUIdydzXwK5NhEhv6GMJkS7ptsgRA= +github.com/DataDog/go-sqllexer v0.0.16/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc= github.com/DataDog/go-tuf v1.1.0-0.5.2 h1:4CagiIekonLSfL8GMHRHcHudo1fQnxELS9g4tiAupQ4= github.com/DataDog/go-tuf v1.1.0-0.5.2/go.mod h1:zBcq6f654iVqmkk8n2Cx81E1JnNTMOAx1UEO/wZR+P0= github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.20.0 h1:fKv05WFWHCXQmUTehW1eEZvXJP65Qv00W4V01B1EqSA= @@ -266,8 +266,8 @@ go.opentelemetry.io/contrib/config v0.7.0 h1:b1rK5tGTuhhPirJiMxOcyQfZs76j2VapY6O go.opentelemetry.io/contrib/config v0.7.0/go.mod h1:8tdiFd8N5etOi3XzBmAoMxplEzI3TcL8dU5rM5/xcOQ= go.opentelemetry.io/contrib/propagators/b3 v1.27.0 h1:IjgxbomVrV9za6bRi8fWCNXENs0co37SZedQilP2hm0= go.opentelemetry.io/contrib/propagators/b3 v1.27.0/go.mod h1:Dv9obQz25lCisDvvs4dy28UPh974CxkahRDUPsY7y9E= -go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= -go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= go.opentelemetry.io/otel/bridge/opencensus v1.27.0 h1:ao9aGGHd+G4YfjBpGs6vbkvt5hoC67STlJA9fCnOAcs= go.opentelemetry.io/otel/bridge/opencensus v1.27.0/go.mod h1:uRvWtAAXzyVOST0WMPX5JHGBaAvBws+2F8PcC5gMnTk= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.27.0 h1:bFgvUr3/O4PHj3VQcFEuYKvRZJX1SJDQ+11JXuSB3/w= @@ -286,14 +286,14 @@ go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.27.0 h1:/jlt1Y8gXWiHG9 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.27.0/go.mod h1:bmToOGOBZ4hA9ghphIc1PAf66VA8KOtsuy3+ScStG20= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.27.0 h1:/0YaXu3755A/cFbtXp+21lkXgI0QE5avTWA2HjU9/WE= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.27.0/go.mod h1:m7SFxp0/7IxmJPLIY3JhOcU9CoFzDaCPL6xxQIxhA+o= -go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= -go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kTWmI= go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A= go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2NemcCrOL8gI= go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= -go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= -go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= go.opentelemetry.io/proto/otlp v1.2.0 h1:pVeZGk7nXDC9O2hncA6nHldxEjm6LByfA2aN8IOkz94= go.opentelemetry.io/proto/otlp v1.2.0/go.mod h1:gGpR8txAl5M03pDhMC79G6SdqNV26naRm/KDsgaHD8A= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= @@ -309,8 +309,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk 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/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= @@ -339,8 +339,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -371,8 +371,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= @@ -382,10 +382,10 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= -golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= +golang.org/x/time v0.7.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= @@ -397,8 +397,8 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= diff --git a/pkg/trace/stats/oteltest/go.mod b/pkg/trace/stats/oteltest/go.mod index 6f9ac469d1943..5446366e3543a 100644 --- a/pkg/trace/stats/oteltest/go.mod +++ b/pkg/trace/stats/oteltest/go.mod @@ -13,7 +13,7 @@ require ( go.opentelemetry.io/collector/component v0.104.0 go.opentelemetry.io/collector/pdata v1.11.0 go.opentelemetry.io/collector/semconv v0.104.0 - go.opentelemetry.io/otel/metric v1.30.0 + go.opentelemetry.io/otel/metric v1.31.0 google.golang.org/protobuf v1.34.2 ) @@ -26,7 +26,7 @@ require ( github.com/DataDog/datadog-agent/pkg/util/log v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/pointer v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.56.0-rc.3 // indirect - github.com/DataDog/go-sqllexer v0.0.15 // indirect + github.com/DataDog/go-sqllexer v0.0.16 // indirect github.com/DataDog/go-tuf v1.1.0-0.5.2 // indirect github.com/DataDog/sketches-go v1.4.2 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect @@ -69,21 +69,21 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.104.0 // indirect - go.opentelemetry.io/otel v1.30.0 // indirect + go.opentelemetry.io/otel v1.31.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect go.opentelemetry.io/otel/sdk v1.27.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.27.0 // indirect - go.opentelemetry.io/otel/trace v1.30.0 // indirect + go.opentelemetry.io/otel/trace v1.31.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/time v0.6.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/time v0.7.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect google.golang.org/grpc v1.64.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/pkg/trace/stats/oteltest/go.sum b/pkg/trace/stats/oteltest/go.sum index 1242d1a48363c..a201b6217a5a0 100644 --- a/pkg/trace/stats/oteltest/go.sum +++ b/pkg/trace/stats/oteltest/go.sum @@ -1,7 +1,7 @@ github.com/DataDog/datadog-go/v5 v5.5.0 h1:G5KHeB8pWBNXT4Jtw0zAkhdxEAWSpWH00geHI6LDrKU= github.com/DataDog/datadog-go/v5 v5.5.0/go.mod h1:K9kcYBlxkcPP8tvvjZZKs/m1edNAUFzBbdpTUKfCsuw= -github.com/DataDog/go-sqllexer v0.0.15 h1:rUUu52dP8EQhJLnUw0MIAxZp0BQx2fOTuMztr3vtHUU= -github.com/DataDog/go-sqllexer v0.0.15/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc= +github.com/DataDog/go-sqllexer v0.0.16 h1:RoSUMS6MECyB3gTUIdydzXwK5NhEhv6GMJkS7ptsgRA= +github.com/DataDog/go-sqllexer v0.0.16/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc= github.com/DataDog/go-tuf v1.1.0-0.5.2 h1:4CagiIekonLSfL8GMHRHcHudo1fQnxELS9g4tiAupQ4= github.com/DataDog/go-tuf v1.1.0-0.5.2/go.mod h1:zBcq6f654iVqmkk8n2Cx81E1JnNTMOAx1UEO/wZR+P0= github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.20.0 h1:fKv05WFWHCXQmUTehW1eEZvXJP65Qv00W4V01B1EqSA= @@ -168,18 +168,18 @@ go.opentelemetry.io/collector/processor v0.104.0 h1:KSvMDu4DWmK1/k2z2rOzMtTvAa00 go.opentelemetry.io/collector/processor v0.104.0/go.mod h1:qU2/xCCYdvVORkN6aq0H/WUWkvo505VGYg2eOwPvaTg= go.opentelemetry.io/collector/semconv v0.104.0 h1:dUvajnh+AYJLEW/XOPk0T0BlwltSdi3vrjO7nSOos3k= go.opentelemetry.io/collector/semconv v0.104.0/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= -go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= -go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0/go.mod h1:KfQ1wpjf3zsHjzP149P4LyAwWRupc6c7t1ZJ9eXpKQM= -go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= -go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kTWmI= go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A= go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2NemcCrOL8gI= go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= -go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= -go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= @@ -193,8 +193,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk 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/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= 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/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -210,8 +210,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -238,8 +238,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= @@ -247,10 +247,10 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= -golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= +golang.org/x/time v0.7.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-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -258,8 +258,8 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= diff --git a/pkg/trace/writer/trace_test.go b/pkg/trace/writer/trace_test.go index 9c3ecd7a4194e..3c6529e1cce11 100644 --- a/pkg/trace/writer/trace_test.go +++ b/pkg/trace/writer/trace_test.go @@ -257,7 +257,10 @@ func TestResetBuffer(t *testing.T) { runtime.ReadMemStats(&m) assert.Greater(t, m.HeapInuse, uint64(50*1e6)) + w.mu.Lock() w.resetBuffer() + w.mu.Unlock() + runtime.GC() runtime.ReadMemStats(&m) assert.Less(t, m.HeapInuse, uint64(50*1e6)) diff --git a/pkg/util/cgroups/go.mod b/pkg/util/cgroups/go.mod index c3b44f5b7957f..7a7254746aa6d 100644 --- a/pkg/util/cgroups/go.mod +++ b/pkg/util/cgroups/go.mod @@ -27,7 +27,7 @@ require ( github.com/opencontainers/runtime-spec v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/sys v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect google.golang.org/protobuf v1.27.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/pkg/util/cgroups/go.sum b/pkg/util/cgroups/go.sum index ececa777f35a5..4852af8e4587c 100644 --- a/pkg/util/cgroups/go.sum +++ b/pkg/util/cgroups/go.sum @@ -24,8 +24,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= diff --git a/pkg/util/containerd/containerd_util.go b/pkg/util/containerd/containerd_util.go index 9b80304c894b4..88fe4ecd91820 100644 --- a/pkg/util/containerd/containerd_util.go +++ b/pkg/util/containerd/containerd_util.go @@ -13,12 +13,13 @@ import ( "encoding/json" "errors" "fmt" + "os" "strings" "time" + "github.com/hashicorp/go-multierror" "github.com/opencontainers/image-spec/identity" - "github.com/DataDog/datadog-agent/pkg/config/env" pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" dderrors "github.com/DataDog/datadog-agent/pkg/errors" "github.com/DataDog/datadog-agent/pkg/util/log" @@ -453,15 +454,33 @@ func (c *ContainerdUtil) getMounts(ctx context.Context, expiration time.Duration return nil, nil, fmt.Errorf("No snapshots returned for image: %s", imageID) } - // Transforming mounts in case we're running in a container - if env.IsContainerized() { - for i := range mounts { - mounts[i].Source = strings.ReplaceAll(mounts[i].Source, "/var/lib", "/host/var/lib") - for j := range mounts[i].Options { - mounts[i].Options[j] = strings.ReplaceAll(mounts[i].Options[j], "/var/lib", "/host/var/lib") + for i := range mounts { + mounts[i].Source = sanitizePath(mounts[i].Source) + + var errs error + for j, opt := range mounts[i].Options { + for _, prefix := range []string{"upperdir=", "lowerdir=", "workdir="} { + if strings.HasPrefix(opt, prefix) { + trimmedOpt := strings.TrimPrefix(opt, prefix) + dirs := strings.Split(trimmedOpt, ":") + for n, dir := range dirs { + dirs[n] = sanitizePath(dir) + if _, err := os.Stat(dirs[n]); err != nil { + errs = multierror.Append(errs, fmt.Errorf("unreachable folder %s for overlayfs mount: %w", dir, err)) + } + } + mounts[i].Options[j] = prefix + strings.Join(dirs, ":") + } } + + log.Debugf("Sanitized overlayfs mount options to %s", strings.Join(mounts[i].Options, ",")) + } + + if errs != nil { + log.Warnf("Unreachable path detected in mounts for image %s: %s", imageID, errs.Error()) } } + return mounts, func(ctx context.Context) error { ctx = namespaces.WithNamespace(ctx, namespace) if err := cleanSnapshot(ctx); err != nil { @@ -474,6 +493,14 @@ func (c *ContainerdUtil) getMounts(ctx context.Context, expiration time.Duration }, nil } +func sanitizePath(path string) string { + if index := strings.Index(path, "/var/lib"); index != -1 { + return "/host" + path[index:] + } + + return path +} + // Mounts returns the mounts for an image func (c *ContainerdUtil) Mounts(ctx context.Context, expiration time.Duration, namespace string, img containerd.Image) ([]mount.Mount, error) { mounts, clean, err := c.getMounts(ctx, expiration, namespace, img) diff --git a/pkg/util/containers/entity_test.go b/pkg/util/containers/entity_test.go index 3799f9785c787..0439b60284069 100644 --- a/pkg/util/containers/entity_test.go +++ b/pkg/util/containers/entity_test.go @@ -10,8 +10,6 @@ import ( "testing" "github.com/stretchr/testify/assert" - - "github.com/DataDog/datadog-agent/comp/core/tagger/types" ) func TestBuildEntityName(t *testing.T) { @@ -36,23 +34,6 @@ func TestBuildEntityName(t *testing.T) { } } -func TestBuildTaggerEntityName(t *testing.T) { - for nb, tc := range []struct { - cID string - expected string - }{ - // Empty - {"", "container_id://"}, - // Empty runtime - {"5bef08742407ef", "container_id://5bef08742407ef"}, - } { - t.Run(fmt.Sprintf("case %d: %s", nb, tc.expected), func(t *testing.T) { - out := types.NewEntityID(types.ContainerID, tc.cID).String() - assert.Equal(t, tc.expected, out) - }) - } -} - func TestSplitEntityName(t *testing.T) { for nb, tc := range []struct { entity string diff --git a/pkg/util/crashreport/crashreport.go b/pkg/util/crashreport/crashreport.go index 0bab9ca167051..8c04cdbb6c11c 100644 --- a/pkg/util/crashreport/crashreport.go +++ b/pkg/util/crashreport/crashreport.go @@ -115,6 +115,13 @@ func (wcr *WinCrashReporter) CheckForCrash() (*probe.WinCrashStatus, error) { if !ok { return nil, fmt.Errorf("Raw data has incorrect type") } + + // Crash dump processing is not done yet, nothing to send at the moment. Try later. + if crash.StatusCode == probe.WinCrashStatusCodeBusy { + log.Infof("Crash dump processing is busy") + return nil, nil + } + /* * originally did this with a sync.once. The problem is the check is run prior to the * system probe being successfully started. This is OK; we just need to detect the BSOD @@ -124,7 +131,7 @@ func (wcr *WinCrashReporter) CheckForCrash() (*probe.WinCrashStatus, error) { * we don't need to run any more */ wcr.hasRunOnce = true - if !crash.Success { + if crash.StatusCode == probe.WinCrashStatusCodeFailed { return nil, fmt.Errorf("Error getting crash data %s", crash.ErrString) } diff --git a/pkg/util/defaultpaths/go.mod b/pkg/util/defaultpaths/go.mod index 62b44ff579d71..bce6ac68c1a2d 100644 --- a/pkg/util/defaultpaths/go.mod +++ b/pkg/util/defaultpaths/go.mod @@ -13,7 +13,7 @@ require ( github.com/DataDog/datadog-agent/pkg/util/executable v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/log v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/winutil v0.56.0-rc.3 - golang.org/x/sys v0.25.0 + golang.org/x/sys v0.26.0 ) require ( diff --git a/pkg/util/defaultpaths/go.sum b/pkg/util/defaultpaths/go.sum index 455cbd9080ea4..b4525732ba7e3 100644 --- a/pkg/util/defaultpaths/go.sum +++ b/pkg/util/defaultpaths/go.sum @@ -10,8 +10,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= diff --git a/pkg/util/filesystem/go.mod b/pkg/util/filesystem/go.mod index 5d34364c542b6..c5415560d8797 100644 --- a/pkg/util/filesystem/go.mod +++ b/pkg/util/filesystem/go.mod @@ -13,7 +13,7 @@ require ( github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95 github.com/shirou/gopsutil/v3 v3.23.9 github.com/stretchr/testify v1.9.0 - golang.org/x/sys v0.25.0 + golang.org/x/sys v0.26.0 ) require ( diff --git a/pkg/util/filesystem/go.sum b/pkg/util/filesystem/go.sum index 3bf8d158ce06e..58a824fac38df 100644 --- a/pkg/util/filesystem/go.sum +++ b/pkg/util/filesystem/go.sum @@ -38,8 +38,8 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/pkg/util/flavor/go.mod b/pkg/util/flavor/go.mod index cb72eee2cd0d1..a15f499635d45 100644 --- a/pkg/util/flavor/go.mod +++ b/pkg/util/flavor/go.mod @@ -78,12 +78,12 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/util/flavor/go.sum b/pkg/util/flavor/go.sum index e92309f06689e..fcbe4c21f6c43 100644 --- a/pkg/util/flavor/go.sum +++ b/pkg/util/flavor/go.sum @@ -252,8 +252,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -296,11 +296,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -313,8 +313,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/pkg/util/fxutil/go.mod b/pkg/util/fxutil/go.mod index b6f06dddb47ba..751bb44cac435 100644 --- a/pkg/util/fxutil/go.mod +++ b/pkg/util/fxutil/go.mod @@ -24,6 +24,6 @@ require ( go.uber.org/dig v1.18.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/sys v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/util/fxutil/go.sum b/pkg/util/fxutil/go.sum index 10ac030dc336f..8cb3943af281f 100644 --- a/pkg/util/fxutil/go.sum +++ b/pkg/util/fxutil/go.sum @@ -22,8 +22,8 @@ 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.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/pkg/util/grpc/go.mod b/pkg/util/grpc/go.mod index 096586f3d7781..a92f6b863421e 100644 --- a/pkg/util/grpc/go.mod +++ b/pkg/util/grpc/go.mod @@ -14,7 +14,7 @@ require ( github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 github.com/grpc-ecosystem/go-grpc-middleware v1.2.0 github.com/stretchr/testify v1.9.0 - golang.org/x/net v0.29.0 + golang.org/x/net v0.30.0 google.golang.org/grpc v1.59.0 ) @@ -28,8 +28,8 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/tinylib/msgp v1.1.8 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect diff --git a/pkg/util/grpc/go.sum b/pkg/util/grpc/go.sum index 4a6614d75865c..b59bc61f80285 100644 --- a/pkg/util/grpc/go.sum +++ b/pkg/util/grpc/go.sum @@ -92,8 +92,8 @@ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= @@ -114,8 +114,8 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= @@ -123,8 +123,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 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= diff --git a/pkg/util/http/go.mod b/pkg/util/http/go.mod index f0472793cbbd0..e525dd15dfe94 100644 --- a/pkg/util/http/go.mod +++ b/pkg/util/http/go.mod @@ -35,7 +35,7 @@ require ( github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/log v0.56.0-rc.3 github.com/stretchr/testify v1.9.0 - golang.org/x/net v0.29.0 + golang.org/x/net v0.30.0 ) require ( @@ -80,12 +80,12 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/util/http/go.sum b/pkg/util/http/go.sum index c38fb40bdc367..5a7962269c3ea 100644 --- a/pkg/util/http/go.sum +++ b/pkg/util/http/go.sum @@ -252,8 +252,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -273,8 +273,8 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/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.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= 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= @@ -298,11 +298,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -315,8 +315,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/pkg/util/log/setup/go.mod b/pkg/util/log/setup/go.mod index b7497a8821daf..55f6a9c2d42df 100644 --- a/pkg/util/log/setup/go.mod +++ b/pkg/util/log/setup/go.mod @@ -3,37 +3,88 @@ module github.com/DataDog/datadog-agent/pkg/util/log/setup go 1.22.0 replace ( + github.com/DataDog/datadog-agent/comp/api/api/def => ../../../../comp/api/api/def + github.com/DataDog/datadog-agent/comp/core/flare/builder => ../../../../comp/core/flare/builder + github.com/DataDog/datadog-agent/comp/core/flare/types => ../../../../comp/core/flare/types + github.com/DataDog/datadog-agent/comp/core/secrets => ../../../../comp/core/secrets + github.com/DataDog/datadog-agent/comp/core/telemetry => ../../../../comp/core/telemetry + github.com/DataDog/datadog-agent/comp/def => ../../../../comp/def + github.com/DataDog/datadog-agent/pkg/collector/check/defaults => ../../../../pkg/collector/check/defaults + github.com/DataDog/datadog-agent/pkg/config/env => ../../../../pkg/config/env + github.com/DataDog/datadog-agent/pkg/config/mock => ../../../../pkg/config/mock github.com/DataDog/datadog-agent/pkg/config/model => ../../../../pkg/config/model/ - github.com/DataDog/datadog-agent/pkg/util/log => ../ + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel => ../../../../pkg/config/nodetreemodel + github.com/DataDog/datadog-agent/pkg/config/setup => ../../../../pkg/config/setup + github.com/DataDog/datadog-agent/pkg/config/teeconfig => ../../../../pkg/config/teeconfig + github.com/DataDog/datadog-agent/pkg/util/executable => ../../../../pkg/util/executable + github.com/DataDog/datadog-agent/pkg/util/filesystem => ../../../../pkg/util/filesystem + github.com/DataDog/datadog-agent/pkg/util/fxutil => ../../../../pkg/util/fxutil + github.com/DataDog/datadog-agent/pkg/util/hostname/validate => ../../../../pkg/util/hostname/validate + github.com/DataDog/datadog-agent/pkg/util/log => ../../../../pkg/util/log + github.com/DataDog/datadog-agent/pkg/util/optional => ../../../../pkg/util/optional + github.com/DataDog/datadog-agent/pkg/util/pointer => ../../../../pkg/util/pointer github.com/DataDog/datadog-agent/pkg/util/scrubber => ../../../util/scrubber/ + github.com/DataDog/datadog-agent/pkg/util/system => ../../../../pkg/util/system + github.com/DataDog/datadog-agent/pkg/util/system/socket => ../../../../pkg/util/system/socket + github.com/DataDog/datadog-agent/pkg/util/testutil => ../../../../pkg/util/testutil + github.com/DataDog/datadog-agent/pkg/util/winutil => ../../../../pkg/util/winutil ) require ( - github.com/DataDog/datadog-agent/pkg/config/model v0.56.0-rc.3 - github.com/DataDog/datadog-agent/pkg/util/log v0.56.0-rc.3 + github.com/DataDog/datadog-agent/pkg/config/mock v0.57.1 + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 + github.com/DataDog/datadog-agent/pkg/util/log v0.57.1 github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 github.com/stretchr/testify v1.9.0 ) require ( - github.com/DataDog/datadog-agent/pkg/util/scrubber v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/comp/core/secrets v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/env v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/config/setup v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/util/executable v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/optional v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/scrubber v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/winutil v0.57.1 // indirect github.com/DataDog/viper v1.13.5 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95 // indirect + github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/magiconair/properties v1.8.1 // indirect github.com/mitchellh/mapstructure v1.1.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/pelletier/go-toml v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/spf13/afero v1.1.2 // indirect + github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect + github.com/shirou/gopsutil/v3 v3.23.12 // indirect + github.com/shoenig/go-m1cpu v0.1.6 // indirect + github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.5.1 // indirect github.com/spf13/jwalterweatherman v1.0.0 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect + github.com/yusufpapurcu/wmi v1.2.3 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect + golang.org/x/mod v0.21.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/util/log/setup/go.sum b/pkg/util/log/setup/go.sum index cc381167ecd6d..fcbe4c21f6c43 100644 --- a/pkg/util/log/setup/go.sum +++ b/pkg/util/log/setup/go.sum @@ -3,6 +3,8 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/viper v1.13.5 h1:SZMcyMknYQN2jRY/40A16gUXexlNJOI8sDs1cWZnI64= github.com/DataDog/viper v1.13.5/go.mod h1:wDdUVJ2SHaMaPrCZrlRCObwkubsX8j5sme3LaR/SGTc= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -12,10 +14,14 @@ github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQY github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 h1:kHaBemcxl8o/pQ5VM1c8PVE1PubbNx3mjUr09OqWGCs= github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575/go.mod h1:9d6lWj8KzO/fd/NrVaLscBKmPigpZpn5YawRPw+e3Yo= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -44,6 +50,12 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/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-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= @@ -56,10 +68,14 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.1/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.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 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= @@ -73,11 +89,17 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/grpc-ecosystem/grpc-gateway v1.13.0/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95 h1:S4qyfL2sEm5Budr4KVMyEniCy+PbS55651I/a+Kn/NQ= +github.com/hectane/go-acl v0.0.0-20190604041725-da78bae5fc95/go.mod h1:QiyDdbZLaJ/mZP4Zwc9g2QsfaEA4o7XvvgZegSci5/E= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA= +github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -90,9 +112,13 @@ 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/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -110,39 +136,58 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE 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/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= +github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= +github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= +github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/shirou/gopsutil/v3 v3.23.12 h1:z90NtUkp3bMtmICZKpC4+WaknU1eXtp5vtbQ11DgpE4= +github.com/shirou/gopsutil/v3 v3.23.12/go.mod h1:1FrWgea594Jp7qmjHUUPlJDTPgcsb9mGnXDxavtikzM= +github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= +github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= +github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= +github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= +github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= +github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= @@ -151,12 +196,21 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.6.2/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= 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/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 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.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= @@ -164,27 +218,49 @@ github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVM github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw= +github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= +go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= +go.opentelemetry.io/otel/metric v1.27.0 h1:hvj3vdEKyeCi4YaYfNjv2NUje8FqKqUY8IlF0FxV/ik= +go.opentelemetry.io/otel/metric v1.27.0/go.mod h1:mVFgmRlhljgBiuk/MP/oKylr4hs85GZAylncepAX/ak= +go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kTWmI= +go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A= +go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2NemcCrOL8gI= +go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= +go.opentelemetry.io/otel/trace v1.27.0 h1:IqYb813p7cmbHk0a5y6pD5JPakbVfftRXABGt5/Rscw= +go.opentelemetry.io/otel/trace v1.27.0/go.mod h1:6RiD1hkAprV4/q+yd2ln1HG9GoPx39SuvvstaLBl+l4= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/dig v1.18.0 h1:imUL1UiY0Mg4bqbFfsRQO5G4CGRBec/ZujWTvSVp3pw= +go.uber.org/dig v1.18.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= +go.uber.org/fx v1.22.2 h1:iPW+OPxv0G8w75OemJ1RAnTUrF55zOJlXlo1TbJ0Buw= +go.uber.org/fx v1.22.2/go.mod h1:o/D9n+2mLP6v1EG+qsdT1O8wKopYAsqZasju97SDFCU= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +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/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.14.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +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-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= 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-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -203,6 +279,8 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/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.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -210,13 +288,19 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h 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-20190529164535-6a60838ec259/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -229,6 +313,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -241,6 +327,8 @@ google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ij google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 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= @@ -257,6 +345,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/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= diff --git a/pkg/util/log/setup/log_nix_test.go b/pkg/util/log/setup/log_nix_test.go index 1294e58e7cf13..4acee15a33ac5 100644 --- a/pkg/util/log/setup/log_nix_test.go +++ b/pkg/util/log/setup/log_nix_test.go @@ -8,17 +8,16 @@ package logs import ( - "strings" "testing" - pkgconfigmodel "github.com/DataDog/datadog-agent/pkg/config/model" + configmock "github.com/DataDog/datadog-agent/pkg/config/mock" "github.com/stretchr/testify/assert" ) func TestGetSyslogURI(t *testing.T) { assert := assert.New(t) - mockConfig := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + mockConfig := configmock.New(t) mockConfig.SetWithoutSource("log_to_syslog", true) mockConfig.SetWithoutSource("syslog_uri", "") @@ -37,7 +36,7 @@ func TestGetSyslogURI(t *testing.T) { func TestSetupLoggingNowhere(t *testing.T) { // setup logger so that it logs nowhere: i.e. not to file, not to syslog, not to console - mockConfig := pkgconfigmodel.NewConfig("test", "DD", strings.NewReplacer(".", "_")) + mockConfig := configmock.New(t) seelogConfig, _ = buildLoggerConfig("agent", "info", "", "", false, false, false, mockConfig) loggerInterface, err := GenerateLoggerInterface(seelogConfig) diff --git a/pkg/util/system/go.mod b/pkg/util/system/go.mod index 1304e3f3a6978..7bf1fff200efc 100644 --- a/pkg/util/system/go.mod +++ b/pkg/util/system/go.mod @@ -20,7 +20,7 @@ require ( github.com/shirou/gopsutil/v3 v3.23.12 github.com/stretchr/testify v1.9.0 go.uber.org/atomic v1.11.0 - golang.org/x/sys v0.25.0 + golang.org/x/sys v0.26.0 ) require ( diff --git a/pkg/util/system/go.sum b/pkg/util/system/go.sum index 5d53bdd9e353d..d3b219df694fd 100644 --- a/pkg/util/system/go.sum +++ b/pkg/util/system/go.sum @@ -45,8 +45,8 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/pkg/util/system/socket/go.mod b/pkg/util/system/socket/go.mod index 3eac26d3e7fe7..2fedb03f388b3 100644 --- a/pkg/util/system/socket/go.mod +++ b/pkg/util/system/socket/go.mod @@ -7,6 +7,6 @@ require github.com/Microsoft/go-winio v0.6.1 require ( golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/tools v0.26.0 // indirect ) diff --git a/pkg/util/system/socket/go.sum b/pkg/util/system/socket/go.sum index 587faa2e10d91..492bf39e8b44d 100644 --- a/pkg/util/system/socket/go.sum +++ b/pkg/util/system/socket/go.sum @@ -4,7 +4,7 @@ golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= diff --git a/pkg/util/tagger/go.mod b/pkg/util/tagger/go.mod index f403dbf5251df..94010f407506c 100644 --- a/pkg/util/tagger/go.mod +++ b/pkg/util/tagger/go.mod @@ -72,11 +72,11 @@ require ( github.com/tklauser/numcpus v0.6.1 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/pkg/util/tagger/go.sum b/pkg/util/tagger/go.sum index e92309f06689e..fcbe4c21f6c43 100644 --- a/pkg/util/tagger/go.sum +++ b/pkg/util/tagger/go.sum @@ -252,8 +252,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -296,11 +296,11 @@ golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -313,8 +313,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= diff --git a/pkg/util/trivy/trivy.go b/pkg/util/trivy/trivy.go index 385068d0518aa..a4fdb87e79c57 100644 --- a/pkg/util/trivy/trivy.go +++ b/pkg/util/trivy/trivy.go @@ -318,6 +318,7 @@ func (c *Collector) ScanContainerdImageFromSnapshotter(ctx context.Context, imgM if err != nil { return nil, fmt.Errorf("unable to get mounts for image %s, err: %w", imgMeta.ID, err) } + layers := extractLayersFromOverlayFSMounts(mounts) if len(layers) == 0 { return nil, fmt.Errorf("unable to extract layers from overlayfs mounts %+v for image %s", mounts, imgMeta.ID) diff --git a/pkg/util/uuid/go.mod b/pkg/util/uuid/go.mod index 15766a7d0f0b9..2da6b01d5dc8a 100644 --- a/pkg/util/uuid/go.mod +++ b/pkg/util/uuid/go.mod @@ -12,7 +12,7 @@ require ( github.com/DataDog/datadog-agent/pkg/util/cache v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/util/log v0.56.0-rc.3 github.com/shirou/gopsutil/v3 v3.24.1 - golang.org/x/sys v0.25.0 + golang.org/x/sys v0.26.0 ) require ( diff --git a/pkg/util/uuid/go.sum b/pkg/util/uuid/go.sum index 857186e53b53d..2071302b1c592 100644 --- a/pkg/util/uuid/go.sum +++ b/pkg/util/uuid/go.sum @@ -44,8 +44,8 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/pkg/util/winutil/go.mod b/pkg/util/winutil/go.mod index fa9f1e0e34f16..a877c0025d6cc 100644 --- a/pkg/util/winutil/go.mod +++ b/pkg/util/winutil/go.mod @@ -13,7 +13,7 @@ require ( github.com/fsnotify/fsnotify v1.7.0 github.com/stretchr/testify v1.9.0 go.uber.org/atomic v1.11.0 - golang.org/x/sys v0.25.0 + golang.org/x/sys v0.26.0 ) require ( diff --git a/pkg/util/winutil/go.sum b/pkg/util/winutil/go.sum index e811a2855f887..b73a746cfc76d 100644 --- a/pkg/util/winutil/go.sum +++ b/pkg/util/winutil/go.sum @@ -10,8 +10,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= diff --git a/pyproject.toml b/pyproject.toml index 526757ec84200..09227ca7e8729 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,6 @@ exclude = [ "docs", "google-marketplace", "omnibus", - "pkg-config", "releasenotes", "vendor", "venv", diff --git a/release.json b/release.json index 3b1075d639a2f..3e09fada9d482 100644 --- a/release.json +++ b/release.json @@ -7,7 +7,7 @@ }, "nightly": { "INTEGRATIONS_CORE_VERSION": "master", - "OMNIBUS_SOFTWARE_VERSION": "375618d70253293d71b13f9385260aa3dedd7125", + "OMNIBUS_SOFTWARE_VERSION": "cf7fc9c3ab792ebf97dd7c2ce0be39a6e197f6f5", "OMNIBUS_RUBY_VERSION": "bc5e0fb395c4b106967f97f8738d23705e5bc933", "JMXFETCH_VERSION": "0.49.3", "JMXFETCH_HASH": "258085a94d529a6bdf914db36dd50faf6fde2cebc44b1f54a60eb209a5d8917c", @@ -26,7 +26,7 @@ }, "nightly-a7": { "INTEGRATIONS_CORE_VERSION": "master", - "OMNIBUS_SOFTWARE_VERSION": "375618d70253293d71b13f9385260aa3dedd7125", + "OMNIBUS_SOFTWARE_VERSION": "cf7fc9c3ab792ebf97dd7c2ce0be39a6e197f6f5", "OMNIBUS_RUBY_VERSION": "bc5e0fb395c4b106967f97f8738d23705e5bc933", "JMXFETCH_VERSION": "0.49.3", "JMXFETCH_HASH": "258085a94d529a6bdf914db36dd50faf6fde2cebc44b1f54a60eb209a5d8917c", diff --git a/releasenotes/notes/flare-provider-timeout-cli-1961b537734bcc84.yaml b/releasenotes/notes/flare-provider-timeout-cli-1961b537734bcc84.yaml new file mode 100644 index 0000000000000..4e3958aa262d7 --- /dev/null +++ b/releasenotes/notes/flare-provider-timeout-cli-1961b537734bcc84.yaml @@ -0,0 +1,11 @@ +# Each section from every release note are combined when the +# CHANGELOG.rst is rendered. So the text needs to be worded so that +# it does not depend on any information only available in another +# section. This may mean repeating some details, but each section +# must be readable independently of the other. +# +# Each section note must be formatted as reStructuredText. +--- +enhancements: + - | + The ``flare`` subcommand includes a ``--provider-timeout`` option to set a timeout for each file collection (default is 10s), useful for unblocking slow flare creation. diff --git a/releasenotes/notes/kube-gpu-container-tag-38d7894664964220.yaml b/releasenotes/notes/kube-gpu-container-tag-38d7894664964220.yaml index 9f2ef8117177e..d4924025d3040 100644 --- a/releasenotes/notes/kube-gpu-container-tag-38d7894664964220.yaml +++ b/releasenotes/notes/kube-gpu-container-tag-38d7894664964220.yaml @@ -8,4 +8,4 @@ --- features: - | - Introduce new Kubernetes container tag `kube_gpu_type` for the GPU resource requested by a container. + Introduce new Kubernetes tag `gpu_vendor` for the GPU resource requested by a container. diff --git a/releasenotes/notes/oracle-reconnect-on-connection-lose-before-select-54d2b6ad6811d1ea.yaml b/releasenotes/notes/oracle-reconnect-on-connection-lose-before-select-54d2b6ad6811d1ea.yaml new file mode 100644 index 0000000000000..90ba69098fce0 --- /dev/null +++ b/releasenotes/notes/oracle-reconnect-on-connection-lose-before-select-54d2b6ad6811d1ea.yaml @@ -0,0 +1,11 @@ +# Each section from every release note are combined when the +# CHANGELOG.rst is rendered. So the text needs to be worded so that +# it does not depend on any information only available in another +# section. This may mean repeating some details, but each section +# must be readable independently of the other. +# +# Each section note must be formatted as reStructuredText. +--- +fixes: + - | + Fix nil pointer error on Oracle DBM query when the check's connection is lost before SELECT statement executes. diff --git a/releasenotes/notes/windowscrashreportasync-1b2c77f9ebeafdd5.yaml b/releasenotes/notes/windowscrashreportasync-1b2c77f9ebeafdd5.yaml new file mode 100644 index 0000000000000..16552ffd1708b --- /dev/null +++ b/releasenotes/notes/windowscrashreportasync-1b2c77f9ebeafdd5.yaml @@ -0,0 +1,14 @@ +# Each section from every release note are combined when the +# CHANGELOG.rst is rendered. So the text needs to be worded so that +# it does not depend on any information only available in another +# section. This may mean repeating some details, but each section +# must be readable independently of the other. +# +# Each section note must be formatted as reStructuredText. +--- +enhancements: + - | + On Windows, the endpoint /windows_crash_detection/check has been modified to report crashes in + an asynchronous manner, to allow processing of large crash dumps without blocking or timing out. + The first check will return a busy status and continue to do so until the processing is completed. + diff --git a/rtloader/CMakeLists.txt b/rtloader/CMakeLists.txt index 7dfa4089ff2ca..9398d863bc3ee 100644 --- a/rtloader/CMakeLists.txt +++ b/rtloader/CMakeLists.txt @@ -8,6 +8,11 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) +# Favor finding Python by location rather than by version +if (POLICY CMP0094) + cmake_policy(SET CMP0094 NEW) +endif() + if(WIN32) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin ) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwin32") @@ -19,17 +24,10 @@ if(ARCH_I386) endif() ## Config options -option(DISABLE_PYTHON2 "Do not build Python2 support") -option(DISABLE_PYTHON3 "Do not build Python3 support") option(BUILD_DEMO "Build the demo app" ON) ## Add Build Targets -if (NOT DISABLE_PYTHON2) - add_subdirectory(two) -endif() -if (NOT DISABLE_PYTHON3) - add_subdirectory(three) -endif() +add_subdirectory(three) add_subdirectory(rtloader) add_subdirectory(test) if (BUILD_DEMO) diff --git a/rtloader/README.md b/rtloader/README.md index 9b9b033f1a530..13b2ce442d5d4 100644 --- a/rtloader/README.md +++ b/rtloader/README.md @@ -15,14 +15,13 @@ RtLoader will `dlopen` the proper backend libraries accordingly. ### libdatadog-agent-rtloader RtLoader exposes its C89-compatible API through `include/datadog_agent_rtloader.h`. By -using the `make2` and `make3` functions, the corresponding Python backend will +using the `make3` function, the corresponding Python backend will be loaded at runtime. Under the hood the library provides `RtLoader`, a C++ interface that must be implemented by any supported backend, see `include/rtloader.h` for details. ### Two and Three -`libdatadog-agent-three` and `libdatadog-agent-two` libraries provide Python support -for extending and embedding by linking different versions of the CPython library. +`libdatadog-agent-three` library provides Python3 support. Python2 isn't supported anymore. ### Common @@ -33,7 +32,6 @@ Most of the code used to extend the embedded interpreter is there. ## Requirements * C/C++ compiler -* Python 2.7.x development packages * Python 3.12.x development packages * Cmake version 3.12 or above * Go compiler with `cgo` capabilities to run the tests diff --git a/rtloader/common/builtins/_util.c b/rtloader/common/builtins/_util.c index c552c441624e1..7dd43a1e0d099 100644 --- a/rtloader/common/builtins/_util.c +++ b/rtloader/common/builtins/_util.c @@ -34,7 +34,6 @@ static PyMethodDef methods[] = { { NULL, NULL } // guards }; -#ifdef DATADOG_AGENT_THREE static struct PyModuleDef module_def = { PyModuleDef_HEAD_INIT, _UTIL_MODULE_NAME, NULL, -1, methods }; PyMODINIT_FUNC PyInit__util(void) @@ -43,16 +42,6 @@ PyMODINIT_FUNC PyInit__util(void) addSubprocessException(m); return m; } -#elif defined(DATADOG_AGENT_TWO) -// in Python2 keep the object alive for the program lifetime -static PyObject *module; - -void Py2_init__util() -{ - module = Py_InitModule(_UTIL_MODULE_NAME, methods); - addSubprocessException(module); -} -#endif void _set_get_subprocess_output_cb(cb_get_subprocess_output_t cb) { diff --git a/rtloader/common/builtins/_util.h b/rtloader/common/builtins/_util.h index 6bed75db34bff..f29712f087057 100644 --- a/rtloader/common/builtins/_util.h +++ b/rtloader/common/builtins/_util.h @@ -46,21 +46,13 @@ // The keyword-only arguments separator ($) for PyArg_ParseTupleAndKeywords() // has been introduced in Python 3.3 // https://docs.python.org/3/c-api/arg.html#other-objects -#ifdef DATADOG_AGENT_THREE -# define PY_ARG_PARSE_TUPLE_KEYWORD_ONLY "$" -#elif defined(DATADOG_AGENT_TWO) -# define PY_ARG_PARSE_TUPLE_KEYWORD_ONLY "" -#endif +#define PY_ARG_PARSE_TUPLE_KEYWORD_ONLY "$" #ifdef __cplusplus extern "C" { #endif -#ifdef DATADOG_AGENT_THREE PyMODINIT_FUNC PyInit__util(void); -#elif defined(DATADOG_AGENT_TWO) -void Py2_init__util(); -#endif void _set_get_subprocess_output_cb(cb_get_subprocess_output_t); #ifdef __cplusplus diff --git a/rtloader/common/builtins/aggregator.c b/rtloader/common/builtins/aggregator.c index 3ee1b6b56678e..15343248b3709 100644 --- a/rtloader/common/builtins/aggregator.c +++ b/rtloader/common/builtins/aggregator.c @@ -48,7 +48,6 @@ static void add_constants(PyObject *m) PyModule_AddIntConstant(m, "HISTORATE", DATADOG_AGENT_RTLOADER_HISTORATE); } -#ifdef DATADOG_AGENT_THREE static struct PyModuleDef module_def = { PyModuleDef_HEAD_INIT, AGGREGATOR_MODULE_NAME, NULL, -1, methods }; PyMODINIT_FUNC PyInit_aggregator(void) @@ -57,16 +56,6 @@ PyMODINIT_FUNC PyInit_aggregator(void) add_constants(m); return m; } -#elif defined(DATADOG_AGENT_TWO) -// module object storage -static PyObject *module; - -void Py2_init_aggregator() -{ - module = Py_InitModule(AGGREGATOR_MODULE_NAME, methods); - add_constants(module); -} -#endif void _set_submit_metric_cb(cb_submit_metric_t cb) { diff --git a/rtloader/common/builtins/aggregator.h b/rtloader/common/builtins/aggregator.h index 6097239ee676d..99b444fd23872 100644 --- a/rtloader/common/builtins/aggregator.h +++ b/rtloader/common/builtins/aggregator.h @@ -74,12 +74,8 @@ extern "C" { #endif -#ifdef DATADOG_AGENT_THREE // PyMODINIT_FUNC macro already specifies extern "C", nesting these is legal PyMODINIT_FUNC PyInit_aggregator(void); -#elif defined(DATADOG_AGENT_TWO) -void Py2_init_aggregator(); -#endif void _set_submit_metric_cb(cb_submit_metric_t cb); void _set_submit_service_check_cb(cb_submit_service_check_t cb); diff --git a/rtloader/common/builtins/containers.c b/rtloader/common/builtins/containers.c index a182703da8a48..bc528fd13e2a7 100644 --- a/rtloader/common/builtins/containers.c +++ b/rtloader/common/builtins/containers.c @@ -18,22 +18,12 @@ static PyMethodDef methods[] = { { NULL, NULL } // guards }; -#ifdef DATADOG_AGENT_THREE static struct PyModuleDef module_def = { PyModuleDef_HEAD_INIT, CONTAINERS_MODULE_NAME, NULL, -1, methods }; PyMODINIT_FUNC PyInit_containers(void) { return PyModule_Create(&module_def); } -#elif defined(DATADOG_AGENT_TWO) -// in Python2 keep the object alive for the program lifetime -static PyObject *module; - -void Py2_init_containers() -{ - module = Py_InitModule(CONTAINERS_MODULE_NAME, methods); -} -#endif void _set_is_excluded_cb(cb_is_excluded_t cb) { diff --git a/rtloader/common/builtins/containers.h b/rtloader/common/builtins/containers.h index 09a129a4e91d3..fadc5442c67ff 100644 --- a/rtloader/common/builtins/containers.h +++ b/rtloader/common/builtins/containers.h @@ -50,10 +50,6 @@ PyMODINIT_FUNC PyInit_containers(void); extern "C" { #endif -#ifdef DATADOG_AGENT_TWO -void Py2_init_containers(); -#endif - void _set_is_excluded_cb(cb_is_excluded_t); #ifdef __cplusplus diff --git a/rtloader/common/builtins/datadog_agent.c b/rtloader/common/builtins/datadog_agent.c index 2e606f8238279..e20b8f8ff30c8 100644 --- a/rtloader/common/builtins/datadog_agent.c +++ b/rtloader/common/builtins/datadog_agent.c @@ -70,22 +70,12 @@ static PyMethodDef methods[] = { { NULL, NULL } // guards }; -#ifdef DATADOG_AGENT_THREE static struct PyModuleDef module_def = { PyModuleDef_HEAD_INIT, DATADOG_AGENT_MODULE_NAME, NULL, -1, methods }; PyMODINIT_FUNC PyInit_datadog_agent(void) { return PyModule_Create(&module_def); } -#elif defined(DATADOG_AGENT_TWO) -// in Python2 keep the object alive for the program lifetime -static PyObject *module; - -void Py2_init_datadog_agent() -{ - module = Py_InitModule(DATADOG_AGENT_MODULE_NAME, methods); -} -#endif void _set_get_version_cb(cb_get_version_t cb) { diff --git a/rtloader/common/builtins/datadog_agent.h b/rtloader/common/builtins/datadog_agent.h index 055878d6490ba..20a7b97391a6c 100644 --- a/rtloader/common/builtins/datadog_agent.h +++ b/rtloader/common/builtins/datadog_agent.h @@ -145,11 +145,7 @@ extern "C" { #endif -#ifdef DATADOG_AGENT_THREE PyMODINIT_FUNC PyInit_datadog_agent(void); -#elif defined(DATADOG_AGENT_TWO) -void Py2_init_datadog_agent(); -#endif void _set_get_clustername_cb(cb_get_clustername_t); void _set_get_config_cb(cb_get_config_t); diff --git a/rtloader/common/builtins/kubeutil.c b/rtloader/common/builtins/kubeutil.c index 804deaeeb6c1c..57f8ec65c14d0 100644 --- a/rtloader/common/builtins/kubeutil.c +++ b/rtloader/common/builtins/kubeutil.c @@ -19,22 +19,12 @@ static PyMethodDef methods[] = { { NULL, NULL } // guards }; -#ifdef DATADOG_AGENT_THREE static struct PyModuleDef module_def = { PyModuleDef_HEAD_INIT, KUBEUTIL_MODULE_NAME, NULL, -1, methods }; PyMODINIT_FUNC PyInit_kubeutil(void) { return PyModule_Create(&module_def); } -#elif defined(DATADOG_AGENT_TWO) -// in Python2 keep the object alive for the program lifetime -static PyObject *module; - -void Py2_init_kubeutil() -{ - module = Py_InitModule(KUBEUTIL_MODULE_NAME, methods); -} -#endif void _set_get_connection_info_cb(cb_get_connection_info_t cb) { diff --git a/rtloader/common/builtins/kubeutil.h b/rtloader/common/builtins/kubeutil.h index db9c95ac863c9..d5eb20ef8b1e1 100644 --- a/rtloader/common/builtins/kubeutil.h +++ b/rtloader/common/builtins/kubeutil.h @@ -45,12 +45,8 @@ extern "C" { #endif -#ifdef DATADOG_AGENT_THREE // PyMODINIT_FUNC macro already specifies extern "C", nesting these is legal PyMODINIT_FUNC PyInit_kubeutil(void); -#elif defined(DATADOG_AGENT_TWO) -void Py2_init_kubeutil(); -#endif void _set_get_connection_info_cb(cb_get_connection_info_t); diff --git a/rtloader/common/builtins/tagger.c b/rtloader/common/builtins/tagger.c index 662174d0be966..4c35738e7c3a2 100644 --- a/rtloader/common/builtins/tagger.c +++ b/rtloader/common/builtins/tagger.c @@ -172,7 +172,6 @@ static void add_constants(PyObject *m) PyModule_AddIntConstant(m, "HIGH", DATADOG_AGENT_RTLOADER_TAGGER_HIGH); } -#ifdef DATADOG_AGENT_THREE static struct PyModuleDef module_def = { PyModuleDef_HEAD_INIT, TAGGER_MODULE_NAME, NULL, -1, methods }; PyMODINIT_FUNC PyInit_tagger(void) @@ -181,13 +180,3 @@ PyMODINIT_FUNC PyInit_tagger(void) add_constants(module); return module; } -#elif defined(DATADOG_AGENT_TWO) -// in Python2 keep the object alive for the program lifetime -static PyObject *module; - -void Py2_init_tagger() -{ - module = Py_InitModule(TAGGER_MODULE_NAME, methods); - add_constants(module); -} -#endif diff --git a/rtloader/common/builtins/tagger.h b/rtloader/common/builtins/tagger.h index fc8230de8bb73..7d30c1a219ed7 100644 --- a/rtloader/common/builtins/tagger.h +++ b/rtloader/common/builtins/tagger.h @@ -46,18 +46,12 @@ #define TAGGER_MODULE_NAME "tagger" -#ifdef DATADOG_AGENT_THREE PyMODINIT_FUNC PyInit_tagger(void); -#endif #ifdef __cplusplus extern "C" { #endif -#ifdef DATADOG_AGENT_TWO -void Py2_init_tagger(); -#endif - void _set_tags_cb(cb_tags_t); #ifdef __cplusplus diff --git a/rtloader/common/builtins/util.c b/rtloader/common/builtins/util.c index 38df33b86f428..c184e681af3ae 100644 --- a/rtloader/common/builtins/util.c +++ b/rtloader/common/builtins/util.c @@ -19,22 +19,12 @@ static PyMethodDef methods[] = { { NULL, NULL } // guards }; -#ifdef DATADOG_AGENT_THREE static struct PyModuleDef module_def = { PyModuleDef_HEAD_INIT, UTIL_MODULE_NAME, NULL, -1, methods }; PyMODINIT_FUNC PyInit_util(void) { return PyModule_Create(&module_def); } -#elif defined(DATADOG_AGENT_TWO) -// in Python2 keep the object alive for the program lifetime -static PyObject *module; - -void Py2_init_util() -{ - module = Py_InitModule(UTIL_MODULE_NAME, methods); -} -#endif /*! \fn PyObject *headers(PyObject *self, PyObject *args, PyObject *kwargs) \brief This function provides a standard set of HTTP headers the caller might want to diff --git a/rtloader/common/builtins/util.h b/rtloader/common/builtins/util.h index 40073cc5c1400..86f5ed7cec1a1 100644 --- a/rtloader/common/builtins/util.h +++ b/rtloader/common/builtins/util.h @@ -21,8 +21,6 @@ extern "C" { #endif -#ifdef DATADOG_AGENT_THREE - /*! \fn void PyInit_util() \brief Initializes the util builtin python module. @@ -30,16 +28,6 @@ extern "C" { array in 'util.c' and registered into python. This function is python3 only. */ PyMODINIT_FUNC PyInit_util(void); -#elif defined(DATADOG_AGENT_TWO) - -/*! \fn void Py2_init_util() - \brief Initializes the util builtin python module. - - The 'util' python builtin is created with the methods from the PyMethodDef - array in 'util.c' and registered into python. This function is python2 only. -*/ -void Py2_init_util(); -#endif #ifdef __cplusplus } diff --git a/rtloader/common/stringutils.c b/rtloader/common/stringutils.c index 1e6315635c9a5..68a5d7820568c 100644 --- a/rtloader/common/stringutils.c +++ b/rtloader/common/stringutils.c @@ -31,21 +31,6 @@ char *as_string(PyObject *object) char *retval = NULL; -// DATADOG_AGENT_THREE implementation is the default -#ifdef DATADOG_AGENT_TWO - if (!PyString_Check(object) && !PyUnicode_Check(object)) { - return NULL; - } - - char *tmp = PyString_AsString(object); - if (tmp == NULL) { - // PyString_AsString might raise an error when python can't encode a - // unicode string to byte - PyErr_Clear(); - return NULL; - } - retval = strdupe(tmp); -#else PyObject *temp_bytes = NULL; if (PyBytes_Check(object)) { @@ -67,7 +52,6 @@ char *as_string(PyObject *object) retval = strdupe(PyBytes_AS_STRING(temp_bytes)); Py_XDECREF(temp_bytes); -#endif return retval; } diff --git a/rtloader/common/stringutils.h b/rtloader/common/stringutils.h index b0a70c02d102c..1e19c8dd7e297 100644 --- a/rtloader/common/stringutils.h +++ b/rtloader/common/stringutils.h @@ -73,11 +73,7 @@ char *as_string(PyObject *); PyObject *from_yaml(const char *); char *as_yaml(PyObject *); -#ifdef DATADOG_AGENT_THREE -# define PyStringFromCString(x) PyUnicode_FromString(x) -#elif defined(DATADOG_AGENT_TWO) -# define PyStringFromCString(x) PyString_FromString(x) -#endif +#define PyStringFromCString(x) PyUnicode_FromString(x) #ifdef __cplusplus } diff --git a/rtloader/demo/main.c b/rtloader/demo/main.c index 2db57cee12677..c9b8f09c3791b 100644 --- a/rtloader/demo/main.c +++ b/rtloader/demo/main.c @@ -78,16 +78,8 @@ int main(int argc, char *argv[]) } char *init_error = NULL; - // Embed Python2 - if (strcmp(argv[1], "2") == 0) { - rtloader = make2(python_home, "", &init_error); - if (!rtloader) { - printf("Unable to init Python2: %s\n", init_error); - return 1; - } - } // Embed Python3 - else if (strcmp(argv[1], "3") == 0) { + if (strcmp(argv[1], "3") == 0) { rtloader = make3(python_home, "", &init_error); if (!rtloader) { printf("Unable to init Python3: %s\n", init_error); diff --git a/rtloader/include/datadog_agent_rtloader.h b/rtloader/include/datadog_agent_rtloader.h index f61f1ffec9b48..dc5a906373418 100644 --- a/rtloader/include/datadog_agent_rtloader.h +++ b/rtloader/include/datadog_agent_rtloader.h @@ -28,17 +28,7 @@ typedef struct rtloader_s rtloader_t; struct rtloader_pyobject_s; typedef struct rtloader_pyobject_s rtloader_pyobject_t; -// FACTORIES -/*! \fn rtloader_t *make2(const char *python_home, const char *python_exe, char **error) - \brief Factory function to load the python2 backend DLL and create its relevant RtLoader - instance. - \param python_home A C-string with the path to the PYTHONHOME for said DLL. - \param python_exe A C-string with the path to the python interpreter. - \param error A C-string pointer output parameter to return error messages. - \return A rtloader_t * pointer to the RtLoader instance. - \sa rtloader_t -*/ -DATADOG_AGENT_RTLOADER_API rtloader_t *make2(const char *python_home, const char *python_exe, char **error); +// FACTORY /*! \fn rtloader_t *make3(const char *python_home, const char *python_exe, char **error) \brief Factory function to load the python3 backend DLL and create its relevant RtLoader instance. diff --git a/rtloader/rtloader/api.cpp b/rtloader/rtloader/api.cpp index 1026c566fe7ca..da99a969f82e1 100644 --- a/rtloader/rtloader/api.cpp +++ b/rtloader/rtloader/api.cpp @@ -33,16 +33,12 @@ #include "rtloader_mem.h" #if __linux__ -# define DATADOG_AGENT_TWO "libdatadog-agent-two.so" # define DATADOG_AGENT_THREE "libdatadog-agent-three.so" #elif __APPLE__ -# define DATADOG_AGENT_TWO "libdatadog-agent-two.dylib" # define DATADOG_AGENT_THREE "libdatadog-agent-three.dylib" #elif __FreeBSD__ -# define DATADOG_AGENT_TWO "libdatadog-agent-two.so" # define DATADOG_AGENT_THREE "libdatadog-agent-three.so" #elif _WIN32 -# define DATADOG_AGENT_TWO "libdatadog-agent-two.dll" # define DATADOG_AGENT_THREE "libdatadog-agent-three.dll" #else # error Platform not supported @@ -69,7 +65,7 @@ static void *rtloader_backend = NULL; \return A create_t * function pointer that will allow us to create the relevant python backend. In case of failure NULL is returned and the error string is set on the output parameter. - \sa create_t, make2, make3 + \sa create_t, make3 This function is windows only. Required by the backend "makers". */ @@ -102,21 +98,6 @@ create_t *loadAndCreate(const char *dll, const char *python_home, char **error) return create; } -rtloader_t *make2(const char *python_home, const char *python_exe, char **error) -{ - - if (rtloader_backend != NULL) { - *error = strdupe("RtLoader already initialized!"); - return NULL; - } - - create_t *create = loadAndCreate(DATADOG_AGENT_TWO, python_home, error); - if (!create) { - return NULL; - } - return AS_TYPE(rtloader_t, create(python_home, python_exe, _get_memory_tracker_cb())); -} - rtloader_t *make3(const char *python_home, const char *python_exe, char **error) { if (rtloader_backend != NULL) { @@ -152,37 +133,6 @@ void destroy(rtloader_t *rtloader) } #else -rtloader_t *make2(const char *python_home, const char *python_exe, char **error) -{ - if (rtloader_backend != NULL) { - std::string err_msg = "RtLoader already initialized!"; - *error = strdupe(err_msg.c_str()); - return NULL; - } - // load library - rtloader_backend = dlopen(DATADOG_AGENT_TWO, RTLD_LAZY | RTLD_GLOBAL); - if (!rtloader_backend) { - std::ostringstream err_msg; - err_msg << "Unable to open two library: " << dlerror(); - *error = strdupe(err_msg.str().c_str()); - return NULL; - } - - // reset dl errors - dlerror(); - - // dlsym class factory - create_t *create = (create_t *)dlsym(rtloader_backend, "create"); - const char *dlsym_error = dlerror(); - if (dlsym_error) { - std::ostringstream err_msg; - err_msg << "Unable to open two factory: " << dlsym_error; - *error = strdupe(err_msg.str().c_str()); - return NULL; - } - - return AS_TYPE(rtloader_t, create(python_home, python_exe, _get_memory_tracker_cb())); -} rtloader_t *make3(const char *python_home, const char *python_exe, char **error) { diff --git a/rtloader/test/CMakeLists.txt b/rtloader/test/CMakeLists.txt index 04b667825c3f3..6f4f509ca0a45 100644 --- a/rtloader/test/CMakeLists.txt +++ b/rtloader/test/CMakeLists.txt @@ -14,9 +14,9 @@ set(PKGS ) if (WIN32) - set(LIBS_PATH \"${PROJECT_BINARY_DIR}/rtloader/\;${PROJECT_BINARY_DIR}/two/\;${PROJECT_BINARY_DIR}/three/\") + set(LIBS_PATH \"${PROJECT_BINARY_DIR}/rtloader/\;${PROJECT_BINARY_DIR}/three/\") else() - set(LIBS_PATH "${PROJECT_BINARY_DIR}/rtloader/:${PROJECT_BINARY_DIR}/two/:${PROJECT_BINARY_DIR}/three/") + set(LIBS_PATH "${PROJECT_BINARY_DIR}/rtloader/:${PROJECT_BINARY_DIR}/three/") endif() set (CGO_CFLAGS \"-I${CMAKE_SOURCE_DIR}/include -I${CMAKE_SOURCE_DIR}/common -Wno-deprecated-declarations\") @@ -27,22 +27,11 @@ else() set (CGO_LDFLAGS -L${PROJECT_BINARY_DIR}/rtloader -ldatadog-agent-rtloader -ldl) endif() -if (NOT DISABLE_PYTHON2) - set (CGO_LDFLAGS \"-L${PROJECT_BINARY_DIR}/two/ ${CGO_LDFLAGS}\") - add_custom_command( - OUTPUT testPy2 - COMMAND ${CMAKE_COMMAND} -E env CGO_CFLAGS=${CGO_CFLAGS} CGO_LDFLAGS=${CGO_LDFLAGS} DYLD_LIBRARY_PATH=${LIBS_PATH} LD_LIBRARY_PATH=${LIBS_PATH} go test -mod=mod -tags "two" -count=1 -p=1 ${PKGS} - ) - list(APPEND TARGETS "testPy2") -endif() - -if (NOT DISABLE_PYTHON3) - set (CGO_LDFLAGS \"-L${PROJECT_BINARY_DIR}/three/ ${CGO_LDFLAGS}\") - add_custom_command( - OUTPUT testPy3 - COMMAND ${CMAKE_COMMAND} -E env CGO_CFLAGS=${CGO_CFLAGS} CGO_LDFLAGS=${CGO_LDFLAGS} DYLD_LIBRARY_PATH=${LIBS_PATH} LD_LIBRARY_PATH=${LIBS_PATH} go test -mod=mod -tags "three" -count=1 -p=1 ${PKGS} - ) - list(APPEND TARGETS "testPy3") -endif() +set (CGO_LDFLAGS \"-L${PROJECT_BINARY_DIR}/three/ ${CGO_LDFLAGS}\") +add_custom_command( + OUTPUT testPy3 + COMMAND ${CMAKE_COMMAND} -E env CGO_CFLAGS=${CGO_CFLAGS} CGO_LDFLAGS=${CGO_LDFLAGS} DYLD_LIBRARY_PATH=${LIBS_PATH} LD_LIBRARY_PATH=${LIBS_PATH} go test -mod=mod -tags "three" -count=1 -p=1 ${PKGS} +) +list(APPEND TARGETS "testPy3") add_custom_target(run DEPENDS ${TARGETS}) diff --git a/rtloader/test/common/cgo_free_two.go b/rtloader/test/common/cgo_free_two.go deleted file mode 100644 index 5b5b65dc1c8e5..0000000000000 --- a/rtloader/test/common/cgo_free_two.go +++ /dev/null @@ -1,19 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed -// under the Apache License Version 2.0. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2016-present Datadog, Inc. - -//go:build two - -package testcommon - -/* -#cgo !windows LDFLAGS: -L../../two/ -ldatadog-agent-two -#cgo windows LDFLAGS: -L../../two/ -ldatadog-agent-two.dll -#include "cgo_free.h" - -void c_callCgoFree(void *ptr) { - cgo_free(ptr); -} -*/ -import "C" diff --git a/rtloader/test/common/common_two.go b/rtloader/test/common/common_two.go deleted file mode 100644 index 16515cab089d6..0000000000000 --- a/rtloader/test/common/common_two.go +++ /dev/null @@ -1,27 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed -// under the Apache License Version 2.0. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2016-present Datadog, Inc. - -//go:build two - -package testcommon - -// #include -// -import "C" - -import "unsafe" - -// UsingTwo states whether we're using Two as backend -const UsingTwo bool = true - -// GetRtLoader returns a RtLoader instance using Two -func GetRtLoader() *C.rtloader_t { - var err *C.char = nil - - executablePath := C.CString("/folder/mock_python_interpeter_bin_path") - defer C.free(unsafe.Pointer(executablePath)) - - return C.make2(nil, executablePath, &err) -} diff --git a/rtloader/test/init/init_two.go b/rtloader/test/init/init_two.go deleted file mode 100644 index 7626d458c727a..0000000000000 --- a/rtloader/test/init/init_two.go +++ /dev/null @@ -1,12 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed -// under the Apache License Version 2.0. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2016-present Datadog, Inc. - -//go:build two - -package testinit - -const ( - initAllocations = 2 -) diff --git a/rtloader/three/three.h b/rtloader/three/three.h index 1f2ae429308eb..829d8d6d88275 100644 --- a/rtloader/three/three.h +++ b/rtloader/three/three.h @@ -6,13 +6,6 @@ #ifndef DATADOG_AGENT_RTLOADER_THREE_H #define DATADOG_AGENT_RTLOADER_THREE_H -// Some preprocessor sanity for builds (2+3 common sources) -#ifndef DATADOG_AGENT_THREE -# error Build requires defining DATADOG_AGENT_THREE -#elif defined(DATADOG_AGENT_TWO) && defined(DATADOG_AGENT_THREE) -# error "DATADOG_AGENT_TWO and DATADOG_AGENT_THREE are mutually exclusive - define only one of the two." -#endif - #include #include #include diff --git a/rtloader/two/CMakeLists.txt b/rtloader/two/CMakeLists.txt deleted file mode 100644 index 8b4fc0f97445f..0000000000000 --- a/rtloader/two/CMakeLists.txt +++ /dev/null @@ -1,82 +0,0 @@ -cmake_minimum_required(VERSION 3.12) -find_package (Python2 COMPONENTS Interpreter Development) - -if(Python2_VERSION_MINOR LESS "7") - message( - FATAL_ERROR - "Python2 version found is too old: found ${Python2_EXECUTABLE} (version \"${Python2_VERSION}\"), minimum required version is 2.7" - ) -endif() - -project(datadog-agent-two VERSION 0.1.0 DESCRIPTION "CPython backend for the Datadog Agent") - -if(WIN32) - if(MSVC) - - # explicitly set the compiler flags to use the static C runtime (/MT(d) instead of the DLL - # c runtime (/MD(d) so that we don't have to worry about redistributing the CRT). - foreach(flag_var - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - if(${flag_var} MATCHES "/MD") - string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") - endif(${flag_var} MATCHES "/MD") - endforeach(flag_var) - else() # assume gnuC on windows - string(REPLACE "\\" "\\\\" Python2_STDLIB ${Python2_STDLIB}) - if(ARCH_I386) - set(CMAKE_C_FLAGS "-D_hypot=hypot ") - set(CMAKE_CXX_FLAGS "-D_hypot=hypot ") - else() - set(CMAKE_C_FLAGS "-D_hypot=hypot -DMS_WIN64") - set(CMAKE_CXX_FLAGS "-D_hypot=hypot -DMS_WIN64") - endif() - endif() -endif() - -include(GNUInstallDirs) -configure_file(constants.h.in constants.h) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) -add_library(datadog-agent-two SHARED - two.cpp - ../common/cgo_free.c - ../common/stringutils.c - ../common/log.c - ../common/builtins/aggregator.c - ../common/builtins/datadog_agent.c - ../common/builtins/util.c - ../common/builtins/_util.c - ../common/builtins/tagger.c - ../common/builtins/kubeutil.c - ../common/builtins/containers.c -) -add_compile_definitions(DATADOG_AGENT_TWO) -target_include_directories(datadog-agent-two PRIVATE .) -target_include_directories(datadog-agent-two PUBLIC - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/common - ${CMAKE_SOURCE_DIR}/common/builtins - ${Python2_INCLUDE_DIRS} -) -if(WIN32) - if(ARCH_I386) - set_target_properties(datadog-agent-two PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32 -static") - else() - set_target_properties(datadog-agent-two PROPERTIES LINK_FLAGS "-static") - endif() -elseif(APPLE) - set_target_properties(datadog-agent-two PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) -endif() - -target_link_libraries(datadog-agent-two ${Python2_LIBRARIES} datadog-agent-rtloader) - -if(WIN32) - install(TARGETS datadog-agent-two - RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) -else() - target_compile_options(datadog-agent-two PRIVATE "-Wno-deprecated-register") - install(TARGETS datadog-agent-two - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) -endif() diff --git a/rtloader/two/constants.h.in b/rtloader/two/constants.h.in deleted file mode 100644 index 78413d0d29b74..0000000000000 --- a/rtloader/two/constants.h.in +++ /dev/null @@ -1,5 +0,0 @@ -#ifdef _WIN32 -static const char *_defaultPythonHome = "@Python2_STDLIB@\\.."; -#else -static const char *_defaultPythonHome = "@Python2_STDLIB@/../.."; -#endif diff --git a/rtloader/two/two.cpp b/rtloader/two/two.cpp deleted file mode 100644 index 4901adb5723b7..0000000000000 --- a/rtloader/two/two.cpp +++ /dev/null @@ -1,1120 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed -// under the Apache License Version 2.0. -// This product includes software developed at Datadog -// (https://www.datadoghq.com/). -// Copyright 2019-present Datadog, Inc. -#include "two.h" - -#include "constants.h" - -#include "_util.h" -#include "aggregator.h" -#include "cgo_free.h" -#include "containers.h" -#include "datadog_agent.h" -#include "kubeutil.h" -#include "rtloader_mem.h" -#include "rtloader_types.h" -#include "stringutils.h" -#include "tagger.h" -#include "util.h" - -#include -#include -#include - -extern "C" DATADOG_AGENT_RTLOADER_API RtLoader *create(const char *python_home, const char *python_exe, - cb_memory_tracker_t memtrack_cb) -{ - return new Two(python_home, python_exe, memtrack_cb); -} - -extern "C" DATADOG_AGENT_RTLOADER_API void destroy(RtLoader *p) -{ - delete p; -} - -Two::Two(const char *python_home, const char *python_exe, cb_memory_tracker_t memtrack_cb) - : RtLoader(memtrack_cb) - , _pythonHome(NULL) - , _pythonExe(NULL) - , _baseClass(NULL) - , _pythonPaths() -{ - initPythonHome(python_home); - - // If not empty, set our Python interpreter path - if (python_exe && strlen(python_exe) > 0) { - initPythonExe(python_exe); - } -} - -Two::~Two() -{ - // For more information on why Py_Finalize() isn't called here please - // refer to the header file or the doxygen documentation. - PyEval_RestoreThread(_threadState); - Py_XDECREF(_baseClass); -} - -void Two::initPythonHome(const char *pythonHome) -{ - // Py_SetPythonHome stores a pointer to the string we pass to it, so we must keep it in memory - char *oldPythonHome = _pythonHome; - - if (pythonHome == NULL || strlen(pythonHome) == 0) { - _pythonHome = strdupe(_defaultPythonHome); - } else { - _pythonHome = strdupe(pythonHome); - } - - Py_SetPythonHome(_pythonHome); - if (oldPythonHome) { - _free(oldPythonHome); - } -} - -void Two::initPythonExe(const char *python_exe) -{ - // Py_SetProgramName stores a pointer to the string we pass to it, so we must keep it in memory - char *oldPythonExe = _pythonExe; - - _pythonExe = strdupe(python_exe); - - Py_SetProgramName(_pythonExe); - - if (oldPythonExe) { - _free(oldPythonExe); - } -} - -bool Two::init() -{ - - Py_Initialize(); - - if (!Py_IsInitialized()) { - return false; - } - - // In recent versions of Python3 this is called from Py_Initialize already, - // for Python2 it has to be explicit. - PyEval_InitThreads(); - - // Set PYTHONPATH - if (!_pythonPaths.empty()) { - char pathchr[] = "path"; - PyObject *path = PySys_GetObject(pathchr); // borrowed - if (path == NULL) { - // sys.path doesn't exist, which should never happen. - // No exception is set on the interpreter, so no need to handle any. - setError("could not access sys.path"); - goto done; - } - for (PyPaths::iterator pit = _pythonPaths.begin(); pit != _pythonPaths.end(); ++pit) { - PyObject *p = PyString_FromString(pit->c_str()); - if (p == NULL) { - setError("could not set pythonPath: " + _fetchPythonError()); - goto done; - } - int retval = PyList_Append(path, p); - Py_XDECREF(p); - if (retval == -1) { - setError("could not append path to pythonPath: " + _fetchPythonError()); - goto done; - } - } - } - - // init custom builtins - if (init_stringutils() != EXIT_SUCCESS) { - setError("error initializing string utils: " + _fetchPythonError()); - goto done; - } - Py2_init_aggregator(); - Py2_init_datadog_agent(); - Py2_init_util(); - Py2_init__util(); - Py2_init_tagger(); - Py2_init_kubeutil(); - Py2_init_containers(); - - // import the base class - _baseClass = _importFrom("datadog_checks.checks", "AgentCheck"); - if (_baseClass == NULL) { - setError("could not import base class: " + std::string(getError())); - } - -done: - // save thread state and release the GIL - _threadState = PyEval_SaveThread(); - - return _baseClass != NULL; -} - -py_info_t *Two::getPyInfo() -{ - PyObject *sys = NULL; - PyObject *path = NULL; - PyObject *str_path = NULL; - - py_info_t *info = (py_info_t *)_malloc(sizeof(*info)); - if (!info) { - setError("could not allocate a py_info_t struct"); - return NULL; - } - - info->version = Py_GetVersion(); - info->path = NULL; - - sys = PyImport_ImportModule("sys"); - if (!sys) { - setError("could not import module 'sys': " + _fetchPythonError()); - goto done; - } - - path = PyObject_GetAttrString(sys, "path"); - if (!path) { - setError("could not get 'sys.path': " + _fetchPythonError()); - goto done; - } - - str_path = PyObject_Repr(path); - if (!str_path) { - setError("could not compute a string representation of 'sys.path': " + _fetchPythonError()); - goto done; - } - - info->path = as_string(str_path); - -done: - Py_XDECREF(sys); - Py_XDECREF(path); - Py_XDECREF(str_path); - return info; -} -/** - * freePyInfo() - */ -void Two::freePyInfo(py_info_t *info) -{ - info->version = NULL; - if (info->path) { - _free(info->path); - } - _free(info); - return; -} - -bool Two::runSimpleString(const char *code) const -{ - return PyRun_SimpleString(code) == 0; -} - -bool Two::addPythonPath(const char *path) -{ - if (std::find(_pythonPaths.begin(), _pythonPaths.end(), path) == _pythonPaths.end()) { - _pythonPaths.push_back(path); - return true; - } - return false; -} - -rtloader_gilstate_t Two::GILEnsure() -{ - PyGILState_STATE state = PyGILState_Ensure(); - if (state == PyGILState_LOCKED) { - return DATADOG_AGENT_RTLOADER_GIL_LOCKED; - } - return DATADOG_AGENT_RTLOADER_GIL_UNLOCKED; -} - -void Two::GILRelease(rtloader_gilstate_t state) -{ - if (state == DATADOG_AGENT_RTLOADER_GIL_LOCKED) { - PyGILState_Release(PyGILState_LOCKED); - } else { - PyGILState_Release(PyGILState_UNLOCKED); - } -} - -bool Two::getClass(const char *module, RtLoaderPyObject *&pyModule, RtLoaderPyObject *&pyClass) -{ - PyObject *obj_module = NULL; - PyObject *obj_class = NULL; - - obj_module = PyImport_ImportModule(module); - if (obj_module == NULL) { - std::ostringstream err; - err << "unable to import module '" << module << "': " + _fetchPythonError(); - setError(err.str()); - return false; - } - - obj_class = _findSubclassOf(_baseClass, obj_module); - if (obj_class == NULL) { - // `_findSubclassOf` does not set the interpreter's error flag, but leaves an error on rtloader - std::ostringstream err; - err << "unable to find a subclass of the base check in module '" << module << "': " << getError(); - setError(err.str()); - Py_XDECREF(obj_module); - return false; - } - - pyModule = reinterpret_cast(obj_module); - pyClass = reinterpret_cast(obj_class); - return true; -} - -bool Two::getCheck(RtLoaderPyObject *py_class, const char *init_config_str, const char *instance_str, - const char *check_id_str, const char *check_name, const char *agent_config_str, - RtLoaderPyObject *&check) -{ - - PyObject *klass = reinterpret_cast(py_class); - PyObject *agent_config = NULL; - PyObject *init_config = NULL; - PyObject *instance = NULL; - PyObject *instances = NULL; - PyObject *py_check = NULL; - PyObject *args = NULL; - PyObject *kwargs = NULL; - PyObject *check_id = NULL; - PyObject *name = NULL; - - char load_config[] = "load_config"; - char format[] = "(s)"; // use parentheses to force Tuple creation - - // call `AgentCheck.load_config(init_config)` - init_config = PyObject_CallMethod(klass, load_config, format, init_config_str); - if (init_config == NULL) { - setError("error parsing init_config: " + _fetchPythonError()); - goto done; - } - // replace an empty init_config by a empty dict - if (init_config == Py_None) { - Py_XDECREF(init_config); - init_config = PyDict_New(); - if (init_config == NULL) { - setError("error 'init_config' can't be initialized to an empty dict: " + _fetchPythonError()); - goto done; - } - } else if (!PyDict_Check(init_config)) { - setError("error 'init_config' is not a dict"); - goto done; - } - - // call `AgentCheck.load_config(instance)` - instance = PyObject_CallMethod(klass, load_config, format, instance_str); - if (instance == NULL) { - setError("error parsing instance: " + _fetchPythonError()); - goto done; - } else if (!PyDict_Check(instance)) { - setError("error instance is not a dict"); - Py_XDECREF(instance); // we still own the reference to instance, so we need to decref it here - goto done; - } - - instances = PyTuple_New(1); - if (instances == NULL) { - setError("could not create tuple for instances: " + _fetchPythonError()); - Py_XDECREF(instance); // we still own the reference to instance, so we need to decref it here - goto done; - } - // As stated in the Python C-API documentation - // https://github.com/python/cpython/blob/2.7/Doc/c-api/intro.rst#reference-count-details, PyTuple_SetItem takes - // over ownership of the given item (instance in this case). This means that we should NOT DECREF it - if (PyTuple_SetItem(instances, 0, instance) != 0) { - setError("could not set instance item on instances: " + _fetchPythonError()); - goto done; - } - - // create `args` and `kwargs` to invoke `AgentCheck` constructor - args = PyTuple_New(0); - if (args == NULL) { - setError("error 'args' can't be initialized to an empty tuple: " + _fetchPythonError()); - goto done; - } - kwargs = PyDict_New(); - if (kwargs == NULL) { - setError("error 'kwargs' can't be initialized to an empty dict: " + _fetchPythonError()); - goto done; - } - name = PyString_FromString(check_name); - if (name == NULL) { - setError("error 'name' can't be initialized: " + _fetchPythonError()); - goto done; - } - if (PyDict_SetItemString(kwargs, "name", name) == -1) { - setError("error 'name' key can't be set: " + _fetchPythonError()); - goto done; - } - if (PyDict_SetItemString(kwargs, "init_config", init_config) == -1) { - setError("error 'init_config' key can't be set: " + _fetchPythonError()); - goto done; - } - if (PyDict_SetItemString(kwargs, "instances", instances) == -1) { - setError("error 'instances' key can't be set: " + _fetchPythonError()); - goto done; - } - - if (agent_config_str != NULL) { - agent_config = PyObject_CallMethod(klass, load_config, format, agent_config_str); - if (agent_config == NULL) { - setError("error parsing agent_config: " + _fetchPythonError()); - goto done; - } else if (!PyDict_Check(agent_config)) { - setError("error agent_config is not a dict"); - goto done; - } - - if (PyDict_SetItemString(kwargs, "agentConfig", agent_config) == -1) { - setError("error 'agentConfig' key can't be set: " + _fetchPythonError()); - goto done; - } - } - - // call `AgentCheck` constructor - py_check = PyObject_Call(klass, args, kwargs); - if (py_check == NULL) { - setError(_fetchPythonError()); - goto done; - } - - if (check_id_str != NULL && strlen(check_id_str) != 0) { - check_id = PyString_FromString(check_id_str); - if (check_id == NULL) { - std::ostringstream err; - err << "error could not set check_id: " << check_id_str; - setError(err.str()); - Py_XDECREF(py_check); - py_check = NULL; - goto done; - } - - if (PyObject_SetAttrString(py_check, "check_id", check_id) != 0) { - setError("error could not set 'check_id' attr: " + _fetchPythonError()); - Py_XDECREF(py_check); - py_check = NULL; - goto done; - } - } - -done: - // We purposefully avoid calling Py_XDECREF on instance because we lost ownership earlier by - // calling PyTuple_SetItem. More details are available in the comment above this PyTuple_SetItem - // call - Py_XDECREF(name); - Py_XDECREF(check_id); - Py_XDECREF(init_config); - Py_XDECREF(instances); - Py_XDECREF(agent_config); - Py_XDECREF(args); - Py_XDECREF(kwargs); - - if (py_check == NULL) { - return false; - } - - check = reinterpret_cast(py_check); - return true; -} - -char *Two::runCheck(RtLoaderPyObject *check) -{ - if (check == NULL) { - return NULL; - } - - PyObject *py_check = reinterpret_cast(check); - - // result will be eventually returned as a copy and the corresponding Python - // string decref'ed, caller will be responsible for memory deallocation. - char *ret = NULL; - char *ret_copy = NULL; - char run[] = "run"; - PyObject *result = NULL; - - result = PyObject_CallMethod(py_check, run, NULL); - if (result == NULL) { - setError("error invoking 'run' method: " + _fetchPythonError()); - goto done; - } - - // `ret` points to the Python string internal storage and will be eventually - // deallocated along with the corresponding Python object. - ret = PyString_AsString(result); - if (ret == NULL) { - setError("error converting 'run' result to string: " + _fetchPythonError()); - goto done; - } - - ret_copy = strdupe(ret); - -done: - Py_XDECREF(result); - return ret_copy; -} - -void Two::cancelCheck(RtLoaderPyObject *check) -{ - if (check == NULL) { - return; - } - - PyObject *py_check = reinterpret_cast(check); - - char cancel[] = "cancel"; - PyObject *result = NULL; - - result = PyObject_CallMethod(py_check, cancel, NULL); - // at least None should be returned - if (result == NULL) { - setError("error invoking 'cancel' method: " + _fetchPythonError()); - } - Py_XDECREF(result); -} - -char **Two::getCheckWarnings(RtLoaderPyObject *check) -{ - if (check == NULL) { - return NULL; - } - - PyObject *py_check = reinterpret_cast(check); - char **warnings = NULL; - - char func_name[] = "get_warnings"; - Py_ssize_t numWarnings; - - PyObject *warns_list = PyObject_CallMethod(py_check, func_name, NULL); - if (warns_list == NULL) { - setError("error invoking 'get_warnings' method: " + _fetchPythonError()); - goto done; - } - - numWarnings = PyList_Size(warns_list); - // docs are not clear but `PyList_Size` can actually fail and in case it would - // return -1, see https://github.com/python/cpython/blob/2.7/Objects/listobject.c#L170 - if (numWarnings == -1) { - setError("error computing 'len(warnings)': " + _fetchPythonError()); - goto done; - } - - warnings = (char **)_malloc(sizeof(*warnings) * (numWarnings + 1)); - if (!warnings) { - setError("could not allocate memory to store warnings"); - goto done; - } - warnings[numWarnings] = NULL; - - for (Py_ssize_t idx = 0; idx < numWarnings; idx++) { - PyObject *warn = PyList_GetItem(warns_list, idx); // borrowed ref - if (warn == NULL) { - setError("there was an error browsing 'warnings' list: " + _fetchPythonError()); - - for (int jdx = 0; jdx < idx; jdx++) { - _free(warnings[jdx]); - } - _free(warnings); - - warnings = NULL; - goto done; - } - warnings[idx] = as_string(warn); - } - -done: - Py_XDECREF(warns_list); - return warnings; -} - -char *Two::getCheckDiagnoses(RtLoaderPyObject *check) -{ - if (check == NULL) { - return NULL; - } - - PyObject *py_check = reinterpret_cast(check); - - // result will be eventually returned as a copy and the corresponding Python - // string decref'ed, caller will be responsible for memory deallocation. - char *ret = NULL; - char *ret_copy = NULL; - char func_name[] = "get_diagnoses"; - PyObject *result = NULL; - - result = PyObject_CallMethod(py_check, func_name, NULL); - if (result == NULL) { - ret = _createInternalErrorDiagnoses(_fetchPythonError().c_str()); - goto done; - } - - // `ret` points to the Python string internal storage and will be eventually - // deallocated along with the corresponding Python object. - ret = PyString_AsString(result); - if (ret == NULL) { - std::string errorMsg = std::string("error converting 'get_diagnoses' result to string: ") + _fetchPythonError(); - ret = _createInternalErrorDiagnoses(errorMsg.c_str()); - goto done; - } - - ret_copy = strdupe(ret); - -done: - Py_XDECREF(result); - return ret_copy; -} - -// return new reference -PyObject *Two::_importFrom(const char *module, const char *name) -{ - PyObject *obj_module = NULL; - PyObject *obj_symbol = NULL; - - obj_module = PyImport_ImportModule(module); - if (obj_module == NULL) { - setError(_fetchPythonError()); - goto error; - } - - obj_symbol = PyObject_GetAttrString(obj_module, name); - if (obj_symbol == NULL) { - setError(_fetchPythonError()); - goto error; - } - - Py_XDECREF(obj_module); - return obj_symbol; - -error: - Py_XDECREF(obj_module); - Py_XDECREF(obj_symbol); - return NULL; -} - -PyObject *Two::_findSubclassOf(PyObject *base, PyObject *module) -{ - // baseClass is not a Class type - if (base == NULL || !PyType_Check(base)) { - setError("base class is not of type 'Class'"); - return NULL; - } - - // module is not a Module object - if (module == NULL || !PyModule_Check(module)) { - setError("module is not of type 'Module'"); - return NULL; - } - - PyObject *dir = PyObject_Dir(module); - if (dir == NULL) { - PyErr_Clear(); - setError("there was an error calling dir() on module object"); - return NULL; - } - - PyObject *klass = NULL; - for (int i = 0; i < PyList_GET_SIZE(dir); i++) { - // Reset `klass` at every iteration so its state is always clean when we - // continue the loop or return early. Reset at first iteration is useless - // but it keeps the code readable. - Py_XDECREF(klass); - klass = NULL; - - // get the symbol in current list item - PyObject *symbol = PyList_GetItem(dir, i); - if (symbol == NULL) { - // This should never happen as it means we're out of bounds - PyErr_Clear(); - setError("there was an error browsing dir() output"); - goto done; - } - - // get symbol name - char *symbol_name = PyString_AsString(symbol); - if (symbol_name == NULL) { - // PyString_AsString returns NULL if `symbol` is not a string object - // and raises TypeError. Let's clear the error and keep going. - PyErr_Clear(); - continue; - } - - // get symbol instance. It's a new ref but in case of success we don't - // DecRef since we return it and the caller will be owner - klass = PyObject_GetAttrString(module, symbol_name); - if (klass == NULL) { - PyErr_Clear(); - continue; - } - - // not a class, ignore - if (!PyType_Check(klass)) { - continue; - } - - // this is an unrelated class, ignore - if (!PyType_IsSubtype((PyTypeObject *)klass, (PyTypeObject *)base)) { - continue; - } - - // check whether `klass` is actually `base` itself - int retval = PyObject_RichCompareBool(klass, base, Py_EQ); - if (retval == 1) { - // `klass` is indeed `base`, continue - continue; - } else if (retval == -1) { - // an error occurred calling __eq__, clear and continue - PyErr_Clear(); - continue; - } - - // does `klass` have subclasses? - char func_name[] = "__subclasses__"; - PyObject *children = PyObject_CallMethod(klass, func_name, NULL); - if (children == NULL) { - PyErr_Clear(); - continue; - } - - // how many? - int children_count = PyList_GET_SIZE(children); - Py_XDECREF(children); - - // Agent integrations are supposed to have no subclasses - if (children_count > 0) { - continue; - } - - // got it, return the check class - goto done; - } - - // we couldn't find any good subclass, set an error and reset - // `klass` state for one last time before moving to `done`. - setError("cannot find a subclass"); - Py_XDECREF(klass); - klass = NULL; - -done: - Py_XDECREF(dir); - return klass; -} - -std::string Two::_fetchPythonError() -{ - std::string ret_val = ""; - - if (PyErr_Occurred() == NULL) { - return ret_val; - } - - PyObject *ptype = NULL; - PyObject *pvalue = NULL; - PyObject *ptraceback = NULL; - PyObject *format_exception = NULL; - PyObject *traceback = NULL; - PyObject *fmt_exc = NULL; - - // Fetch error and make sure exception values are normalized, as per python C - // API docs. - // PyErr_Fetch returns void, no need to check its return value - PyErr_Fetch(&ptype, &pvalue, &ptraceback); - // PyErr_NormalizeException returns void, no need to check its return value - PyErr_NormalizeException(&ptype, &pvalue, &ptraceback); - - // There's a traceback, try to format it nicely - if (ptraceback != NULL) { - traceback = PyImport_ImportModule("traceback"); - if (traceback != NULL) { - char fname[] = "format_exception"; - format_exception = PyObject_GetAttrString(traceback, fname); - if (format_exception != NULL) { - fmt_exc = PyObject_CallFunctionObjArgs(format_exception, ptype, pvalue, ptraceback, NULL); - if (fmt_exc != NULL) { - Py_ssize_t len = PyList_Size(fmt_exc); - // docs are not clear but `PyList_Size` can actually fail and in case it would - // return -1, see https://github.com/python/cpython/blob/2.7/Objects/listobject.c#L170 - if (len == -1) { - // don't fetch the actual error or the caller might think it was the root cause, - // while it's not. Setting `ret_val` empty will make the function return "unknown error". - // PyErr_Clear() will be called before returning. - ret_val = ""; - goto done; - } - - // "format_exception" returns a list of strings (one per line) - for (int i = 0; i < len; i++) { - PyObject *s = PyList_GetItem(fmt_exc, i); // borrowed ref - if (s == NULL || !PyString_Check(s)) { - // unlikely to happen but same as above, do not propagate this error upstream - // to avoid confusing the caller. PyErr_Clear() will be called before returning. - ret_val = ""; - goto done; - } - // traceback.format_exception returns a list of strings, each ending in a *newline* - // and some containing internal newlines. No need to add any CRLF/newlines. - // PyString_AsString returns a char* to a temporary object, no need to strdup it because - // of the implicit conversion to std::string, which already makes a copy. - ret_val += PyString_AsString(s); - } - } - } - } else { - // If we reach this point, there was an error while formatting the - // exception - ret_val = "can't format exception"; - } - } - // we sometimes do not get a traceback but an error in pvalue - else if (pvalue != NULL) { - PyObject *pvalue_obj = PyObject_Str(pvalue); - if (pvalue_obj != NULL) { - // we know pvalue_obj is a string (we just casted it), no need to PyString_Check() - // PyString_AsString returns a char* to a temporary object, no need to strdup it because - // of the implicit conversion to std::string, which already makes a copy. - ret_val = PyString_AsString(pvalue_obj); - Py_XDECREF(pvalue_obj); - } - } else if (ptype != NULL) { - PyObject *ptype_obj = PyObject_Str(ptype); - if (ptype_obj != NULL) { - // we know ptype_obj is a string (we just casted it), no need to PyString_Check() - // PyString_AsString returns a char* to a temporary object, no need to strdup it because - // of the implicit conversion to std::string, which already makes a copy. - ret_val = PyString_AsString(ptype_obj); - Py_XDECREF(ptype_obj); - } - } - -done: - if (ret_val == "") { - ret_val = "unknown error"; - } - - // something might've gone wrong while fetching the error, ensure - // the error state is clean before returning - PyErr_Clear(); - - Py_XDECREF(traceback); - Py_XDECREF(format_exception); - Py_XDECREF(fmt_exc); - Py_XDECREF(ptype); - Py_XDECREF(pvalue); - Py_XDECREF(ptraceback); - return ret_val; -} - -bool Two::getAttrString(RtLoaderPyObject *obj, const char *attributeName, char *&value) const -{ - if (obj == NULL) { - return false; - } - - bool res = false; - PyObject *py_attr = NULL; - PyObject *py_obj = reinterpret_cast(obj); - - py_attr = PyObject_GetAttrString(py_obj, attributeName); - if (py_attr != NULL && PyString_Check(py_attr)) { - value = as_string(py_attr); - if (value == NULL) { - // as_string clears the error, so we can't fetch it here - setError("error converting attribute " + std::string(attributeName) + " to string"); - } else { - res = true; - } - } else if (py_attr != NULL && !PyString_Check(py_attr)) { - setError("error attribute " + std::string(attributeName) + " has a different type than string"); - PyErr_Clear(); - } else { - PyErr_Clear(); - } - - Py_XDECREF(py_attr); - return res; -} - -void Two::decref(RtLoaderPyObject *obj) -{ - Py_XDECREF(reinterpret_cast(obj)); -} - -void Two::incref(RtLoaderPyObject *obj) -{ - Py_XINCREF(reinterpret_cast(obj)); -} - -void Two::setModuleAttrString(char *module, char *attr, char *value) -{ - PyObject *py_module = PyImport_ImportModule(module); - if (!py_module) { - setError("error importing python '" + std::string(module) + "' module: " + _fetchPythonError()); - return; - } - - PyObject *py_value = PyStringFromCString(value); - if (PyObject_SetAttrString(py_module, attr, py_value) != 0) { - setError("error setting the '" + std::string(module) + "." + std::string(attr) - + "' attribute: " + _fetchPythonError()); - } - - Py_XDECREF(py_module); - Py_XDECREF(py_value); -} - -void Two::setSubmitMetricCb(cb_submit_metric_t cb) -{ - _set_submit_metric_cb(cb); -} - -void Two::setSubmitServiceCheckCb(cb_submit_service_check_t cb) -{ - _set_submit_service_check_cb(cb); -} - -void Two::setSubmitEventCb(cb_submit_event_t cb) -{ - _set_submit_event_cb(cb); -} - -void Two::setSubmitHistogramBucketCb(cb_submit_histogram_bucket_t cb) -{ - _set_submit_histogram_bucket_cb(cb); -} - -void Two::setSubmitEventPlatformEventCb(cb_submit_event_platform_event_t cb) -{ - _set_submit_event_platform_event_cb(cb); -} - -void Two::setGetVersionCb(cb_get_version_t cb) -{ - _set_get_version_cb(cb); -} - -void Two::setGetConfigCb(cb_get_config_t cb) -{ - _set_get_config_cb(cb); -} - -void Two::setHeadersCb(cb_headers_t cb) -{ - _set_headers_cb(cb); -} - -void Two::setGetHostnameCb(cb_get_hostname_t cb) -{ - _set_get_hostname_cb(cb); -} - -void Two::setGetHostTagsCb(cb_get_host_tags_t cb) -{ - _set_get_host_tags_cb(cb); -} - -void Two::setGetClusternameCb(cb_get_clustername_t cb) -{ - _set_get_clustername_cb(cb); -} - -void Two::setGetTracemallocEnabledCb(cb_tracemalloc_enabled_t cb) -{ - _set_tracemalloc_enabled_cb(cb); -} - -void Two::setLogCb(cb_log_t cb) -{ - _set_log_cb(cb); -} - -void Two::setSendLogCb(cb_send_log_t cb) -{ - _set_send_log_cb(cb); -} - -void Two::setSetCheckMetadataCb(cb_set_check_metadata_t cb) -{ - _set_set_check_metadata_cb(cb); -} - -void Two::setSetExternalTagsCb(cb_set_external_tags_t cb) -{ - _set_set_external_tags_cb(cb); -} - -void Two::setSubprocessOutputCb(cb_get_subprocess_output_t cb) -{ - _set_get_subprocess_output_cb(cb); -} - -void Two::setCGOFreeCb(cb_cgo_free_t cb) -{ - _set_cgo_free_cb(cb); -} - -void Two::setTagsCb(cb_tags_t cb) -{ - _set_tags_cb(cb); -} - -void Two::setGetConnectionInfoCb(cb_get_connection_info_t cb) -{ - _set_get_connection_info_cb(cb); -} - -void Two::setIsExcludedCb(cb_is_excluded_t cb) -{ - _set_is_excluded_cb(cb); -} - -void Two::setWritePersistentCacheCb(cb_write_persistent_cache_t cb) -{ - _set_write_persistent_cache_cb(cb); -} - -void Two::setReadPersistentCacheCb(cb_read_persistent_cache_t cb) -{ - _set_read_persistent_cache_cb(cb); -} - -void Two::setObfuscateSqlCb(cb_obfuscate_sql_t cb) -{ - _set_obfuscate_sql_cb(cb); -} - -void Two::setObfuscateSqlExecPlanCb(cb_obfuscate_sql_exec_plan_t cb) -{ - _set_obfuscate_sql_exec_plan_cb(cb); -} - -void Two::setGetProcessStartTimeCb(cb_get_process_start_time_t cb) -{ - _set_get_process_start_time_cb(cb); -} - -void Two::setObfuscateMongoDBStringCb(cb_obfuscate_mongodb_string_t cb) -{ - _set_obfuscate_mongodb_string_cb(cb); -} - -void Two::setEmitAgentTelemetryCb(cb_emit_agent_telemetry_t cb) -{ - _set_emit_agent_telemetry_cb(cb); -} - -// Python Helpers - -// get_integration_list return a list of every datadog's wheels installed. -char *Two::getIntegrationList() -{ - PyObject *pyPackages = NULL; - PyObject *pkgLister = NULL; - PyObject *args = NULL; - PyObject *packages = NULL; - char *wheels = NULL; - - rtloader_gilstate_t state = GILEnsure(); - - pyPackages = PyImport_ImportModule("datadog_checks.base.utils.agent.packages"); - if (pyPackages == NULL) { - setError("could not import datadog_checks.base.utils.agent.packages: " + _fetchPythonError()); - goto done; - } - - pkgLister = PyObject_GetAttrString(pyPackages, "get_datadog_wheels"); - if (pkgLister == NULL) { - setError("could not fetch get_datadog_wheels attr: " + _fetchPythonError()); - goto done; - } - - args = PyTuple_New(0); - if (args == NULL) { - setError("could not initialize args to empty tuple: " + _fetchPythonError()); - goto done; - } - - packages = PyObject_Call(pkgLister, args, NULL); - if (packages == NULL) { - setError("error fetching wheels list: " + _fetchPythonError()); - goto done; - } - - if (PyList_Check(packages) == 0) { - setError("'get_datadog_wheels' did not return a list"); - goto done; - } - - wheels = as_yaml(packages); - if (wheels == NULL) { - setError("'packages' could not be serialized to yaml: " + _fetchPythonError()); - goto done; - } - -done: - Py_XDECREF(pyPackages); - Py_XDECREF(pkgLister); - Py_XDECREF(args); - Py_XDECREF(packages); - GILRelease(state); - - return wheels; -} - -// getInterpreterMemoryUsage return a dict with the python interpreters memory -// usage snapshot. The returned dict must be freed by calling.... -char *Two::getInterpreterMemoryUsage() -{ - PyObject *pyMemory = NULL; - PyObject *memSummary = NULL; - PyObject *args = NULL; - PyObject *summary = NULL; - char *memUsage = NULL; - - rtloader_gilstate_t state = GILEnsure(); - - pyMemory = PyImport_ImportModule(_PY_MEM_MODULE); - if (pyMemory == NULL) { - setError("could not import " _PY_MEM_MODULE ": " + _fetchPythonError()); - goto done; - } - - memSummary = PyObject_GetAttrString(pyMemory, _PY_MEM_SUMMARY_FUNC); - if (memSummary == NULL) { - setError("could not fetch " _PY_MEM_SUMMARY_FUNC ": " + _fetchPythonError()); - goto done; - } - - // an empty tuple *must* be used when no arguments are used - args = PyTuple_New(0); - if (args == NULL) { - setError("could not initialize args to empty tuple: " + _fetchPythonError()); - goto done; - } - - summary = PyObject_Call(memSummary, args, NULL); - if (summary == NULL) { - setError("error fetching interpreter memory usage: " + _fetchPythonError()); - goto done; - } - - if (PyDict_Check(summary) == 0) { - setError("'" _PY_MEM_SUMMARY_FUNC "' did not return a dictionary"); - goto done; - } - - memUsage = as_yaml(summary); - if (memUsage == NULL) { - setError("'packages' could not be serialized to yaml: " + _fetchPythonError()); - goto done; - } - -done: - Py_XDECREF(summary); - Py_XDECREF(args); - Py_XDECREF(memSummary); - Py_XDECREF(pyMemory); - GILRelease(state); - - return memUsage; -} diff --git a/rtloader/two/two.h b/rtloader/two/two.h deleted file mode 100644 index 88137ad16e4f7..0000000000000 --- a/rtloader/two/two.h +++ /dev/null @@ -1,194 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed -// under the Apache License Version 2.0. -// This product includes software developed at Datadog -// (https://www.datadoghq.com/). -// Copyright 2019-present Datadog, Inc. -#ifndef DATADOG_AGENT_RTLOADER_TWO_H -#define DATADOG_AGENT_RTLOADER_TWO_H - -// Some preprocessor sanity for builds (2+3 common sources) -#ifndef DATADOG_AGENT_TWO -# error Build requires defining DATADOG_AGENT_TWO -#elif defined(DATADOG_AGENT_TWO) && defined(DATADOG_AGENT_THREE) -# error "DATADOG_AGENT_TWO and DATADOG_AGENT_THREE are mutually exclusive - define only one of the two." -#endif - -#include -#include -#include - -#include -#include - -class Two : public RtLoader -{ -public: - //! Constructor. - /*! - \param python_home A C-string with the path to the python home for the - python interpreter. - \param python_exe A C-string with the path to the python interpreter. - - Basic constructor, initializes the _error string to an empty string and - errorFlag to false and set the supplied PYTHONHOME. - */ - Two(const char *python_home, const char *python_exe, cb_memory_tracker_t memtrack_cb); - - //! Destructor. - /*! - Destroys the Two instance, including relevant python teardown calls. - - We do not call Py_Finalize() since we won't be calling it from the same - thread where we called Py_Initialize(), this is a product of the go runtime - switch threads constantly. It's not really an issue here as we destroy this - class instance just before exiting the agent. - Calling Py_Finalize from a different thread cause the "threading" - package to raise an exception: "Exception KeyError: KeyError(,) in (Py_None); - } - - // Python Helpers - char *getIntegrationList(); - char *getInterpreterMemoryUsage(); - - // aggregator API - void setSubmitMetricCb(cb_submit_metric_t); - void setSubmitServiceCheckCb(cb_submit_service_check_t); - void setSubmitEventCb(cb_submit_event_t); - void setSubmitHistogramBucketCb(cb_submit_histogram_bucket_t); - void setSubmitEventPlatformEventCb(cb_submit_event_platform_event_t); - - // datadog_agent API - void setGetVersionCb(cb_get_version_t); - void setGetConfigCb(cb_get_config_t); - void setHeadersCb(cb_headers_t); - void setGetHostnameCb(cb_get_hostname_t); - void setGetHostTagsCb(cb_get_host_tags_t); - void setGetClusternameCb(cb_get_clustername_t); - void setGetTracemallocEnabledCb(cb_tracemalloc_enabled_t); - void setLogCb(cb_log_t); - void setSendLogCb(cb_send_log_t); - void setSetCheckMetadataCb(cb_set_check_metadata_t); - void setSetExternalTagsCb(cb_set_external_tags_t); - void setWritePersistentCacheCb(cb_write_persistent_cache_t); - void setReadPersistentCacheCb(cb_read_persistent_cache_t); - void setObfuscateSqlCb(cb_obfuscate_sql_t); - void setObfuscateSqlExecPlanCb(cb_obfuscate_sql_exec_plan_t); - void setGetProcessStartTimeCb(cb_get_process_start_time_t); - void setObfuscateMongoDBStringCb(cb_obfuscate_mongodb_string_t); - void setEmitAgentTelemetryCb(cb_emit_agent_telemetry_t); - - // _util API - virtual void setSubprocessOutputCb(cb_get_subprocess_output_t); - - // CGO API - void setCGOFreeCb(cb_cgo_free_t); - - // tagger - void setTagsCb(cb_tags_t); - - // kubeutil - void setGetConnectionInfoCb(cb_get_connection_info_t); - - // containers - void setIsExcludedCb(cb_is_excluded_t); - -private: - //! initPythonHome member. - /*! - \brief This member function sets the Python home for the underlying python2.7 interpreter. - \param pythonHome A C-string to the target python home for the python runtime. - */ - void initPythonHome(const char *pythonHome = NULL); - - //! initPythonExe member. - /*! - \brief This member function sets the path to the underlying python2 interpreter. - \param python_exe A C-string to the target python executable. - */ - void initPythonExe(const char *python_exe = NULL); - - //! _importFrom member. - /*! - \brief This member function imports a Python object by name from the specified - module. - \param module A C-string representation of the Python module we wish to import from. - \param name A C-string representation of the target Python object we wish to import. - \return A PyObject * pointer to the imported Python object, or NULL in case of error. - - This function returns a new reference to the underlying PyObject. In case of error, - NULL is returned with clean interpreter error flag. - */ - PyObject *_importFrom(const char *module, const char *name); - - //! _findSubclassOf member. - /*! - \brief This member function attemts to find a subclass of the provided base class in - the specified Python module. - \param base A PyObject * pointer to the Python base class we wish to search for. - \param moduleName A PyObject * pointer to the module we wish to find a derived class - in. - \return A PyObject * pointer to the found subclass Python object, or NULL in case of error. - - This function returns a new reference to the underlying PyObject. In case of error, - NULL is returned with clean interpreter error flag. - */ - PyObject *_findSubclassOf(PyObject *base, PyObject *moduleName); - - //! _fetchPythonError member. - /*! - \brief This member function retrieves the error set on the python interpreter. - \return A string describing the python error/exception set on the underlying python - interpreter. - */ - std::string _fetchPythonError(); - - /*! PyPaths type prototype - \typedef PyPaths defines a vector of strings. - */ - typedef std::vector PyPaths; - - char *_pythonHome; /*!< string with the PYTHONHOME for the underlying interpreter */ - char *_pythonExe; /*!< string with the path to the executable of the underlying interpreter */ - PyObject *_baseClass; /*!< PyObject * pointer to the base Agent check class */ - PyPaths _pythonPaths; /*!< string vector containing paths in the PYTHONPATH */ - PyThreadState *_threadState; /*!< PyThreadState * pointer to the saved Python interpreter thread state */ -}; - -#endif diff --git a/tasks/ebpf.py b/tasks/ebpf.py index 9d85ece794e6d..dc84b410e43d0 100644 --- a/tasks/ebpf.py +++ b/tasks/ebpf.py @@ -800,8 +800,8 @@ def _try_delete_github_comment(msg: str): return summarized_complexity_changes = [] - max_complexity_rel_change = 0 - max_complexity_abs_change = 0 + max_complexity_rel_change = -9e9 + max_complexity_abs_change = -9e9 threshold_for_max_limit = 0.85 programs_now_below_limit, programs_now_above_limit = 0, 0 for program, entries in sorted(program_complexity.items(), key=lambda x: max(e[2] for e in x[1])): diff --git a/tasks/gitlab_helpers.py b/tasks/gitlab_helpers.py index 26aa05b84b157..bb82fc683fa6f 100644 --- a/tasks/gitlab_helpers.py +++ b/tasks/gitlab_helpers.py @@ -1,6 +1,4 @@ -""" -Helper for generating links to CI Visibility for Gitlab CI jobs -""" +"""Helper tasks related to the gitlab CI (website, API, configuration etc.).""" from __future__ import annotations @@ -33,11 +31,12 @@ @task def generate_ci_visibility_links(_ctx, output: str | None): + """Generates links to CI Visibility for the current job. + + Usage: + $ inv gitlab.generate-ci-visibility-links """ - Generate links to CI Visibility for the current job - usage deva gitlab.generate-ci-visibility-links - Generated file - """ + ci_job_id = os.environ.get("CI_JOB_ID") if not ci_job_id: print( @@ -105,9 +104,8 @@ def create_gitlab_annotations_report(ci_job_id: str, ci_job_name: str): def print_gitlab_object(get_object, ctx, ids, repo='DataDog/datadog-agent', jq: str | None = None, jq_colors=True): - """ - Print one or more Gitlab objects in JSON and potentially query them with jq - """ + """Prints one or more Gitlab objects in JSON and potentially query them with jq.""" + repo = get_gitlab_repo(repo) ids = [i for i in ids.split(",") if i] for id in ids: @@ -126,8 +124,12 @@ def print_gitlab_object(get_object, ctx, ids, repo='DataDog/datadog-agent', jq: @task def print_pipeline(ctx, ids, repo='DataDog/datadog-agent', jq: str | None = None, jq_colors=True): - """ - Print one or more Gitlab pipelines in JSON and potentially query them with jq + """Prints one or more Gitlab pipelines in JSON and potentially query them with jq. + + Usage: + $ inv gitlab.print-pipeline 1234 + $ inv gitlab.print-pipeline 1234 -j .source + $ inv gitlab.print-pipeline 1234 -j .duration,.ref,.status,.sha """ def get_pipeline(repo, id): @@ -138,8 +140,14 @@ def get_pipeline(repo, id): @task def print_job(ctx, ids, repo='DataDog/datadog-agent', jq: str | None = None, jq_colors=True): - """ - Print one or more Gitlab jobs in JSON and potentially query them with jq + """Prints one or more Gitlab jobs in JSON and potentially query them with jq. + + Usage: + $ inv gitlab.print-job 1234 + $ inv gitlab.print-job 1234 -j '.commit.id' + $ inv gitlab.print-job 1234 -j '.pipeline.id' + $ inv gitlab.print-job 1234 -j '.web_url.stage,.ref,.duration,.status' + $ inv gitlab.print-job 1234 -j '.artifacts | length' """ def get_job(repo, id): @@ -153,18 +161,20 @@ def get_job(repo, id): 'This task takes into account only explicit dependencies (job `needs` / `dependencies`), implicit dependencies (stages order) are ignored' ) def gen_config_subset(ctx, jobs, dry_run=False, force=False): - """ - Will generate a full .gitlab-ci.yml containing only the jobs necessary to run the target jobs `jobs`. + """Will generate a full .gitlab-ci.yml containing only the jobs necessary to run the target jobs `jobs`. + That is, the resulting pipeline will have `jobs` as last jobs to run. - Warning: This doesn't take implicit dependencies into account (stages order), only explicit dependencies (job `needs` / `dependencies`). + Warning: + This doesn't take implicit dependencies into account (stages order), only explicit dependencies (job `needs` / `dependencies`). - - dry_run: Print only the new configuration without writing it to the .gitlab-ci.yml file. - - force: Force the update of the .gitlab-ci.yml file even if it has been modified. + Args: + dry_run: Print only the new configuration without writing it to the .gitlab-ci.yml file. + force: Force the update of the .gitlab-ci.yml file even if it has been modified. Example: - $ inv gitlab.gen-config-subset tests_deb-arm64-py3 - $ inv gitlab.gen-config-subset tests_rpm-arm64-py3,tests_deb-arm64-py3 --dry-run + $ inv gitlab.gen-config-subset tests_deb-arm64-py3 + $ inv gitlab.gen-config-subset tests_rpm-arm64-py3,tests_deb-arm64-py3 --dry-run """ jobs_to_keep = ['cancel-prev-pipelines', 'github_rate_limit_info', 'setup_agent_version'] @@ -224,9 +234,8 @@ def add_dependencies(job): @task def print_job_trace(_, job_id, repo='DataDog/datadog-agent'): - """ - Print the trace (the log) of a Gitlab job - """ + """Prints the trace (the log) of a Gitlab job.""" + repo = get_gitlab_repo(repo) trace = str(repo.jobs.get(job_id, lazy=True).trace(), 'utf-8') @@ -245,17 +254,20 @@ def print_ci( git_ref: str | None = None, with_lint: bool = True, ): + """Prints the full gitlab ci configuration. + + Args: + job: If provided, print only one job + clean: Apply post processing to make output more readable (remove extends, flatten lists of lists...) + keep_special_objects: If True, do not filter out special objects (variables, stages etc.) + expand_matrix: Will expand matrix jobs into multiple jobs + with_lint: If False, do not lint the configuration + git_ref: If provided, use this git reference to fetch the configuration + + Notes: + This requires a full api token access level to the repository """ - Prints the full gitlab ci configuration. - - - job: If provided, print only one job - - clean: Apply post processing to make output more readable (remove extends, flatten lists of lists...) - - keep_special_objects: If True, do not filter out special objects (variables, stages etc.) - - expand_matrix: Will expand matrix jobs into multiple jobs - - with_lint: If False, do not lint the configuration - - git_ref: If provided, use this git reference to fetch the configuration - - NOTE: This requires a full api token access level to the repository - """ + yml = get_gitlab_ci_configuration( ctx, input_file, @@ -273,9 +285,8 @@ def print_ci( @task def print_entry_points(ctx): - """ - Print gitlab ci configuration entry points. - """ + """Prints gitlab ci configuration entry points.""" + print(color_message('info:', Color.BLUE), 'Fetching entry points...') entry_points = get_all_gitlab_ci_configurations(ctx, filter_configs=True, clean_configs=True) @@ -293,8 +304,12 @@ def compute_gitlab_ci_config( after_file: str = 'after.gitlab-ci.yml', diff_file: str = 'diff.gitlab-ci.yml', ): - """ - Will compute the Gitlab CI full configuration for the current commit and the base commit and will compute the diff between them. + """Will compute the Gitlab CI full configuration for the current commit and the base commit and will compute the diff between them. + + The resulting files can be loaded via yaml and the diff file can be used to instantiate a MultiGitlabCIDiff object. + + Side effects: + before_file, after_file and diff_file will be written with the corresponding configuration. """ before_config, after_config, diff = compute_gitlab_ci_config_diff(ctx, before, after) diff --git a/tasks/gotest.py b/tasks/gotest.py index cf0a5efd540b7..abdbdfb86a8d1 100644 --- a/tasks/gotest.py +++ b/tasks/gotest.py @@ -32,7 +32,7 @@ from tasks.libs.common.datadog_api import create_count, send_metrics from tasks.libs.common.git import get_modified_files from tasks.libs.common.junit_upload_core import enrich_junitxml, produce_junit_tar -from tasks.libs.common.utils import clean_nested_paths, get_build_flags, gitlab_section +from tasks.libs.common.utils import clean_nested_paths, get_build_flags, gitlab_section, running_in_ci from tasks.libs.releasing.json import _get_release_json_value from tasks.modules import DEFAULT_MODULES, GoModule, get_module_by_path from tasks.test_core import ModuleTestResult, process_input_args, process_module_results, test_core @@ -215,7 +215,10 @@ def process_test_result(test_results, junit_tar: str, flavor: AgentFlavor, test_ print(color_message("All tests passed", "green")) return True - if test_washer: + if test_washer or running_in_ci(): + if not test_washer: + print("Test washer is always enabled in the CI, enforcing it") + tw = TestWasher() should_succeed = tw.process_module_results(test_results) if should_succeed: diff --git a/tasks/kmt.py b/tasks/kmt.py index 65e5077111ca7..fb5ada35894a8 100644 --- a/tasks/kmt.py +++ b/tasks/kmt.py @@ -751,7 +751,7 @@ def prepare( domains = get_target_domains(ctx, stack, ssh_key, arch_obj, vms, alien_vms) assert len(domains) > 0, err_msg - _prepare(ctx, stack, component, arch, packages, verbose, ci, compile_only, domains=domains) + _prepare(ctx, stack, component, arch_obj, packages, verbose, ci, compile_only, domains=domains) def _prepare( @@ -1023,13 +1023,6 @@ def kmt_sysprobe_prepare( variables=variables, ) - if pkg.endswith("java"): - nw.build( - inputs=[os.path.join(pkg, "agent-usm.jar")], - outputs=[os.path.join(target_path, "agent-usm.jar")], - rule="copyfiles", - ) - # handle testutils and testdata separately since they are # shared across packages target_pkgs = build_target_packages([], build_tags) diff --git a/tasks/libs/ciproviders/ci_config.py b/tasks/libs/ciproviders/ci_config.py index 2963949e7b513..639891c38302a 100644 --- a/tasks/libs/ciproviders/ci_config.py +++ b/tasks/libs/ciproviders/ci_config.py @@ -1,3 +1,5 @@ +"""Classes related to the CI configuration files.""" + from pathlib import Path import yaml @@ -12,12 +14,12 @@ class CILintersConfig: def __init__( self, path: str | Path = CONFIG_CI_LINTERS, lint=False, all_jobs: set[str] = None, all_stages: set[str] = None ) -> None: - """ - Parses the ci linters configuration file and lints it. + """Parses the ci linters configuration file and lints it. - - lint: If True, will lint the file to verify that each job / stage is present in the configuration - - all_jobs: All the jobs in the configuration used to verify that the specified jobs are present within the full configuration - - all_stages: All the stages in the configuration used to verify that the specified stages are present within the full configuration + Args: + lint: If True, will lint the file to verify that each job / stage is present in the configuration + all_jobs: All the jobs in the configuration used to verify that the specified jobs are present within the full configuration + all_stages: All the stages in the configuration used to verify that the specified stages are present within the full configuration """ self.path = path @@ -35,7 +37,14 @@ def lint_assert_subset(self, errors: list[str], items: str, all_items: set[str], """ Asserts that multiple items belong to a super set. - - kind: "job" or "stage" + Args: + kind: "job" or "stage" + + Side effects: + errors will be appended with a message if the items are not a subset of all_items. + + Raises: + AssertionError: Invalid kind argument """ assert kind in ("job", "stage"), f"Invalid kind: {kind}" diff --git a/tasks/libs/ciproviders/gitlab_api.py b/tasks/libs/ciproviders/gitlab_api.py index afb1b9c249a6c..170e71496fc8e 100644 --- a/tasks/libs/ciproviders/gitlab_api.py +++ b/tasks/libs/ciproviders/gitlab_api.py @@ -1,3 +1,8 @@ +"""Gitlab API / CI related functions. + +Provides functions to interact with the API and also helpers to manipulate and resolve gitlab-ci configurations. +""" + from __future__ import annotations import json @@ -76,10 +81,12 @@ def get_gitlab_bot_token(): def get_gitlab_api(token=None) -> gitlab.Gitlab: + """Returns the gitlab api object with the api token. + + Args: + The token is the one of get_gitlab_token() by default. """ - Returns the gitlab api object with the api token. - The token is the one of get_gitlab_token() by default. - """ + token = token or get_gitlab_token() return gitlab.Gitlab(BASE_URL, private_token=token, retry_transient_errors=True) @@ -93,26 +100,23 @@ def get_gitlab_repo(repo='DataDog/datadog-agent', token=None) -> Project: def get_commit(project_name: str, git_sha: str) -> ProjectCommit: - """ - Retrieves the commit for a given git sha a given project. - """ + """Retrieves the commit for a given git sha a given project.""" + repo = get_gitlab_repo(project_name) return repo.commits.get(git_sha) def get_pipeline(project_name: str, pipeline_id: str) -> ProjectPipeline: - """ - Retrieves the pipeline for a given pipeline id in a given project. - """ + """Retrieves the pipeline for a given pipeline id in a given project.""" + repo = get_gitlab_repo(project_name) return repo.pipelines.get(pipeline_id) @retry_function('refresh pipeline #{0.id}') def refresh_pipeline(pipeline: ProjectPipeline): - """ - Refresh a pipeline, retries if there is an error - """ + """Refreshes a pipeline, retries if there is an error.""" + pipeline.refresh() @@ -128,9 +132,19 @@ def __init__( modified_diffs: dict[str, list[str]] | None = None, added_contents: dict[str, str] | None = None, ) -> None: + """Used to display job diffs between two gitlab ci configurations. + + Attributes: + before: The configuration before the change. + after: The configuration after the change. + added: The jobs that have been added. + removed: The jobs that have been removed. + modified: The jobs that have been modified. + renamed: The jobs that have been renamed. + modified_diffs: The diffs of each of the modified jobs. + added_contents: The contents of each of the added jobs. """ - Used to display job diffs between two gitlab ci configurations - """ + self.before = before or {} self.after = after or {} self.added = added or set() @@ -176,9 +190,8 @@ def from_contents(before: dict | None = None, after: dict | None = None) -> Gitl return diff def make_diff(self): - """ - Compute the diff between the two gitlab ci configurations - """ + """Computes the diff between the two gitlab ci configurations.""" + # Find added / removed jobs by names unmoved = self.before.keys() & self.after.keys() self.removed = self.before.keys() - unmoved @@ -231,9 +244,7 @@ def sort_jobs(self, jobs): def display( self, cli: bool = True, max_detailed_jobs=6, job_url=None, only_summary=False, no_footnote=False ) -> str: - """ - Display in cli or markdown - """ + """Returns the displayable diff in cli or markdown.""" def str_section(title, wrap=False) -> list[str]: if cli: @@ -382,13 +393,16 @@ def str_note() -> list[str]: return '\n'.join(res) def iter_jobs(self, added=False, modified=False, removed=False, only_leaves=True): - """ - Will iterate over all jobs in all files for the given states + """Will iterate over all jobs in all files for the given states. - - only_leaves: If True, will return only leaf jobs - - Returns a tuple of (job_name, contents, state) + Args: + only_leaves: If True, will return only leaf jobs - Note that the contents of the job is the contents after modification if modified or before removal if removed + Returns: + A tuple of (job_name, contents, state) + + Notes: + The contents of the job is the contents after modification if modified or before removal if removed """ if added: @@ -439,11 +453,13 @@ def __init__( after: dict[str, dict] | None = None, diffs: list[MultiGitlabCIDiff.MultiDiff] | None = None, ) -> None: - """ - Used to display job diffs between two full gitlab ci configurations (multiple entry points) + """Used to display job diffs between two full gitlab ci configurations (multiple entry points). - - before/after: Dict of [entry point] -> ([job name] -> job content) + Attributes: + before: The configuration before the change. Dict of [entry point] -> ([job name] -> job content) + after: The configuration after the change. Dict of [entry point] -> ([job name] -> job content) """ + self.before = before self.after = after self.diffs = diffs or [] @@ -482,9 +498,8 @@ def make_diff(self): ) def display(self, cli: bool = True, job_url: str = None, **kwargs) -> str: - """ - Display in cli or markdown - """ + """Returns the displayable diff in cli or markdown.""" + if not self: return '' @@ -536,13 +551,16 @@ def str_entry_end() -> list[str]: return '\n'.join(res) def iter_jobs(self, added=False, modified=False, removed=False, only_leaves=True): - """ - Will iterate over all jobs in all files for the given states + """Will iterate over all jobs in all files for the given states. - - only_leaves: If True, will return only leaf jobs - - Returns a tuple of (entry_point, job_name, contents, state) + Args: + only_leaves: If True, will return only leaf jobs. - Note that the contents is the contents after modification or before removal + Returns: + A tuple of (entry_point, job_name, contents, state). + + Notes: + The contents is the contents after modification or before removal. """ for diff in self.diffs: @@ -553,9 +571,7 @@ def iter_jobs(self, added=False, modified=False, removed=False, only_leaves=True class ReferenceTag(yaml.YAMLObject): - """ - Custom yaml tag to handle references in gitlab-ci configuration - """ + """Custom yaml tag to handle references (!reference [...]) in gitlab-ci configuration.""" yaml_tag = '!reference' @@ -588,9 +604,10 @@ def to_yaml(cls, dumper, data: ReferenceTag): def clean_gitlab_ci_configuration(yml): - """ - - Remove `extends` tags - - Flatten lists of lists + """Cleans the yaml configuration: + + - Removes `extends` tags. + - Flattens lists of lists. """ def flatten(yml): @@ -621,19 +638,17 @@ def flatten(yml): def is_leaf_job(job_name, job_contents): - """ - A 'leaf' job is a job that will be executed by gitlab-ci, that is a job that is not meant to be only extended (usually jobs starting with '.') or special gitlab objects (variables, stages...) - """ + """A 'leaf' job is a job that will be executed by gitlab-ci, that is a job that is not meant to be only extended (usually jobs starting with '.') or special gitlab objects (variables, stages...).""" return not job_name.startswith('.') and ('script' in job_contents or 'trigger' in job_contents) def filter_gitlab_ci_configuration(yml: dict, job: str | None = None, keep_special_objects: bool = False) -> dict: - """ - Filters gitlab-ci configuration jobs + """Filters gitlab-ci configuration jobs - - job: If provided, retrieve only this job - - keep_special_objects: Will keep special objects (not jobs) in the configuration (variables, stages, etc.) + Args: + job: If provided, retrieve only this job. + keep_special_objects: Will keep special objects (not jobs) in the configuration (variables, stages, etc.). """ def filter_yaml(key, value): @@ -655,15 +670,15 @@ def filter_yaml(key, value): def _get_combinated_variables(arg: dict[str, (str | list[str])]): - """ - Make combinations from the matrix arguments to obtain the list of variables that have each new job. + """Make combinations from the matrix arguments to obtain the list of variables that have each new job. combinations({'key1': ['val1', 'val2'], 'key2': 'val3'}) -> [ {'key1': 'val1', 'key2': 'val3'}, {'key1': 'val2', 'key2': 'val3'} ] - - Returns a tuple of (1) the list of variable values and (2) the list of variable dictionaries + Returns: + A tuple of (1) the list of variable values and (2) the list of variable dictionaries """ job_keys = [] @@ -685,9 +700,8 @@ def _get_combinated_variables(arg: dict[str, (str | list[str])]): def expand_matrix_jobs(yml: dict) -> dict: - """ - Will expand matrix jobs into multiple jobs - """ + """Will expand matrix jobs into multiple jobs.""" + new_jobs = {} to_remove = set() for job in yml: @@ -723,11 +737,12 @@ def expand_matrix_jobs(yml: dict) -> dict: def print_gitlab_ci_configuration(yml: dict, sort_jobs: bool): - """ - Prints a gitlab ci as yaml. + """Prints a gitlab ci as yaml. - - sort_jobs: Sort jobs by name (the job keys are always sorted) + Args: + sort_jobs: Sort jobs by name (the job keys are always sorted). """ + jobs = yml.items() if sort_jobs: jobs = sorted(jobs) @@ -767,14 +782,18 @@ def get_all_gitlab_ci_configurations( with_lint: bool = True, git_ref: str | None = None, ) -> dict[str, dict]: - """ - Returns all gitlab-ci configurations from each configuration file (.gitlab-ci.yml and files called with the `trigger` keyword) + """Returns all gitlab-ci configurations from each configuration file (.gitlab-ci.yml and files called with the `trigger` keyword). + + Args: + filter_configs: Whether to apply post process filtering to the configurations (get only jobs...). + clean_configs: Whether to apply post process cleaning to the configurations (remove extends, flatten lists of lists...). + ignore_errors: Ignore gitlab lint errors. + git_ref: If provided, use this git reference to fetch the configuration. - - filter_configs: Whether to apply post process filtering to the configurations (get only jobs...) - - clean_configs: Whether to apply post process cleaning to the configurations (remove extends, flatten lists of lists...) - - ignore_errors: Ignore gitlab lint errors - - git_ref: If provided, use this git reference to fetch the configuration + Returns: + A dictionary of [entry point] -> configuration """ + # configurations[input_file] -> parsed config configurations: dict[str, dict] = {} @@ -794,9 +813,8 @@ def get_all_gitlab_ci_configurations( def get_ci_configurations(input_file, configurations, ctx, with_lint, git_ref): - """ - DFS to get all distinct configurations from input files - """ + """Produces a DFS to get all distinct configurations from input files.""" + if input_file in configurations: return @@ -814,9 +832,8 @@ def get_ci_configurations(input_file, configurations, ctx, with_lint, git_ref): def get_trigger_filenames(node): - """ - Get all trigger downstream pipelines defined by the `trigger` key in the gitlab-ci configuration - """ + """Gets all trigger downstream pipelines defined by the `trigger` key in the gitlab-ci configuration.""" + if isinstance(node, str): return [node] elif isinstance(node, dict): @@ -837,12 +854,14 @@ def resolve_gitlab_ci_configuration( git_ref: str | None = None, input_config: dict | None = None, ) -> str | dict: - """ - Returns the full gitlab-ci configuration by resolving all includes and applying postprocessing (extends / !reference) - Uses the /lint endpoint from the gitlab api to apply postprocessing + """Returns the full gitlab-ci configuration by resolving all includes and applying postprocessing (extends / !reference). - - input_config: If not None, will use this config instead of parsing existing yaml file at `input_file` + Uses the /lint endpoint from the gitlab api to apply postprocessing. + + Args: + input_config: If not None, will use this config instead of parsing existing yaml file at `input_file`. """ + if not input_config: # Read includes concat_config = read_includes(ctx, input_file, return_config=True, git_ref=git_ref) @@ -876,11 +895,11 @@ def get_gitlab_ci_configuration( expand_matrix: bool = False, git_ref: str | None = None, ) -> dict: - """ - Creates, filters and processes the gitlab-ci configuration + """Creates, filters and processes the gitlab-ci configuration. - - keep_special_objects: Will keep special objects (not jobs) in the configuration (variables, stages, etc.) - - expand_matrix: Will expand matrix jobs into multiple jobs + Args: + keep_special_objects: Will keep special objects (not jobs) in the configuration (variables, stages, etc.). + expand_matrix: Will expand matrix jobs into multiple jobs. """ # Make full configuration @@ -903,16 +922,17 @@ def get_gitlab_ci_configuration( def generate_gitlab_full_configuration( ctx, input_file, context=None, compare_to=None, return_dump=True, apply_postprocessing=False, input_config=None ): + """Generates a full gitlab-ci configuration by resolving all includes. + + Args: + input_file: Initial gitlab yaml file (.gitlab-ci.yml). + context: Gitlab variables. + compare_to: Override compare_to on change rules. + return_dump: Whether to return the string dump or the dict object representing the configuration. + apply_postprocessing: Whether or not to solve `extends` and `!reference` tags. + input_config: If not None, will use this config instead of parsing existing yaml file at `input_file`. """ - Generate a full gitlab-ci configuration by resolving all includes - - - input_file: Initial gitlab yaml file (.gitlab-ci.yml) - - context: Gitlab variables - - compare_to: Override compare_to on change rules - - return_dump: Whether to return the string dump or the dict object representing the configuration - - apply_postprocessing: Whether or not to solve `extends` and `!reference` tags - - input_config: If not None, will use this config instead of parsing existing yaml file at `input_file` - """ + if apply_postprocessing: full_configuration = resolve_gitlab_ci_configuration(ctx, input_file, input_config=input_config) elif input_config: @@ -946,10 +966,12 @@ def generate_gitlab_full_configuration( def read_includes(ctx, yaml_files, includes=None, return_config=False, add_file_path=False, git_ref: str | None = None): + """Recursive method to read all includes from yaml files and store them in a list. + + Args: + add_file_path: add the file path to each object of the parsed file. """ - Recursive method to read all includes from yaml files and store them in a list - - add_file_path: add the file path to each object of the parsed file - """ + if includes is None: includes = [] @@ -981,9 +1003,7 @@ def read_includes(ctx, yaml_files, includes=None, return_config=False, add_file_ def read_content(ctx, file_path, git_ref: str | None = None): - """ - Read the content of a file, either from a local file or from an http endpoint - """ + """Reads the content of a file, either from a local file or from an http endpoint.""" # Do not use ctx for cache @lru_cache(maxsize=512) @@ -1092,9 +1112,8 @@ def generate_contexts(contexts, context, all_contexts): def load_context(context): - """ - Load a context either from a yaml file or from a json string - """ + """Loads a context either from a yaml file or from a json string.""" + if os.path.exists(context): with open(context) as f: y = yaml.safe_load(f) @@ -1182,9 +1201,13 @@ def gitlab_configuration_is_modified(ctx): def compute_gitlab_ci_config_diff(ctx, before: str, after: str): - """ - Computes the full configs and the diff between two git references. + """Computes the full configs and the diff between two git references. + The "after reference" is compared to the Lowest Common Ancestor (LCA) commit of "before reference" and "after reference". + + Args: + before: The git reference to compare to (default: default branch). + after: The git reference to compare (default: local files). """ before_name = before or "merge base" @@ -1206,9 +1229,12 @@ def compute_gitlab_ci_config_diff(ctx, before: str, after: str): def full_config_get_all_leaf_jobs(full_config: dict) -> set[str]: + """Filters all leaf jobs from a full gitlab-ci configuration. + + Returns: + A set containing all leaf jobs. A leaf job is a job that will be executed by gitlab-ci, that is a job that is not meant to be only extended (usually jobs starting with '.') or special gitlab objects (variables, stages...). """ - Get all leaf jobs from a full gitlab-ci configuration - """ + all_jobs = set() for config in full_config.values(): all_jobs.update({job for job in config if is_leaf_job(job, config[job])}) @@ -1217,9 +1243,8 @@ def full_config_get_all_leaf_jobs(full_config: dict) -> set[str]: def full_config_get_all_stages(full_config: dict) -> set[str]: - """ - Get all stages from a full gitlab-ci configuration - """ + """Retrieves all stages from a full gitlab-ci configuration.""" + all_stages = set() for config in full_config.values(): all_stages.update(config.get("stages", [])) diff --git a/tasks/libs/common/git.py b/tasks/libs/common/git.py index 431492d3ed3c0..61bac36427b21 100644 --- a/tasks/libs/common/git.py +++ b/tasks/libs/common/git.py @@ -72,7 +72,7 @@ def get_file_modifications( flags = '--no-renames' if no_renames else '' modifications = [ - line.split() + line.split('\t') for line in ctx.run(f"git diff --name-status {flags} {last_main_commit}", hide=True).stdout.splitlines() ] diff --git a/tasks/libs/common/junit_upload_core.py b/tasks/libs/common/junit_upload_core.py index fdbd052760974..5d2508e055bc6 100644 --- a/tasks/libs/common/junit_upload_core.py +++ b/tasks/libs/common/junit_upload_core.py @@ -23,6 +23,7 @@ GITHUB_JIRA_MAP, GITHUB_SLACK_MAP, ) +from tasks.libs.testing.flakes import get_tests_family, is_known_flaky_test from tasks.modules import DEFAULT_MODULES E2E_INTERNAL_ERROR_STRING = "E2E INTERNAL ERROR" @@ -210,7 +211,11 @@ def split_junitxml(root_dir: Path, xml_path: Path, codeowners, flaky_tests): # Flag the test as known flaky if gotestsum already knew it for test_case in suite.iter("testcase"): test_name = "/".join([test_case.attrib["classname"], test_case.attrib["name"]]) - test_case.attrib["agent_is_known_flaky"] = "true" if test_name in flaky_tests else "false" + if is_known_flaky_test(test_name, flaky_tests, get_tests_family(list(flaky_tests))): + test_case.attrib["agent_is_known_flaky"] = "true" + print("KNOWN FLAKY:", test_name) + else: + test_case.attrib["agent_is_known_flaky"] = "false" xml.getroot().append(suite) diff --git a/tasks/libs/common/omnibus.py b/tasks/libs/common/omnibus.py index d91b2649d27ab..6809892feac7e 100644 --- a/tasks/libs/common/omnibus.py +++ b/tasks/libs/common/omnibus.py @@ -121,7 +121,7 @@ def env_filter(item): "HOSTNAME", "HOST_IP", "INFOPATH", - "INSTALL_SCRIPT_API_KEY", + "INSTALL_SCRIPT_API_KEY_ORG2", "INTEGRATION_WHEELS_CACHE_BUCKET", "IRBRC", "KITCHEN_INFRASTRUCTURE_FLAKES_RETRY", @@ -141,7 +141,6 @@ def env_filter(item): "PROCESS_S3_BUCKET", "PWD", "PROMPT", - "PYTHON_RUNTIMES", "RESTORE_CACHE_ATTEMPTS", "RUSTC_SHA256", "SIGN", @@ -234,9 +233,7 @@ def should_retry_bundle_install(res): def send_build_metrics(ctx, overall_duration): # We only want to generate those metrics from the CI src_dir = os.environ.get('CI_PROJECT_DIR') - aws_cmd = "aws" if sys.platform == 'win32': - aws_cmd = "aws.cmd" if src_dir is None: src_dir = os.environ.get("REPO_ROOT", os.getcwd()) @@ -317,10 +314,16 @@ def send_build_metrics(ctx, overall_duration): 'type': 0, } ) - dd_api_key = ctx.run( - f'{aws_cmd} ssm get-parameter --region us-east-1 --name {os.environ["API_KEY_ORG2"]} --with-decryption --query "Parameter.Value" --out text', - hide=True, - ).stdout.strip() + if sys.platform == 'win32': + dd_api_key = ctx.run( + f'aws.cmd ssm get-parameter --region us-east-1 --name {os.environ["API_KEY_ORG2"]} --with-decryption --query "Parameter.Value" --out text', + hide=True, + ).stdout.strip() + else: + dd_api_key = ctx.run( + f'vault kv get -field=token kv/k8s/gitlab-runner/datadog-agent/{os.environ["AGENT_API_KEY_ORG2"]}', + hide=True, + ).stdout.strip() headers = {'Accept': 'application/json', 'Content-Type': 'application/json', 'DD-API-KEY': dd_api_key} r = requests.post("https://api.datadoghq.com/api/v2/series", json={'series': series}, headers=headers) if r.ok: @@ -332,13 +335,15 @@ def send_build_metrics(ctx, overall_duration): def send_cache_miss_event(ctx, pipeline_id, job_name, job_id): if sys.platform == 'win32': - aws_cmd = "aws.cmd" + dd_api_key = ctx.run( + f'aws.cmd ssm get-parameter --region us-east-1 --name {os.environ["API_KEY_ORG2"]} --with-decryption --query "Parameter.Value" --out text', + hide=True, + ).stdout.strip() else: - aws_cmd = "aws" - dd_api_key = ctx.run( - f'{aws_cmd} ssm get-parameter --region us-east-1 --name {os.environ["API_KEY_ORG2"]} --with-decryption --query "Parameter.Value" --out text', - hide=True, - ).stdout.strip() + dd_api_key = ctx.run( + f'vault kv get -field=token kv/k8s/gitlab-runner/datadog-agent/{os.environ["AGENT_API_KEY_ORG2"]}', + hide=True, + ).stdout.strip() headers = {'Accept': 'application/json', 'Content-Type': 'application/json', 'DD-API-KEY': dd_api_key} payload = { 'title': 'omnibus cache miss', diff --git a/tasks/libs/common/utils.py b/tasks/libs/common/utils.py index 9b8138176a624..5fef10fd29cfc 100644 --- a/tasks/libs/common/utils.py +++ b/tasks/libs/common/utils.py @@ -337,6 +337,11 @@ def get_build_flags( if os.getenv('DD_CXX'): env['CXX'] = os.getenv('DD_CXX') + if sys.platform == 'linux': + # Enable lazy binding, which seems to be overridden when loading containerd + # Required to fix go-nvml compilation (see https://github.com/NVIDIA/go-nvml/issues/18) + extldflags += "-Wl,-z,lazy " + if extldflags: ldflags += f"'-extldflags={extldflags}' " @@ -527,7 +532,8 @@ def gitlab_section(section_name, collapsed=False, echo=False): """ - echo: If True, will echo the gitlab section in bold in CLI mode instead of not showing anything """ - section_id = section_name.replace(" ", "_").replace("/", "_") + # Replace with "_" every special character (" ", ":", "/", "\") which prevent the section generation + section_id = re.sub(r"[ :/\\]", "_", section_name) in_ci = running_in_gitlab_ci() try: if in_ci: @@ -669,7 +675,6 @@ def file_match(word): 'internal', 'omnibus', 'pkg', - 'pkg-config', 'rtloader', 'tasks', 'test', diff --git a/tasks/libs/pipeline/github_jira_map.yaml b/tasks/libs/pipeline/github_jira_map.yaml index 0564ae0206376..e49a8fc64f6c9 100644 --- a/tasks/libs/pipeline/github_jira_map.yaml +++ b/tasks/libs/pipeline/github_jira_map.yaml @@ -40,3 +40,4 @@ '@datadog/agent-devx-infra': ACIX '@datadog/apm-onboarding': APMON '@datadog/agent-processing-and-routing': APR +'@DataDog/container-ecosystems': CECO diff --git a/tasks/libs/pipeline/github_slack_map.yaml b/tasks/libs/pipeline/github_slack_map.yaml index 9897fa9c53ccc..6d1e115d9798a 100644 --- a/tasks/libs/pipeline/github_slack_map.yaml +++ b/tasks/libs/pipeline/github_slack_map.yaml @@ -43,3 +43,4 @@ '@datadog/agent-devx-loops': '#agent-devx-ops' '@datadog/apm-onboarding': '#apm-onboarding' '@datadog/apm-reliability-and-performance': '#apm-ecosystems-reliability-and-performance' +'@DataDog/container-ecosystems': '#container-ecosystems-ops' diff --git a/tasks/libs/testing/flakes.py b/tasks/libs/testing/flakes.py new file mode 100644 index 0000000000000..1630e509677d2 --- /dev/null +++ b/tasks/libs/testing/flakes.py @@ -0,0 +1,58 @@ +def get_tests_family_if_failing_tests(test_name_list, failing_tests: set): + """Get the parent tests of a list of tests only if the marked test is failing + + For example with the test ["TestEKSSuite/TestCPU/TestCPUUtilization", "TestKindSuite/TestCPU"] + this method should return the set{"TestEKSSuite/TestCPU/TestCPUUtilization", "TestEKSSuite/TestCPU", "TestEKSSuite", "TestKindSuite/TestCPU", "TestKindSuite"} + if TestKindSuite/TestCPU and TestEKSSuite/TestCPU/TestCPUUtilization are failing + Another example, with the test ["TestEKSSuite/TestCPU/TestCPUUtilization", "TestKindSuite/TestCPU"] + if only TestKindSuite/TestCPU is failing, the method should return the set{"TestKindSuite/TestCPU", "TestKindSuite"} + + Args: + test_name_list (list): List of test names to get the parent tests from + failing_tests (set): Set of tests that are failing + """ + test_name_set = set(test_name_list) + marked_tests_failing = failing_tests.intersection(test_name_set) + return get_tests_family(list(marked_tests_failing)) + + +def get_tests_family(test_name_list): + """Get the parent tests of a list of tests + + Get the parent tests of a list of tests + For example with the test ["TestEKSSuite/TestCPU/TestCPUUtilization", "TestKindSuite/TestCPU"] + this method should return the set{"TestEKSSuite/TestCPU/TestCPUUtilization", "TestEKSSuite/TestCPU", "TestEKSSuite", "TestKindSuite/TestCPU", "TestKindSuite"} + + Args: + test_name_list (list): List of test names to get the parent tests from + + """ + test_family = set(test_name_list) + for test_name in test_name_list: + while test_name.count('/') > 0: + test_name = test_name.rsplit('/', 1)[0] + test_family.add(test_name) + return test_family + + +def is_known_flaky_test(failing_test, known_flaky_tests, known_flaky_tests_parents): + """Check if a test is known to be flaky + + If a test is a parent of a test that is known to be flaky, the test should be considered flaky + For example: + - if TestEKSSuite/TestCPU is known to be flaky, TestEKSSuite/TestCPU/TestCPUUtilization should be considered flaky + - if TestEKSSuite/TestCPU is known to be flaky, TestEKSSuite should be considered flaky unless TestEKSSuite/TestCPU is not failing + - if TestEKSSuite/TestCPU is known to be flaky, TestEKSSuite/TestMemory should not be considered flaky + + Args: + failing_test (str): The test that is failing + known_flaky_tests (set): Set of tests that are known to be flaky + known_flaky_tests_parents (set): Set of tests that are parent of a test that is known to be flaky + """ + + failing_test_parents = get_tests_family([failing_test]) + + if any(parent in known_flaky_tests for parent in failing_test_parents): + return True + + return failing_test in known_flaky_tests_parents diff --git a/tasks/linter.py b/tasks/linter.py index f6ffcd7279d1a..082c3065cc666 100644 --- a/tasks/linter.py +++ b/tasks/linter.py @@ -44,8 +44,8 @@ @task def python(ctx): - """ - Lints Python files. + """Lints Python files. + See 'setup.cfg' and 'pyproject.toml' file for configuration. If running locally, you probably want to use the pre-commit instead. """ @@ -70,11 +70,12 @@ def python(ctx): @task def copyrights(ctx, fix=False, dry_run=False, debug=False, only_staged_files=False): + """Checks that all Go files contain the appropriate copyright header. + + If '--fix' is provided as an option, it will try to fix problems as it finds them. + If '--dry_run' is provided when fixing, no changes to the files will be applied. """ - Checks that all Go files contain the appropriate copyright header. If '--fix' - is provided as an option, it will try to fix problems as it finds them. If - '--dry_run' is provided when fixing, no changes to the files will be applied. - """ + files = None if only_staged_files: @@ -90,9 +91,8 @@ def copyrights(ctx, fix=False, dry_run=False, debug=False, only_staged_files=Fal @task def filenames(ctx): - """ - Scan files to ensure there are no filenames too long or containing illegal characters - """ + """Scans files to ensure there are no filenames too long or containing illegal characters.""" + files = ctx.run("git ls-files -z", hide=True).stdout.split("\0") failure = False @@ -149,8 +149,7 @@ def go( run_on=None, # noqa: U100, F841. Used by the run_on_devcontainer decorator debug=False, ): - """ - Run go linters on the given module and targets. + """Runs go linters on the given module and targets. A module should be provided as the path to one of the go modules in the repository. @@ -159,14 +158,16 @@ def go( If no module or target is set the tests are run against all modules and targets. - --timeout is the number of minutes after which the linter should time out. - --headless-mode allows you to output the result in a single json file. - --debug prints the go version and the golangci-lint debug information to help debugging lint discrepancies between versions. + Args: + timeout: Number of minutes after which the linter should time out. + headless_mode: Allows you to output the result in a single json file. + debug: prints the go version and the golangci-lint debug information to help debugging lint discrepancies between versions. Example invokation: - inv linter.go --targets=./pkg/collector/check,./pkg/aggregator - inv linter.go --module=. + $ inv linter.go --targets=./pkg/collector/check,./pkg/aggregator + $ inv linter.go --module=. """ + check_tools_version(ctx, ['golangci-lint', 'go'], debug=debug) modules, flavor = process_input_args( @@ -266,9 +267,7 @@ def lint_flavor( headless_mode: bool = False, verbose: bool = False, ): - """ - Runs linters for given flavor, build tags, and modules. - """ + """Runs linters for given flavor, build tags, and modules.""" execution_times = [] @@ -333,9 +332,8 @@ def list_parameters(_, type): @task def ssm_parameters(ctx, mode="all", folders=None): - """ - Lint SSM parameters in the datadog-agent repository. - """ + """Lints SSM parameters in the datadog-agent repository.""" + modes = ["env", "wrapper", "all"] if mode not in modes: raise Exit(f"Invalid mode: {mode}. Must be one of {modes}") @@ -418,11 +416,14 @@ def list_get_parameter_calls(file): @task def gitlab_ci(ctx, test="all", custom_context=None): - """ - Lint Gitlab CI files in the datadog-agent repository. + """Lints Gitlab CI files in the datadog-agent repository. This will lint the main gitlab ci file with different variable contexts and lint other triggered gitlab ci configs. + + Args: + test: The context preset to test the gitlab ci file with containing environment variables. + custom_context: A custom context to test the gitlab ci file with. """ print(f'{color_message("info", Color.BLUE)}: Fetching Gitlab CI configurations...') configs = get_all_gitlab_ci_configurations(ctx, with_lint=False) @@ -446,11 +447,11 @@ def gitlab_ci(ctx, test="all", custom_context=None): def get_gitlab_ci_lintable_jobs(diff_file, config_file, only_names=False): - """ - Utility to get the jobs from full gitlab ci configuration file or from a diff file. + """Retrieves the jobs from full gitlab ci configuration file or from a diff file. - - diff_file: Path to the diff file used to build MultiGitlabCIDiff obtained by compute-gitlab-ci-config - - config_file: Path to the full gitlab ci configuration file obtained by compute-gitlab-ci-config + Args: + diff_file: Path to the diff file used to build MultiGitlabCIDiff obtained by compute-gitlab-ci-config. + config_file: Path to the full gitlab ci configuration file obtained by compute-gitlab-ci-config. """ assert ( @@ -486,12 +487,17 @@ def get_gitlab_ci_lintable_jobs(diff_file, config_file, only_names=False): @task def gitlab_ci_jobs_needs_rules(_, diff_file=None, config_file=None): - """ - Verifies that each added / modified job contains `needs` and also `rules`. + """Verifies that each added / modified job contains `needs` and also `rules`. + It is possible to declare a job not following these rules within `.gitlab/.ci-linters.yml`. All configurations are checked (even downstream ones). - SEE: https://datadoghq.atlassian.net/wiki/spaces/ADX/pages/4059234597/Gitlab+CI+configuration+guidelines#datadog-agent + Args: + diff_file: Path to the diff file used to build MultiGitlabCIDiff obtained by compute-gitlab-ci-config + config_file: Path to the full gitlab ci configuration file obtained by compute-gitlab-ci-config + + See: + https://datadoghq.atlassian.net/wiki/spaces/ADX/pages/4059234597/Gitlab+CI+configuration+guidelines#datadog-agent """ jobs, full_config = get_gitlab_ci_lintable_jobs(diff_file, config_file) @@ -542,9 +548,8 @@ def gitlab_ci_jobs_needs_rules(_, diff_file=None, config_file=None): @task def releasenote(ctx): - """ - Lint release notes with Reno - """ + """Lints release notes with Reno.""" + branch = os.environ.get("BRANCH_NAME") pr_id = os.environ.get("PR_ID") @@ -573,9 +578,7 @@ def update_go(_): @task(iterable=['job_files']) def job_change_path(ctx, job_files=None): - """ - Verify that the jobs defined within job_files contain a change path rule. - """ + """Verifies that the jobs defined within job_files contain a change path rule.""" tests_without_change_path_allow_list = { 'generate-flakes-finder-pipeline', @@ -657,12 +660,14 @@ def job_change_path(ctx, job_files=None): 'new-e2e-cws', 'new-e2e-language-detection', 'new-e2e-npm-docker', + 'new-e2e-eks-cleanup', 'new-e2e-npm-packages', 'new-e2e-orchestrator', 'new-e2e-package-signing-amazonlinux-a6-x86_64', 'new-e2e-package-signing-debian-a7-x86_64', 'new-e2e-package-signing-suse-a7-x86_64', 'new-e2e_windows_powershell_module_test', + 'new-e2e-eks-cleanup-on-failure', 'trigger-flakes-finder', } @@ -677,9 +682,8 @@ def job_change_path(ctx, job_files=None): tests = [(test, data['_file_path']) for test, data in test_config.items() if test[0] != '.'] def contains_valid_change_rule(rule): - """ - Verifies that the job rule contains the required change path configuration. - """ + """Verifies that the job rule contains the required change path configuration.""" + if 'changes' not in rule or 'paths' not in rule['changes']: return False @@ -730,6 +734,8 @@ def contains_valid_change_rule(rule): @task def gitlab_change_paths(ctx): + """Verifies that rules: changes: paths match existing files in the repository.""" + # Read gitlab config config = generate_gitlab_full_configuration(ctx, ".gitlab-ci.yml", {}, return_dump=False, apply_postprocessing=True) error_paths = [] @@ -744,26 +750,7 @@ def gitlab_change_paths(ctx): print(f"All rule:changes:paths from gitlab-ci are {color_message('valid', Color.GREEN)}.") -@task -def gitlab_ci_jobs_owners(_, diff_file=None, config_file=None, path_jobowners='.gitlab/JOBOWNERS'): - """ - Verifies that each job is defined within JOBOWNERS files. - """ - - jobs, full_config = get_gitlab_ci_lintable_jobs(diff_file, config_file, only_names=True) - - # No change, info already printed in get_gitlab_ci_lintable_jobs - if not full_config: - return - - ci_linters_config = CILintersConfig( - lint=True, - all_jobs=full_config_get_all_leaf_jobs(full_config), - all_stages=full_config_get_all_stages(full_config), - ) - - jobowners = read_owners(path_jobowners, remove_default_pattern=True) - +def _gitlab_ci_jobs_owners_lint(jobs, jobowners, ci_linters_config, path_jobowners): error_jobs = [] n_ignored = 0 for job in jobs: @@ -788,6 +775,33 @@ def gitlab_ci_jobs_owners(_, diff_file=None, config_file=None, path_jobowners='. print(f'{color_message("Success", Color.GREEN)}: All jobs have owners defined in {path_jobowners}') +@task +def gitlab_ci_jobs_owners(_, diff_file=None, config_file=None, path_jobowners='.gitlab/JOBOWNERS'): + """Verifies that each job is defined within JOBOWNERS files. + + Args: + diff_file: Path to the diff file used to build MultiGitlabCIDiff obtained by compute-gitlab-ci-config + config_file: Path to the full gitlab ci configuration file obtained by compute-gitlab-ci-config + path_jobowners: Path to the JOBOWNERS file + """ + + jobs, full_config = get_gitlab_ci_lintable_jobs(diff_file, config_file, only_names=True) + + # No change, info already printed in get_gitlab_ci_lintable_jobs + if not full_config: + return + + ci_linters_config = CILintersConfig( + lint=True, + all_jobs=full_config_get_all_leaf_jobs(full_config), + all_stages=full_config_get_all_stages(full_config), + ) + + jobowners = read_owners(path_jobowners, remove_default_pattern=True) + + _gitlab_ci_jobs_owners_lint(jobs, jobowners, ci_linters_config, path_jobowners) + + def _gitlab_ci_jobs_codeowners_lint(path_codeowners, modified_yml_files, gitlab_owners): error_files = [] for path in modified_yml_files: @@ -807,7 +821,12 @@ def _gitlab_ci_jobs_codeowners_lint(path_codeowners, modified_yml_files, gitlab_ @task def gitlab_ci_jobs_codeowners(ctx, path_codeowners='.github/CODEOWNERS', all_files=False): - """Verifies that added / modified job files are defined within CODEOWNERS.""" + """Verifies that added / modified job files are defined within CODEOWNERS. + + Args: + all_files: If True, lint all job files. If False, lint only added / modified job. + """ + from codeowners import CodeOwners if all_files: diff --git a/tasks/new_e2e_tests.py b/tasks/new_e2e_tests.py index 0fe180d8d4e2b..40abe8121b4be 100644 --- a/tasks/new_e2e_tests.py +++ b/tasks/new_e2e_tests.py @@ -5,8 +5,10 @@ from __future__ import annotations import json +import multiprocessing import os import os.path +import re import shutil import tempfile from pathlib import Path @@ -22,6 +24,7 @@ from tasks.libs.common.go import download_go_dependencies from tasks.libs.common.utils import REPO_PATH, color_message, running_in_ci from tasks.modules import DEFAULT_MODULES +from tools.e2e_stacks import destroy_remote_stack @task( @@ -194,6 +197,62 @@ def clean(ctx, locks=True, stacks=False, output=False, skip_destroy=False): _clean_output() +@task +def cleanup_remote_stacks(ctx, stack_regex, pulumi_backend): + """ + Clean up remote stacks created by the pipeline + """ + if not running_in_ci(): + raise Exit("This task should be run in CI only", 1) + + stack_regex = re.compile(stack_regex) + + # Ideally we'd use the pulumi CLI to list all the stacks. However we have way too much stacks in the bucket so the commands hang forever. + # Once the bucket is cleaned up we can switch to the pulumi CLI + res = ctx.run( + "pulumi stack ls --all --json", + hide=True, + warn=True, + ) + if res.exited != 0: + print(f"Failed to list stacks in {pulumi_backend}:", res.stdout, res.stderr) + return + to_delete_stacks = set() + stacks = json.loads(res.stdout) + print(stacks) + for stack in stacks: + stack_id = ( + stack.get("name", "") + .split("/")[-1] + .replace(".json.bak", "") + .replace(".json", "") + .replace(".pulumi/stacks/e2eci", "") + ) + if stack_regex.match(stack_id): + to_delete_stacks.add(f"organization/e2eci/{stack_id}") + + if len(to_delete_stacks) == 0: + print("No stacks to delete") + return + + print("About to delete the following stacks:", to_delete_stacks) + with multiprocessing.Pool(len(to_delete_stacks)) as pool: + res = pool.map(destroy_remote_stack, to_delete_stacks) + destroyed_stack = set() + failed_stack = set() + for r, stack in res: + if r.returncode != 0: + failed_stack.add(stack) + else: + destroyed_stack.add(stack) + print(f"Stack {stack}: {r.stdout} {r.stderr}") + + for stack in destroyed_stack: + print(f"Stack {stack} destroyed successfully") + for stack in failed_stack: + print(f"Failed to destroy stack {stack}") + + @task def deps(ctx, verbose=False): """ diff --git a/tasks/pipeline.py b/tasks/pipeline.py index 1bfad63fb27ae..9a0ff2b3821d3 100644 --- a/tasks/pipeline.py +++ b/tasks/pipeline.py @@ -889,11 +889,11 @@ def trigger_external(ctx, owner_branch_name: str, no_verify=False): owner_branch_name = owner_branch_name.lower() assert ( - owner_branch_name.count('/') == 1 + owner_branch_name.count('/') >= 1 ), f'owner_branch_name should be "/" but is {owner_branch_name}' assert "'" not in owner_branch_name - owner, branch = owner_branch_name.split('/') + owner, branch = owner_branch_name.split('/', 1) no_verify_flag = ' --no-verify' if no_verify else '' # Can checkout diff --git a/tasks/release.py b/tasks/release.py index 52dbc4fde4be9..57ed76ba1671f 100644 --- a/tasks/release.py +++ b/tasks/release.py @@ -1043,7 +1043,7 @@ def create_qa_cards(ctx, tag): """ from tasks.libs.releasing.qa import get_labels, setup_ddqa - version = _create_version_from_match(RC_VERSION_RE.match(tag)) + version = _create_version_from_match(VERSION_RE.match(tag)) if not version.rc: print(f"{tag} is not a release candidate, skipping") return diff --git a/tasks/security_agent.py b/tasks/security_agent.py index 8e2d86f37dc41..2dc906d6d318f 100644 --- a/tasks/security_agent.py +++ b/tasks/security_agent.py @@ -159,7 +159,7 @@ def build_dev_image(ctx, image=None, push=False, base_image="datadog/agent:lates ctx.run(f"touch {docker_context}/agent") core_agent_dest = "/dev/null" - copy_ebpf_and_related_files(ctx, docker_context, copy_usm_jar=False) + copy_ebpf_and_related_files(ctx, docker_context) with ctx.cd(docker_context): # --pull in the build will force docker to grab the latest base image @@ -369,6 +369,7 @@ def build_functional_tests( debug=False, skip_object_files=False, syscall_tester_compiler='clang', + ebpf_compiler='clang', ): if not is_windows: if not skip_object_files: @@ -379,6 +380,7 @@ def build_functional_tests( kernel_release=kernel_release, debug=debug, bundle_ebpf=bundle_ebpf, + ebpf_compiler=ebpf_compiler, ) build_embed_syscall_tester(ctx, compiler=syscall_tester_compiler) @@ -608,8 +610,6 @@ def docker_functional_tests( cmd += '-v ./pkg/security/tests:/tests {image_tag} sleep 3600' args = { - "GOPATH": get_gopath(ctx), - "REPO_PATH": REPO_PATH, "container_name": container_name, "caps": ' '.join(f"--cap-add {cap}" for cap in capabilities), "image_tag": image_tag, diff --git a/tasks/system_probe.py b/tasks/system_probe.py index 173094a511775..88cadc19603b8 100644 --- a/tasks/system_probe.py +++ b/tasks/system_probe.py @@ -68,7 +68,6 @@ } CWS_PREBUILT_MINIMUM_KERNEL_VERSION = (5, 8, 0) EMBEDDED_SHARE_DIR = os.path.join("/opt", "datadog-agent", "embedded", "share", "system-probe", "ebpf") -EMBEDDED_SHARE_JAVA_DIR = os.path.join("/opt", "datadog-agent", "embedded", "share", "system-probe", "java") is_windows = sys.platform == "win32" is_macos = sys.platform == "darwin" @@ -112,7 +111,12 @@ def ninja_define_windows_resources(ctx, nw: NinjaWriter, major_version): def ninja_define_ebpf_compiler( - nw: NinjaWriter, strip_object_files=False, kernel_release=None, with_unit_test=False, arch: Arch | None = None + nw: NinjaWriter, + strip_object_files=False, + kernel_release=None, + with_unit_test=False, + arch: Arch | None = None, + compiler: str = 'clang', ): if arch is not None and arch.is_cross_compiling(): # -target ARCH is important even if we're just emitting LLVM. If we're cross-compiling, clang @@ -125,7 +129,7 @@ def ninja_define_ebpf_compiler( nw.variable("kheaders", get_kernel_headers_flags(kernel_release, arch=arch)) nw.rule( name="ebpfclang", - command="clang -MD -MF $out.d $target $ebpfflags $kheaders $flags -c $in -o $out", + command=f"{compiler} -MD -MF $out.d $target $ebpfflags $kheaders $flags -c $in -o $out", depfile="$out.d", ) strip = "&& llvm-strip -g $out" if strip_object_files else "" @@ -135,12 +139,12 @@ def ninja_define_ebpf_compiler( ) -def ninja_define_co_re_compiler(nw: NinjaWriter, arch: Arch | None = None): +def ninja_define_co_re_compiler(nw: NinjaWriter, arch: Arch | None = None, compiler: str = "clang"): nw.variable("ebpfcoreflags", get_co_re_build_flags(arch)) nw.rule( name="ebpfcoreclang", - command="clang -MD -MF $out.d -target bpf $ebpfcoreflags $flags -c $in -o $out", + command=f"{compiler} -MD -MF $out.d -target bpf $ebpfcoreflags $flags -c $in -o $out", depfile="$out.d", ) @@ -555,6 +559,7 @@ def ninja_generate( strip_object_files=False, kernel_release: str | None = None, with_unit_test=False, + ebpf_compiler='clang', ): arch = Arch.from_str(arch) build_dir = get_ebpf_build_dir(arch) @@ -585,8 +590,10 @@ def ninja_generate( nw.build(inputs=[rcin], outputs=["cmd/system-probe/rsrc.syso"], rule="windres") else: gobin = get_gobin(ctx) - ninja_define_ebpf_compiler(nw, strip_object_files, kernel_release, with_unit_test, arch=arch) - ninja_define_co_re_compiler(nw, arch=arch) + ninja_define_ebpf_compiler( + nw, strip_object_files, kernel_release, with_unit_test, arch=arch, compiler=ebpf_compiler + ) + ninja_define_co_re_compiler(nw, arch=arch, compiler=ebpf_compiler) ninja_network_ebpf_programs(nw, build_dir, co_re_build_dir) ninja_test_ebpf_programs(nw, build_dir) ninja_security_ebpf_programs(nw, build_dir, debug, kernel_release, arch=arch) @@ -614,6 +621,7 @@ def build( strip_binary=False, with_unit_test=False, bundle=True, + ebpf_compiler='clang', ): """ Build the system-probe @@ -627,6 +635,7 @@ def build( strip_object_files=strip_object_files, with_unit_test=with_unit_test, bundle_ebpf=bundle_ebpf, + ebpf_compiler=ebpf_compiler, ) build_sysprobe_binary( @@ -959,9 +968,6 @@ def kitchen_prepare(ctx, kernel_release=None, ci=False, packages=""): if os.path.isdir(extra_path): shutil.copytree(extra_path, os.path.join(target_path, extra)) - if pkg.endswith("java"): - shutil.copy(os.path.join(pkg, "agent-usm.jar"), os.path.join(target_path, "agent-usm.jar")) - for gobin in [ "external_unix_proxy_server", "fmapper", @@ -1259,10 +1265,21 @@ def run_ninja( debug=False, strip_object_files=False, with_unit_test=False, + ebpf_compiler='clang', ) -> None: check_for_ninja(ctx) nf_path = os.path.join(ctx.cwd, 'system-probe.ninja') - ninja_generate(ctx, nf_path, major_version, arch, debug, strip_object_files, kernel_release, with_unit_test) + ninja_generate( + ctx, + nf_path, + major_version, + arch, + debug, + strip_object_files, + kernel_release, + with_unit_test, + ebpf_compiler=ebpf_compiler, + ) explain_opt = "-d explain" if explain else "" if task: ctx.run(f"ninja {explain_opt} -f {nf_path} -t {task}") @@ -1379,6 +1396,7 @@ def build_object_files( strip_object_files=False, with_unit_test=False, bundle_ebpf=False, + ebpf_compiler='clang', ) -> None: arch_obj = Arch.from_str(arch) build_dir = get_ebpf_build_dir(arch_obj) @@ -1406,6 +1424,7 @@ def build_object_files( strip_object_files=strip_object_files, with_unit_test=with_unit_test, arch=arch, + ebpf_compiler=ebpf_compiler, ) if bundle_ebpf: @@ -1417,10 +1436,6 @@ def build_object_files( sudo = "" if is_root() else "sudo" ctx.run(f"{sudo} mkdir -p {EMBEDDED_SHARE_DIR}") - java_dir = os.path.join("pkg", "network", "protocols", "tls", "java") - ctx.run(f"{sudo} mkdir -p {EMBEDDED_SHARE_JAVA_DIR}") - ctx.run(f"{sudo} install -m644 -oroot -groot {java_dir}/agent-usm.jar {EMBEDDED_SHARE_JAVA_DIR}/agent-usm.jar") - if ctx.run("command -v rsync >/dev/null 2>&1", warn=True, hide=True).ok: rsync_filter = "--filter='+ */' --filter='+ *.o' --filter='+ *.c' --filter='- *'" ctx.run( @@ -1476,6 +1491,7 @@ def build_cws_object_files( strip_object_files=False, with_unit_test=False, bundle_ebpf=False, + ebpf_compiler='clang', ): run_ninja( ctx, @@ -1492,8 +1508,12 @@ def build_cws_object_files( @task -def object_files(ctx, kernel_release=None, with_unit_test=False, arch: str = CURRENT_ARCH): - build_object_files(ctx, kernel_release=kernel_release, with_unit_test=with_unit_test, arch=arch) +def object_files( + ctx, kernel_release=None, with_unit_test=False, arch: str = CURRENT_ARCH, ebpf_compiler: str = 'clang' +): + build_object_files( + ctx, kernel_release=kernel_release, with_unit_test=with_unit_test, arch=arch, ebpf_compiler=ebpf_compiler + ) def clean_object_files(ctx, major_version='7', kernel_release=None, debug=False, strip_object_files=False): @@ -1874,8 +1894,6 @@ def _test_docker_image_list(): for component in docker_compose["services"]: images.add(docker_compose["services"][component]["image"]) - # Special use-case in javatls - images.remove("${IMAGE_VERSION}") # Temporary: GoTLS monitoring inside containers tests are flaky in the CI, so at the meantime, the tests are # disabled, so we can skip downloading a redundant image. images.remove("public.ecr.aws/b1o7r7e0/usm-team/go-httpbin:https") @@ -1973,7 +1991,7 @@ def save_build_outputs(ctx, destfile): ctx.run(f"sha256sum {outfile} >> {absdest}.sum") -def copy_ebpf_and_related_files(ctx: Context, target: Path | str, arch: Arch | None = None, copy_usm_jar: bool = True): +def copy_ebpf_and_related_files(ctx: Context, target: Path | str, arch: Arch | None = None): if arch is None: arch = Arch.local() @@ -1986,6 +2004,3 @@ def copy_ebpf_and_related_files(ctx: Context, target: Path | str, arch: Arch | N ctx.run(f"chmod 0444 {target}/*.o {target}/*.c {target}/co-re/*.o") ctx.run(f"cp /opt/datadog-agent/embedded/bin/clang-bpf {target}") ctx.run(f"cp /opt/datadog-agent/embedded/bin/llc-bpf {target}") - - if copy_usm_jar: - ctx.run(f"cp pkg/network/protocols/tls/java/agent-usm.jar {target}") diff --git a/tasks/testwasher.py b/tasks/testwasher.py index b3ceb6d6c8e09..ac3623b468a09 100644 --- a/tasks/testwasher.py +++ b/tasks/testwasher.py @@ -2,15 +2,17 @@ import copy import json +import os from collections import defaultdict import yaml -from invoke import task +from invoke import Exit, task from tasks.libs.ciproviders.gitlab_api import ( resolve_gitlab_ci_configuration, ) from tasks.libs.common.utils import gitlab_section +from tasks.libs.testing.flakes import get_tests_family_if_failing_tests, is_known_flaky_test from tasks.test_core import ModuleTestResult FLAKY_TEST_INDICATOR = "flakytest: this is a known flaky test" @@ -40,11 +42,11 @@ def get_non_flaky_failing_tests(self, failing_tests: dict, flaky_marked_tests: d for package, tests in failing_tests.items(): non_flaky_failing_tests_in_package = set() - known_flaky_tests_parents = self.get_tests_family_if_failing_tests( + known_flaky_tests_parents = get_tests_family_if_failing_tests( all_known_flakes[package], failing_tests[package] ) for failing_test in tests: - if not self.is_known_flaky_test(failing_test, all_known_flakes[package], known_flaky_tests_parents): + if not is_known_flaky_test(failing_test, all_known_flakes[package], known_flaky_tests_parents): non_flaky_failing_tests_in_package.add(failing_test) if non_flaky_failing_tests_in_package: non_flaky_failing_tests[package] = non_flaky_failing_tests_in_package @@ -125,62 +127,23 @@ def process_module_results(self, module_results: list[ModuleTestResult]): return should_succeed - def is_known_flaky_test(self, failing_test, known_flaky_tests, known_flaky_tests_parents): - """ - Check if a test is known to be flaky - The method should be called with the following arguments: - - failing_test: the test that is failing - - known_flaky_tests: the set of tests that are known to be flaky - - known_flaky_tests_parents: the set of tests that are ancestors of a known flaky test, thus would fail when the flaky leaf test fails - If a test is a parent of a test that is known to be flaky, the test should be considered flaky - For example: - - if TestEKSSuite/TestCPU is known to be flaky, TestEKSSuite/TestCPU/TestCPUUtilization should be considered flaky - - if TestEKSSuite/TestCPU is known to be flaky, TestEKSSuite should be considered flaky unless TestEKSSuite/TestCPU is not failing - - if TestEKSSuite/TestCPU is known to be flaky, TestEKSSuite/TestMemory should not be considered flaky - """ - - failing_test_parents = self.get_tests_family([failing_test]) - - if any(parent in known_flaky_tests for parent in failing_test_parents): - return True - - return failing_test in known_flaky_tests_parents - - def get_tests_family_if_failing_tests(self, test_name_list, failing_tests: set): - """ - Get the parent tests of a list of tests only if the marked test is failing - For example with the test ["TestEKSSuite/TestCPU/TestCPUUtilization", "TestKindSuite/TestCPU"] - this method should return the set{"TestEKSSuite/TestCPU/TestCPUUtilization", "TestEKSSuite/TestCPU", "TestEKSSuite", "TestKindSuite/TestCPU", "TestKindSuite"} - if TestKindSuite/TestCPU and TestEKSSuite/TestCPU/TestCPUUtilization are failing - Another example, with the test ["TestEKSSuite/TestCPU/TestCPUUtilization", "TestKindSuite/TestCPU"] - if only TestKindSuite/TestCPU is failing, the method should return the set{"TestKindSuite/TestCPU", "TestKindSuite"} - """ - test_name_set = set(test_name_list) - marked_tests_failing = failing_tests.intersection(test_name_set) - return self.get_tests_family(list(marked_tests_failing)) - - def get_tests_family(self, test_name_list): - """ - Get the parent tests of a list of tests - For example with the test ["TestEKSSuite/TestCPU/TestCPUUtilization", "TestKindSuite/TestCPU"] - this method should return the set{"TestEKSSuite/TestCPU/TestCPUUtilization", "TestEKSSuite/TestCPU", "TestEKSSuite", "TestKindSuite/TestCPU", "TestKindSuite"} - """ - test_family = set(test_name_list) - for test_name in test_name_list: - while test_name.count('/') > 0: - test_name = test_name.rsplit('/', 1)[0] - test_family.add(test_name) - return test_family - @task -def generate_flake_finder_pipeline(ctx, n=3): +def generate_flake_finder_pipeline(ctx, n=3, generate_config=False): """ Generate a child pipeline where jobs marked with SHOULD_RUN_IN_FLAKES_FINDER are run n times """ - - # Read gitlab config - config = resolve_gitlab_ci_configuration(ctx, ".gitlab-ci.yml") + if generate_config: + # Read gitlab config + config = resolve_gitlab_ci_configuration(ctx, ".gitlab-ci.yml") + else: + # Read gitlab config, which is computed and stored in compute_gitlab_ci_config job + if not os.path.exists("artifacts/after.gitlab-ci.yml"): + raise Exit( + "The configuration is not stored as artifact. Please ensure you ran the compute_gitlab_ci_config job, or set generate_config to True" + ) + with open("artifacts/after.gitlab-ci.yml") as f: + config = yaml.safe_load(f)[".gitlab-ci.yml"] # Lets keep only variables and jobs with flake finder variable kept_job = {} @@ -226,6 +189,8 @@ def generate_flake_finder_pipeline(ctx, n=3): and new_job['variables']['E2E_COMMIT_SHA'] == "$CI_COMMIT_SHA" ): new_job['variables']['E2E_COMMIT_SHA'] = "$PARENT_COMMIT_SHA" + if 'E2E_PRE_INITIALIZED' in new_job['variables']: + del new_job['variables']['E2E_PRE_INITIALIZED'] new_job["rules"] = [{"when": "always"}] new_job["needs"] = ["go_e2e_deps"] new_jobs[f"{job}-{i}"] = new_job diff --git a/tasks/tools/e2e_stacks.py b/tasks/tools/e2e_stacks.py new file mode 100644 index 0000000000000..b360b7826878d --- /dev/null +++ b/tasks/tools/e2e_stacks.py @@ -0,0 +1,8 @@ +import subprocess + + +# This function cannot be defined in a file that imports invoke.tasks. Otherwise it fails when called with multiprocessing. +def destroy_remote_stack(stack: str): + return subprocess.run( + ["pulumi", "destroy", "--remove", "--yes", "--stack", stack], capture_output=True, text=True + ), stack diff --git a/tasks/unit_tests/flakes_tests.py b/tasks/unit_tests/flakes_tests.py new file mode 100644 index 0000000000000..39ff6c787be0c --- /dev/null +++ b/tasks/unit_tests/flakes_tests.py @@ -0,0 +1,96 @@ +import unittest + +from tasks.libs.testing.flakes import get_tests_family, get_tests_family_if_failing_tests, is_known_flaky_test + + +class TestGetTestParents(unittest.TestCase): + def test_get_tests_parents(self): + parents = get_tests_family(["TestEKSSuite/TestCPU/TestCPUUtilization", "TestKindSuite/TestKind"]) + self.assertEqual( + parents, + { + "TestEKSSuite", + "TestEKSSuite/TestCPU", + "TestEKSSuite/TestCPU/TestCPUUtilization", + "TestKindSuite", + "TestKindSuite/TestKind", + }, + ) + + def test_get_test_parents_empty(self): + parents = get_tests_family([]) + self.assertEqual( + parents, + set(), + ) + + def test_get_test_parents_failing_no_failing_tests(self): + parents = get_tests_family_if_failing_tests(["TestEKSSuite/TestCPU/TestCPUUtilization"], set()) + self.assertEqual( + parents, + set(), + ) + + def test_get_test_parents_failing_all_failing_tests(self): + parents = get_tests_family_if_failing_tests( + ["TestEKSSuite/TestCPU/TestCPUUtilization", "TestKindSuite/TestCPU"], + {"TestKindSuite/TestCPU", "TestEKSSuite/TestCPU/TestCPUUtilization"}, + ) + self.assertEqual( + parents, + { + "TestEKSSuite", + "TestEKSSuite/TestCPU", + "TestEKSSuite/TestCPU/TestCPUUtilization", + "TestKindSuite", + "TestKindSuite/TestCPU", + }, + ) + + def test_get_test_parents_failing_some_failing_tests(self): + parents = get_tests_family_if_failing_tests( + ["TestEKSSuite/TestCPU/TestCPUUtilization", "TestKindSuite/TestCPU"], {"TestKindSuite/TestCPU"} + ) + self.assertEqual( + parents, + { + "TestKindSuite", + "TestKindSuite/TestCPU", + }, + ) + + +class TestIsKnownFlake(unittest.TestCase): + def test_known_flake(self): + is_known_flaky = is_known_flaky_test( + "TestEKSSuite/mario", {"TestEKSSuite/mario"}, {"TestEKSSuite", "TestEKSSuite/mario"} + ) + self.assertTrue(is_known_flaky) + + def test_known_flake_parent_failing(self): + is_known_flaky = is_known_flaky_test( + "TestEKSSuite", {"TestEKSSuite/mario"}, {"TestEKSSuite", "TestEKSSuite/mario"} + ) + self.assertTrue(is_known_flaky) + + def test_known_flake_parent_failing_2(self): + is_known_flaky = is_known_flaky_test( + "TestEKSSuite/mario", + {"TestEKSSuite/mario/luigi"}, + {"TestEKSSuite", "TestEKSSuite/mario", "TestEKSSuite/mario/luigi"}, + ) + self.assertTrue(is_known_flaky) + + def test_not_known_flake(self): + is_known_flaky = is_known_flaky_test( + "TestEKSSuite/luigi", {"TestEKSSuite/mario"}, {"TestEKSSuite", "TestEKSSuite/mario"} + ) + self.assertFalse(is_known_flaky) + + def test_not_known_flake_ambiguous_start(self): + is_known_flaky = is_known_flaky_test("TestEKSSuiteVM/mario", {"TestEKSSuite/mario"}, {"TestEKSSuite"}) + self.assertFalse(is_known_flaky) + + def test_not_known_flake_ambiguous_start_2(self): + is_known_flaky = is_known_flaky_test("TestEKSSuite/mario", {"TestEKSSuiteVM/mario"}, {"TestEKSSuiteVM"}) + self.assertFalse(is_known_flaky) diff --git a/tasks/unit_tests/linter_tests.py b/tasks/unit_tests/linter_tests.py index 21102ad7b9472..7178e9010f891 100644 --- a/tasks/unit_tests/linter_tests.py +++ b/tasks/unit_tests/linter_tests.py @@ -51,7 +51,7 @@ def test_with_wrapper_no_env(self): def test_with_wrapper_with_env(self): with open(self.test_file, "w") as f: f.write( - "DD_APP_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $APP_KEY_ORG2) || exit $?; export DD_APP_KEY" + "DD_APP_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $AGENT_APP_KEY_ORG2 token) || exit $?; export DD_APP_KEY" ) matched = linter.list_get_parameter_calls(self.test_file) self.assertListEqual([], matched) @@ -126,6 +126,73 @@ def test_error(self): linter.gitlab_ci_jobs_needs_rules(MockContext()) +class TestGitlabCIJobsOwners(unittest.TestCase): + def empty_ci_linters_config(self) -> MagicMock: + mock = MagicMock() + mock.job_owners_jobs = set() + mock.path = './config.yml' + + return mock + + def test_one_job(self): + jobowners = """ + /somejob @DataDog/the-best-team + """ + + linter._gitlab_ci_jobs_owners_lint( + ['somejob'], CodeOwners(jobowners), self.empty_ci_linters_config(), 'jobowners' + ) + + def test_one_job_glob(self): + jobowners = """ + /my* @DataDog/the-best-team + """ + + linter._gitlab_ci_jobs_owners_lint( + ['myjob'], CodeOwners(jobowners), self.empty_ci_linters_config(), 'jobowners' + ) + + def test_one_job_fail(self): + jobowners = """ + /somejob @DataDog/the-best-team + """ + + with self.assertRaises(Exit): + linter._gitlab_ci_jobs_owners_lint( + ['someotherjob'], CodeOwners(jobowners), self.empty_ci_linters_config(), 'jobowners' + ) + + def test_multiple_jobs(self): + jobowners = """ + /somejob @DataDog/the-best-team + /my* @DataDog/another-best-team + """ + + linter._gitlab_ci_jobs_owners_lint( + ['somejob', 'myjob'], CodeOwners(jobowners), self.empty_ci_linters_config(), 'jobowners' + ) + + def test_multiple_jobs_fail(self): + jobowners = """ + /somejob @DataDog/the-best-team + """ + + with self.assertRaises(Exit): + linter._gitlab_ci_jobs_owners_lint( + ['somejob', 'someotherjob'], CodeOwners(jobowners), self.empty_ci_linters_config(), 'jobowners' + ) + + def test_multiple_jobs_ignore(self): + jobowners = """ + /somejob @DataDog/the-best-team + """ + + config = self.empty_ci_linters_config() + config.job_owners_jobs.add('someotherjob') + + linter._gitlab_ci_jobs_owners_lint(['somejob', 'someotherjob'], CodeOwners(jobowners), config, 'jobowners') + + class TestGitlabCIJobsCodeowners(unittest.TestCase): def test_no_file(self): codeowners = """ diff --git a/tasks/unit_tests/omnibus_tests.py b/tasks/unit_tests/omnibus_tests.py index 1aeaf35e411f7..dba84635d9503 100644 --- a/tasks/unit_tests/omnibus_tests.py +++ b/tasks/unit_tests/omnibus_tests.py @@ -42,6 +42,7 @@ def _run_calls_to_string(mock_calls): 'RELEASE_VERSION_7': 'nightly', 'S3_OMNIBUS_CACHE_BUCKET': 'omnibus-cache', 'API_KEY_ORG2': 'api-key', + 'AGENT_API_KEY_ORG2': 'agent-api-key', }, clear=True, ) @@ -60,6 +61,7 @@ def _set_up_default_command_mocks(self): (r'go mod .*', Result()), (r'grep .*', Result()), (r'aws ssm .*', Result()), + (r'vault kv get .*', Result()), ] for pattern, result in patterns: self.mock_ctx.set_result_for('run', re.compile(pattern), result) diff --git a/tasks/unit_tests/testdata/erroneous_circleci_config.yml b/tasks/unit_tests/testdata/erroneous_circleci_config.yml index c9023266058b1..c3530a876c372 100644 --- a/tasks/unit_tests/testdata/erroneous_circleci_config.yml +++ b/tasks/unit_tests/testdata/erroneous_circleci_config.yml @@ -107,7 +107,7 @@ jobs: - run: name: run unit tests no_output_timeout: 20m - command: inv -e test --rerun-fails=2 --python-runtimes 3 --coverage --race --profile --cpus 8 --build-stdlib + command: inv -e test --rerun-fails=2 --coverage --race --profile --cpus 8 --build-stdlib integration_tests: <<: *job_template diff --git a/tasks/unit_tests/testdata/fake_circleci_config.yml b/tasks/unit_tests/testdata/fake_circleci_config.yml index dbe3b45982418..22e93f769d59f 100644 --- a/tasks/unit_tests/testdata/fake_circleci_config.yml +++ b/tasks/unit_tests/testdata/fake_circleci_config.yml @@ -107,7 +107,7 @@ jobs: - run: name: run unit tests no_output_timeout: 20m - command: inv -e test --rerun-fails=2 --python-runtimes 3 --coverage --race --profile --cpus 8 + command: inv -e test --rerun-fails=2 --coverage --race --profile --cpus 8 integration_tests: <<: *job_template diff --git a/tasks/unit_tests/testwasher_tests.py b/tasks/unit_tests/testwasher_tests.py index 1d644e6d02880..8b25537454e02 100644 --- a/tasks/unit_tests/testwasher_tests.py +++ b/tasks/unit_tests/testwasher_tests.py @@ -65,7 +65,6 @@ def test_should_not_be_considered_flaky(self): non_flaky_failing_tests = test_washer.get_non_flaky_failing_tests( failing_tests=failing_tests, flaky_marked_tests=marked_flaky_tests ) - print("TOTOTO", non_flaky_failing_tests) self.assertEqual( non_flaky_failing_tests, {"github.com/DataDog/datadog-agent/test/new-e2e/tests/containers": {"TestEKSSuite"}}, @@ -133,73 +132,3 @@ def test_empty_yaml(self): merged_flakes, {"nintendo": {"mario", "luigi"}}, ) - - -class TestGetTestParents(unittest.TestCase): - def test_get_tests_parents(self): - test_washer = TestWasher() - parents = test_washer.get_tests_family(["TestEKSSuite/TestCPU/TestCPUUtilization", "TestKindSuite/TestKind"]) - self.assertEqual( - parents, - { - "TestEKSSuite", - "TestEKSSuite/TestCPU", - "TestEKSSuite/TestCPU/TestCPUUtilization", - "TestKindSuite", - "TestKindSuite/TestKind", - }, - ) - - def test_get_test_parents_empty(self): - test_washer = TestWasher() - parents = test_washer.get_tests_family([]) - self.assertEqual( - parents, - set(), - ) - - -class TestIsKnownFlake(unittest.TestCase): - def test_known_flake(self): - test_washer = TestWasher() - is_known_flaky = test_washer.is_known_flaky_test( - "TestEKSSuite/mario", {"TestEKSSuite/mario"}, {"TestEKSSuite", "TestEKSSuite/mario"} - ) - self.assertTrue(is_known_flaky) - - def test_known_flake_parent_failing(self): - test_washer = TestWasher() - is_known_flaky = test_washer.is_known_flaky_test( - "TestEKSSuite", {"TestEKSSuite/mario"}, {"TestEKSSuite", "TestEKSSuite/mario"} - ) - self.assertTrue(is_known_flaky) - - def test_known_flake_parent_failing_2(self): - test_washer = TestWasher() - is_known_flaky = test_washer.is_known_flaky_test( - "TestEKSSuite/mario", - {"TestEKSSuite/mario/luigi"}, - {"TestEKSSuite", "TestEKSSuite/mario", "TestEKSSuite/mario/luigi"}, - ) - self.assertTrue(is_known_flaky) - - def test_not_known_flake(self): - test_washer = TestWasher() - is_known_flaky = test_washer.is_known_flaky_test( - "TestEKSSuite/luigi", {"TestEKSSuite/mario"}, {"TestEKSSuite", "TestEKSSuite/mario"} - ) - self.assertFalse(is_known_flaky) - - def test_not_known_flake_ambiguous_start(self): - test_washer = TestWasher() - is_known_flaky = test_washer.is_known_flaky_test( - "TestEKSSuiteVM/mario", {"TestEKSSuite/mario"}, {"TestEKSSuite"} - ) - self.assertFalse(is_known_flaky) - - def test_not_known_flake_ambiguous_start_2(self): - test_washer = TestWasher() - is_known_flaky = test_washer.is_known_flaky_test( - "TestEKSSuite/mario", {"TestEKSSuiteVM/mario"}, {"TestEKSSuiteVM"} - ) - self.assertFalse(is_known_flaky) diff --git a/tasks/winbuildscripts/unittests.bat b/tasks/winbuildscripts/unittests.bat index ab7eb626ed44a..9673769c4c329 100644 --- a/tasks/winbuildscripts/unittests.bat +++ b/tasks/winbuildscripts/unittests.bat @@ -15,7 +15,10 @@ xcopy /e/s/h/q c:\mnt\*.* call %TEST_ROOT%\datadog-agent\tasks\winbuildscripts\extract-modcache.bat %TEST_ROOT%\datadog-agent modcache call %TEST_ROOT%\datadog-agent\tasks\winbuildscripts\extract-modcache.bat %TEST_ROOT%\datadog-agent modcache_tools -Powershell -C "%TEST_ROOT%\datadog-agent\tasks\winbuildscripts\unittests.ps1" || exit /b 2 +Powershell -File "%TEST_ROOT%\datadog-agent\tasks\winbuildscripts\unittests.ps1" +if %ERRORLEVEL% neq 0 ( + exit /b %ERRORLEVEL% +) goto :EOF diff --git a/tasks/winbuildscripts/unittests.ps1 b/tasks/winbuildscripts/unittests.ps1 index 5f4fc6a848b70..5285e6c9d86b4 100644 --- a/tasks/winbuildscripts/unittests.ps1 +++ b/tasks/winbuildscripts/unittests.ps1 @@ -55,8 +55,9 @@ if($err -ne 0){ [Environment]::Exit($err) } & inv -e test --junit-tar="$Env:JUNIT_TAR" --race --profile --rerun-fails=2 --coverage --cpus 8 --python-runtimes="$Env:PY_RUNTIMES" --python-home-2=$Env:Python2_ROOT_DIR --python-home-3=$Env:Python3_ROOT_DIR --save-result-json C:\mnt\$test_output_file $Env:EXTRA_OPTS --build-stdlib $TEST_WASHER_FLAG - -$err = $LASTEXITCODE +If ($LASTEXITCODE -ne "0") { + exit $LASTEXITCODE +} # Ignore upload failures $ErrorActionPreference = "Continue" @@ -65,10 +66,14 @@ $tmpfile = [System.IO.Path]::GetTempFileName() # 1. Upload coverage reports to Codecov & "$UT_BUILD_ROOT\tools\ci\fetch_secret.ps1" -parameterName "$Env:CODECOV_TOKEN" -tempFile "$tmpfile" If ($LASTEXITCODE -ne "0") { - exit $LASTEXITCODE + Write-Host "Failed to fetch CODECOV_TOKEN - ignoring" + exit "0" } $Env:CODECOV_TOKEN=$(cat "$tmpfile") & inv -e coverage.upload-to-codecov $Env:COVERAGE_CACHE_FLAG +if($LASTEXITCODE -ne "0"){ + Write-Host -ForegroundColor Red "coverage upload failed $err" +} # 2. Upload junit files # Copy test files to c:\mnt for further gitlab upload @@ -77,15 +82,15 @@ Get-ChildItem -Path "$UT_BUILD_ROOT" -Filter "junit-out-*.xml" -Recurse | ForEac } & "$UT_BUILD_ROOT\tools\ci\fetch_secret.ps1" -parameterName "$Env:API_KEY_ORG2" -tempFile "$tmpfile" If ($LASTEXITCODE -ne "0") { - exit $LASTEXITCODE + Write-Host "Failed to fetch API_KEY - ignoring" + exit "0" } $Env:DATADOG_API_KEY=$(cat "$tmpfile") Remove-Item "$tmpfile" & inv -e junit-upload --tgz-path $Env:JUNIT_TAR -if($err -ne 0){ - Write-Host -ForegroundColor Red "test failed $err" - [Environment]::Exit($err) +if($LASTEXITCODE -ne "0"){ + Write-Host -ForegroundColor Red "junit upload failed $err" } Write-Host Test passed \ No newline at end of file diff --git a/test/fakeintake/client/client.go b/test/fakeintake/client/client.go index d31e22c992628..6890eb51cc6a8 100644 --- a/test/fakeintake/client/client.go +++ b/test/fakeintake/client/client.go @@ -776,7 +776,7 @@ func (c *Client) get(route string) ([]byte, error) { err := backoff.Retry(func() error { tmpResp, err := http.Get(fmt.Sprintf("%s/%s", c.fakeIntakeURL, route)) if err, ok := err.(net.Error); ok && err.Timeout() { - panic("fakeintake call timed out") + panic(fmt.Sprintf("fakeintake call timed out: %v", err)) } if err != nil { return err diff --git a/test/fakeintake/go.mod b/test/fakeintake/go.mod index 767a5be5b89f1..77a23f143589e 100644 --- a/test/fakeintake/go.mod +++ b/test/fakeintake/go.mod @@ -51,8 +51,8 @@ require ( github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/sys v0.25.0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect + golang.org/x/sys v0.26.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect modernc.org/libc v1.41.0 // indirect diff --git a/test/fakeintake/go.sum b/test/fakeintake/go.sum index 9e3c4fa3a0f05..839ac41e36081 100644 --- a/test/fakeintake/go.sum +++ b/test/fakeintake/go.sum @@ -95,8 +95,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk 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/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -110,8 +110,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/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= @@ -129,8 +129,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= @@ -144,8 +144,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= diff --git a/test/integration/docker/otel_agent_build_tests.py b/test/integration/docker/otel_agent_build_tests.py new file mode 100644 index 0000000000000..5ec4a9209986c --- /dev/null +++ b/test/integration/docker/otel_agent_build_tests.py @@ -0,0 +1,36 @@ +import os +import unittest + +import docker + + +def setUpModule(): + global client + client = docker.from_env() + + +class OtelAgentBuildTest(unittest.TestCase): + """contains setup and tests for otel agent build. Must be invoked directly + by 'inv otel-agent.test-image-build' so that necessary image is built and + environment variables are set""" + + def setUp(self): + self.assertIsNotNone(os.environ.get('OT_AGENT_IMAGE_NAME'), "OT_AGENT_IMAGE_NAME envvar needed") + self.image_name = os.environ.get('OT_AGENT_IMAGE_NAME') + self.assertIsNotNone(os.environ.get('OT_AGENT_TAG'), "OT_AGENT_TAG envvar needed") + self.tag = os.environ.get('OT_AGENT_TAG') + # self.assertIsNotNone(os.environ.get('EXPECTED_VERSION'), "EXPECTED_VERSION envvar needed") + # self.expected_version = os.environ.get('EXPECTED_VERSION') + + def test_otel_agent_docker_image(self): + version_output = client.containers.run( + f'{self.image_name}:{self.tag}', entrypoint='otel-agent', command='version' + ) + self.assertIn("otel-agent", version_output.decode('utf-8')) + # TODO: replace with expected version code when https://github.com/DataDog/datadog-agent/pull/29334 + # is merged to otel beta branch + # self.assertIn(f"otel-agent {self.expected_version}", version_output.decode('utf-8')) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/kitchen/test/integration/security-agent-test/rspec_datadog/security-agent-test_spec.rb b/test/kitchen/test/integration/security-agent-test/rspec_datadog/security-agent-test_spec.rb index dc00263722256..6e6deec63c3e6 100644 --- a/test/kitchen/test/integration/security-agent-test/rspec_datadog/security-agent-test_spec.rb +++ b/test/kitchen/test/integration/security-agent-test/rspec_datadog/security-agent-test_spec.rb @@ -122,9 +122,7 @@ def check_output(output, wait_thr, tag="") case cws_platform when "host" context 'functional tests running directly on host' do - env = { - "DD_TESTS_RUNTIME_COMPILED"=>"1", - } + env = {} include_examples "passes", "host", env end when "host-fentry" @@ -150,7 +148,6 @@ def check_output(output, wait_thr, tag="") context 'activity dump functional test running on dedicated node' do env = { "DEDICATED_ACTIVITY_DUMP_NODE"=>"1", - "DD_TESTS_RUNTIME_COMPILED"=>"1", } include_examples "passes", "ad", env end diff --git a/test/new-e2e/go.mod b/test/new-e2e/go.mod index 496ee8b6854c3..1d49efad885d4 100644 --- a/test/new-e2e/go.mod +++ b/test/new-e2e/go.mod @@ -59,8 +59,8 @@ require ( // `TEST_INFRA_DEFINITIONS_BUILDIMAGES` matches the commit sha in the module version // Example: github.com/DataDog/test-infra-definitions v0.0.0-YYYYMMDDHHmmSS-0123456789AB // => TEST_INFRA_DEFINITIONS_BUILDIMAGES: 0123456789AB - github.com/DataDog/test-infra-definitions v0.0.0-20241007132100-08b9d8e048c1 - github.com/aws/aws-sdk-go-v2 v1.32.0 + github.com/DataDog/test-infra-definitions v0.0.0-20241018132225-15203a025239 + github.com/aws/aws-sdk-go-v2 v1.32.2 github.com/aws/aws-sdk-go-v2/config v1.27.40 github.com/aws/aws-sdk-go-v2/service/ec2 v1.164.2 github.com/aws/aws-sdk-go-v2/service/eks v1.44.1 @@ -74,16 +74,16 @@ require ( github.com/mitchellh/mapstructure v1.5.0 github.com/pkg/sftp v1.13.6 github.com/pulumi/pulumi-aws/sdk/v6 v6.54.2 - github.com/pulumi/pulumi-awsx/sdk/v2 v2.14.0 - github.com/pulumi/pulumi-eks/sdk/v2 v2.7.8 + github.com/pulumi/pulumi-awsx/sdk/v2 v2.16.1 + github.com/pulumi/pulumi-eks/sdk/v2 v2.7.8 // indirect github.com/pulumi/pulumi-kubernetes/sdk/v4 v4.17.1 - github.com/pulumi/pulumi/sdk/v3 v3.133.0 + github.com/pulumi/pulumi/sdk/v3 v3.134.1 github.com/samber/lo v1.47.0 github.com/stretchr/testify v1.9.0 github.com/xeipuuv/gojsonschema v1.2.0 - golang.org/x/crypto v0.27.0 - golang.org/x/sys v0.25.0 - golang.org/x/term v0.24.0 + golang.org/x/crypto v0.28.0 + golang.org/x/sys v0.26.0 + golang.org/x/term v0.25.0 gopkg.in/yaml.v2 v2.4.0 gopkg.in/zorkian/go-datadog-api.v2 v2.30.0 k8s.io/api v0.30.2 @@ -94,7 +94,7 @@ require ( ) require ( - dario.cat/mergo v1.0.0 // indirect + dario.cat/mergo v1.0.1 // indirect github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/BurntSushi/toml v1.2.1 // indirect github.com/DataDog/datadog-agent/comp/netflow/payload v0.56.0-rc.3 // indirect @@ -114,11 +114,11 @@ require ( github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 // indirect github.com/aws/aws-sdk-go-v2/credentials v1.17.38 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.14 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.19 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.19 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.19 // indirect - github.com/aws/aws-sdk-go-v2/service/ecr v1.32.4 // indirect + github.com/aws/aws-sdk-go-v2/service/ecr v1.36.2 // indirect github.com/aws/aws-sdk-go-v2/service/ecs v1.45.2 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.0 // indirect @@ -150,7 +150,7 @@ require ( github.com/emirpasic/gods v1.18.1 // indirect github.com/evanphx/json-patch v4.12.0+incompatible // indirect github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect - github.com/felixge/httpsnoop v1.0.3 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fvbommel/sortorder v1.1.0 // indirect github.com/go-errors/errors v1.4.2 // indirect @@ -222,7 +222,7 @@ require ( github.com/pkg/term v1.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231 // indirect - github.com/pulumi/esc v0.9.1 // indirect + github.com/pulumi/esc v0.10.0 // indirect github.com/pulumi/pulumi-command/sdk v1.0.1 // indirect github.com/pulumi/pulumi-docker/sdk/v4 v4.5.5 // indirect github.com/pulumi/pulumi-libvirt/sdk v0.4.7 // indirect @@ -251,22 +251,22 @@ require ( github.com/xlab/treeprint v1.2.0 // indirect github.com/zclconf/go-cty v1.14.4 // indirect github.com/zorkian/go-datadog-api v2.30.0+incompatible - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0 // indirect - go.opentelemetry.io/otel v1.30.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect + go.opentelemetry.io/otel v1.31.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0 // indirect - go.opentelemetry.io/otel/metric v1.30.0 // indirect + go.opentelemetry.io/otel/metric v1.31.0 // indirect go.opentelemetry.io/otel/sdk v1.28.0 // indirect - go.opentelemetry.io/otel/trace v1.30.0 // indirect + go.opentelemetry.io/otel/trace v1.31.0 // indirect go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/oauth2 v0.18.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/text v0.18.0 - golang.org/x/time v0.6.0 // indirect - golang.org/x/tools v0.25.0 // indirect + golang.org/x/text v0.19.0 + golang.org/x/time v0.7.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect google.golang.org/grpc v1.64.0 // indirect diff --git a/test/new-e2e/go.sum b/test/new-e2e/go.sum index 4567e90b8819f..7a3b0e624cc48 100644 --- a/test/new-e2e/go.sum +++ b/test/new-e2e/go.sum @@ -1,6 +1,6 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= -dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= +dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -16,8 +16,8 @@ github.com/DataDog/datadog-go/v5 v5.5.0 h1:G5KHeB8pWBNXT4Jtw0zAkhdxEAWSpWH00geHI github.com/DataDog/datadog-go/v5 v5.5.0/go.mod h1:K9kcYBlxkcPP8tvvjZZKs/m1edNAUFzBbdpTUKfCsuw= github.com/DataDog/mmh3 v0.0.0-20200805151601-30884ca2197a h1:m9REhmyaWD5YJ0P53ygRHxKKo+KM+nw+zz0hEdKztMo= github.com/DataDog/mmh3 v0.0.0-20200805151601-30884ca2197a/go.mod h1:SvsjzyJlSg0rKsqYgdcFxeEVflx3ZNAyFfkUHP0TxXg= -github.com/DataDog/test-infra-definitions v0.0.0-20241007132100-08b9d8e048c1 h1:vQFrWWJ8BUWqHpkUP4bu81ZVsk/2vPsykdiilL5LJCk= -github.com/DataDog/test-infra-definitions v0.0.0-20241007132100-08b9d8e048c1/go.mod h1:spBV6LBmaH17vb/oe6n2kVfsuEUR+eQGsoaCGJclHF0= +github.com/DataDog/test-infra-definitions v0.0.0-20241018132225-15203a025239 h1:tyhgAkIShd+6tQCUYpkQ+DLcylPfC9cyY2GDuAsPrho= +github.com/DataDog/test-infra-definitions v0.0.0-20241018132225-15203a025239/go.mod h1:r1vj2GDG6jHKNUnXQWzkLefaQ6CBlD0pQwnsySERqaM= github.com/DataDog/viper v1.13.5 h1:SZMcyMknYQN2jRY/40A16gUXexlNJOI8sDs1cWZnI64= github.com/DataDog/viper v1.13.5/go.mod h1:wDdUVJ2SHaMaPrCZrlRCObwkubsX8j5sme3LaR/SGTc= github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= @@ -57,8 +57,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= -github.com/aws/aws-sdk-go-v2 v1.32.0 h1:GuHp7GvMN74PXD5C97KT5D87UhIy4bQPkflQKbfkndg= -github.com/aws/aws-sdk-go-v2 v1.32.0/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= +github.com/aws/aws-sdk-go-v2 v1.32.2 h1:AkNLZEyYMLnx/Q/mSKkcMqwNFXMAvFto9bNsHqcTduI= +github.com/aws/aws-sdk-go-v2 v1.32.2/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 h1:pT3hpW0cOHRJx8Y0DfJUEQuqPild8jRGmSFmBgvydr0= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6/go.mod h1:j/I2++U0xX+cr44QjHay4Cvxj6FUbnxrgmqN3H1jTZA= github.com/aws/aws-sdk-go-v2/config v1.27.40 h1:sie4mPBGFOO+Z27+yHzvyN31G20h/bf2xb5mCbpLv2Q= @@ -67,18 +67,18 @@ github.com/aws/aws-sdk-go-v2/credentials v1.17.38 h1:iM90eRhCeZtlkzCNCG1JysOzJXG github.com/aws/aws-sdk-go-v2/credentials v1.17.38/go.mod h1:TCVYPZeQuLaYNEkf/TVn6k5k/zdVZZ7xH9po548VNNg= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.14 h1:C/d03NAmh8C4BZXhuRNboF/DqhBkBCeDiJDcaqIT5pA= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.14/go.mod h1:7I0Ju7p9mCIdlrfS+JCgqcYD0VXz/N4yozsox+0o078= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.19 h1:Q/k5wCeJkSWs+62kDfOillkNIJ5NqmE3iOfm48g/W8c= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.19/go.mod h1:Wns1C66VvtA2Bv/cUBuKZKQKdjo7EVMhp90aAa+8oTI= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.19 h1:AYLE0lUfKvN6icFTR/p+NmD1amYKTbqHQ1Nm+jwE6BM= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.19/go.mod h1:1giLakj64GjuH1NBzF/DXqly5DWHtMTaOzRZ53nFX0I= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21 h1:UAsR3xA31QGf79WzpG/ixT9FZvQlh5HY1NRqSHBNOCk= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.21/go.mod h1:JNr43NFf5L9YaG3eKTm7HQzls9J+A9YYcGI5Quh1r2Y= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21 h1:6jZVETqmYCadGFvrYEQfC5fAQmlo80CeL5psbno6r0s= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.21/go.mod h1:1SR0GbLlnN3QUmYaflZNiH1ql+1qrSiB2vwcJ+4UM60= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.19 h1:FKdiFzTxlTRO71p0C7VrLbkkdW8qfMKF5+ej6bTmkT0= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.19/go.mod h1:abO3pCj7WLQPTllnSeYImqFfkGrmJV0JovWo/gqT5N0= github.com/aws/aws-sdk-go-v2/service/ec2 v1.164.2 h1:Rts0EZgdi3tneJMXp+uKrZHbMxQIu0y5O/2MG6a2+hY= github.com/aws/aws-sdk-go-v2/service/ec2 v1.164.2/go.mod h1:j0V2ahvdX3mGIyXQSe9vjdIQvSxz3uaMM0bR7Y+0WCE= -github.com/aws/aws-sdk-go-v2/service/ecr v1.32.4 h1:nQAU2Yr+afkAvIV39mg7LrNYFNQP7ShwbmiJqx2fUKA= -github.com/aws/aws-sdk-go-v2/service/ecr v1.32.4/go.mod h1:keOS9j4fv5ASh7dV29lIpGw2QgoJwGFAyMU0uPvfax4= +github.com/aws/aws-sdk-go-v2/service/ecr v1.36.2 h1:VDQaVwGOokbd3VUbHF+wupiffdrbAZPdQnr5XZMJqrs= +github.com/aws/aws-sdk-go-v2/service/ecr v1.36.2/go.mod h1:lvUlMghKYmSxSfv0vU7pdU/8jSY+s0zpG8xXhaGKCw0= github.com/aws/aws-sdk-go-v2/service/ecs v1.45.2 h1:DSFxt4HBQjlgKNMyYdME9cbB11FFi7umpTGbqJaS9nw= github.com/aws/aws-sdk-go-v2/service/ecs v1.45.2/go.mod h1:er8WHbgZAl17Dmu41ifKmUrV7JPpiQnRc+XSrnu4qR8= github.com/aws/aws-sdk-go-v2/service/eks v1.44.1 h1:onUAzZXDsyXzyrmOGw/9p8Csl1NZkTDEs4URZ8covUY= @@ -197,8 +197,8 @@ github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZM github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= -github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= -github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -320,7 +320,6 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= -github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= @@ -500,12 +499,12 @@ github.com/prometheus/procfs v0.15.0/go.mod h1:Y0RJ/Y5g5wJpkTisOtqwDSo4HwhGmLB4V github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231 h1:vkHw5I/plNdTr435cARxCW6q9gc0S/Yxz7Mkd38pOb0= github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231/go.mod h1:murToZ2N9hNJzewjHBgfFdXhZKjY3z5cYC1VXk+lbFE= -github.com/pulumi/esc v0.9.1 h1:HH5eEv8sgyxSpY5a8yePyqFXzA8cvBvapfH8457+mIs= -github.com/pulumi/esc v0.9.1/go.mod h1:oEJ6bOsjYlQUpjf70GiX+CXn3VBmpwFDxUTlmtUN84c= +github.com/pulumi/esc v0.10.0 h1:jzBKzkLVW0mePeanDRfqSQoCJ5yrkux0jIwAkUxpRKE= +github.com/pulumi/esc v0.10.0/go.mod h1:2Bfa+FWj/xl8CKqRTWbWgDX0SOD4opdQgvYSURTGK2c= github.com/pulumi/pulumi-aws/sdk/v6 v6.54.2 h1:nOa8VQ06HHSI02X5LeVH95lKH5bKe9eQ/4uvuuJgS1s= github.com/pulumi/pulumi-aws/sdk/v6 v6.54.2/go.mod h1:HWyVOgw2WogCRYxH6eRSKM7fNK+vHXxPKqrbx/oy0wI= -github.com/pulumi/pulumi-awsx/sdk/v2 v2.14.0 h1:GknlrxIweg8X65VcxJaUVdZIHhclZjdzEWxsLGnMR2Y= -github.com/pulumi/pulumi-awsx/sdk/v2 v2.14.0/go.mod h1:mB6jxy6GjMd1dmTA129GkHH5pyryYG/W0J1X2XznxW4= +github.com/pulumi/pulumi-awsx/sdk/v2 v2.16.1 h1:6082hB+ILpPB/0V5F+LTmHbX1BO54tCVOQCVOL/FYI4= +github.com/pulumi/pulumi-awsx/sdk/v2 v2.16.1/go.mod h1:z2bnBPHNYfk72IW1P01H9qikBtBSBhCwi3QpH6Y/38Q= github.com/pulumi/pulumi-azure-native-sdk/authorization/v2 v2.60.0 h1:qCpKZQECnZWXVMWfuTk6nfPfQoP+7zXPS5bHdeIh5Mc= github.com/pulumi/pulumi-azure-native-sdk/authorization/v2 v2.60.0/go.mod h1:ILyyA8nuYMWOcU7sRqRVmakNeY4hxog7K4nMCL+IOjE= github.com/pulumi/pulumi-azure-native-sdk/compute/v2 v2.56.0 h1:MFOd6X9FPlixzriy14fBHv7pFCCh/mu1pwHtSSjqfJ4= @@ -534,8 +533,8 @@ github.com/pulumi/pulumi-random/sdk/v4 v4.16.6 h1:M9BSF13bQxj74C61nBTVITrsgT6oRR github.com/pulumi/pulumi-random/sdk/v4 v4.16.6/go.mod h1:l5ew7S/G1GspPLH9KeWXqxQ4ZmS2hh2sEMv3bW9M3yc= github.com/pulumi/pulumi-tls/sdk/v4 v4.11.1 h1:tXemWrzeVTqG8zq6hBdv1TdPFXjgZ+dob63a/6GlF1o= github.com/pulumi/pulumi-tls/sdk/v4 v4.11.1/go.mod h1:hODo3iEmmXDFOXqPK+V+vwI0a3Ww7BLjs5Tgamp86Ng= -github.com/pulumi/pulumi/sdk/v3 v3.133.0 h1:o+7dbJZY9BVgAjOF5GYIWgjp/zpKAgWZwD4pPjUMXKQ= -github.com/pulumi/pulumi/sdk/v3 v3.133.0/go.mod h1:J5kQEX8v87aeUhk6NdQXnjCo1DbiOnOiL3Sf2DuDda8= +github.com/pulumi/pulumi/sdk/v3 v3.134.1 h1:v1zd0d+B9gpUhsdJ483YUMHwHXqDvXvZ+mh/A4HhPWg= +github.com/pulumi/pulumi/sdk/v3 v3.134.1/go.mod h1:J5kQEX8v87aeUhk6NdQXnjCo1DbiOnOiL3Sf2DuDda8= github.com/pulumiverse/pulumi-time/sdk v0.1.0 h1:xfi9HKDgV+GgDxQ23oSv9KxC3DQqViGTcMrJICRgJv0= github.com/pulumiverse/pulumi-time/sdk v0.1.0/go.mod h1:NUa1zA74DF002WrM6iF111A6UjX9knPpXufVRvBwNyg= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= @@ -654,22 +653,22 @@ github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgr github.com/zorkian/go-datadog-api v2.30.0+incompatible h1:R4ryGocppDqZZbnNc5EDR8xGWF/z/MxzWnqTUijDQes= github.com/zorkian/go-datadog-api v2.30.0+incompatible/go.mod h1:PkXwHX9CUQa/FpB9ZwAD45N1uhCW4MT/Wj7m36PbKss= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0 h1:KfYpVmrjI7JuToy5k8XV3nkapjWx48k4E4JOtVstzQI= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0/go.mod h1:SeQhzAEccGVZVEy7aH87Nh0km+utSpo1pTv6eMMop48= -go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= -go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 h1:3Q/xZUyC1BBkualc9ROb4G8qkH90LXEIICcs5zv1OYY= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0/go.mod h1:s75jGIWA9OfCMzF0xr+ZgfrB5FEbbV7UuYo32ahUiFI= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0 h1:j9+03ymgYhPKmeXGk5Zu+cIZOlVzd9Zv7QIiyItjFBU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0/go.mod h1:Y5+XiUG4Emn1hTfciPzGPJaSI+RpDts6BnCIir0SLqk= -go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= -go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2NemcCrOL8gI= go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= -go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= -go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.starlark.net v0.0.0-20230525235612-a134d8f9ddca h1:VdD38733bfYv5tUZwEIskMM93VanwNIi5bIKnDrJdEY= @@ -701,11 +700,11 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -744,8 +743,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= @@ -799,8 +798,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -809,8 +808,8 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= -golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -820,12 +819,12 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= -golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= +golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -845,8 +844,8 @@ golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= -golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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= @@ -859,7 +858,7 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ= +google.golang.org/genproto v0.0.0-20240311173647-c811ad7063a7 h1:ImUcDPHjTrAqNhlOkSocDLfG9rrNHH7w7uoKWPaWZ8s= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094 h1:0+ozOGcrp+Y8Aq8TLNN2Aliibms5LEzsq99ZZmAGYm0= google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094/go.mod h1:fJ/e3If/Q67Mj99hin0hMhiNyCRmt6BQ2aWIJshUSJw= google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 h1:BwIjyKYGsK9dMCBOorzRri8MQwmi7mT9rGHsCEinZkA= diff --git a/test/new-e2e/pkg/e2e/suite.go b/test/new-e2e/pkg/e2e/suite.go index 50e3578e68f8e..7fa0495c5f061 100644 --- a/test/new-e2e/pkg/e2e/suite.go +++ b/test/new-e2e/pkg/e2e/suite.go @@ -150,11 +150,12 @@ import ( "testing" "time" + "github.com/DataDog/test-infra-definitions/common/utils" + "github.com/DataDog/test-infra-definitions/components" + "github.com/DataDog/datadog-agent/test/new-e2e/pkg/runner" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/runner/parameters" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/utils/infra" - "github.com/DataDog/test-infra-definitions/common/utils" - "github.com/DataDog/test-infra-definitions/components" "github.com/stretchr/testify/suite" ) @@ -190,6 +191,7 @@ type BaseSuite[Env any] struct { currentProvisioners ProvisionerMap firstFailTest string + initOnly bool testSessionOutputDir string onceTestSessionOutputDir sync.Once @@ -216,7 +218,6 @@ func (bs *BaseSuite[Env]) UpdateEnv(newProvisioners ...Provisioner) { uniqueIDs[provisioner.ID()] = struct{}{} targetProvisioners[provisioner.ID()] = provisioner } - if err := bs.reconcileEnv(targetProvisioners); err != nil { panic(err) } @@ -233,6 +234,11 @@ func (bs *BaseSuite[Env]) init(options []SuiteOption, self Suite[Env]) { o(&bs.params) } + initOnly, err := runner.GetProfile().ParamStore().GetBoolWithDefault(parameters.InitOnly, false) + if err == nil { + bs.initOnly = initOnly + } + if !runner.GetProfile().AllowDevMode() { bs.params.devMode = false } @@ -310,6 +316,11 @@ func (bs *BaseSuite[Env]) reconcileEnv(targetProvisioners ProvisionerMap) error resources.Merge(provisionerResources) } + // When INIT_ONLY is set, we only partially provision the environment so we do not want initialize the environment + if bs.initOnly { + return nil + } + // Env is taken as parameter as some fields may have keys set by Env pulumi program. err = bs.buildEnvFromResources(resources, newEnvFields, newEnvValues) if err != nil { @@ -332,6 +343,7 @@ func (bs *BaseSuite[Env]) reconcileEnv(targetProvisioners ProvisionerMap) error func (bs *BaseSuite[Env]) createEnv() (*Env, []reflect.StructField, []reflect.Value, error) { var env Env + envFields := reflect.VisibleFields(reflect.TypeOf(&env).Elem()) envValue := reflect.ValueOf(&env) @@ -471,6 +483,10 @@ func (bs *BaseSuite[Env]) SetupSuite() { // `panic()` is required to stop the execution of the test suite. Otherwise `testify.Suite` will keep on running suite tests. panic(err) } + + if bs.initOnly { + bs.T().Skip("INIT_ONLY is set, skipping tests") + } } // BeforeTest is executed right before the test starts and receives the suite and test names as input. @@ -517,6 +533,11 @@ func (bs *BaseSuite[Env]) TearDownSuite() { return } + if bs.initOnly { + bs.T().Logf("INIT_ONLY is set, skipping deletion") + return + } + if bs.firstFailTest != "" && bs.params.skipDeleteOnFailure { bs.Require().FailNow(fmt.Sprintf("%v failed. As SkipDeleteOnFailure feature is enabled the tests after %v were skipped. "+ "The environment of %v was kept.", bs.firstFailTest, bs.firstFailTest, bs.firstFailTest)) diff --git a/test/new-e2e/pkg/environments/aws/kubernetes/eks.go b/test/new-e2e/pkg/environments/aws/kubernetes/eks.go index 65680a36f0657..fe5bac77b5748 100644 --- a/test/new-e2e/pkg/environments/aws/kubernetes/eks.go +++ b/test/new-e2e/pkg/environments/aws/kubernetes/eks.go @@ -10,30 +10,19 @@ import ( "context" "fmt" - "github.com/DataDog/test-infra-definitions/common/config" "github.com/DataDog/test-infra-definitions/common/utils" - "github.com/DataDog/test-infra-definitions/components" "github.com/DataDog/test-infra-definitions/components/datadog/agent/helm" dogstatsdstandalone "github.com/DataDog/test-infra-definitions/components/datadog/dogstatsd-standalone" fakeintakeComp "github.com/DataDog/test-infra-definitions/components/datadog/fakeintake" "github.com/DataDog/test-infra-definitions/components/datadog/kubernetesagentparams" - kubeComp "github.com/DataDog/test-infra-definitions/components/kubernetes" "github.com/DataDog/test-infra-definitions/resources/aws" - localEks "github.com/DataDog/test-infra-definitions/resources/aws/eks" + "github.com/DataDog/test-infra-definitions/scenarios/aws/eks" "github.com/DataDog/test-infra-definitions/scenarios/aws/fakeintake" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/e2e" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/utils/optional" - "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" - awsEks "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/eks" - awsIam "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" - "github.com/pulumi/pulumi-eks/sdk/v2/go/eks" - "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes" - appsv1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/apps/v1" - corev1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/core/v1" - metav1 "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/meta/v1" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) @@ -79,291 +68,68 @@ func EKSRunFunc(ctx *pulumi.Context, env *environments.Kubernetes, params *Provi } } - clusterComp, err := components.NewComponent(&awsEnv, awsEnv.Namer.ResourceName("eks"), func(comp *kubeComp.Cluster) error { - // Create Cluster SG - clusterSG, err := ec2.NewSecurityGroup(ctx, awsEnv.Namer.ResourceName("eks-sg"), &ec2.SecurityGroupArgs{ - NamePrefix: awsEnv.CommonNamer().DisplayName(255, pulumi.String("eks-sg")), - Description: pulumi.StringPtr("EKS Cluster sg for stack: " + ctx.Stack()), - Ingress: ec2.SecurityGroupIngressArray{ - ec2.SecurityGroupIngressArgs{ - SecurityGroups: pulumi.ToStringArray(awsEnv.EKSAllowedInboundSecurityGroups()), - PrefixListIds: pulumi.ToStringArray(awsEnv.EKSAllowedInboundPrefixLists()), - ToPort: pulumi.Int(22), - FromPort: pulumi.Int(22), - Protocol: pulumi.String("tcp"), - }, - ec2.SecurityGroupIngressArgs{ - SecurityGroups: pulumi.ToStringArray(awsEnv.EKSAllowedInboundSecurityGroups()), - PrefixListIds: pulumi.ToStringArray(awsEnv.EKSAllowedInboundPrefixLists()), - ToPort: pulumi.Int(443), - FromPort: pulumi.Int(443), - Protocol: pulumi.String("tcp"), - }, - }, - VpcId: pulumi.StringPtr(awsEnv.DefaultVPCID()), - }, awsEnv.WithProviders(config.ProviderAWS)) - if err != nil { - return err + cluster, err := eks.NewCluster(awsEnv, params.name, params.eksOptions...) + if err != nil { + return err + } + + if err := cluster.Export(ctx, &env.KubernetesCluster.ClusterOutput); err != nil { + return err + } + + if awsEnv.InitOnly() { + return nil + } + + var fakeIntake *fakeintakeComp.Fakeintake + if params.fakeintakeOptions != nil { + fakeIntakeOptions := []fakeintake.Option{ + fakeintake.WithCPU(1024), + fakeintake.WithMemory(6144), + } + if awsEnv.GetCommonEnvironment().InfraShouldDeployFakeintakeWithLB() { + fakeIntakeOptions = append(fakeIntakeOptions, fakeintake.WithLoadBalancer()) } - // Cluster role - clusterRole, err := localEks.GetClusterRole(awsEnv, "eks-cluster-role") - if err != nil { + if fakeIntake, err = fakeintake.NewECSFargateInstance(awsEnv, "ecs", fakeIntakeOptions...); err != nil { return err } - - // IAM Node role - linuxNodeRole, err := localEks.GetNodeRole(awsEnv, "eks-linux-node-role") - if err != nil { + if err := fakeIntake.Export(awsEnv.Ctx(), &env.FakeIntake.FakeintakeOutput); err != nil { return err } + } else { + env.FakeIntake = nil + } - windowsNodeRole, err := localEks.GetNodeRole(awsEnv, "eks-windows-node-role") + // Deploy the agent + dependsOnSetup := utils.PulumiDependsOn(cluster) + if params.agentOptions != nil { + params.agentOptions = append(params.agentOptions, kubernetesagentparams.WithPulumiResourceOptions(dependsOnSetup), kubernetesagentparams.WithFakeintake(fakeIntake)) + kubernetesAgent, err := helm.NewKubernetesAgent(&awsEnv, "eks", cluster.KubeProvider, params.agentOptions...) if err != nil { return err } - - // Fargate Configuration - var fargateProfile pulumi.Input - if fargateNamespace := awsEnv.EKSFargateNamespace(); fargateNamespace != "" { - fargateProfile = pulumi.Any( - eks.FargateProfile{ - Selectors: []awsEks.FargateProfileSelector{ - { - Namespace: fargateNamespace, - }, - }, - }, - ) - } - - // Create an EKS cluster with the default configuration. - cluster, err := eks.NewCluster(ctx, awsEnv.Namer.ResourceName("eks"), &eks.ClusterArgs{ - Name: awsEnv.CommonNamer().DisplayName(100), - Version: pulumi.StringPtr(awsEnv.KubernetesVersion()), - EndpointPrivateAccess: pulumi.BoolPtr(true), - EndpointPublicAccess: pulumi.BoolPtr(false), - Fargate: fargateProfile, - ClusterSecurityGroup: clusterSG, - NodeAssociatePublicIpAddress: pulumi.BoolRef(false), - PrivateSubnetIds: awsEnv.RandomSubnets(), - VpcId: pulumi.StringPtr(awsEnv.DefaultVPCID()), - SkipDefaultNodeGroup: pulumi.BoolRef(true), - // The content of the aws-auth map is the merge of `InstanceRoles` and `RoleMappings`. - // For managed node groups, we push the value in `InstanceRoles`. - // For unmanaged node groups, we push the value in `RoleMappings` - RoleMappings: eks.RoleMappingArray{ - eks.RoleMappingArgs{ - Groups: pulumi.ToStringArray([]string{"system:bootstrappers", "system:nodes", "eks:kube-proxy-windows"}), - Username: pulumi.String("system:node:{{EC2PrivateDNSName}}"), - RoleArn: windowsNodeRole.Arn, - }, - }, - InstanceRoles: awsIam.RoleArray{ - linuxNodeRole, - }, - ServiceRole: clusterRole, - ProviderCredentialOpts: &eks.KubeconfigOptionsArgs{ - ProfileName: pulumi.String(awsEnv.Profile()), - }, - }, pulumi.Timeouts(&pulumi.CustomTimeouts{ - Create: "30m", - Update: "30m", - Delete: "30m", - }), awsEnv.WithProviders(config.ProviderEKS, config.ProviderAWS)) + err = kubernetesAgent.Export(ctx, &env.Agent.KubernetesAgentOutput) if err != nil { return err } + } else { + env.Agent = nil + } - kubeConfig, err := cluster.GetKubeconfig(ctx, &eks.ClusterGetKubeconfigArgs{ - ProfileName: pulumi.String(awsEnv.Profile()), - }) - if err != nil { + // Deploy standalone dogstatsd + if params.deployDogstatsd { + if _, err := dogstatsdstandalone.K8sAppDefinition(&awsEnv, cluster.KubeProvider, "dogstatsd-standalone", fakeIntake, true, ""); err != nil { return err } + } - // Building Kubernetes provider - eksKubeProvider, err := kubernetes.NewProvider(awsEnv.Ctx(), awsEnv.Namer.ResourceName("k8s-provider"), &kubernetes.ProviderArgs{ - Kubeconfig: kubeConfig, - EnableServerSideApply: pulumi.BoolPtr(true), - DeleteUnreachable: pulumi.BoolPtr(true), - }, awsEnv.WithProviders(config.ProviderAWS)) + // Deploy workloads + for _, appFunc := range params.workloadAppFuncs { + _, err := appFunc(&awsEnv, cluster.KubeProvider) if err != nil { return err } - - // Filling Kubernetes component from EKS cluster - comp.ClusterName = cluster.EksCluster.Name() - comp.KubeConfig = kubeConfig - comp.KubeProvider = eksKubeProvider - - // Create configuration for POD subnets if any - workloadDeps := make([]pulumi.Resource, 0) - if podSubnets := awsEnv.EKSPODSubnets(); len(podSubnets) > 0 { - eniConfigs, err := localEks.NewENIConfigs(awsEnv, podSubnets, awsEnv.DefaultSecurityGroups(), pulumi.Provider(eksKubeProvider)) - if err != nil { - return err - } - - // Setting AWS_VPC_K8S_CNI_CUSTOM_NETWORK_CFG is mandatory for EKS CNI to work with ENIConfig CRD - dsPatch, err := appsv1.NewDaemonSetPatch(awsEnv.Ctx(), awsEnv.Namer.ResourceName("eks-custom-network"), &appsv1.DaemonSetPatchArgs{ - Metadata: metav1.ObjectMetaPatchArgs{ - Namespace: pulumi.String("kube-system"), - Name: pulumi.String("aws-node"), - Annotations: pulumi.StringMap{ - "pulumi.com/patchForce": pulumi.String("true"), - }, - }, - Spec: appsv1.DaemonSetSpecPatchArgs{ - Template: corev1.PodTemplateSpecPatchArgs{ - Spec: corev1.PodSpecPatchArgs{ - Containers: corev1.ContainerPatchArray{ - corev1.ContainerPatchArgs{ - Name: pulumi.StringPtr("aws-node"), - Env: corev1.EnvVarPatchArray{ - corev1.EnvVarPatchArgs{ - Name: pulumi.String("AWS_VPC_K8S_CNI_CUSTOM_NETWORK_CFG"), - Value: pulumi.String("true"), - }, - corev1.EnvVarPatchArgs{ - Name: pulumi.String("ENI_CONFIG_LABEL_DEF"), - Value: pulumi.String("topology.kubernetes.io/zone"), - }, - corev1.EnvVarPatchArgs{ - Name: pulumi.String("ENABLE_PREFIX_DELEGATION"), - Value: pulumi.String("true"), - }, - corev1.EnvVarPatchArgs{ - Name: pulumi.String("WARM_IP_TARGET"), - Value: pulumi.String("1"), - }, - corev1.EnvVarPatchArgs{ - Name: pulumi.String("MINIMUM_IP_TARGET"), - Value: pulumi.String("1"), - }, - }, - }, - }, - }, - }, - }, - }, pulumi.Provider(eksKubeProvider), utils.PulumiDependsOn(eniConfigs)) - if err != nil { - return err - } - - workloadDeps = append(workloadDeps, eniConfigs, dsPatch) - } - - // Create managed node groups - if params.eksLinuxNodeGroup { - ng, err := localEks.NewLinuxNodeGroup(awsEnv, cluster, linuxNodeRole) - if err != nil { - return err - } - workloadDeps = append(workloadDeps, ng) - } - - if params.eksLinuxARMNodeGroup { - ng, err := localEks.NewLinuxARMNodeGroup(awsEnv, cluster, linuxNodeRole) - if err != nil { - return err - } - workloadDeps = append(workloadDeps, ng) - } - - if params.eksBottlerocketNodeGroup { - ng, err := localEks.NewBottlerocketNodeGroup(awsEnv, cluster, linuxNodeRole) - if err != nil { - return err - } - workloadDeps = append(workloadDeps, ng) - } - - // Create unmanaged node groups - if params.eksWindowsNodeGroup { - _, err := localEks.NewWindowsNodeGroup(awsEnv, cluster, windowsNodeRole) - if err != nil { - return err - } - } - - // Applying necessary Windows configuration if Windows nodes - // Custom networking is not available for Windows nodes, using normal subnets IPs - if params.eksWindowsNodeGroup { - _, err := corev1.NewConfigMapPatch(awsEnv.Ctx(), awsEnv.Namer.ResourceName("eks-cni-cm"), &corev1.ConfigMapPatchArgs{ - Metadata: metav1.ObjectMetaPatchArgs{ - Namespace: pulumi.String("kube-system"), - Name: pulumi.String("amazon-vpc-cni"), - Annotations: pulumi.StringMap{ - "pulumi.com/patchForce": pulumi.String("true"), - }, - }, - Data: pulumi.StringMap{ - "enable-windows-ipam": pulumi.String("true"), - }, - }, pulumi.Provider(eksKubeProvider)) - if err != nil { - return err - } - } - - var fakeIntake *fakeintakeComp.Fakeintake - if params.fakeintakeOptions != nil { - fakeIntakeOptions := []fakeintake.Option{ - fakeintake.WithCPU(1024), - fakeintake.WithMemory(6144), - } - if awsEnv.GetCommonEnvironment().InfraShouldDeployFakeintakeWithLB() { - fakeIntakeOptions = append(fakeIntakeOptions, fakeintake.WithLoadBalancer()) - } - - if fakeIntake, err = fakeintake.NewECSFargateInstance(awsEnv, "ecs", fakeIntakeOptions...); err != nil { - return err - } - if err := fakeIntake.Export(awsEnv.Ctx(), &env.FakeIntake.FakeintakeOutput); err != nil { - return err - } - } else { - env.FakeIntake = nil - } - - // Deploy the agent - dependsOnSetup := utils.PulumiDependsOn(workloadDeps...) - if params.agentOptions != nil { - params.agentOptions = append(params.agentOptions, kubernetesagentparams.WithPulumiResourceOptions(dependsOnSetup), kubernetesagentparams.WithFakeintake(fakeIntake)) - kubernetesAgent, err := helm.NewKubernetesAgent(&awsEnv, "eks", eksKubeProvider, params.agentOptions...) - if err != nil { - return err - } - err = kubernetesAgent.Export(ctx, &env.Agent.KubernetesAgentOutput) - if err != nil { - return err - } - } else { - env.Agent = nil - } - - // Deploy standalone dogstatsd - if params.deployDogstatsd { - if _, err := dogstatsdstandalone.K8sAppDefinition(&awsEnv, eksKubeProvider, "dogstatsd-standalone", fakeIntake, true, ""); err != nil { - return err - } - } - - // Deploy workloads - for _, appFunc := range params.workloadAppFuncs { - _, err := appFunc(&awsEnv, eksKubeProvider) - if err != nil { - return err - } - } - - return nil - }) - if err != nil { - return err } - - return clusterComp.Export(ctx, &env.KubernetesCluster.ClusterOutput) + return nil } diff --git a/test/new-e2e/pkg/environments/aws/kubernetes/params.go b/test/new-e2e/pkg/environments/aws/kubernetes/params.go index 1084e6f41bc32..abc939d523bfb 100644 --- a/test/new-e2e/pkg/environments/aws/kubernetes/params.go +++ b/test/new-e2e/pkg/environments/aws/kubernetes/params.go @@ -17,6 +17,7 @@ import ( kubeComp "github.com/DataDog/test-infra-definitions/components/kubernetes" "github.com/DataDog/test-infra-definitions/resources/aws" "github.com/DataDog/test-infra-definitions/scenarios/aws/ec2" + "github.com/DataDog/test-infra-definitions/scenarios/aws/eks" "github.com/DataDog/test-infra-definitions/scenarios/aws/fakeintake" "github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes" @@ -28,6 +29,7 @@ type ProvisionerParams struct { vmOptions []ec2.VMOption agentOptions []kubernetesagentparams.Option fakeintakeOptions []fakeintake.Option + eksOptions []eks.Option extraConfigParams runner.ConfigMap workloadAppFuncs []WorkloadAppFunc @@ -45,6 +47,7 @@ func newProvisionerParams() *ProvisionerParams { vmOptions: []ec2.VMOption{}, agentOptions: []kubernetesagentparams.Option{}, fakeintakeOptions: []fakeintake.Option{}, + eksOptions: []eks.Option{}, extraConfigParams: runner.ConfigMap{}, workloadAppFuncs: []WorkloadAppFunc{}, @@ -101,34 +104,10 @@ func WithFakeIntakeOptions(opts ...fakeintake.Option) ProvisionerOption { } } -// WithEKSLinuxNodeGroup enable Linux node group -func WithEKSLinuxNodeGroup() ProvisionerOption { +// WithEKSOptions adds options to the EKS cluster +func WithEKSOptions(opts ...eks.Option) ProvisionerOption { return func(params *ProvisionerParams) error { - params.eksLinuxNodeGroup = true - return nil - } -} - -// WithEKSLinuxARMNodeGroup enable ARM node group -func WithEKSLinuxARMNodeGroup() ProvisionerOption { - return func(params *ProvisionerParams) error { - params.eksLinuxARMNodeGroup = true - return nil - } -} - -// WithEKSBottlerocketNodeGroup enable AWS Bottle rocket node group -func WithEKSBottlerocketNodeGroup() ProvisionerOption { - return func(params *ProvisionerParams) error { - params.eksBottlerocketNodeGroup = true - return nil - } -} - -// WithEKSWindowsNodeGroup enable Windows node group -func WithEKSWindowsNodeGroup() ProvisionerOption { - return func(params *ProvisionerParams) error { - params.eksWindowsNodeGroup = true + params.eksOptions = opts return nil } } diff --git a/test/new-e2e/pkg/runner/ci_profile.go b/test/new-e2e/pkg/runner/ci_profile.go index 8a2ec9a0ebcdb..44637d79356d8 100644 --- a/test/new-e2e/pkg/runner/ci_profile.go +++ b/test/new-e2e/pkg/runner/ci_profile.go @@ -52,9 +52,23 @@ func NewCIProfile() (Profile, error) { if jobID == "" || projectID == "" { return nil, fmt.Errorf("unable to compute name prefix, missing variables job id: %s, project id: %s", jobID, projectID) } - + uniqueID := jobID store := parameters.NewEnvStore(EnvPrefix) + initOnly, err := store.GetBoolWithDefault(parameters.InitOnly, false) + if err != nil { + return nil, err + } + + preInitialized, err := store.GetBoolWithDefault(parameters.PreInitialized, false) + if err != nil { + return nil, err + } + + if initOnly || preInitialized { + uniqueID = fmt.Sprintf("init-%s", os.Getenv("CI_PIPELINE_ID")) // We use pipeline ID for init only and pre-initialized jobs, to be able to share state + } + // get environments from store environmentsStr, err := store.GetWithDefault(parameters.Environments, "") if err != nil { @@ -75,7 +89,7 @@ func NewCIProfile() (Profile, error) { return ciProfile{ baseProfile: newProfile("e2eci", ciEnvironments, store, &secretStore, outputRoot), - ciUniqueID: "ci-" + jobID + "-" + projectID, + ciUniqueID: "ci-" + uniqueID + "-" + projectID, }, nil } diff --git a/test/new-e2e/pkg/runner/configmap.go b/test/new-e2e/pkg/runner/configmap.go index e69223d164864..1213ed527d265 100644 --- a/test/new-e2e/pkg/runner/configmap.go +++ b/test/new-e2e/pkg/runner/configmap.go @@ -35,6 +35,9 @@ const ( // InfraExtraResourcesTags pulumi config parameter name InfraExtraResourcesTags = commonconfig.DDInfraConfigNamespace + ":" + commonconfig.DDInfraExtraResourcesTags + //InfraInitOnly pulumi config parameter name + InfraInitOnly = commonconfig.DDInfraConfigNamespace + ":" + commonconfig.DDInfraInitOnly + // AWSKeyPairName pulumi config parameter name AWSKeyPairName = commonconfig.DDInfraConfigNamespace + ":" + infraaws.DDInfraDefaultKeyPairParamName // AWSPublicKeyPath pulumi config parameter name @@ -124,6 +127,7 @@ func BuildStackParameters(profile Profile, scenarioConfig ConfigMap) (ConfigMap, parameters.ExtraResourcesTags: {InfraExtraResourcesTags}, parameters.PipelineID: {AgentPipelineID}, parameters.CommitSHA: {AgentCommitSHA}, + parameters.InitOnly: {InfraInitOnly}, } for storeKey, configMapKeys := range params { diff --git a/test/new-e2e/pkg/runner/configmap_test.go b/test/new-e2e/pkg/runner/configmap_test.go index 6835eb9ea1fb9..2997010649a1e 100644 --- a/test/new-e2e/pkg/runner/configmap_test.go +++ b/test/new-e2e/pkg/runner/configmap_test.go @@ -36,6 +36,7 @@ func Test_BuildStackParameters(t *testing.T) { "ddinfra:aws/defaultKeyPairName": auto.ConfigValue{Value: "key_pair_name", Secret: false}, "ddinfra:env": auto.ConfigValue{Value: "", Secret: false}, "ddinfra:extraResourcesTags": auto.ConfigValue{Value: "extra_resources_tags", Secret: false}, + "ddinfra:initOnly": auto.ConfigValue{Value: "init_only", Secret: false}, "ddinfra:aws/defaultPublicKeyPath": auto.ConfigValue{Value: "public_key_path", Secret: false}, "ddinfra:aws/defaultPrivateKeyPath": auto.ConfigValue{Value: "private_key_path", Secret: false}, "ddinfra:aws/defaultPrivateKeyPassword": auto.ConfigValue{Value: "private_key_password", Secret: true}, diff --git a/test/new-e2e/pkg/runner/parameters/const.go b/test/new-e2e/pkg/runner/parameters/const.go index acd7b97fe6850..5286dd7ed9d90 100644 --- a/test/new-e2e/pkg/runner/parameters/const.go +++ b/test/new-e2e/pkg/runner/parameters/const.go @@ -49,4 +49,8 @@ const ( PulumiVerboseProgressStreams StoreKey = "pulumi_verbose_progress_streams" // DevMode allows to keep the stack after the test completes DevMode StoreKey = "dev_mode" + // InitOnly config flag parameter name + InitOnly StoreKey = "init_only" + // PreInitialized config flag parameter name + PreInitialized StoreKey = "pre_initialized" ) diff --git a/test/new-e2e/system-probe/config/platforms.json b/test/new-e2e/system-probe/config/platforms.json index 9397bb69e396d..b7a95fb5f7e26 100644 --- a/test/new-e2e/system-probe/config/platforms.json +++ b/test/new-e2e/system-probe/config/platforms.json @@ -7,7 +7,7 @@ "kernel": "6.0.7-301.fc37", "os_version": "37", "image": "Fedora-Cloud-Base-37.x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "fedora_38": { "os_name": "Fedora Linux", @@ -15,7 +15,7 @@ "kernel": "6.2.9-300.fc38", "os_version": "38", "image": "Fedora-Cloud-Base-38.x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "amazon_4.14": { "os_name": "Amazon Linux", @@ -23,23 +23,23 @@ "kernel": "4.14.314-237.533.amzn2", "os_version": "2", "image": "amzn2-x86_64-4.14.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "amazon_5.10": { "os_name": "Amazon Linux", "os_id": "amzn", - "kernel": "5.10.219-208.866.amzn2", + "kernel": "5.10.226-214.879.amzn2", "os_version": "2", "image": "amzn2-x86_64-5.10.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "amazon_5.4": { "os_name": "Amazon Linux", "os_id": "amzn", - "kernel": "5.4.277-190.375.amzn2", + "kernel": "5.4.284-196.380.amzn2", "os_version": "2", "image": "amzn2-x86_64-5.4.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "amazon_2023": { "os_name": "Amazon Linux", @@ -47,7 +47,7 @@ "kernel": "6.1.77-99.164.amzn2023", "os_version": "2023", "image": "amzn2023-amd64-2023.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "centos_7.9": { "os_name": "CentOS Linux", @@ -55,7 +55,7 @@ "kernel": "3.10.0-1160.80.1.el7", "os_version": "7.9.2009", "image": "centos-7.9-x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "centos_8": { "os_name": "CentOS Stream", @@ -63,15 +63,15 @@ "kernel": "4.18.0-552.3.1.el8", "os_version": "8", "image": "centos-8-x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "debian_10": { "os_name": "Debian GNU/Linux", "os_id": "debian", - "kernel": "4.19.0-26", + "kernel": "4.19.0-27", "os_version": "10", "image": "debian-10-generic-x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "buster" ] @@ -79,10 +79,10 @@ "debian_11": { "os_name": "Debian GNU/Linux", "os_id": "debian", - "kernel": "5.10.0-28", + "kernel": "5.10.0-32", "os_version": "11", "image": "debian-11-generic-x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "bullseye" ] @@ -90,10 +90,10 @@ "debian_12": { "os_name": "Debian GNU/Linux", "os_id": "debian", - "kernel": "6.1.0-18", + "kernel": "6.1.0-25", "os_version": "12", "image": "debian-12-generic-x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "bookworm" ] @@ -104,7 +104,7 @@ "kernel": "3.10.0-1160.105.1.0.1.el7", "os_version": "7.9", "image": "oracle-7.9-x86_64.qcow.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "oracle_8.9": { "os_name": "Oracle Linux Server", @@ -112,7 +112,7 @@ "kernel": "5.15.0-200.131.27.el8uek", "os_version": "8.9", "image": "oracle-8.9-x86_64.qcow.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "oracle_9.3": { "os_name": "Oracle Linux Server", @@ -120,7 +120,7 @@ "kernel": "5.15.0-200.131.27.el9uek", "os_version": "9.3", "image": "oracle-9.3-x86_64.qcow.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "rocky_8.5": { "os_name": "Rocky Linux", @@ -128,7 +128,7 @@ "kernel": "4.18.0-348.el8.0.2", "os_version": "8.5", "image": "rocky-8.5-x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "rocky_9.3": { "os_name": "Rocky Linux", @@ -136,7 +136,7 @@ "kernel": "5.14.0-362.8.1.el9_3", "os_version": "9.3", "image": "rocky-9.3-x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "ubuntu_16.04": { "os_name": "Ubuntu", @@ -144,7 +144,7 @@ "kernel": "4.4.0-210-generic", "os_version": "16.04", "image": "ubuntu-16.04-x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "xenial" ] @@ -155,7 +155,7 @@ "kernel": "4.18.0-25-generic", "os_version": "18.04", "image": "ubuntu-18.04-x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "bionic" ] @@ -166,7 +166,7 @@ "kernel": "5.4.0-167-generic", "os_version": "20.04", "image": "ubuntu-20.04-x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "focal" ] @@ -177,7 +177,7 @@ "kernel": "5.15.0-91-generic", "os_version": "22.04", "image": "ubuntu-22.04-x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "jammy" ] @@ -185,10 +185,10 @@ "ubuntu_23.10": { "os_name": "Ubuntu", "os_id": "ubuntu", - "kernel": "6.5.0-9-generic", + "kernel": "6.5.0-44-generic", "os_version": "23.10", "image": "ubuntu-23.10-x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "mantic" ] @@ -199,7 +199,7 @@ "kernel": "6.8.0-31-generic", "os_version": "24.04", "image": "ubuntu-24.04-x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "noble" ] @@ -210,23 +210,23 @@ "kernel": "5.3.18-150300.59.106.1", "os_version": "15.3", "image": "opensuse-15.3-x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "opensuse_15.5": { "os_name": "openSUSE Leap", "os_id": "opensuse-leap", - "kernel": "5.14.21-150500.55.68.1", + "kernel": "5.14.21-150500.55.80.2", "os_version": "15.5", "image": "opensuse-15.5-x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "suse_12.5": { "os_name": "SLES", "os_id": "sles", - "kernel": "4.12.14-122.219.1", + "kernel": "4.12.14-122.228.1", "os_version": "12.5", "image": "suse-12.5-x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "debian_9": { "os_name": "Debian GNU/Linux", @@ -234,7 +234,7 @@ "kernel": "4.9.0-19", "os_version": "9", "image": "debian-9-generic-x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "stretch" ] @@ -245,7 +245,7 @@ "kernel": "6.8.5-301.fc40", "os_version": "40", "image": "Fedora-Cloud-Base-40.x86_64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" } }, "arm64": { @@ -255,7 +255,7 @@ "kernel": "6.0.7-301.fc37", "os_version": "37", "image": "Fedora-Cloud-Base-37.arm64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "fedora_38": { "os_name": "Fedora Linux", @@ -263,7 +263,7 @@ "kernel": "6.2.9-300.fc38", "os_version": "38", "image": "Fedora-Cloud-Base-38.arm64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "amazon_4.14": { "os_name": "Amazon Linux", @@ -271,15 +271,15 @@ "kernel": "4.14.314-237.533.amzn2", "os_version": "2", "image": "amzn2-arm64-4.14.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "amazon_5.4": { "os_name": "Amazon Linux", "os_id": "amzn", - "kernel": "5.4.277-190.375.amzn2", + "kernel": "5.4.284-196.380.amzn2", "os_version": "2", "image": "amzn2-arm64-5.4.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "centos_7.9": { "os_name": "CentOS Linux", @@ -287,7 +287,7 @@ "kernel": "4.18.0-348.20.1.el7", "os_version": "7.9.2009", "image": "centos-7.9-arm64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "centos_8": { "os_name": "CentOS Stream", @@ -295,15 +295,15 @@ "kernel": "4.18.0-552.3.1.el8", "os_version": "8", "image": "centos-8-arm64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "debian_10": { "os_name": "Debian GNU/Linux", "os_id": "debian", - "kernel": "4.19.0-26", + "kernel": "4.19.0-27", "os_version": "10", "image": "debian-10-generic-arm64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "buster" ] @@ -311,10 +311,10 @@ "debian_11": { "os_name": "Debian GNU/Linux", "os_id": "debian", - "kernel": "5.10.0-28", + "kernel": "5.10.0-32", "os_version": "11", "image": "debian-11-generic-arm64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "bullseye" ] @@ -322,10 +322,10 @@ "debian_12": { "os_name": "Debian GNU/Linux", "os_id": "debian", - "kernel": "6.1.0-18", + "kernel": "6.1.0-25", "os_version": "12", "image": "debian-12-generic-arm64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "bookworm" ] @@ -336,7 +336,7 @@ "kernel": "5.15.0-200.131.27.el8uek", "os_version": "8.9", "image": "oracle-8.9-arm64.qcow.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "oracle_9.3": { "os_name": "Oracle Linux Server", @@ -344,7 +344,7 @@ "kernel": "5.15.0-200.131.27.el9uek", "os_version": "9.3", "image": "oracle-9.3-arm64.qcow.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "rocky_8.5": { "os_name": "Rocky Linux", @@ -352,7 +352,7 @@ "kernel": "4.18.0-348.el8.0.2", "os_version": "8.5", "image": "rocky-8.5-arm64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "rocky_9.3": { "os_name": "Rocky Linux", @@ -360,15 +360,15 @@ "kernel": "5.14.0-362.8.1.el9_3", "os_version": "9.3", "image": "rocky-9.3-arm64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "amazon_5.10": { "os_name": "Amazon Linux", "os_id": "amzn", - "kernel": "5.10.219-208.866.amzn2", + "kernel": "5.10.226-214.879.amzn2", "os_version": "2", "image": "amzn2-arm64-5.10.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "amazon_2023": { "os_name": "Amazon Linux", @@ -376,7 +376,7 @@ "kernel": "6.1.77-99.164.amzn2023", "os_version": "2023", "image": "amzn2023-arm64-2023.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "ubuntu_18.04": { "os_name": "Ubuntu", @@ -384,7 +384,7 @@ "kernel": "4.18.0-25-generic", "os_version": "18.04", "image": "ubuntu-18.04-arm64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "bionic" ] @@ -395,7 +395,7 @@ "kernel": "5.4.0-167-generic", "os_version": "20.04", "image": "ubuntu-20.04-arm64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "focal" ] @@ -406,7 +406,7 @@ "kernel": "5.15.0-91-generic", "os_version": "22.04", "image": "ubuntu-22.04-arm64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "jammy" ] @@ -414,10 +414,10 @@ "ubuntu_23.10": { "os_name": "Ubuntu", "os_id": "ubuntu", - "kernel": "6.5.0-9-generic", + "kernel": "6.5.0-44-generic", "os_version": "23.10", "image": "ubuntu-23.10-arm64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "mantic" ] @@ -428,7 +428,7 @@ "kernel": "6.8.0-31-generic", "os_version": "24.04", "image": "ubuntu-24.04-arm64.qcow2.xz", - "image_version": "20240710_cd40ed99", + "image_version": "20241003_a9a46356", "alt_version_names": [ "noble" ] @@ -439,23 +439,23 @@ "kernel": "5.3.18-150300.59.106.1", "os_version": "15.3", "image": "opensuse-15.3-arm64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "opensuse_15.5": { "os_name": "openSUSE Leap", "os_id": "opensuse-leap", - "kernel": "5.14.21-150500.55.68.1", + "kernel": "5.14.21-150500.55.80.2", "os_version": "15.5", "image": "opensuse-15.5-arm64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "suse_12.5": { "os_name": "SLES", "os_id": "sles", - "kernel": "4.12.14-122.219.1", + "kernel": "4.12.14-122.228.1", "os_version": "12.5", "image": "suse-12.5-arm64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" }, "fedora_40": { "os_name": "Fedora Linux", @@ -463,7 +463,7 @@ "kernel": "6.8.5-301.fc40", "os_version": "40", "image": "Fedora-Cloud-Base-40.arm64.qcow2.xz", - "image_version": "20240710_cd40ed99" + "image_version": "20241003_a9a46356" } } } \ No newline at end of file diff --git a/test/new-e2e/system-probe/test-runner/files/all_tests.json b/test/new-e2e/system-probe/test-runner/files/all_tests.json deleted file mode 100644 index d19097180afab..0000000000000 --- a/test/new-e2e/system-probe/test-runner/files/all_tests.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "*": { - "exclude": false - } -} diff --git a/test/new-e2e/system-probe/test-runner/files/cws_docker.json b/test/new-e2e/system-probe/test-runner/files/cws_docker.json new file mode 100644 index 0000000000000..c445dbc9b193c --- /dev/null +++ b/test/new-e2e/system-probe/test-runner/files/cws_docker.json @@ -0,0 +1,8 @@ +{ + "filters": { + "*": { + "exclude": false + } + }, + "testcontainer": "ghcr.io/datadog/apps-cws-centos7:main" +} diff --git a/test/new-e2e/system-probe/test-runner/files/cws_host.json b/test/new-e2e/system-probe/test-runner/files/cws_host.json new file mode 100644 index 0000000000000..03ac2f0fc2aeb --- /dev/null +++ b/test/new-e2e/system-probe/test-runner/files/cws_host.json @@ -0,0 +1,7 @@ +{ + "filters": { + "*": { + "exclude": false + } + } +} diff --git a/test/new-e2e/system-probe/test-runner/files/no_usm.json b/test/new-e2e/system-probe/test-runner/files/no_usm.json index f700502621fd3..60dcef477454a 100644 --- a/test/new-e2e/system-probe/test-runner/files/no_usm.json +++ b/test/new-e2e/system-probe/test-runner/files/no_usm.json @@ -1,8 +1,10 @@ { - "pkg/network/usm": { - "exclude": true - }, - "*": { - "exclude": false + "filters": { + "pkg/network/usm": { + "exclude": true + }, + "*": { + "exclude": false + } } } diff --git a/test/new-e2e/system-probe/test-runner/files/only_usm.json b/test/new-e2e/system-probe/test-runner/files/only_usm.json index 42ee8200ecf42..d63d56fbd9617 100644 --- a/test/new-e2e/system-probe/test-runner/files/only_usm.json +++ b/test/new-e2e/system-probe/test-runner/files/only_usm.json @@ -1,5 +1,7 @@ { - "pkg/network/usm": { - "exclude": false + "filters": { + "pkg/network/usm": { + "exclude": false + } } } diff --git a/test/new-e2e/system-probe/test-runner/main.go b/test/new-e2e/system-probe/test-runner/main.go index a7b21754bd50e..4d9c993406ce1 100644 --- a/test/new-e2e/system-probe/test-runner/main.go +++ b/test/new-e2e/system-probe/test-runner/main.go @@ -49,6 +49,12 @@ type testConfig struct { testingTools string extraParams string extraEnv string + inContainerImage string +} + +type userProvidedConfig struct { + PackagesRunConfig map[string]packageRunConfiguration `json:"filters"` + InContainerImage string `json:"testcontainer"` } const ciVisibility = "/ci-visibility" @@ -119,7 +125,7 @@ func glob(dir, filePattern string, filterFn func(path string) bool) ([]string, e return matches, nil } -func buildCommandArgs(pkg string, xmlpath string, jsonpath string, file string, testConfig *testConfig) []string { +func buildCommandArgs(pkg string, xmlpath string, jsonpath string, testArgs []string, testConfig *testConfig) []string { verbosity := "testname" if testConfig.verbose { verbosity = "standard-verbose" @@ -132,8 +138,15 @@ func buildCommandArgs(pkg string, xmlpath string, jsonpath string, file string, fmt.Sprintf("--rerun-fails=%d", testConfig.retryCount), "--rerun-fails-max-failures=100", "--raw-command", "--", - filepath.Join(testConfig.testingTools, "go/bin/test2json"), "-t", "-p", pkg, file, "-test.v", fmt.Sprintf("-test.count=%d", testConfig.runCount), "-test.timeout=" + getTimeout(pkg).String(), + filepath.Join(testConfig.testingTools, "go/bin/test2json"), "-t", "-p", pkg, } + args = append(args, testArgs...) + args = append( + args, + "-test.v", + fmt.Sprintf("-test.count=%d", testConfig.runCount), + "-test.timeout="+getTimeout(pkg).String(), + ) if testConfig.extraParams != "" { args = append(args, strings.Split(testConfig.extraParams, " ")...) @@ -213,6 +226,20 @@ func testPass(testConfig *testConfig, props map[string]string) error { } } + buildDir, err := getEBPFBuildDir() + if err != nil { + return fmt.Errorf("getEBPFBuildDir: %w", err) + } + bpfDir := filepath.Join(testConfig.testDirRoot, buildDir) + + var testContainer *testContainer + if testConfig.inContainerImage != "" { + testContainer = newTestContainer(testConfig.inContainerImage, bpfDir) + if err := testContainer.start(); err != nil { + return fmt.Errorf("error creating test container: %w", err) + } + } + for _, testsuite := range testsuites { pkg, err := filepath.Rel(testConfig.testDirRoot, filepath.Dir(testsuite)) if err != nil { @@ -221,17 +248,19 @@ func testPass(testConfig *testConfig, props map[string]string) error { junitfilePrefix := strings.ReplaceAll(pkg, "/", "-") xmlpath := filepath.Join(xmlDir, fmt.Sprintf("%s.xml", junitfilePrefix)) jsonpath := filepath.Join(jsonDir, fmt.Sprintf("%s.json", junitfilePrefix)) - args := buildCommandArgs(pkg, xmlpath, jsonpath, testsuite, testConfig) + + testsuiteArgs := []string{testsuite} + if testContainer != nil { + testsuiteArgs = testContainer.buildDockerExecArgs(testsuite, "--env", "docker") + } + + args := buildCommandArgs(pkg, xmlpath, jsonpath, testsuiteArgs, testConfig) cmd := exec.Command(filepath.Join(testConfig.testingTools, "go/bin/gotestsum"), args...) - buildDir, err := getEBPFBuildDir() - if err != nil { - return fmt.Errorf("getEBPFBuildDir: %w", err) - } baseEnv = append( baseEnv, - "DD_SYSTEM_PROBE_BPF_DIR="+filepath.Join(testConfig.testDirRoot, buildDir), + "DD_SYSTEM_PROBE_BPF_DIR="+bpfDir, "DD_SERVICE_MONITORING_CONFIG_TLS_JAVA_DIR="+filepath.Join(testConfig.testDirRoot, "pkg/network/protocols/tls/java"), ) if testConfig.extraEnv != "" { @@ -284,7 +313,7 @@ func buildTestConfiguration() (*testConfig, error) { flag.Parse() - breakdown := make(map[string]packageRunConfiguration) + var userConfig userProvidedConfig if *packageRunConfigPtr != "" { configData, err := os.ReadFile(*packageRunConfigPtr) if err != nil { @@ -294,7 +323,7 @@ func buildTestConfiguration() (*testConfig, error) { dec := json.NewDecoder(bytes.NewReader(configData)) dec.DisallowUnknownFields() - if err := dec.Decode(&breakdown); err != nil { + if err := dec.Decode(&userConfig); err != nil { return nil, err } } @@ -314,11 +343,12 @@ func buildTestConfiguration() (*testConfig, error) { runCount: *runCount, verbose: *verbose, retryCount: *retryPtr, - packagesRunConfig: breakdown, + packagesRunConfig: userConfig.PackagesRunConfig, testDirRoot: root, testingTools: tools, extraParams: *extraParams, extraEnv: *extraEnv, + inContainerImage: userConfig.InContainerImage, }, nil } diff --git a/test/new-e2e/system-probe/test-runner/testcontainer.go b/test/new-e2e/system-probe/test-runner/testcontainer.go new file mode 100644 index 0000000000000..1901432a296c0 --- /dev/null +++ b/test/new-e2e/system-probe/test-runner/testcontainer.go @@ -0,0 +1,95 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2016-present Datadog, Inc. + +//go:build linux + +package main + +import ( + "fmt" + "os" + "os/exec" +) + +const containerName = "kmt-test-container" + +type testContainer struct { + image string + bpfDir string +} + +func newTestContainer(image, bpfDir string) *testContainer { + return &testContainer{ + image: image, + bpfDir: bpfDir, + } +} + +func (ctc *testContainer) runDockerCmd(args []string) error { + cmd := exec.Command("docker", args...) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + return cmd.Run() +} + +func (ctc *testContainer) start() error { + args := []string{ + "run", + "--name", containerName, + "--privileged", + "--detach", + } + + var capabilities = []string{"SYS_ADMIN", "SYS_RESOURCE", "SYS_PTRACE", "NET_ADMIN", "IPC_LOCK", "ALL"} + for _, cap := range capabilities { + args = append(args, "--cap-add", cap) + } + + var mounts = []string{ + "/dev:/dev", + "/proc:/host/proc", + "/etc:/host/etc", + "/sys:/host/sys", + "/etc/os-release:/host/etc/os-release", + "/usr/lib/os-release:/host/usr/lib/os-release", + "/etc/passwd:/etc/passwd", + "/etc/group:/etc/group", + "/opt/datadog-agent/embedded/:/opt/datadog-agent/embedded/", + "/opt/kmt-ramfs:/opt/kmt-ramfs", + fmt.Sprintf("%s:/opt/bpf", ctc.bpfDir), + } + for _, mount := range mounts { + args = append(args, "-v", mount) + } + + var envs = []string{ + "HOST_PROC=/host/proc", + "HOST_ETC=/host/etc", + "HOST_SYS=/host/sys", + "DD_SYSTEM_PROBE_BPF_DIR=/opt/bpf", + } + for _, env := range envs { + args = append(args, "-e", env) + } + + // create container + args = append(args, ctc.image) // image tag + args = append(args, "sleep", "infinity") + if err := ctc.runDockerCmd(args); err != nil { + return fmt.Errorf("run docker: %s", err) + } + + // mount debugfs + args = []string{"exec", containerName, "mount", "-t", "debugfs", "none", "/sys/kernel/debug"} + if err := ctc.runDockerCmd(args); err != nil { + return fmt.Errorf("run docker: %w", err) + } + + return nil +} + +func (ctc *testContainer) buildDockerExecArgs(args ...string) []string { + return append([]string{"docker", "exec", containerName}, args...) +} diff --git a/test/new-e2e/tests/agent-platform/platforms/platforms.json b/test/new-e2e/tests/agent-platform/platforms/platforms.json index a0aee09367140..6af9b65dafb02 100644 --- a/test/new-e2e/tests/agent-platform/platforms/platforms.json +++ b/test/new-e2e/tests/agent-platform/platforms/platforms.json @@ -3,12 +3,12 @@ "x86_64": { "debian-9": "ami-0182559468c1975fe", "debian-10": "ami-067a196d70cb53732", - "debian-11": "ami-0607e701db389efe7", - "debian-12": "ami-07edaec601cf2b6d3" + "debian-11": "ami-0698acab5370075a9", + "debian-12": "ami-0eef9d92ec044bc94" }, "arm64": { "debian-10": "ami-0b6ee4b8f4aa91fb4", - "debian-11": "ami-00988b9ead6afb0b1", + "debian-11": "ami-0eec63b0513577808", "debian-12": "ami-02aab8d5301cb8d68" } }, @@ -63,8 +63,8 @@ }, "suse": { "x86_64": { - "sles-12": "ami-08d21b039336d9351", - "sles-15": "ami-08f3662e2d5b3989a" + "sles-12": "ami-058c3f61e5f37c43f", + "sles-15": "ami-067dfda331f8296b0" }, "arm64": { "sles-15": "ami-0d446ba26bbe19573" diff --git a/test/new-e2e/tests/agent-platform/step-by-step/step_by_step_test.go b/test/new-e2e/tests/agent-platform/step-by-step/step_by_step_test.go index fcec9ed915b38..01ba9d04182a5 100644 --- a/test/new-e2e/tests/agent-platform/step-by-step/step_by_step_test.go +++ b/test/new-e2e/tests/agent-platform/step-by-step/step_by_step_test.go @@ -262,8 +262,8 @@ func (is *stepByStepSuite) StepByStepSuseTest(VMclient *common.TestClient) { var err error // Disable all existing non-datadog repos to avoid issues during refresh (which is hard to prevent zypper from doing spontaneously); - // we don't need them to install the Agent anyway - ExecuteWithoutError(nil, VMclient, "sudo rm /etc/zypp/repos.d/*.repo") + // we don't need them to install the Agent anyway. + ExecuteWithoutError(nil, VMclient, "sudo rm -f /etc/zypp/repos.d/*.repo") fileContent := fmt.Sprintf("[datadog]\n"+ "name = Datadog, Inc.\n"+ diff --git a/test/new-e2e/tests/agent-shared-components/config-refresh/non_core_agents_sync_win_test.go b/test/new-e2e/tests/agent-shared-components/config-refresh/non_core_agents_sync_win_test.go index 7745859ee3e3d..5499a802a5e65 100644 --- a/test/new-e2e/tests/agent-shared-components/config-refresh/non_core_agents_sync_win_test.go +++ b/test/new-e2e/tests/agent-shared-components/config-refresh/non_core_agents_sync_win_test.go @@ -16,7 +16,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/DataDog/datadog-agent/pkg/util/testutil/flake" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/e2e" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments" awshost "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments/aws/host" @@ -30,9 +29,6 @@ type configRefreshWindowsSuite struct { } func TestConfigRefreshWindowsSuite(t *testing.T) { - // WINA-1014 - flake.Mark(t) - t.Parallel() e2e.Run(t, &configRefreshWindowsSuite{}, e2e.WithProvisioner(awshost.Provisioner(awshost.WithEC2InstanceOptions(ec2.WithOS(os.WindowsDefault))))) } diff --git a/test/new-e2e/tests/agent-shared-components/secret/secret_win_test.go b/test/new-e2e/tests/agent-shared-components/secret/secret_win_test.go index 53d9f4abe4836..0528334d553c0 100644 --- a/test/new-e2e/tests/agent-shared-components/secret/secret_win_test.go +++ b/test/new-e2e/tests/agent-shared-components/secret/secret_win_test.go @@ -16,7 +16,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/DataDog/datadog-agent/pkg/util/testutil/flake" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/e2e" awshost "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments/aws/host" secrets "github.com/DataDog/datadog-agent/test/new-e2e/tests/agent-shared-components/secretsutils" @@ -27,9 +26,6 @@ type windowsRuntimeSecretSuite struct { } func TestWindowsRuntimeSecretSuite(t *testing.T) { - // WINA-1014 - flake.Mark(t) - t.Parallel() e2e.Run(t, &windowsRuntimeSecretSuite{}, e2e.WithProvisioner(awshost.Provisioner( awshost.WithEC2InstanceOptions(ec2.WithOS(os.WindowsDefault)), diff --git a/test/new-e2e/tests/agent-subcommands/check/check_common_test.go b/test/new-e2e/tests/agent-subcommands/check/check_common_test.go index 59db2a49022c2..b117050474fa0 100644 --- a/test/new-e2e/tests/agent-subcommands/check/check_common_test.go +++ b/test/new-e2e/tests/agent-subcommands/check/check_common_test.go @@ -7,19 +7,26 @@ package check import ( + _ "embed" "fmt" + "github.com/stretchr/testify/assert" + "github.com/DataDog/datadog-agent/test/new-e2e/pkg/e2e" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/utils/e2e/client/agentclient" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) type baseCheckSuite struct { e2e.BaseSuite[environments.Host] } +//go:embed fixtures/hello.yaml +var customCheckYaml []byte + +//go:embed fixtures/hello.py +var customCheckPython []byte + func (v *baseCheckSuite) TestCheckDisk() { check := v.Env().Agent.Client.Check(agentclient.WithArgs([]string{"disk"})) @@ -43,8 +50,7 @@ func (v *baseCheckSuite) TestCustomCheck() { func (v *baseCheckSuite) TestCheckRate() { check := v.Env().Agent.Client.Check(agentclient.WithArgs([]string{"hello", "--check-rate", "--json"})) - data := parseCheckOutput([]byte(check)) - require.NotNil(v.T(), data) + data := parseCheckOutput(v.T(), []byte(check)) metrics := data[0].Aggregator.Metrics @@ -59,8 +65,7 @@ func (v *baseCheckSuite) TestCheckTimes() { times := 10 check := v.Env().Agent.Client.Check(agentclient.WithArgs([]string{"hello", "--check-times", fmt.Sprint(times), "--json"})) - data := parseCheckOutput([]byte(check)) - require.NotNil(v.T(), data) + data := parseCheckOutput(v.T(), []byte(check)) metrics := data[0].Aggregator.Metrics diff --git a/test/new-e2e/tests/agent-subcommands/check/check_nix_test.go b/test/new-e2e/tests/agent-subcommands/check/check_nix_test.go index 92e80c401a72e..253ecc8075cc3 100644 --- a/test/new-e2e/tests/agent-subcommands/check/check_nix_test.go +++ b/test/new-e2e/tests/agent-subcommands/check/check_nix_test.go @@ -7,7 +7,6 @@ package check import ( - _ "embed" "testing" "github.com/DataDog/test-infra-definitions/components/datadog/agentparams" @@ -22,12 +21,6 @@ type linuxCheckSuite struct { baseCheckSuite } -//go:embed fixtures/hello.yaml -var customCheckYaml []byte - -//go:embed fixtures/hello.py -var customCheckPython []byte - func TestLinuxCheckSuite(t *testing.T) { t.Parallel() e2e.Run(t, &linuxCheckSuite{}, e2e.WithProvisioner(awshost.ProvisionerNoFakeIntake(awshost.WithAgentOptions( diff --git a/test/new-e2e/tests/agent-subcommands/check/check_win_test.go b/test/new-e2e/tests/agent-subcommands/check/check_win_test.go index 123a2442cc13a..383663c37f0e6 100644 --- a/test/new-e2e/tests/agent-subcommands/check/check_win_test.go +++ b/test/new-e2e/tests/agent-subcommands/check/check_win_test.go @@ -22,7 +22,6 @@ type windowsCheckSuite struct { } func TestWindowsCheckSuite(t *testing.T) { - t.Skip("not working because of the following error: unable to import module 'hello': source code string cannot contain null bytes") t.Parallel() e2e.Run(t, &windowsCheckSuite{}, e2e.WithProvisioner( awshost.ProvisionerNoFakeIntake( @@ -30,5 +29,7 @@ func TestWindowsCheckSuite(t *testing.T) { awshost.WithAgentOptions( agentparams.WithFile("C:/ProgramData/Datadog/conf.d/hello.d/conf.yaml", string(customCheckYaml), true), agentparams.WithFile("C:/ProgramData/Datadog/checks.d/hello.py", string(customCheckPython), true), - )))) + ), + ), + )) } diff --git a/test/new-e2e/tests/agent-subcommands/check/parse.go b/test/new-e2e/tests/agent-subcommands/check/parse.go index 36b665c36c471..dac78070b1deb 100644 --- a/test/new-e2e/tests/agent-subcommands/check/parse.go +++ b/test/new-e2e/tests/agent-subcommands/check/parse.go @@ -6,7 +6,11 @@ package check import ( + "bytes" "encoding/json" + "testing" + + "github.com/stretchr/testify/require" ) type root struct { @@ -27,11 +31,17 @@ type metric struct { Type string `json:"type"` } -func parseCheckOutput(check []byte) []root { +func parseCheckOutput(t *testing.T, check []byte) []root { + // On Windows a warning is printed when running the check command with the wrong user + // This warning is not part of the JSON output and needs to be ignored when parsing + startIdx := bytes.IndexAny(check, "[{") + require.NotEqual(t, -1, startIdx, "Failed to find start of JSON output in check output: %v", string(check)) + + check = check[startIdx:] + var data []root - if err := json.Unmarshal([]byte(check), &data); err != nil { - return nil - } + err := json.Unmarshal([]byte(check), &data) + require.NoErrorf(t, err, "Failed to unmarshal check output: %v", string(check)) return data } diff --git a/test/new-e2e/tests/agent-subcommands/hostname/hostname_ec2_win_test.go b/test/new-e2e/tests/agent-subcommands/hostname/hostname_ec2_win_test.go index 8f527460691ad..3429569e29e7a 100644 --- a/test/new-e2e/tests/agent-subcommands/hostname/hostname_ec2_win_test.go +++ b/test/new-e2e/tests/agent-subcommands/hostname/hostname_ec2_win_test.go @@ -13,7 +13,6 @@ import ( "github.com/DataDog/test-infra-definitions/scenarios/aws/ec2" "github.com/stretchr/testify/assert" - "github.com/DataDog/datadog-agent/pkg/util/testutil/flake" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/e2e" awshost "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments/aws/host" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/utils/e2e/client" @@ -24,9 +23,6 @@ type windowsHostnameSuite struct { } func TestWindowsHostnameSuite(t *testing.T) { - // WINA-1014 - flake.Mark(t) - t.Parallel() osOption := awshost.WithEC2InstanceOptions(ec2.WithOS(os.WindowsDefault)) e2e.Run(t, &windowsHostnameSuite{baseHostnameSuite: baseHostnameSuite{osOption: osOption}}, e2e.WithProvisioner(awshost.ProvisionerNoFakeIntake(osOption))) diff --git a/test/new-e2e/tests/agent-subcommands/secret/secret_win_test.go b/test/new-e2e/tests/agent-subcommands/secret/secret_win_test.go index 460c8bd4d88ca..d4e099410dda6 100644 --- a/test/new-e2e/tests/agent-subcommands/secret/secret_win_test.go +++ b/test/new-e2e/tests/agent-subcommands/secret/secret_win_test.go @@ -16,7 +16,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/DataDog/datadog-agent/pkg/util/testutil/flake" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/e2e" awshost "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments/aws/host" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/utils/e2e/client/agentclient" @@ -28,8 +27,6 @@ type windowsSecretSuite struct { } func TestWindowsSecretSuite(t *testing.T) { - // WINA-1014 - flake.Mark(t) t.Parallel() e2e.Run(t, &windowsSecretSuite{}, e2e.WithProvisioner(awshost.Provisioner(awshost.WithEC2InstanceOptions(ec2.WithOS(os.WindowsDefault))))) } diff --git a/test/new-e2e/tests/apm/vm_test.go b/test/new-e2e/tests/apm/vm_test.go index 520366ed9cad7..c84fd40d2b8d6 100644 --- a/test/new-e2e/tests/apm/vm_test.go +++ b/test/new-e2e/tests/apm/vm_test.go @@ -406,7 +406,6 @@ func (s *VMFakeintakeSuite) logJournal(force bool) { } func (s *VMFakeintakeSuite) TestAPIKeyRefresh() { - s.T().Skip("Skipping this flaking test while we investigate the cause") apiKey1 := strings.Repeat("1", 32) apiKey2 := strings.Repeat("2", 32) @@ -424,13 +423,15 @@ func (s *VMFakeintakeSuite) TestAPIKeyRefresh() { api_key: ENC[api_key] log_level: debug -secret_refresh_interval: 5 secret_backend_command: %s secret_backend_arguments: - %s secret_backend_remove_trailing_line_break: true secret_backend_command_allow_group_exec_perm: true +agent_ipc: + port: 5004 + config_refresh_interval: 5 `, secretResolverPath, rootDir) s.UpdateEnv(awshost.Provisioner( diff --git a/test/new-e2e/tests/containers/ecs_test.go b/test/new-e2e/tests/containers/ecs_test.go index 55c4dd15f12b4..ab48a7fbb367e 100644 --- a/test/new-e2e/tests/containers/ecs_test.go +++ b/test/new-e2e/tests/containers/ecs_test.go @@ -13,6 +13,7 @@ import ( "testing" "time" + ecsComp "github.com/DataDog/test-infra-definitions/components/ecs" "github.com/DataDog/test-infra-definitions/scenarios/aws/ecs" "github.com/DataDog/datadog-agent/pkg/util/pointer" @@ -77,7 +78,12 @@ func (suite *ecsSuite) SetupSuite() { suite.Require().NoError(fakeintake.Init(suite)) suite.Fakeintake = fakeintake.Client() - suite.ecsClusterName = stackOutput.Outputs["ecs-cluster-name"].Value.(string) + clusterSerialized, err := json.Marshal(stackOutput.Outputs["dd-Cluster-ecs"].Value) + suite.Require().NoError(err) + ecsCluster := &ecsComp.ClusterOutput{} + suite.Require().NoError(ecsCluster.Import(clusterSerialized, ecsCluster)) + + suite.ecsClusterName = ecsCluster.ClusterName suite.clusterName = suite.ecsClusterName suite.baseSuite.SetupSuite() diff --git a/test/new-e2e/tests/containers/eks_test.go b/test/new-e2e/tests/containers/eks_test.go index 5f7829eee8d51..6562eff6abb80 100644 --- a/test/new-e2e/tests/containers/eks_test.go +++ b/test/new-e2e/tests/containers/eks_test.go @@ -14,6 +14,7 @@ import ( "github.com/DataDog/datadog-agent/test/new-e2e/pkg/components" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/runner" + "github.com/DataDog/datadog-agent/test/new-e2e/pkg/runner/parameters" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/utils/infra" "github.com/pulumi/pulumi/sdk/v3/go/auto" @@ -23,10 +24,16 @@ import ( type eksSuite struct { k8sSuite + initOnly bool } func TestEKSSuite(t *testing.T) { - suite.Run(t, &eksSuite{}) + var initOnly bool + initOnlyParam, err := runner.GetProfile().ParamStore().GetBoolWithDefault(parameters.InitOnly, false) + if err == nil { + initOnly = initOnlyParam + } + suite.Run(t, &eksSuite{initOnly: initOnly}) } func (suite *eksSuite) SetupSuite() { @@ -56,6 +63,10 @@ func (suite *eksSuite) SetupSuite() { suite.T().FailNow() } + if suite.initOnly { + suite.T().Skip("E2E_INIT_ONLY is set, skipping tests") + } + fakeintake := &components.FakeIntake{} fiSerialized, err := json.Marshal(stackOutput.Outputs["dd-Fakeintake-aws-ecs"].Value) suite.Require().NoError(err) @@ -64,7 +75,7 @@ func (suite *eksSuite) SetupSuite() { suite.Fakeintake = fakeintake.Client() kubeCluster := &components.KubernetesCluster{} - kubeSerialized, err := json.Marshal(stackOutput.Outputs["dd-Cluster-aws-eks"].Value) + kubeSerialized, err := json.Marshal(stackOutput.Outputs["dd-Cluster-eks"].Value) suite.Require().NoError(err) suite.Require().NoError(kubeCluster.Import(kubeSerialized, &kubeCluster)) suite.Require().NoError(kubeCluster.Init(suite)) @@ -84,6 +95,11 @@ func (suite *eksSuite) SetupSuite() { } func (suite *eksSuite) TearDownSuite() { + if suite.initOnly { + suite.T().Logf("E2E_INIT_ONLY is set, skipping deletion") + return + } + suite.k8sSuite.TearDownSuite() ctx := context.Background() diff --git a/test/new-e2e/tests/containers/main_test.go b/test/new-e2e/tests/containers/main_test.go index dd3e39da50f9b..005e6e439b647 100644 --- a/test/new-e2e/tests/containers/main_test.go +++ b/test/new-e2e/tests/containers/main_test.go @@ -13,6 +13,7 @@ import ( "testing" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/runner" + "github.com/DataDog/datadog-agent/test/new-e2e/pkg/runner/parameters" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/utils/infra" ) @@ -20,7 +21,12 @@ var keepStacks = flag.Bool("keep-stacks", false, "Do not destroy the Pulumi stac func TestMain(m *testing.M) { code := m.Run() - if runner.GetProfile().AllowDevMode() && *keepStacks { + initOnly, err := runner.GetProfile().ParamStore().GetBoolWithDefault(parameters.InitOnly, false) + if err != nil { + fmt.Fprintln(os.Stderr, err) + } + + if runner.GetProfile().AllowDevMode() && *keepStacks || initOnly { fmt.Fprintln(os.Stderr, "Keeping stacks") } else { fmt.Fprintln(os.Stderr, "Cleaning up stacks") diff --git a/test/new-e2e/tests/gpu/gpu_test.go b/test/new-e2e/tests/gpu/gpu_test.go new file mode 100644 index 0000000000000..56a49051c8e46 --- /dev/null +++ b/test/new-e2e/tests/gpu/gpu_test.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2024-present Datadog, Inc. + +package gpu + +import ( + "encoding/json" + "flag" + "fmt" + "testing" + + "github.com/DataDog/test-infra-definitions/scenarios/aws/ec2" + + "github.com/DataDog/test-infra-definitions/components/datadog/agentparams" + "github.com/DataDog/test-infra-definitions/components/os" + + "github.com/DataDog/datadog-agent/test/new-e2e/pkg/e2e" + "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments" + awshost "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments/aws/host" + "github.com/DataDog/datadog-agent/test/new-e2e/pkg/utils/e2e/client/agentclient" +) + +var devMode = flag.Bool("devmode", false, "enable dev mode") + +type gpuSuite struct { + e2e.BaseSuite[environments.Host] +} + +const defaultGpuCheckConfig = ` +init_config: + min_collection_interval: 5 + +instances: + - {} +` + +const defaultSysprobeConfig = ` +gpu_monitoring: + enabled: true +` + +const vectorAddDockerImg = "nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda10.2" +const gpuEnabledAMI = "ami-0f71e237bb2ba34be" // Ubuntu 22.04 with GPU drivers + +// TestGPUSuite runs tests for the VM interface to ensure its implementation is correct. +func TestGPUSuite(t *testing.T) { + provisioner := awshost.Provisioner( + awshost.WithEC2InstanceOptions( + ec2.WithInstanceType("g4dn.xlarge"), + ec2.WithAMI(gpuEnabledAMI, os.Ubuntu2204, os.AMD64Arch), + ), + awshost.WithAgentOptions( + agentparams.WithIntegration("gpu.d", defaultGpuCheckConfig), + agentparams.WithSystemProbeConfig(defaultSysprobeConfig), + ), + awshost.WithDocker(), + ) + + suiteParams := []e2e.SuiteOption{e2e.WithProvisioner(provisioner)} + if *devMode { + suiteParams = append(suiteParams, e2e.WithDevMode()) + } + + e2e.Run(t, &gpuSuite{}, suiteParams...) +} + +func (v *gpuSuite) SetupSuite() { + v.BaseSuite.SetupSuite() + + v.Env().RemoteHost.MustExecute(fmt.Sprintf("docker pull %s", vectorAddDockerImg)) +} + +// TODO: Extract this to common package? service_discovery uses it too +type checkStatus struct { + CheckID string `json:"CheckID"` + CheckName string `json:"CheckName"` + CheckConfigSource string `json:"CheckConfigSource"` + ExecutionTimes []int `json:"ExecutionTimes"` + LastError string `json:"LastError"` +} + +type runnerStats struct { + Checks map[string]checkStatus `json:"Checks"` +} + +type collectorStatus struct { + RunnerStats runnerStats `json:"runnerStats"` +} + +func (v *gpuSuite) TestGPUCheckIsEnabled() { + statusOutput := v.Env().Agent.Client.Status(agentclient.WithArgs([]string{"collector", "--json"})) + + var status collectorStatus + err := json.Unmarshal([]byte(statusOutput.Content), &status) + v.Require().NoError(err, "failed to unmarshal agent status") + v.Require().Contains(status.RunnerStats.Checks, "gpu") + + gpuCheckStatus := status.RunnerStats.Checks["gpu"] + v.Require().Equal(gpuCheckStatus.LastError, "") +} diff --git a/test/new-e2e/tests/installer/unix/package_apm_inject_test.go b/test/new-e2e/tests/installer/unix/package_apm_inject_test.go index 389da3c392f3e..926a6210e00ef 100644 --- a/test/new-e2e/tests/installer/unix/package_apm_inject_test.go +++ b/test/new-e2e/tests/installer/unix/package_apm_inject_test.go @@ -54,6 +54,10 @@ func (s *packageApmInjectSuite) TestInstall() { state.AssertFileExists("/usr/bin/dd-host-install", 0755, "root", "root") state.AssertFileExists("/usr/bin/dd-container-install", 0755, "root", "root") state.AssertDirExists("/etc/datadog-agent/inject", 0755, "root", "root") + if s.os == e2eos.Ubuntu2204 || s.os == e2eos.Debian12 { + state.AssertDirExists("/etc/apparmor.d/abstractions/base.d", 0755, "root", "root") + state.AssertFileExists("/etc/apparmor.d/abstractions/base.d/datadog", 0644, "root", "root") + } s.assertLDPreloadInstrumented(injectOCIPath) s.assertSocketPath() s.assertDockerdInstrumented(injectOCIPath) @@ -78,6 +82,7 @@ func (s *packageApmInjectSuite) TestUninstall() { state := s.host.State() state.AssertPathDoesNotExist("/usr/bin/dd-host-install") state.AssertPathDoesNotExist("/usr/bin/dd-container-install") + state.AssertPathDoesNotExist("/etc/apparmor.d/abstractions/base.d/datadog") } func (s *packageApmInjectSuite) TestDockerAdditionalFields() { @@ -421,6 +426,23 @@ func (s *packageApmInjectSuite) TestInstallWithUmask() { s.TestInstall() } +func (s *packageApmInjectSuite) TestAppArmor() { + if s.os != e2eos.Ubuntu2204 && s.os != e2eos.Debian12 { + s.T().Skip("AppArmor not installed by default") + } + assert.Contains(s.T(), s.Env().RemoteHost.MustExecute("sudo aa-enabled"), "Yes") + s.RunInstallScript( + "DD_APM_INSTRUMENTATION_ENABLED=host", + "DD_APM_INSTRUMENTATION_LIBRARIES=python", + envForceInstall("datadog-agent"), + ) + defer s.Purge() + s.assertAppArmorProfile() + assert.Contains(s.T(), s.Env().RemoteHost.MustExecute("sudo aa-enabled"), "Yes") + res := s.Env().RemoteHost.MustExecute("sudo DD_APM_INSTRUMENTATION_DEBUG=true /usr/sbin/dhclient 2>&1") + assert.Contains(s.T(), res, "not injecting; on deny list") +} + func (s *packageApmInjectSuite) assertTraceReceived(traceID uint64) { found := assert.Eventually(s.T(), func() bool { tracePayloads, err := s.Env().FakeIntake.Client().GetTraces() @@ -495,6 +517,13 @@ func (s *packageApmInjectSuite) assertDockerdNotInstrumented() { assert.Equal(s.T(), runtimeConfig, "") } +func (s *packageApmInjectSuite) assertAppArmorProfile() { + content, err := s.host.ReadFile("/etc/apparmor.d/abstractions/base.d/datadog") + assert.NoError(s.T(), err) + assert.Equal(s.T(), string(content), "/opt/datadog-packages/** rix,\n/proc/@{pid}/** rix,") + assert.Contains(s.T(), s.Env().RemoteHost.MustExecute("sudo aa-enabled"), "Yes") +} + func (s *packageApmInjectSuite) purgeInjectorDebInstall() { s.Env().RemoteHost.MustExecute("sudo rm -f /opt/datadog-packages/run/environment") s.Env().RemoteHost.MustExecute("sudo rm -f /etc/datadog-agent/datadog.yaml") diff --git a/test/new-e2e/tests/npm/eks_1host_test.go b/test/new-e2e/tests/npm/eks_1host_test.go index c36a33ef17b25..12f86c5fd37e2 100644 --- a/test/new-e2e/tests/npm/eks_1host_test.go +++ b/test/new-e2e/tests/npm/eks_1host_test.go @@ -17,6 +17,7 @@ import ( kubeComp "github.com/DataDog/test-infra-definitions/components/kubernetes" "github.com/DataDog/test-infra-definitions/resources/aws" "github.com/DataDog/test-infra-definitions/scenarios/aws/ec2" + "github.com/DataDog/test-infra-definitions/scenarios/aws/eks" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/components" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/e2e" @@ -37,7 +38,7 @@ type eksVMSuite struct { e2e.BaseSuite[eksHttpbinEnv] } -func eksHttpbinEnvProvisioner() e2e.PulumiEnvRunFunc[eksHttpbinEnv] { +func eksHttpbinEnvProvisioner(opts ...envkube.ProvisionerOption) e2e.PulumiEnvRunFunc[eksHttpbinEnv] { return func(ctx *pulumi.Context, env *eksHttpbinEnv) error { awsEnv, err := aws.NewEnvironment(ctx) if err != nil { @@ -71,11 +72,16 @@ func eksHttpbinEnvProvisioner() e2e.PulumiEnvRunFunc[eksHttpbinEnv] { return npmtools.K8sAppDefinition(&awsEnv, kubeProvider, "npmtools", testURL) } - params := envkube.GetProvisionerParams( + provisionerOpts := []envkube.ProvisionerOption{ envkube.WithAwsEnv(&awsEnv), - envkube.WithEKSLinuxNodeGroup(), + envkube.WithEKSOptions(eks.WithLinuxNodeGroup()), envkube.WithAgentOptions(kubernetesagentparams.WithHelmValues(systemProbeConfigNPMHelmValues)), envkube.WithWorkloadApp(npmToolsWorkload), + } + provisionerOpts = append(provisionerOpts, opts...) + + params := envkube.GetProvisionerParams( + provisionerOpts..., ) envkube.EKSRunFunc(ctx, &env.Kubernetes, params) @@ -96,7 +102,6 @@ func TestEKSVMSuite(t *testing.T) { // BeforeTest will be called before each test func (v *eksVMSuite) BeforeTest(suiteName, testName string) { v.BaseSuite.BeforeTest(suiteName, testName) - // default is to reset the current state of the fakeintake aggregators if !v.BaseSuite.IsDevMode() { v.Env().FakeIntake.Client().FlushServerAndResetAggregators() diff --git a/test/new-e2e/tests/otel/otel-agent/infraattributes_eks_test.go b/test/new-e2e/tests/otel/otel-agent/infraattributes_eks_test.go index a94e4ad83de88..f151b745ea624 100644 --- a/test/new-e2e/tests/otel/otel-agent/infraattributes_eks_test.go +++ b/test/new-e2e/tests/otel/otel-agent/infraattributes_eks_test.go @@ -11,9 +11,9 @@ import ( "testing" "github.com/DataDog/test-infra-definitions/components/datadog/kubernetesagentparams" + "github.com/DataDog/test-infra-definitions/scenarios/aws/eks" "github.com/DataDog/datadog-agent/comp/core/tagger/types" - "github.com/DataDog/datadog-agent/pkg/util/testutil/flake" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/e2e" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments" awskubernetes "github.com/DataDog/datadog-agent/test/new-e2e/pkg/environments/aws/kubernetes" @@ -25,7 +25,6 @@ type iaEKSTestSuite struct { } func TestOTelAgentIAEKS(t *testing.T) { - flake.Mark(t) values := ` datadog: logs: @@ -33,7 +32,7 @@ datadog: containerCollectUsingFiles: false ` t.Parallel() - e2e.Run(t, &iaEKSTestSuite{}, e2e.WithProvisioner(awskubernetes.EKSProvisioner(awskubernetes.WithEKSLinuxNodeGroup(), awskubernetes.WithAgentOptions(kubernetesagentparams.WithoutDualShipping(), kubernetesagentparams.WithHelmValues(values), kubernetesagentparams.WithOTelAgent(), kubernetesagentparams.WithOTelConfig(iaConfig))))) + e2e.Run(t, &iaEKSTestSuite{}, e2e.WithProvisioner(awskubernetes.EKSProvisioner(awskubernetes.WithEKSOptions(eks.WithLinuxNodeGroup()), awskubernetes.WithAgentOptions(kubernetesagentparams.WithoutDualShipping(), kubernetesagentparams.WithHelmValues(values), kubernetesagentparams.WithOTelAgent(), kubernetesagentparams.WithOTelConfig(iaConfig))))) } var eksParams = utils.IAParams{ diff --git a/test/new-e2e/tests/otel/utils/pipelines_utils.go b/test/new-e2e/tests/otel/utils/pipelines_utils.go index 9365d487b3e36..332137d5566de 100644 --- a/test/new-e2e/tests/otel/utils/pipelines_utils.go +++ b/test/new-e2e/tests/otel/utils/pipelines_utils.go @@ -390,7 +390,7 @@ func TestCalendarApp(s OTelTestSuite) { logs, err := s.Env().FakeIntake.Client().FilterLogs(calendarService, fakeintake.WithMessageContaining(logBody)) assert.NoError(c, err) assert.NotEmpty(c, logs) - }, 60*time.Minute, 10*time.Second) + }, 30*time.Minute, 10*time.Second) } func createCalendarApp(ctx context.Context, s OTelTestSuite) { @@ -465,7 +465,7 @@ func createCalendarApp(ctx context.Context, s OTelTestSuite) { Spec: corev1.PodSpec{ Containers: []corev1.Container{{ Name: name, - Image: "datadog/opentelemetry-examples:calendar-go-rest-0.15", + Image: "ghcr.io/datadog/apps-calendar-go:main", ImagePullPolicy: "IfNotPresent", Ports: []corev1.ContainerPort{{ Name: "http", diff --git a/test/otel/go.mod b/test/otel/go.mod index 810c3b553d6e6..76543d05d11fe 100644 --- a/test/otel/go.mod +++ b/test/otel/go.mod @@ -101,8 +101,8 @@ require ( github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/exporter/logsagentexporter v0.56.0-rc.3 github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/metricsclient v0.56.0-rc.3 github.com/DataDog/datadog-agent/comp/otelcol/otlp/components/statsprocessor v0.56.0-rc.1 - github.com/DataDog/datadog-agent/pkg/config/model v0.57.0 - github.com/DataDog/datadog-agent/pkg/config/setup v0.57.0 + github.com/DataDog/datadog-agent/pkg/config/model v0.57.1 + github.com/DataDog/datadog-agent/pkg/config/setup v0.57.1 github.com/DataDog/datadog-agent/pkg/proto v0.56.0-rc.3 github.com/DataDog/datadog-agent/pkg/trace v0.56.0-rc.3 ) @@ -111,10 +111,10 @@ require ( github.com/DataDog/agent-payload/v5 v5.0.119 // indirect github.com/DataDog/datadog-agent/comp/core/flare/builder v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/core/flare/types v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/comp/core/secrets v0.57.0 // indirect + github.com/DataDog/datadog-agent/comp/core/secrets v0.57.1 // indirect github.com/DataDog/datadog-agent/comp/core/status v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/comp/core/telemetry v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/comp/def v0.56.0-rc.3 // indirect + github.com/DataDog/datadog-agent/comp/core/telemetry v0.57.1 // indirect + github.com/DataDog/datadog-agent/comp/def v0.57.1 // indirect github.com/DataDog/datadog-agent/comp/forwarder/defaultforwarder v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/forwarder/orchestrator/orchestratorinterface v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/logs/agent/config v0.56.0-rc.3 // indirect @@ -124,12 +124,12 @@ require ( github.com/DataDog/datadog-agent/comp/trace/compression/def v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/comp/trace/compression/impl-gzip v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/aggregator/ckey v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/config/env v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/collector/check/defaults v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/config/env v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/config/mock v0.58.0-devel // indirect - github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/config/nodetreemodel v0.60.0-devel // indirect github.com/DataDog/datadog-agent/pkg/config/structure v0.0.0-00010101000000-000000000000 // indirect - github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.0.0-00010101000000-000000000000 // indirect + github.com/DataDog/datadog-agent/pkg/config/teeconfig v0.60.0-devel // indirect github.com/DataDog/datadog-agent/pkg/config/utils v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/logs/auditor v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/logs/client v0.56.0-rc.3 // indirect @@ -158,26 +158,26 @@ require ( github.com/DataDog/datadog-agent/pkg/util/cgroups v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/common v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/executable v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/util/fxutil v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/filesystem v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/fxutil v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/hostname/validate v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/http v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/json v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/log v0.57.1 // indirect - github.com/DataDog/datadog-agent/pkg/util/optional v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/optional v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/pointer v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/scrubber v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/sort v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/startstop v0.56.0-rc.3 // indirect github.com/DataDog/datadog-agent/pkg/util/statstracker v0.56.0-rc.3 // indirect - github.com/DataDog/datadog-agent/pkg/util/system v0.57.0 // indirect - github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.0 // indirect + github.com/DataDog/datadog-agent/pkg/util/system v0.57.1 // indirect + github.com/DataDog/datadog-agent/pkg/util/system/socket v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/util/winutil v0.57.1 // indirect github.com/DataDog/datadog-agent/pkg/version v0.56.0-rc.3 // indirect github.com/DataDog/datadog-api-client-go/v2 v2.26.0 // indirect github.com/DataDog/datadog-go/v5 v5.5.0 // indirect github.com/DataDog/dd-sensitive-data-scanner/sds-go/go v0.0.0-20240816154533-f7f9beb53a42 // indirect - github.com/DataDog/go-sqllexer v0.0.15 // indirect + github.com/DataDog/go-sqllexer v0.0.16 // indirect github.com/DataDog/go-tuf v1.1.0-0.5.2 // indirect github.com/DataDog/mmh3 v0.0.0-20210722141835-012dc69a9e49 // indirect github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.20.0 // indirect @@ -288,24 +288,24 @@ require ( go.opentelemetry.io/collector/pdata v1.11.0 // indirect go.opentelemetry.io/collector/semconv v0.104.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 // indirect - go.opentelemetry.io/otel v1.30.0 // indirect + go.opentelemetry.io/otel v1.31.0 // indirect go.opentelemetry.io/otel/exporters/prometheus v0.49.0 // indirect - go.opentelemetry.io/otel/metric v1.30.0 // indirect + go.opentelemetry.io/otel/metric v1.31.0 // indirect go.opentelemetry.io/otel/sdk v1.27.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.27.0 // indirect - go.opentelemetry.io/otel/trace v1.30.0 // indirect + go.opentelemetry.io/otel/trace v1.31.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.18.0 // indirect go.uber.org/fx v1.22.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/net v0.29.0 // indirect + golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 // indirect + golang.org/x/net v0.30.0 // indirect golang.org/x/oauth2 v0.20.0 // indirect - golang.org/x/sys v0.25.0 // indirect - golang.org/x/term v0.24.0 // indirect - golang.org/x/text v0.18.0 // indirect - golang.org/x/time v0.6.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/term v0.25.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/time v0.7.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e // indirect google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.2 // indirect diff --git a/test/otel/go.sum b/test/otel/go.sum index ae3f18370fe46..71a0a814b244b 100644 --- a/test/otel/go.sum +++ b/test/otel/go.sum @@ -8,8 +8,8 @@ github.com/DataDog/datadog-go/v5 v5.5.0 h1:G5KHeB8pWBNXT4Jtw0zAkhdxEAWSpWH00geHI github.com/DataDog/datadog-go/v5 v5.5.0/go.mod h1:K9kcYBlxkcPP8tvvjZZKs/m1edNAUFzBbdpTUKfCsuw= github.com/DataDog/dd-sensitive-data-scanner/sds-go/go v0.0.0-20240816154533-f7f9beb53a42 h1:RoH7VLzTnxHEugRPIgnGlxwDFszFGI7b3WZZUtWuPRM= github.com/DataDog/dd-sensitive-data-scanner/sds-go/go v0.0.0-20240816154533-f7f9beb53a42/go.mod h1:TX7CTOQ3LbQjfAi4SwqUoR5gY1zfUk7VRBDTuArjaDc= -github.com/DataDog/go-sqllexer v0.0.15 h1:rUUu52dP8EQhJLnUw0MIAxZp0BQx2fOTuMztr3vtHUU= -github.com/DataDog/go-sqllexer v0.0.15/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc= +github.com/DataDog/go-sqllexer v0.0.16 h1:RoSUMS6MECyB3gTUIdydzXwK5NhEhv6GMJkS7ptsgRA= +github.com/DataDog/go-sqllexer v0.0.16/go.mod h1:KwkYhpFEVIq+BfobkTC1vfqm4gTi65skV/DpDBXtexc= github.com/DataDog/go-tuf v1.1.0-0.5.2 h1:4CagiIekonLSfL8GMHRHcHudo1fQnxELS9g4tiAupQ4= github.com/DataDog/go-tuf v1.1.0-0.5.2/go.mod h1:zBcq6f654iVqmkk8n2Cx81E1JnNTMOAx1UEO/wZR+P0= github.com/DataDog/mmh3 v0.0.0-20210722141835-012dc69a9e49 h1:EbzDX8HPk5uE2FsJYxD74QmMw0/3CqSKhEr6teh0ncQ= @@ -433,18 +433,18 @@ go.opentelemetry.io/collector/semconv v0.104.0 h1:dUvajnh+AYJLEW/XOPk0T0BlwltSdi go.opentelemetry.io/collector/semconv v0.104.0/go.mod h1:yMVUCNoQPZVq/IPfrHrnntZTWsLf5YGZ7qwKulIl5hw= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0 h1:9l89oX4ba9kHbBol3Xin3leYJ+252h0zszDtBwyKe2A= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.52.0/go.mod h1:XLZfZboOJWHNKUv7eH0inh0E9VV6eWDFB/9yJyTLPp0= -go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= -go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= +go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= +go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= go.opentelemetry.io/otel/exporters/prometheus v0.49.0 h1:Er5I1g/YhfYv9Affk9nJLfH/+qCCVVg1f2R9AbJfqDQ= go.opentelemetry.io/otel/exporters/prometheus v0.49.0/go.mod h1:KfQ1wpjf3zsHjzP149P4LyAwWRupc6c7t1ZJ9eXpKQM= -go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= -go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= +go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= +go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kTWmI= go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A= go.opentelemetry.io/otel/sdk/metric v1.27.0 h1:5uGNOlpXi+Hbo/DRoI31BSb1v+OGcpv2NemcCrOL8gI= go.opentelemetry.io/otel/sdk/metric v1.27.0/go.mod h1:we7jJVrYN2kh3mVBlswtPU22K0SA+769l93J6bsyvqw= -go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= -go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= +go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= +go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= @@ -470,11 +470,11 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 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/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= -golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= +golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= -golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6 h1:1wqE9dj9NpSm04INVsJhhEUzhuDVjbcyKH91sVyPATw= +golang.org/x/exp v0.0.0-20241004190924-225e2abe05e6/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= 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= @@ -497,8 +497,8 @@ golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLL 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.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= -golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= @@ -530,19 +530,19 @@ golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= -golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= -golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= +golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= +golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= -golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= -golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= +golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/test/regression/cases/file_to_blackhole_0ms_latency/experiment.yaml b/test/regression/cases/file_to_blackhole_0ms_latency/experiment.yaml index 861c37b6bc8b6..215dcfa86cc48 100644 --- a/test/regression/cases/file_to_blackhole_0ms_latency/experiment.yaml +++ b/test/regression/cases/file_to_blackhole_0ms_latency/experiment.yaml @@ -28,6 +28,6 @@ checks: - name: memory_usage description: "Memory usage" bounds: - series: rss_bytes + series: total_rss_bytes # The machine has 12GiB free. - upper_bound: 1GiB + upper_bound: 1.2GiB diff --git a/test/regression/cases/file_to_blackhole_1000ms_latency/experiment.yaml b/test/regression/cases/file_to_blackhole_1000ms_latency/experiment.yaml index 861c37b6bc8b6..215dcfa86cc48 100644 --- a/test/regression/cases/file_to_blackhole_1000ms_latency/experiment.yaml +++ b/test/regression/cases/file_to_blackhole_1000ms_latency/experiment.yaml @@ -28,6 +28,6 @@ checks: - name: memory_usage description: "Memory usage" bounds: - series: rss_bytes + series: total_rss_bytes # The machine has 12GiB free. - upper_bound: 1GiB + upper_bound: 1.2GiB diff --git a/test/regression/cases/file_to_blackhole_100ms_latency/experiment.yaml b/test/regression/cases/file_to_blackhole_100ms_latency/experiment.yaml index 861c37b6bc8b6..215dcfa86cc48 100644 --- a/test/regression/cases/file_to_blackhole_100ms_latency/experiment.yaml +++ b/test/regression/cases/file_to_blackhole_100ms_latency/experiment.yaml @@ -28,6 +28,6 @@ checks: - name: memory_usage description: "Memory usage" bounds: - series: rss_bytes + series: total_rss_bytes # The machine has 12GiB free. - upper_bound: 1GiB + upper_bound: 1.2GiB diff --git a/test/regression/cases/file_to_blackhole_300ms_latency/experiment.yaml b/test/regression/cases/file_to_blackhole_300ms_latency/experiment.yaml index 861c37b6bc8b6..215dcfa86cc48 100644 --- a/test/regression/cases/file_to_blackhole_300ms_latency/experiment.yaml +++ b/test/regression/cases/file_to_blackhole_300ms_latency/experiment.yaml @@ -28,6 +28,6 @@ checks: - name: memory_usage description: "Memory usage" bounds: - series: rss_bytes + series: total_rss_bytes # The machine has 12GiB free. - upper_bound: 1GiB + upper_bound: 1.2GiB diff --git a/test/regression/cases/file_to_blackhole_500ms_latency/experiment.yaml b/test/regression/cases/file_to_blackhole_500ms_latency/experiment.yaml index 861c37b6bc8b6..215dcfa86cc48 100644 --- a/test/regression/cases/file_to_blackhole_500ms_latency/experiment.yaml +++ b/test/regression/cases/file_to_blackhole_500ms_latency/experiment.yaml @@ -28,6 +28,6 @@ checks: - name: memory_usage description: "Memory usage" bounds: - series: rss_bytes + series: total_rss_bytes # The machine has 12GiB free. - upper_bound: 1GiB + upper_bound: 1.2GiB diff --git a/test/regression/cases/idle/experiment.yaml b/test/regression/cases/idle/experiment.yaml index 07fdaa0c45fc3..6ff80775cb802 100644 --- a/test/regression/cases/idle/experiment.yaml +++ b/test/regression/cases/idle/experiment.yaml @@ -32,4 +32,8 @@ checks: description: "Memory usage quality gate. This puts a bound on the total agent memory usage." bounds: series: total_rss_bytes - upper_bound: "465.0 MiB" + upper_bound: "430.0 MiB" + +report_links: + - text: "bounds checks dashboard" + link: "https://app.datadoghq.com/dashboard/vz3-jd5-bdi?fromUser=true&refresh_mode=paused&tpl_var_experiment%5B0%5D={{ experiment }}&tpl_var_job_id%5B0%5D={{ job_id }}&tpl_var_run-id%5B0%5D={{ job_id }}&view=spans&from_ts={{ start_time_ms }}&to_ts={{ end_time_ms }}&live=false" diff --git a/test/regression/cases/idle_all_features/experiment.yaml b/test/regression/cases/idle_all_features/experiment.yaml index a8e00cc0322ec..b1cb6e02c0d62 100644 --- a/test/regression/cases/idle_all_features/experiment.yaml +++ b/test/regression/cases/idle_all_features/experiment.yaml @@ -40,4 +40,13 @@ target: DD_PROFILING_EXECUTION_TRACE_PERIOD: 1m DD_PROFILING_WAIT_PROFILE: true - +checks: + - name: memory_usage + description: "Memory usage quality gate. This puts a bound on the total agent memory usage." + bounds: + series: total_rss_bytes + upper_bound: "785.0 MiB" + +report_links: + - text: "bounds checks dashboard" + link: "https://app.datadoghq.com/dashboard/vz3-jd5-bdi?fromUser=true&refresh_mode=paused&tpl_var_experiment%5B0%5D={{ experiment }}&tpl_var_job_id%5B0%5D={{ job_id }}&tpl_var_run-id%5B0%5D={{ job_id }}&view=spans&from_ts={{ start_time_ms }}&to_ts={{ end_time_ms }}&live=false" diff --git a/tools/ci/docker-login.ps1 b/tools/ci/docker-login.ps1 index 840b6b786492d..39f03f4fb7632 100644 --- a/tools/ci/docker-login.ps1 +++ b/tools/ci/docker-login.ps1 @@ -9,12 +9,14 @@ If ($lastExitCode -ne "0") { $tmpfile = [System.IO.Path]::GetTempFileName() & "C:\mnt\tools\ci\fetch_secret.ps1" -parameterName "$Env:DOCKER_REGISTRY_LOGIN" -tempFile "$tmpfile" If ($lastExitCode -ne "0") { - throw "Previous command returned $lastExitCode" + Write-Host "Previous command returned $lastExitCode" + exit "$lastExitCode" } $DOCKER_REGISTRY_LOGIN = $(cat "$tmpfile") & "C:\mnt\tools\ci\fetch_secret.ps1" -parameterName "$Env:DOCKER_REGISTRY_PWD" -tempFile "$tmpfile" If ($lastExitCode -ne "0") { - throw "Previous command returned $lastExitCode" + Write-Host "Previous command returned $lastExitCode" + exit "$lastExitCode" } $DOCKER_REGISTRY_PWD = $(cat "$tmpfile") Remove-Item "$tmpfile" diff --git a/tools/ci/junit_upload.sh b/tools/ci/junit_upload.sh index 27690cced9747..97312066045e1 100755 --- a/tools/ci/junit_upload.sh +++ b/tools/ci/junit_upload.sh @@ -6,7 +6,7 @@ if [[ -n "$1" ]]; then junit_files="$1" fi -DATADOG_API_KEY="$("$CI_PROJECT_DIR"/tools/ci/fetch_secret.sh "$API_KEY_ORG2")" +DATADOG_API_KEY="$("$CI_PROJECT_DIR"/tools/ci/fetch_secret.sh "$AGENT_API_KEY_ORG2" token)" export DATADOG_API_KEY error=0 for file in $junit_files; do diff --git a/tools/ebpf/Dockerfiles/Dockerfile-process-agent-dev b/tools/ebpf/Dockerfiles/Dockerfile-process-agent-dev index 3cef80b912fb4..0f964fbd783c4 100644 --- a/tools/ebpf/Dockerfiles/Dockerfile-process-agent-dev +++ b/tools/ebpf/Dockerfiles/Dockerfile-process-agent-dev @@ -23,4 +23,3 @@ COPY agent $CORE_AGENT_DEST COPY *.o /opt/datadog-agent/embedded/share/system-probe/ebpf/ COPY co-re/*.o /opt/datadog-agent/embedded/share/system-probe/ebpf/co-re/ COPY *.c /opt/datadog-agent/embedded/share/system-probe/ebpf/runtime/ -COPY agent-usm.jar /opt/datadog-agent/embedded/share/system-probe/java/ diff --git a/tools/windows/DatadogAgentInstallScript/Install-Datadog.ps1 b/tools/windows/DatadogAgentInstallScript/Install-Datadog.ps1 index ef89be5eb5c5e..023a11938a148 100644 --- a/tools/windows/DatadogAgentInstallScript/Install-Datadog.ps1 +++ b/tools/windows/DatadogAgentInstallScript/Install-Datadog.ps1 @@ -6,6 +6,17 @@ $SCRIPT_VERSION = "1.0.0" $GENERAL_ERROR_CODE = 1 +# Set some defaults if not provided +$ddInstallerUrl = $env:DD_INSTALLER_URL +if (-Not $ddInstallerUrl) { + $ddInstallerUrl = "https://s3.amazonaws.com/dd-agent-mstesting/datadog-installer-x86_64.exe" +} + +$ddRemoteUpdates = $env:DD_REMOTE_UPDATES +if (-Not $ddRemoteUpdates) { + $ddRemoteUpdates = "false" +} + # ExitCodeException can be used to report failures from executables that set $LASTEXITCODE class ExitCodeException : Exception { [string] $LastExitCode @@ -15,11 +26,18 @@ class ExitCodeException : Exception { } } -function Update-ConfigFile($regex, $replacement) { - $configFile = Join-Path (Get-ItemPropertyValue -Path "HKLM:\\SOFTWARE\\Datadog\\Datadog Agent" -Name "ConfigRoot") "datadog.yaml" - if (-Not $configFile) { - $configFile = "C:\\ProgramData\\Datadog\\datadog.yaml" +function Get-DatadogConfigPath() { + if ( + (Test-Path "HKLM:\\SOFTWARE\\Datadog\\Datadog Agent") -and + ($null -ne (Get-Item -Path "HKLM:\\SOFTWARE\\Datadog\\Datadog Agent").GetValue("ConfigRoot")) + ) { + return (Join-Path (Get-ItemPropertyValue -Path "HKLM:\\SOFTWARE\\Datadog\\Datadog Agent" -Name "ConfigRoot") "datadog.yaml") } + return "C:\\ProgramData\\Datadog\\datadog.yaml" +} + +function Update-DatadogConfigFile($regex, $replacement) { + $configFile = Get-DatadogConfigPath if (-Not (Test-Path $configFile)) { throw "datadog.yaml doesn't exist" } @@ -44,8 +62,15 @@ function Send-Telemetry($payload) { "DD-Api-Key" = $env:DD_API_KEY "Content-Type" = "application/json" } - $result = Invoke-WebRequest -Uri $telemetryUrl -Method POST -Body $payload -Headers $requestHeaders - Write-Host "Sending telemetry: $($result.StatusCode)" + try { + $result = Invoke-WebRequest -Uri $telemetryUrl -Method POST -Body $payload -Headers $requestHeaders + Write-Host "Sending telemetry: $($result.StatusCode)" + } catch { + # Don't propagate errors when sending telemetry, because our error handling code will also + # try to send telemetry. + # It's enough to just print a message since there's no further error handling to be done. + Write-Host "Error sending telemetry" + } } function Show-Error($errorMessage, $errorCode) { @@ -125,15 +150,36 @@ function Start-ProcessWithOutput { return $process.ExitCode } -# Set some defaults if not provided -$ddInstallerUrl = $env:DD_INSTALLER_URL -if (-Not $ddInstallerUrl) { - $ddInstallerUrl = "https://s3.amazonaws.com/dd-agent-mstesting/datadog-installer-x86_64.exe" +function Test-DatadogAgentPresence() { + # Rudimentary check for the Agent presence, the `datadogagent` service should exist, and so should the `InstallPath` key in the registry. + # We check that particular key since we use it later in the script to restart the service. + return ( + ((Get-Service "datadogagent" -ea silent | Measure-Object).Count -eq 1) -and + (Test-Path "HKLM:\\SOFTWARE\\Datadog\\Datadog Agent") -and + ($null -ne (Get-Item -Path "HKLM:\\SOFTWARE\\Datadog\\Datadog Agent").GetValue("InstallPath")) + ) } -$ddRemoteUpdates = $env:DD_REMOTE_UPDATES -if (-Not $ddRemoteUpdates) { - $ddRemoteUpdates = "false" +function Update-DatadogAgentConfig() { + if ($env:DD_API_KEY) { + Write-Host "Writing DD_API_KEY" + Update-DatadogConfigFile "^[ #]*api_key:.*" "api_key: $env:DD_API_KEY" + } + + if ($env:DD_SITE) { + Write-Host "Writing DD_SITE" + Update-DatadogConfigFile "^[ #]*site:.*" "site: $env:DD_SITE" + } + + if ($env:DD_URL) { + Write-Host "Writing DD_URL" + Update-DatadogConfigFile "^[ #]*dd_url:.*" "dd_url: $env:DD_URL" + } + + if ($ddRemoteUpdates) { + Write-Host "Writing DD_REMOTE_UPDATES" + Update-DatadogConfigFile "^[ #]*remote_updates:.*" "remote_updates: $($ddRemoteUpdates.ToLower())" + } } try { @@ -145,11 +191,7 @@ try { $myWindowsID = [System.Security.Principal.WindowsIdentity]::GetCurrent() $myWindowsPrincipal = new-object System.Security.Principal.WindowsPrincipal($myWindowsID) $adminRole = [System.Security.Principal.WindowsBuiltInRole]::Administrator - if ($myWindowsPrincipal.IsInRole($adminRole)) { - # We are running "as Administrator" - $Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevated)" - } - else { + if (-not $myWindowsPrincipal.IsInRole($adminRole)) { # We are not running "as Administrator" $newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell"; $newProcess.Arguments = $myInvocation.MyCommand.Definition; @@ -159,6 +201,26 @@ try { return $proc.ExitCode } + # First thing to do is to stop the services if they are started + if (Test-DatadogAgentPresence) { + Write-Host "Stopping Datadog Agent services" + & ((Get-ItemProperty "HKLM:\\SOFTWARE\\Datadog\\Datadog Agent").InstallPath + "bin\\agent.exe") stop-service + } + + if ((Get-Service "Datadog Installer" -ea silent | Measure-Object).Count -eq 1) { + Write-Host "Stopping Datadog Installer service" + Stop-Service "Datadog Installer" + } + + $configUpdated = $False + # Write the config before-hand if it exists, that way if the Agent/Installer services start + # once installed, they will have a valid configuration. + # This allows the MSI to emit some telemetry as well. + if (Test-Path (Get-DatadogConfigPath)) { + Update-DatadogAgentConfig + $configUpdated = $True + } + # Powershell does not enable TLS 1.2 by default, & we want it enabled for faster downloads Write-Host "Forcing web requests to TLS v1.2" [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor [System.Net.SecurityProtocolType]::Tls12 @@ -177,33 +239,17 @@ try { Write-Host "Starting bootstrap process" $result = Start-ProcessWithOutput -Path $installer -ArgumentList "bootstrap" if ($result -ne 0) { - # bootstrap only fails if it fails to install to install the Datadog Installer, so it's possible the Agent was not installed + # bootstrap only fails if it fails to install to install the Datadog Installer, so it's possible the Agent was not installed throw [ExitCodeException]::new("Bootstrap failed", $result) } Write-Host "Bootstrap execution done" - if (-Not (Test-Path "HKLM:\\SOFTWARE\\Datadog\\Datadog Agent")) { + if (-Not (Test-DatadogAgentPresence)) { throw "Agent is not installed" } - if ($env:DD_API_KEY) { - Write-Host "Writing DD_API_KEY" - Update-ConfigFile "^[ #]*api_key:.*" "api_key: $env:DD_API_KEY" - } - - if ($env:DD_SITE) { - Write-Host "Writing DD_SITE" - Update-ConfigFile "^[ #]*site:.*" "site: $env:DD_SITE" - } - - if ($env:DD_URL) { - Write-Host "Writing DD_URL" - Update-ConfigFile "^[ #]*dd_url:.*" "dd_url: $env:DD_URL" - } - - if ($ddRemoteUpdates) { - Write-Host "Writing DD_REMOTE_UPDATES" - Update-ConfigFile "^[ #]*remote_updates:.*" "remote_updates: $($ddRemoteUpdates.ToLower())" + if (-Not ($configUpdated)) { + Update-DatadogAgentConfig } Send-Telemetry @" @@ -223,7 +269,12 @@ try { } } "@ - Start-Service "Datadog Installer" + # The datadog.yaml configuration was potentially modified so restart the services + Write-Host "Starting Datadog Installer service" + Restart-Service "Datadog Installer" + # This command handles restarting the dependent services as well + Write-Host "Starting Datadog Agent services" + & ((Get-ItemProperty "HKLM:\\SOFTWARE\\Datadog\\Datadog Agent").InstallPath + "bin\\agent.exe") restart-service } catch [ExitCodeException] { Show-Error $_.Exception.Message $_.Exception.LastExitCode @@ -233,6 +284,8 @@ catch { } finally { Write-Host "Cleaning up..." - Remove-Item -Force -EA SilentlyContinue $installer + if ($installer -and (Test-Path $installer)) { + Remove-Item -Force -EA SilentlyContinue $installer + } } Write-Host "Datadog Install Script finished!" diff --git a/tools/windows/DatadogAgentInstaller/InstallerCustomActions/CustomAction.cs b/tools/windows/DatadogAgentInstaller/InstallerCustomActions/CustomAction.cs index 69c42d537056c..fb6db05527a77 100644 --- a/tools/windows/DatadogAgentInstaller/InstallerCustomActions/CustomAction.cs +++ b/tools/windows/DatadogAgentInstaller/InstallerCustomActions/CustomAction.cs @@ -48,12 +48,6 @@ public static ActionResult ReadConfig(Session session) return Datadog.CustomActions.ConfigCustomActions.ReadConfig(session); } - [CustomAction] - public static ActionResult WriteConfig(Session session) - { - return Datadog.CustomActions.ConfigCustomActions.WriteConfig(session); - } - [CustomAction] public static ActionResult ProcessDdAgentUserCredentials(Session session) { diff --git a/tools/windows/DatadogAgentInstaller/WixSetup/Datadog Installer/DatadogInstallerCustomActions.cs b/tools/windows/DatadogAgentInstaller/WixSetup/Datadog Installer/DatadogInstallerCustomActions.cs index a8f7f86bab33f..79ebb0d9d3378 100644 --- a/tools/windows/DatadogAgentInstaller/WixSetup/Datadog Installer/DatadogInstallerCustomActions.cs +++ b/tools/windows/DatadogAgentInstaller/WixSetup/Datadog Installer/DatadogInstallerCustomActions.cs @@ -7,7 +7,6 @@ public class DatadogInstallerCustomActions { public ManagedAction RunAsAdmin { get; } public ManagedAction ReadConfig { get; } - public ManagedAction WriteConfig { get; } public ManagedAction ReadInstallState { get; } public ManagedAction WriteInstallState { get; } public ManagedAction RollbackWriteInstallState { get; } @@ -72,24 +71,6 @@ public DatadogInstallerCustomActions() } .SetProperties("APPLICATIONDATADIRECTORY=[APPLICATIONDATADIRECTORY]"); - WriteConfig = new CustomAction( - new Id(nameof(WriteConfig)), - CustomActions.WriteConfig, - Return.check, - When.Before, - Step.InstallServices, - Conditions.FirstInstall | Conditions.Upgrading | Conditions.Maintenance - ) - { - Execute = Execute.deferred, - Impersonate = false - } - .SetProperties( - "APPLICATIONDATADIRECTORY=[APPLICATIONDATADIRECTORY]," + - "APIKEY=[APIKEY], " + - "SITE=[SITE]") - .HideTarget(true); - OpenMsiLog = new CustomAction( new Id(nameof(OpenMsiLog)), CustomActions.OpenMsiLog