Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add_cloud_metadata - Retrieve AKS cluster name and id #37685

Merged

Conversation

MichaelKatsoulis
Copy link
Contributor

@MichaelKatsoulis MichaelKatsoulis commented Jan 22, 2024

Proposed commit message

  • WHAT: Enhance add_cloud_metadata processor with orchestrator.cluster.name and orchestrator.cluster.id for AKS clusters.
  • WHY: It allows filtering of events based on the AKS cluster the vm belongs to.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

  • Create an AKS cluster
  • Run Metricbeat or Filebeat with sleep command and correct values of following additional env vars
- name: TENANT_ID
 value: ""
- name: CLIENT_ID
 value: ""
- name: CLIENT_SECRET
 value: ""

In order to acquire a CLIENT_SECRET and CLIENT_ID follow the app_registration instructions.

  • Build this pr's version of metricbeat/filebeat with GOOS=linux GOARCH=amd64 go build
  • Copy the metricbeat/filebeat binary in metricbeat/filebeat pod with kubectl cp ./metricbeat metricbeat-9lkhf:/usr/share/metricbeat/ -n kube-system
  • Exec in the pod and run ./metricbeat -c /etc/metricbeat.yml -e
  • Check in Kibana the fields orchestrator.cluster.name and orchestrator.cluster.id being populated

Related issues

Use cases

Screenshots

orchestrator

Logs

@MichaelKatsoulis MichaelKatsoulis requested review from a team as code owners January 22, 2024 12:02
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jan 22, 2024
@MichaelKatsoulis MichaelKatsoulis marked this pull request as draft January 22, 2024 12:03
Copy link
Contributor

mergify bot commented Jan 22, 2024

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @MichaelKatsoulis? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@elasticmachine
Copy link
Collaborator

💔 Build Failed

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Duration: 137 min 19 sec

Pipeline error 1

This error is likely related to the pipeline itself. Click here
and then you will see the error (either incorrect syntax or an invalid configuration).

❕ Flaky test report

No test was executed to be analysed.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@elasticmachine
Copy link
Collaborator

❕ Build Aborted

Either there was a build timeout or someone aborted the build.

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Duration: 36 min 41 sec

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@MichaelKatsoulis MichaelKatsoulis added Team:Cloud-Monitoring Label for the Cloud Monitoring team Team:Cloudnative-Monitoring Label for the Cloud Native Monitoring team labels Jan 24, 2024
@botelastic botelastic bot removed needs_team Indicates that the issue/PR needs a Team:* label labels Jan 24, 2024
@elasticmachine
Copy link
Collaborator

💔 Tests Failed

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2024-01-24T15:09:11.210+0000

  • Duration: 127 min 49 sec

Test stats 🧪

Test Results
Failed 2
Passed 28763
Skipped 1998
Total 30763

Test errors 2

Expand to view the tests failures

Build&Test / libbeat-unitTest / TestRetrieveAzureMetadata – github.com/elastic/beats/v7/libbeat/processors/add_cloud_metadata
    Expand to view the error details

     Failed 
    

    Expand to view the stacktrace

     === RUN   TestRetrieveAzureMetadata
        provider_azure_vm_test.go:188: 
            	Error Trace:	/var/lib/jenkins/workspace/PR-37685-3-5434ad54-fc27-4ff7-93d7-63eaf703320a/src/github.com/elastic/beats/libbeat/processors/add_cloud_metadata/provider_azure_vm_test.go:188
            	Error:      	Not equal: 
            	            	expected: {"cloud":{"account":{"id":"0e073ec1-c22f-4488-adde-da35ed609ccd"},"instance":{"id":"220e2b43-0913-492f-ada0-b6b2795bdb9b","name":"aks-agentpool-12628255-vmss_2"},"machine":{"type":"Standard_DS2_v2"},"provider":"azure","region":"eastus","resourceGroup":{"name":"MC_myname_group_myname_eastus"},"service":{"name":"Virtual Machines"}},"orchestrator":{"cluster":{"id":"testcluster1Id","name":"testcluster1Name"}}}
            	            	actual  : {"cloud":{"account":{"id":"0e073ec1-c22f-4488-adde-da35ed609ccd"},"instance":{"id":"220e2b43-0913-492f-ada0-b6b2795bdb9b","name":"aks-agentpool-12628255-vmss_2"},"machine":{"type":"Standard_DS2_v2"},"provider":"azure","region":"eastus","resourceGroup":{"name":"MC_myname_group_myname_eastus"},"service":{"name":"Virtual Machines"}}}
            	            	
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1,2 +1,2 @@
            	            	-(mapstr.M) (len=2) {
            	            	+(mapstr.M) (len=1) {
            	            	  (string) (len=5) "cloud": (mapstr.M) (len=7) {
            	            	@@ -20,8 +20,2 @@
            	            	   }
            	            	- },
            	            	- (string) (len=12) "orchestrator": (mapstr.M) (len=1) {
            	            	-  (string) (len=7) "cluster": (mapstr.M) (len=2) {
            	            	-   (string) (len=2) "id": (string) (len=14) "testcluster1Id",
            	            	-   (string) (len=4) "name": (string) (len=16) "testcluster1Name"
            	            	-  }
            	            	  }
            	Test:       	TestRetrieveAzureMetadata
    --- FAIL: TestRetrieveAzureMetadata (1.94s)
     
    

Build&Test / libbeat-goIntegTest / TestRetrieveAzureMetadata – github.com/elastic/beats/v7/libbeat/processors/add_cloud_metadata
    Expand to view the error details

     Failed 
    

    Expand to view the stacktrace

     === RUN   TestRetrieveAzureMetadata
        provider_azure_vm_test.go:188: 
            	Error Trace:	/var/lib/jenkins/workspace/PR-37685-3-96180cfd-f1b8-42b2-bf0c-7fe3fac46860/src/github.com/elastic/beats/libbeat/processors/add_cloud_metadata/provider_azure_vm_test.go:188
            	Error:      	Not equal: 
            	            	expected: {"cloud":{"account":{"id":"0e073ec1-c22f-4488-adde-da35ed609ccd"},"instance":{"id":"220e2b43-0913-492f-ada0-b6b2795bdb9b","name":"aks-agentpool-12628255-vmss_2"},"machine":{"type":"Standard_DS2_v2"},"provider":"azure","region":"eastus","resourceGroup":{"name":"MC_myname_group_myname_eastus"},"service":{"name":"Virtual Machines"}},"orchestrator":{"cluster":{"id":"testcluster1Id","name":"testcluster1Name"}}}
            	            	actual  : {}
            	            	
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1,28 +1,2 @@
            	            	-(mapstr.M) (len=2) {
            	            	- (string) (len=5) "cloud": (mapstr.M) (len=7) {
            	            	-  (string) (len=7) "account": (mapstr.M) (len=1) {
            	            	-   (string) (len=2) "id": (string) (len=36) "0e073ec1-c22f-4488-adde-da35ed609ccd"
            	            	-  },
            	            	-  (string) (len=8) "instance": (mapstr.M) (len=2) {
            	            	-   (string) (len=2) "id": (string) (len=36) "220e2b43-0913-492f-ada0-b6b2795bdb9b",
            	            	-   (string) (len=4) "name": (string) (len=29) "aks-agentpool-12628255-vmss_2"
            	            	-  },
            	            	-  (string) (len=7) "machine": (mapstr.M) (len=1) {
            	            	-   (string) (len=4) "type": (string) (len=15) "Standard_DS2_v2"
            	            	-  },
            	            	-  (string) (len=8) "provider": (string) (len=5) "azure",
            	            	-  (string) (len=6) "region": (string) (len=6) "eastus",
            	            	-  (string) (len=13) "resourceGroup": (mapstr.M) (len=1) {
            	            	-   (string) (len=4) "name": (string) (len=29) "MC_myname_group_myname_eastus"
            	            	-  },
            	            	-  (string) (len=7) "service": (mapstr.M) (len=1) {
            	            	-   (string) (len=4) "name": (string) (len=16) "Virtual Machines"
            	            	-  }
            	            	- },
            	            	- (string) (len=12) "orchestrator": (mapstr.M) (len=1) {
            	            	-  (string) (len=7) "cluster": (mapstr.M) (len=2) {
            	            	-   (string) (len=2) "id": (string) (len=14) "testcluster1Id",
            	            	-   (string) (len=4) "name": (string) (len=16) "testcluster1Name"
            	            	-  }
            	            	- }
            	            	+(mapstr.M) {
            	            	 }
            	Test:       	TestRetrieveAzureMetadata
    --- FAIL: TestRetrieveAzureMetadata (3.00s)
     
    

Steps errors 7

Expand to view the steps failures

libbeat-unitTest - mage build unitTest
  • Took 12 min 35 sec . View more details here
  • Description: mage build unitTest
libbeat-unitTest - mage build unitTest
  • Took 9 min 14 sec . View more details here
  • Description: mage build unitTest
libbeat-unitTest - mage build unitTest
  • Took 9 min 15 sec . View more details here
  • Description: mage build unitTest
libbeat-goIntegTest - mage goIntegTest
  • Took 16 min 40 sec . View more details here
  • Description: mage goIntegTest
libbeat-goIntegTest - mage goIntegTest
  • Took 12 min 32 sec . View more details here
  • Description: mage goIntegTest
libbeat-goIntegTest - mage goIntegTest
  • Took 11 min 21 sec . View more details here
  • Description: mage goIntegTest
Error signal
  • Took 0 min 0 sec . View more details here
  • Description: Error 'hudson.AbortException: script returned exit code 1'

🐛 Flaky test report

❕ There are test failures but not known flaky tests.

Expand to view the summary

Genuine test errors 2

💔 There are test failures but not known flaky tests, most likely a genuine test failure.

  • Name: Build&Test / libbeat-unitTest / TestRetrieveAzureMetadata – github.com/elastic/beats/v7/libbeat/processors/add_cloud_metadata
  • Name: Build&Test / libbeat-goIntegTest / TestRetrieveAzureMetadata – github.com/elastic/beats/v7/libbeat/processors/add_cloud_metadata

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@elasticmachine
Copy link
Collaborator

❕ Build Aborted

There is a new build on-going so the previous on-going builds have been aborted.

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Start Time: 2024-01-25T10:06:38.271+0000

  • Duration: 109 min 10 sec

Test stats 🧪

Test Results
Failed 0
Passed 3
Skipped 0
Total 3

Steps errors 5

Expand to view the steps failures

Archive the artifacts
  • Took 0 min 0 sec . View more details here
Checks if running on a Unix-like node
  • Took 0 min 0 sec . View more details here
Archive the artifacts
  • Took 0 min 0 sec . View more details here
Checks if running on a Unix-like node
  • Took 0 min 0 sec . View more details here
Error signal
  • Took 0 min 0 sec . View more details here
  • Description: Error 'org.jenkinsci.plugins.workflow.steps.FlowInterruptedException'

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@elasticmachine
Copy link
Collaborator

❕ Build Aborted

There is a new build on-going so the previous on-going builds have been aborted.

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Start Time: 2024-01-25T10:13:53.345+0000

  • Duration: 104 min 36 sec

Test stats 🧪

Test Results
Failed 2
Passed 28329
Skipped 1998
Total 30329

Test errors 2

Expand to view the tests failures

Build&Test / libbeat-unitTest / TestRetrieveAzureMetadata – github.com/elastic/beats/v7/libbeat/processors/add_cloud_metadata
    Expand to view the error details

     Failed 
    

    Expand to view the stacktrace

     === RUN   TestRetrieveAzureMetadata
        provider_azure_vm_test.go:189: 
            	Error Trace:	/var/lib/jenkins/workspace/PR-37685-5-247ed27c-a11b-4ed4-bd6e-36d84e2f7e1e/src/github.com/elastic/beats/libbeat/processors/add_cloud_metadata/provider_azure_vm_test.go:189
            	Error:      	Not equal: 
            	            	expected: {"cloud":{"account":{"id":"0e073ec1-c22f-4488-adde-da35ed609ccd"},"instance":{"id":"220e2b43-0913-492f-ada0-b6b2795bdb9b","name":"aks-agentpool-12628255-vmss_2"},"machine":{"type":"Standard_DS2_v2"},"provider":"azure","region":"eastus","resourceGroup":{"name":"MC_myname_group_myname_eastus"},"service":{"name":"Virtual Machines"}},"orchestrator":{"cluster":{"id":"testcluster1Id","name":"testcluster1Name"}}}
            	            	actual  : {"cloud":{"account":{"id":"0e073ec1-c22f-4488-adde-da35ed609ccd"},"instance":{"id":"220e2b43-0913-492f-ada0-b6b2795bdb9b","name":"aks-agentpool-12628255-vmss_2"},"machine":{"type":"Standard_DS2_v2"},"provider":"azure","region":"eastus","resourceGroup":{"name":"MC_myname_group_myname_eastus"},"service":{"name":"Virtual Machines"}}}
            	            	
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1,2 +1,2 @@
            	            	-(mapstr.M) (len=2) {
            	            	+(mapstr.M) (len=1) {
            	            	  (string) (len=5) "cloud": (mapstr.M) (len=7) {
            	            	@@ -20,8 +20,2 @@
            	            	   }
            	            	- },
            	            	- (string) (len=12) "orchestrator": (mapstr.M) (len=1) {
            	            	-  (string) (len=7) "cluster": (mapstr.M) (len=2) {
            	            	-   (string) (len=2) "id": (string) (len=14) "testcluster1Id",
            	            	-   (string) (len=4) "name": (string) (len=16) "testcluster1Name"
            	            	-  }
            	            	  }
            	Test:       	TestRetrieveAzureMetadata
    --- FAIL: TestRetrieveAzureMetadata (1.95s)
     
    

Build&Test / libbeat-goIntegTest / TestRetrieveAzureMetadata – github.com/elastic/beats/v7/libbeat/processors/add_cloud_metadata
    Expand to view the error details

     Failed 
    

    Expand to view the stacktrace

     === RUN   TestRetrieveAzureMetadata
        provider_azure_vm_test.go:189: 
            	Error Trace:	/var/lib/jenkins/workspace/PR-37685-5-3dfa0685-11f0-4630-81a2-bc3675d27050/src/github.com/elastic/beats/libbeat/processors/add_cloud_metadata/provider_azure_vm_test.go:189
            	Error:      	Not equal: 
            	            	expected: {"cloud":{"account":{"id":"0e073ec1-c22f-4488-adde-da35ed609ccd"},"instance":{"id":"220e2b43-0913-492f-ada0-b6b2795bdb9b","name":"aks-agentpool-12628255-vmss_2"},"machine":{"type":"Standard_DS2_v2"},"provider":"azure","region":"eastus","resourceGroup":{"name":"MC_myname_group_myname_eastus"},"service":{"name":"Virtual Machines"}},"orchestrator":{"cluster":{"id":"testcluster1Id","name":"testcluster1Name"}}}
            	            	actual  : {}
            	            	
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1,28 +1,2 @@
            	            	-(mapstr.M) (len=2) {
            	            	- (string) (len=5) "cloud": (mapstr.M) (len=7) {
            	            	-  (string) (len=7) "account": (mapstr.M) (len=1) {
            	            	-   (string) (len=2) "id": (string) (len=36) "0e073ec1-c22f-4488-adde-da35ed609ccd"
            	            	-  },
            	            	-  (string) (len=8) "instance": (mapstr.M) (len=2) {
            	            	-   (string) (len=2) "id": (string) (len=36) "220e2b43-0913-492f-ada0-b6b2795bdb9b",
            	            	-   (string) (len=4) "name": (string) (len=29) "aks-agentpool-12628255-vmss_2"
            	            	-  },
            	            	-  (string) (len=7) "machine": (mapstr.M) (len=1) {
            	            	-   (string) (len=4) "type": (string) (len=15) "Standard_DS2_v2"
            	            	-  },
            	            	-  (string) (len=8) "provider": (string) (len=5) "azure",
            	            	-  (string) (len=6) "region": (string) (len=6) "eastus",
            	            	-  (string) (len=13) "resourceGroup": (mapstr.M) (len=1) {
            	            	-   (string) (len=4) "name": (string) (len=29) "MC_myname_group_myname_eastus"
            	            	-  },
            	            	-  (string) (len=7) "service": (mapstr.M) (len=1) {
            	            	-   (string) (len=4) "name": (string) (len=16) "Virtual Machines"
            	            	-  }
            	            	- },
            	            	- (string) (len=12) "orchestrator": (mapstr.M) (len=1) {
            	            	-  (string) (len=7) "cluster": (mapstr.M) (len=2) {
            	            	-   (string) (len=2) "id": (string) (len=14) "testcluster1Id",
            	            	-   (string) (len=4) "name": (string) (len=16) "testcluster1Name"
            	            	-  }
            	            	- }
            	            	+(mapstr.M) {
            	            	 }
            	Test:       	TestRetrieveAzureMetadata
    --- FAIL: TestRetrieveAzureMetadata (3.01s)
     
    

Steps errors 7

Expand to view the steps failures

libbeat-unitTest - mage build unitTest
  • Took 12 min 35 sec . View more details here
  • Description: mage build unitTest
libbeat-unitTest - mage build unitTest
  • Took 9 min 14 sec . View more details here
  • Description: mage build unitTest
libbeat-unitTest - mage build unitTest
  • Took 9 min 14 sec . View more details here
  • Description: mage build unitTest
libbeat-goIntegTest - mage goIntegTest
  • Took 16 min 39 sec . View more details here
  • Description: mage goIntegTest
libbeat-goIntegTest - mage goIntegTest
  • Took 12 min 45 sec . View more details here
  • Description: mage goIntegTest
libbeat-goIntegTest - mage goIntegTest
  • Took 12 min 44 sec . View more details here
  • Description: mage goIntegTest
Error signal
  • Took 0 min 0 sec . View more details here
  • Description: Error 'hudson.AbortException: script returned exit code 1'

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@elasticmachine
Copy link
Collaborator

💔 Tests Failed

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2024-01-25T11:50:34.518+0000

  • Duration: 129 min 53 sec

Test stats 🧪

Test Results
Failed 2
Passed 28763
Skipped 1998
Total 30763

Test errors 2

Expand to view the tests failures

Build&Test / libbeat-unitTest / TestRetrieveAzureMetadata – github.com/elastic/beats/v7/libbeat/processors/add_cloud_metadata
    Expand to view the error details

     Failed 
    

    Expand to view the stacktrace

     === RUN   TestRetrieveAzureMetadata
        provider_azure_vm_test.go:190: 
            	Error Trace:	/var/lib/jenkins/workspace/PR-37685-6-fe2b6713-3612-40d7-89c7-6537285a90ce/src/github.com/elastic/beats/libbeat/processors/add_cloud_metadata/provider_azure_vm_test.go:190
            	Error:      	Not equal: 
            	            	expected: {"cloud":{"account":{"id":"0e073ec1-c22f-4488-adde-da35ed609ccd"},"instance":{"id":"220e2b43-0913-492f-ada0-b6b2795bdb9b","name":"aks-agentpool-12628255-vmss_2"},"machine":{"type":"Standard_DS2_v2"},"provider":"azure","region":"eastus","resourceGroup":{"name":"MC_myname_group_myname_eastus"},"service":{"name":"Virtual Machines"}},"orchestrator":{"cluster":{"id":"testcluster1Id","name":"testcluster1Name"}}}
            	            	actual  : {"cloud":{"account":{"id":"0e073ec1-c22f-4488-adde-da35ed609ccd"},"instance":{"id":"220e2b43-0913-492f-ada0-b6b2795bdb9b","name":"aks-agentpool-12628255-vmss_2"},"machine":{"type":"Standard_DS2_v2"},"provider":"azure","region":"eastus","resourceGroup":{"name":"MC_myname_group_myname_eastus"},"service":{"name":"Virtual Machines"}}}
            	            	
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1,2 +1,2 @@
            	            	-(mapstr.M) (len=2) {
            	            	+(mapstr.M) (len=1) {
            	            	  (string) (len=5) "cloud": (mapstr.M) (len=7) {
            	            	@@ -20,8 +20,2 @@
            	            	   }
            	            	- },
            	            	- (string) (len=12) "orchestrator": (mapstr.M) (len=1) {
            	            	-  (string) (len=7) "cluster": (mapstr.M) (len=2) {
            	            	-   (string) (len=2) "id": (string) (len=14) "testcluster1Id",
            	            	-   (string) (len=4) "name": (string) (len=16) "testcluster1Name"
            	            	-  }
            	            	  }
            	Test:       	TestRetrieveAzureMetadata
    --- FAIL: TestRetrieveAzureMetadata (2.09s)
     
    

Build&Test / libbeat-goIntegTest / TestRetrieveAzureMetadata – github.com/elastic/beats/v7/libbeat/processors/add_cloud_metadata
    Expand to view the error details

     Failed 
    

    Expand to view the stacktrace

     === RUN   TestRetrieveAzureMetadata
        provider_azure_vm_test.go:190: 
            	Error Trace:	/var/lib/jenkins/workspace/PR-37685-6-2c8b8f66-131b-4cf9-86aa-795372e3a396/src/github.com/elastic/beats/libbeat/processors/add_cloud_metadata/provider_azure_vm_test.go:190
            	Error:      	Not equal: 
            	            	expected: {"cloud":{"account":{"id":"0e073ec1-c22f-4488-adde-da35ed609ccd"},"instance":{"id":"220e2b43-0913-492f-ada0-b6b2795bdb9b","name":"aks-agentpool-12628255-vmss_2"},"machine":{"type":"Standard_DS2_v2"},"provider":"azure","region":"eastus","resourceGroup":{"name":"MC_myname_group_myname_eastus"},"service":{"name":"Virtual Machines"}},"orchestrator":{"cluster":{"id":"testcluster1Id","name":"testcluster1Name"}}}
            	            	actual  : {}
            	            	
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1,28 +1,2 @@
            	            	-(mapstr.M) (len=2) {
            	            	- (string) (len=5) "cloud": (mapstr.M) (len=7) {
            	            	-  (string) (len=7) "account": (mapstr.M) (len=1) {
            	            	-   (string) (len=2) "id": (string) (len=36) "0e073ec1-c22f-4488-adde-da35ed609ccd"
            	            	-  },
            	            	-  (string) (len=8) "instance": (mapstr.M) (len=2) {
            	            	-   (string) (len=2) "id": (string) (len=36) "220e2b43-0913-492f-ada0-b6b2795bdb9b",
            	            	-   (string) (len=4) "name": (string) (len=29) "aks-agentpool-12628255-vmss_2"
            	            	-  },
            	            	-  (string) (len=7) "machine": (mapstr.M) (len=1) {
            	            	-   (string) (len=4) "type": (string) (len=15) "Standard_DS2_v2"
            	            	-  },
            	            	-  (string) (len=8) "provider": (string) (len=5) "azure",
            	            	-  (string) (len=6) "region": (string) (len=6) "eastus",
            	            	-  (string) (len=13) "resourceGroup": (mapstr.M) (len=1) {
            	            	-   (string) (len=4) "name": (string) (len=29) "MC_myname_group_myname_eastus"
            	            	-  },
            	            	-  (string) (len=7) "service": (mapstr.M) (len=1) {
            	            	-   (string) (len=4) "name": (string) (len=16) "Virtual Machines"
            	            	-  }
            	            	- },
            	            	- (string) (len=12) "orchestrator": (mapstr.M) (len=1) {
            	            	-  (string) (len=7) "cluster": (mapstr.M) (len=2) {
            	            	-   (string) (len=2) "id": (string) (len=14) "testcluster1Id",
            	            	-   (string) (len=4) "name": (string) (len=16) "testcluster1Name"
            	            	-  }
            	            	- }
            	            	+(mapstr.M) {
            	            	 }
            	Test:       	TestRetrieveAzureMetadata
    --- FAIL: TestRetrieveAzureMetadata (3.06s)
     
    

Steps errors 7

Expand to view the steps failures

libbeat-unitTest - mage build unitTest
  • Took 11 min 24 sec . View more details here
  • Description: mage build unitTest
libbeat-unitTest - mage build unitTest
  • Took 9 min 13 sec . View more details here
  • Description: mage build unitTest
libbeat-unitTest - mage build unitTest
  • Took 9 min 17 sec . View more details here
  • Description: mage build unitTest
libbeat-goIntegTest - mage goIntegTest
  • Took 15 min 5 sec . View more details here
  • Description: mage goIntegTest
libbeat-goIntegTest - mage goIntegTest
  • Took 11 min 8 sec . View more details here
  • Description: mage goIntegTest
libbeat-goIntegTest - mage goIntegTest
  • Took 11 min 13 sec . View more details here
  • Description: mage goIntegTest
Error signal
  • Took 0 min 0 sec . View more details here
  • Description: Error 'hudson.AbortException: script returned exit code 1'

🐛 Flaky test report

❕ There are test failures but not known flaky tests.

Expand to view the summary

Genuine test errors 2

💔 There are test failures but not known flaky tests, most likely a genuine test failure.

  • Name: Build&Test / libbeat-unitTest / TestRetrieveAzureMetadata – github.com/elastic/beats/v7/libbeat/processors/add_cloud_metadata
  • Name: Build&Test / libbeat-goIntegTest / TestRetrieveAzureMetadata – github.com/elastic/beats/v7/libbeat/processors/add_cloud_metadata

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@elasticmachine
Copy link
Collaborator

❕ Build Aborted

Either there was a build timeout or someone aborted the build.

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Duration: 98 min 10 sec

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

// hfetcher represents an http fetcher to retrieve metadata from azure metadata endpoint
hfetcher, err := newMetadataFetcher(config, "azure", azHeaders, metadataHost, azHttpSchema, azMetadataURI)
if err != nil {
return hfetcher, err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add fmt.Errorf statements to the errors here? We put them in some of the later functions, so we should be consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -53,4 +52,12 @@
path: cloud.region
migration: true

- name: azure.resourcegroup
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this consistent with what we have been using in Fleet integrations? I think I recall azure.resource.group being used over there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am also a little concerned about this processor beginning to produce fields outside of the ECS cloud and orchestrator namespaces.

Downstream consumers (e.g Fleet integrations) should ideally be updated to have this field included in their mappings since it's not part of ECS. This affects almost all integrations since Agent includes add_cloud_metadata with most input types from Beats. (Imagine if we ran our CI on Azure for Fleet integration system testing, after this merges every integration's system tests would begin failing because this field was not defined in its mappings.)

The other concern is whether or not existing pipelines will safely handle the addition of this field. For example if an ingest pipeline is already using this field then does it safely handle the case where the field already exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The azure.resource.group , created by a pipeline? as I noticed is the resource group stripped. It only includes the group's name. The addition of the azure.resourcegroup.name field I did was to me a nice to have and definitely not the reason of this PR.
I understand that it then needs to be added in all the integrations because it comes from the processor.
Also it is confusing having two similar named fields. I chose the naming to be compliant with Otel.

I hear your concerns and I will remove this field as it beats the purpose of this PR which was to add the orchestrator ecs fields.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The azure.resource.group , created by a pipeline?

I'm not familiar with these integrations, but, yes, I see it being created by a grok in a few pipeline.

https://github.com/search?q=repo%3Aelastic%2Fintegrations+path%3A**%2F*.yml+%2Fazure%5C.resource%5C.%3Fgroup%2F&type=code

I understand that it then needs to be added in all the integrations because it comes from the processor.

This is a really general problem we have with Fleet integrations in that there is no easy or centralized way to account for the fields being added by the processors.

I hear your concerns and I will remove this field as it beats the purpose of this PR which was to add the orchestrator ecs fields.

👍

libbeat/processors/add_cloud_metadata/provider_azure_vm.go Outdated Show resolved Hide resolved
libbeat/processors/add_cloud_metadata/provider_azure_vm.go Outdated Show resolved Hide resolved
libbeat/processors/add_cloud_metadata/provider_azure_vm.go Outdated Show resolved Hide resolved
libbeat/processors/add_cloud_metadata/provider_azure_vm.go Outdated Show resolved Hide resolved
libbeat/processors/add_cloud_metadata/provider_azure_vm.go Outdated Show resolved Hide resolved
MichaelKatsoulis and others added 7 commits March 8, 2024 11:30
…asciidoc

Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
…asciidoc

Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
libbeat/processors/add_cloud_metadata/provider_azure_vm.go Outdated Show resolved Hide resolved
@@ -53,4 +52,12 @@
path: cloud.region
migration: true

- name: azure.resourcegroup
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The azure.resource.group , created by a pipeline?

I'm not familiar with these integrations, but, yes, I see it being created by a grok in a few pipeline.

https://github.com/search?q=repo%3Aelastic%2Fintegrations+path%3A**%2F*.yml+%2Fazure%5C.resource%5C.%3Fgroup%2F&type=code

I understand that it then needs to be added in all the integrations because it comes from the processor.

This is a really general problem we have with Fleet integrations in that there is no easy or centralized way to account for the fields being added by the processors.

I hear your concerns and I will remove this field as it beats the purpose of this PR which was to add the orchestrator ecs fields.

👍

Co-authored-by: Andrew Kroh <andrew.kroh@elastic.co>
@elasticmachine
Copy link
Collaborator

elasticmachine commented Mar 11, 2024

💔 Build Failed

Failed CI Steps

History

cc @MichaelKatsoulis

@elasticmachine
Copy link
Collaborator

elasticmachine commented Mar 11, 2024

@elasticmachine
Copy link
Collaborator

elasticmachine commented Mar 11, 2024

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @MichaelKatsoulis

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @MichaelKatsoulis

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @MichaelKatsoulis

@MichaelKatsoulis MichaelKatsoulis removed the request for review from faec March 11, 2024 14:12
@MichaelKatsoulis MichaelKatsoulis merged commit 7987272 into elastic:main Mar 11, 2024
160 of 164 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Processors Team:Cloud-Monitoring Label for the Cloud Monitoring team Team:Cloudnative-Monitoring Label for the Cloud Native Monitoring team Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate if it is possible to set orchestrator fields from Cloud provider kubernetes metadata
10 participants