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

Metricbeat: Support multiple apache status page versions #6450

Merged
merged 1 commit into from
Mar 20, 2018

Conversation

jsoriano
Copy link
Member

In Apache 2.4.16 server status page changed to provide more CPU information and uptime in human format (#5637). These changes make apache module support old and new schemas.

To test it, I add a second apache with the latest version using the old format, but it doesn't look very orthodox as we are not doing it with any other module. @exekias @ruflin wdyt? do we have any other approach when needing to support multiple formats?

@jsoriano jsoriano added enhancement discuss Issue needs further discussion. review Metricbeat Metricbeat labels Feb 22, 2018
@jsoriano jsoriano force-pushed the server-status-apache-versions branch from 3541aaa to d198b42 Compare February 22, 2018 20:23
Copy link
Contributor

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

Thanks for taking a stab on this. So far there is not much precedence on how to deal with this. We test across multiple versions in the Elasticsearch module but there we just start an http and endpoint to serve a predefined json object. I think that is part of the "static" solution to support multiple versions.

The other part about actually running the services is also important as it helps us to detect the edge cases. I'm good with moving forward as you have specified it in this PR to have multiple images per module for now.

It does not seem to work on CI at the moment:
https://beats-ci.elastic.co/job/elastic+beats+pull-request+multijob-linux/3335/beat=metricbeat,label=ubuntu/console

@exekias WDYT? This should probably work with your compose magic?

@@ -141,6 +163,9 @@ func eventMapping(scanner *bufio.Scanner, hostname string) (common.MapStr, *s.Er
},
}
_, err := schema.ApplyTo(event, fullEvent)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to identify on the first request which Apache version it is to then pick the schema? Otherwise we decode every event twice.

Copy link
Member Author

Choose a reason for hiding this comment

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

Umm, indeed I can do it depend on the different fields seen in fullEvent instead of completelly decoding it twice.

@@ -51,6 +50,29 @@ var (
"15": c.Float("Load15", s.Optional),
},
}

// Schema used till apache 2.4.12
schemaOld = s.Schema{
Copy link
Contributor

Choose a reason for hiding this comment

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

We must make sure all these fields are also in the fields.yml documented.

Copy link
Member Author

Choose a reason for hiding this comment

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

schemaOld contains a subset of the fields of the current schema.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, I have removed the server_uptime field, it looks redundant to me with the uptime field. Also I think uptime shouldn't be a group, it should be enough with a long for this value, but changing from group to long looks fearful for backwards compatibility.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's not introduce a breaking change here as this potentially goes out in a minor.

We should start a list of fields we want to change in the next master where we can break things.

For server_uptime vs uptime I'm not sure if one is from the actual host itself and the other one apache?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, I revert these changes on server_update.

@jsoriano jsoriano force-pushed the server-status-apache-versions branch 3 times, most recently from a917a29 to 548d858 Compare February 23, 2018 19:46
@ruflin ruflin removed the discuss Issue needs further discussion. label Feb 26, 2018
@jsoriano jsoriano force-pushed the server-status-apache-versions branch from 548d858 to c5813c0 Compare March 5, 2018 01:46
@exekias
Copy link
Contributor

exekias commented Mar 10, 2018

I'm ok with this approach while we work on a permanent solution, please have a look to failing tests, they look legit

@jsoriano jsoriano force-pushed the server-status-apache-versions branch 2 times, most recently from ecb2cb7 to 048e5f3 Compare March 10, 2018 03:27
@jsoriano
Copy link
Member Author

jenkins, test it

Copy link
Contributor

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

LGTM. Can you add a CHANGELOG entry?

Can you also check if this needs some update? https://github.com/elastic/beats/blob/master/metricbeat/module/apache/_meta/docs.asciidoc If you change it, run make update.

Apache before version 2.4.16 had less information in its status
page. Add support to both, old and new status pages.
@jsoriano jsoriano force-pushed the server-status-apache-versions branch from 048e5f3 to db217fa Compare March 19, 2018 12:13
@jsoriano
Copy link
Member Author

Changelog and info about tested versions in doc updated

jsoriano added a commit to jsoriano/beats that referenced this pull request Oct 3, 2018
jsoriano added a commit that referenced this pull request Oct 17, 2018
jsoriano added a commit that referenced this pull request Oct 18, 2018
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants