Skip to content

[Azure] Fix the metrics field name in the container instance datastream #7445

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

Merged

Conversation

zmoog
Copy link
Contributor

@zmoog zmoog commented Aug 17, 2023

What does this PR do?

Fix the rename processor to use the correct field name. Add aliases to allow existing users to access all data with the old field names azure.metrics.* for backwards compatibility.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

Author's Checklist

  • Fix rename processor
  • Add aliases for the azure.metrics.* field names

How to test this PR locally

Aliases for backwards compatibility

Existing users can use field names azure.metrics.*in dashboards and queries to access old and new documents:

In the metrics-azure.container_instance-default there are:

  • 12 documents created with integration v1.0.23, having azure.metrics fields only.
  • 22 documents created with integration v1.0.24, having azure.container_instance fields only.
#
# request
#

POST metrics-azure.container_instance-default/_search
{
  "query": {
    "exists":{
      "field":"azure.metrics"
    }
  }
}

#
# response
#

{
  "hits": {
    "total": {
      "value": 34,
      "relation": "eq"
    },


#
# request
#

POST metrics-azure.container_instance-default/_search
{
  "query": {
    "exists":{
      "field":"azure.container_instance"
    }
  }
}

#
# response
#

{
  "hits": {
    "total": {
      "value": 22,
      "relation": "eq"
    },

If we query azure.container_instance we get the 22 new docs only. However, if we query using azure.metrics we get all 34 (12 + 22) documents.

Related issues

Screenshots

The dashboard can show data now that the pipeline creates the documents with the expected field names.

CleanShot 2023-08-17 at 16 44 36@2x

zmoog added 2 commits August 17, 2023 16:28
The processor now renames the actual field name `azure.metrics`
produced by the Metricbeat metricset, according to the current
configuration
Since there may be users with deployments of this integration, we add
an alias for all the `azure.metrics.*` fields pointing to the
equivalent `azure.container_instace.*` field.

Existing users that are using the `azure.metrics` can take advantage
of new documents created with the `azure.container_instace.*` names.
@zmoog zmoog added Integration:azure Azure Logs Team:Cloud-Monitoring Label for the Cloud Monitoring team labels Aug 17, 2023
@zmoog zmoog self-assigned this Aug 17, 2023
@elasticmachine
Copy link

elasticmachine commented Aug 17, 2023

💚 Build Succeeded

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: 2023-08-22T14:32:08.175+0000

  • Duration: 14 min 44 sec

Test stats 🧪

Test Results
Failed 0
Passed 33
Skipped 0
Total 33

🤖 GitHub comments

Expand to view the GitHub comments

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

  • /test : Re-trigger the build.

@elasticmachine
Copy link

elasticmachine commented Aug 17, 2023

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (3/3) 💚
Files 100.0% (3/3) 💚
Classes 100.0% (3/3) 💚
Methods 73.333% (22/30) 👎 -15.556
Lines 100.0% (21/21) 💚 9.333
Conditionals 100.0% (0/0) 💚

The sample document with the `azure.monitor.*` field comes from a
Metricbeat.

Azure Monitor field names can vary depending on the metricset
configuration.

See https://github.com/elastic/beats/blob/90cd631cabf82c2bac7999029feb791764ba2698/x-pack/metricbeat/module/azure/data.go#L100-L106
for more information about how this works.
@zmoog zmoog marked this pull request as ready for review August 17, 2023 15:44
@zmoog zmoog requested a review from a team as a code owner August 17, 2023 15:44
Copy link
Contributor

@rajvi-patel-22 rajvi-patel-22 left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Contributor

@tetianakravchenko tetianakravchenko left a comment

Choose a reason for hiding this comment

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

changelog and manifest version update are missing, could you please add it?

maybe it makes sense to update the relevant dashboards with the correct metric naming? for example: If I install fixed version of integration, it might be confusing to find that used azure.metrics... instead of expected azure.container_instance, @zmoog wdyt?

@zmoog
Copy link
Contributor Author

zmoog commented Aug 22, 2023

changelog and manifest version update are missing, could you please add it?

🤦

I added the missing changelog entry, thanks!

maybe it makes sense to update the relevant dashboards with the correct metric naming? for example: If I install fixed version of integration, it might be confusing to find that used azure.metrics... instead of expected azure.container_instance, @zmoog wdyt?

The dashboards was already using azure.container_instance.* field names. Without this change, the dashboard does not display anything. I am surprised we didn't receive and SDH or other bug report about problem.

Copy link
Member

@endorama endorama left a comment

Choose a reason for hiding this comment

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

Add aliases to allow existing users to access all data with the old field names azure.metrics.* for backwards compatibility.

🤩

@zmoog zmoog changed the title [Azure] Fix container instance metrics field problem [Azure] Fix the metrics field name in the container instance datastream Aug 22, 2023
@zmoog
Copy link
Contributor Author

zmoog commented Aug 22, 2023

Add aliases to allow existing users to access all data with the old field names azure.metrics.* for backwards compatibility.

🤩

If you break it, you fix it ™

@zmoog zmoog merged commit 4c50ad2 into elastic:main Aug 22, 2023
@zmoog zmoog deleted the zmoog/azure-container-instance-metrics-field-problem branch August 22, 2023 15:28
@elasticmachine
Copy link

Package azure_metrics - 1.0.24 containing this change is available at https://epr.elastic.co/search?package=azure_metrics

@andrewkroh andrewkroh added Integration:azure_metrics Azure Resource Metrics and removed Integration:azure Azure Logs labels Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Integration:azure_metrics Azure Resource Metrics Team:Cloud-Monitoring Label for the Cloud Monitoring team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Azure] [container_instance] Not correct metrics field
6 participants