-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Create-metricset docs review #8375
Create-metricset docs review #8375
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Submitted a handful of changes, but looks good overall. Thanks for doing this!!
binary in debug mode with the following command: | ||
+ | ||
[source,bash] | ||
---- | ||
./{beat} -e -d "*" | ||
./metricset -e -d "*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this say metricbeat?
} | ||
---- | ||
|
||
[float] | ||
===== Definition | ||
|
||
The MetricSet type defines all fields of the metricset. As a minimum it must inherit the `mb.BaseMetricSet` fields, | ||
The MetricSet type defines all fields of the metricset. As a minimum it must be composed of the `mb.BaseMetricSet` fields, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: remove the extra spaces after "be composed of"
The `fields.yml` file is used for different purposes: | ||
You can find up to 3 related `fields.yml` files in the beats repository for each metricbeat module: | ||
|
||
* `fields.yml` (at the root of the repository). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no fields.yml at the root. You should give the full path and filename.
@@ -87,14 +87,22 @@ functionality of the metricset and `Fetch` method from the data mapping. | |||
[float] | |||
==== fields.yml | |||
|
|||
The `fields.yml` file is used for different purposes: | |||
You can find up to 3 related `fields.yml` files in the beats repository for each metricbeat module: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this structure is harder for readers to skim. It's OK if you want to leave it for now (might make sense for me to take a quick editorial pass through the dev docs after you are done with your additions anyhow). If you want to make this easier to skim, you can put the description of each file under the bullet point (then you can just list the files and avoid saying "The first fields.yml is under..." (let me know if my comment is confusing...easier to do than explain). The asciidoc markup for indenting sections below bullet points looks like this:
. Some text next to a bullet point
+
Paragraph.
+
Example block
+
Etc
. Some text next to a bullet point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree that maybe it wasn't the best. I have built a new structure that I think is a bit better.
@@ -104,7 +112,7 @@ Here an example for the `fields.yml` file from the MySQL module. | |||
include::../../metricbeat/module/mysql/_meta/fields.yml[] | |||
---- | |||
|
|||
There is another `fields.yml` file under `module/{module}/{metricset}/_meta/fields.yml` that contains all fields retrieved | |||
The last `fields.yml` file under `module/{module}/{metricset}/_meta/fields.yml` that contains all fields retrieved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sentence structure here is not parallel with the previous bullet item, but that problem will be fixed if you change the structure as I described previously.
If you decide to punt, change this bullet item to use a parallel sentence structure: "The xyz is under....and it contains..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed! :)
+ | ||
[source,bash] | ||
---- | ||
make create-metricset | ||
---- | ||
+ | ||
You'll be prompted to enter a module and metricset name. Only use characters `[a-z]` | ||
You need to use Python 2.7 to run this command. If you also have Python 3 in your system, you can run the command with `VIRTUALENV_PARAMS="-p python2.7" make create-metricset` to force it to run with Python 2.7. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typically we use asciidoc attributes to resolve version numbers, or this info gets stale and we forget to update it. We should use one of the existing attributes, or add one to this file: https://github.com/elastic/beats/blob/master/libbeat/docs/version.asciidoc
So you might add something like :python-short: python2.7
to the versions file, and then use Python {python-short}
to resolve the value at doc build time.
Note that asciidoc attributes that appear within code snippets need extra love to resolve correctly. Wrap the code in plus signs instead of back ticks.
+VIRTUALENV_PARAMS="-p python{python-short}" make create-metricset+
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I found a python
reference already which also works so I have changed it accordingly.
@@ -148,7 +156,7 @@ We recommend that you use all three when you create a metricset. Unit tests are | |||
written in Go and have no dependencies. Integration tests are also written | |||
in Go but require the service from which the module collects metrics to also be running. | |||
System tests for Metricbeat also require the service to be running in most cases and are | |||
written in Python based on our small Python test framework. | |||
written in Python 2 based on our small Python test framework. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment...use an asciidoc attribute to resolve the version number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed! :)
I added the review label as I assume it's ready to be reviewed. |
@@ -17,7 +17,7 @@ To create a new metricset: | |||
make create-metricset | |||
---- | |||
+ | |||
You need to use Python 2.7 to run this command. If you also have Python 3 in your system, you can run the command with `VIRTUALENV_PARAMS="-p python2.7" make create-metricset` to force it to run with Python 2.7. | |||
You need to use Python 2.7 to run this command. If you also have Python 3 in your system, you can run the command with +VIRTUALENV_PARAMS="-p python{python}" make create-metricset+ to force it to run with Python 2.7. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still a couple of places where you say "Python 2.7"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that {python}
is defined as:
:python: 2.7.9
So python{python}
resolves as python2.7.9
. If you need this to resolve to a shorter version (2.7), you''ll need to add another attribute to the versions.asciidoc file and use that attribute here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I messed up here the python titles with commands. I think now with a new parameter in the versions file it should be more clear
[float] | ||
===== metricbeat/{module}/_meta/fields.yml | ||
|
||
The second `fields.yml` file is under `metricbeat/module/{module}/_meta/fields.yml` and it contains | ||
the general top level structure for all metricsets. Normally you only need to modify the description in this file. | ||
|
||
Here an example for the `fields.yml` file from the MySQL module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I missed this before, but there is a missing word here. Should say "Here is an example" or "Here's an example"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that :)
[float] | ||
===== metricbeat/{module}/{metricseat}/_meta/fields.yml | ||
|
||
The last `fields.yml` file under `metricbeat/module/{module}/{metricset}/_meta/fields.yml` that contains all fields retrieved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The phrasing of this sentence is still wrong. Should say "The last...file is under...and it contains... (otherwise it's a sentence fragment and doesn't match style/structure of other sections).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry again :)
@@ -148,7 +161,7 @@ We recommend that you use all three when you create a metricset. Unit tests are | |||
written in Go and have no dependencies. Integration tests are also written | |||
in Go but require the service from which the module collects metrics to also be running. | |||
System tests for Metricbeat also require the service to be running in most cases and are | |||
written in Python based on our small Python test framework. | |||
written in {python} based on our small Python test framework. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my previous comment. I think you want this to say Python {python}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a few minor nits. The structure of the content about the yaml files is much better. thanks!
To go green this needs a rebase on master and then |
f61f628
to
fd5e3be
Compare
Rebased done and |
@sayden Seems like this breaks the doc build: https://beats-ci.elastic.co/job/elastic+beats+pull-request+multijob-docs/923/console You can run |
Gonna fix it |
It took me a while until I realized that Jenkins was complaining about the brackets @dedemorton Is this ok? If not I think I'll need some creative suggestion 😆 |
@sayden You need to escape the content that appears in curly braces. Otherwise, asciidoc thinks it's an attribute and tries to resolve it. It fails (silently--a feature, I've been told), and you end up with an empty heading, which as you've discovered breaks the doc build. To fix the problem, escape the curly braces. For example:
Note that you don't have to escape curly braces in the example that appears after the heading because you've told asciidoc to treat it as text (by wrapping in back ticks). |
@kaiyan-sheng this content may be useful if you find anything outdated in the current guide ^ |
Pinging @elastic/infrastructure |
@sayden Wondering about the status of this PR. Would you like some help moving it forward? |
f34e08e
to
363ac47
Compare
363ac47
to
e4becd4
Compare
@dedemorton I have removed the mentions about Python because they are changing all the Pyhton related things now that we have had to move to Python 3. I have also reviewed some of the comments you did and I have tried to restructure some of the things in the way you explained (I'm not sure if I did it correctly) Feel free to add more comments, of course. |
Forgot to mention, I have ran a zillion of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor change to add a space, but otherwise LGTM. I'll approve because there's no need for you to ask for a second review after adding the space.
|
||
* `metricbeat/fields.yml`: Contains the definitions to create the Elasticsearch template, the Kibana index pattern configuration and the exported fields documentation for metricsets.To make sure the Elasticsearch template is correct, it's important to keep this file up-to-date with all the changes. Generally, you shouldn't touch this file manually because it's generated by some commands in the build environment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `metricbeat/fields.yml`: Contains the definitions to create the Elasticsearch template, the Kibana index pattern configuration and the exported fields documentation for metricsets.To make sure the Elasticsearch template is correct, it's important to keep this file up-to-date with all the changes. Generally, you shouldn't touch this file manually because it's generated by some commands in the build environment. | |
* `metricbeat/fields.yml`: Contains the definitions to create the Elasticsearch template, the Kibana index pattern configuration and the exported fields documentation for metricsets. To make sure the Elasticsearch template is correct, it's important to keep this file up-to-date with all the changes. Generally, you shouldn't touch this file manually because it's generated by some commands in the build environment. |
I think this is ready merge! |
Right now, It's only lacking a more detailed description about testing. @dedemorton suggested that maybe they should be in their own section. I think it's a good idea too.