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 metrics storage support to auto-generated CLI documentation #539

Merged

Conversation

albertteoh
Copy link
Contributor

Signed-off-by: albertteoh see.kwang.teoh@gmail.com

Which problem is this PR solving?

Short description of the changes

  • Adds support for metrics-storage to the auto-generated documentation.
  • Minor improvements:
    • Taking advantage of python 3 features such as f-strings along with some simplifications.
    • Fix variable names and titles in template.

Testing

Generated CLI docs against version 1.28 to allow output comparison.

# Only prometheus-related files were added.
$ diff -q /home/go/src/github.com/albertteoh/documentation/data/cli/1.28/ /tmp/docs/data/cli/1.28
Files /home/go/src/github.com/albertteoh/documentation/data/cli/1.28/config.json and /tmp/docs/data/cli/1.28/config.json differ
Only in /tmp/docs/data/cli/1.28: jaeger-all-in-one-prometheus.yaml
Only in /tmp/docs/data/cli/1.28: jaeger-query-prometheus.yaml

# Only prometheus flags added to these files.
$ diff /home/go/src/github.com/albertteoh/documentation/data/cli/1.28/jaeger-all-in-one.yaml /tmp/docs/data/cli/1.28/jaeger-all-in-one-prometheus.yaml
150a151,177
> - name: prometheus.connect-timeout
>   default_value: 30s
>   usage: |
>     The period to wait for a connection to Prometheus when executing queries.
> - name: prometheus.server-url
>   default_value: http://localhost:9090
>   usage: |
>     The Prometheus server's URL, must include the protocol scheme e.g. http://localhost:9090
> - name: prometheus.tls.ca
>   usage: |
>     Path to a TLS CA (Certification Authority) file used to verify the remote server(s) (by default will use the system truststore)
> - name: prometheus.tls.cert
>   usage: |
>     Path to a TLS Certificate file, used to identify this process to the remote server(s)
> - name: prometheus.tls.enabled
>   default_value: "false"
>   usage: Enable TLS when talking to the remote server(s)
> - name: prometheus.tls.key
>   usage: |
>     Path to a TLS Private Key file, used to identify this process to the remote server(s)
> - name: prometheus.tls.server-name
>   usage: |
>     Override the TLS server name we expect in the certificate of the remote server(s)
> - name: prometheus.tls.skip-host-verify
>   default_value: "false"
>   usage: |
>     (insecure) Skip server's certificate chain and host name verification

Copied generated doc files to documentation/data/cli/1.28/ and ran make develop. The following are relevant screenshots of the rendered changes made in this PR:

Screen Shot 2021-11-30 at 10 31 50 pm

Screen Shot 2021-11-30 at 10 31 28 pm

Screen Shot 2021-11-30 at 10 32 38 pm

Screen Shot 2021-11-30 at 10 32 33 pm

Screen Shot 2021-11-30 at 10 32 19 pm

Screen Shot 2021-11-30 at 10 32 15 pm

Screen Shot 2021-11-30 at 10 32 04 pm

Signed-off-by: albertteoh <see.kwang.teoh@gmail.com>
Signed-off-by: albertteoh <see.kwang.teoh@gmail.com>
Signed-off-by: albertteoh <see.kwang.teoh@gmail.com>
Signed-off-by: albertteoh <see.kwang.teoh@gmail.com>
<li>
<a href="#{{ $file }}">
{{ $tool }} with <code>{{ $storage }}</code>
{{ $tool }} with <code>{{ $sampling }}</code> sampling
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before: "... with adaptive"
After: "... with adaptive sampling"

@@ -80,11 +96,25 @@ <h3 id="{{ $file }}">

<!-- TODO right sidebar gets too long, we should use tabs here -->
<h3 id="{{ $file }}">
{{ $tool }} with <code>{{ $sampling }}</code> sampling type
{{ $tool }} with <code>{{ $sampling }}</code> sampling
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before: "... with adaptive sampling type"
After: "... with adaptive sampling"



for tool in cfg['tools']:
tool_cfg = cfg[tool]
storage_types=tool_cfg['storage']
sampling_types=tool_cfg['sampling']
if storage_types:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These ifs were redundant as a "zero" value of a list just means the body of the for loop won't be executed.

# generate generates the CLI documentation for a given "tool" (e.g.
# jaeger-collector, jaeger-query, etc.) and feature (e.g. storage=elasticsearch,
# sampling=adaptive, metrics-storage=prometheus).
def generate(tool, **kwargs):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think using kwargs would be simpler and cleaner than adding another "optional" parameter to support metrics storage, especially avoiding the need to extend the storageOrSampling variable.

@yurishkuro
Copy link
Member

I think we need to rethink the organization of this doc. Each entry repeats a lot of options not related to the given storage type. It was sort of ok when there was only one dimension we could vary, now we have three.

What if we had a "core flags" section first and then each storage type would only list additional flags it enables? Could we isolate those extra flags by a common prefix?

@jpkrohling
Copy link
Contributor

I think we need to rethink the organization of this doc.

For this PR, or for the future? Should I wait on this one to release the new docs for 1.29.0?

@yurishkuro
Copy link
Member

For this PR, or for the future? Should I wait on this one to release the new docs for 1.29.0?

Well, I guess since we're right in the middle of the release we should merge this as is and refactor later.

@jpkrohling jpkrohling merged commit 2fa5b0c into jaegertracing:master Dec 1, 2021
@albertteoh albertteoh deleted the add-metrics-storage-support branch December 3, 2021 07:35
@albertteoh
Copy link
Contributor Author

I think we need to rethink the organization of this doc. Each entry repeats a lot of options not related to the given storage type. It was sort of ok when there was only one dimension we could vary, now we have three.

What if we had a "core flags" section first and then each storage type would only list additional flags it enables? Could we isolate those extra flags by a common prefix?

I agree that the page has a lot of duplicated flags; I'd originally thought that was by design so all possible flags are localised to that particular configuration to avoid jumping around different sections of the document.

I've created a follow-up ticket to discuss and/or address this concern: #541

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants