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

1928 update name behavior #2302

Merged
merged 4 commits into from Aug 5, 2020
Merged

1928 update name behavior #2302

merged 4 commits into from Aug 5, 2020

Conversation

aneveu
Copy link
Contributor

@aneveu aneveu commented Aug 5, 2020

  • remove the flow tag altogether
  • using the name operator will replace the reactor prefix in meter names with whatever name was given to the sequence
  • using tags but not name will be documented as potentially dangerous, as it creates a sparse set of tags for sequences in the application that don't have a unique name
  • aggregated view is still somewhat possible in this mode by refraining from giving a name to the sequence, but consistently using a tag("flow", "theName") across all usages of .metrics() (which might be challenging if a framework or library also uses metrics() without a name())

@aneveu aneveu requested a review from a team August 5, 2020 11:17
@codecov-commenter
Copy link

codecov-commenter commented Aug 5, 2020

Codecov Report

Merging #2302 into master will increase coverage by 0.02%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2302      +/-   ##
============================================
+ Coverage     84.08%   84.11%   +0.02%     
- Complexity     4528     4530       +2     
============================================
  Files           378      378              
  Lines         31439    31440       +1     
  Branches       6035     6035              
============================================
+ Hits          26436    26445       +9     
+ Misses         3372     3367       -5     
+ Partials       1631     1628       -3     
Impacted Files Coverage Δ Complexity Δ
...ore/src/main/java/reactor/core/publisher/Flux.java 98.55% <ø> (ø) 529.00 <0.00> (ø)
.../main/java/reactor/core/publisher/FluxMetrics.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...va/reactor/core/publisher/FluxMetricsFuseable.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...ore/src/main/java/reactor/core/publisher/Mono.java 92.20% <ø> (ø) 278.00 <0.00> (ø)
.../main/java/reactor/core/publisher/MonoMetrics.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...va/reactor/core/publisher/MonoMetricsFuseable.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...c/main/java/reactor/core/publisher/MonoCreate.java 77.37% <0.00%> (-2.19%) 5.00% <0.00%> (ø%)
...ain/java/reactor/core/scheduler/SchedulerTask.java 76.78% <0.00%> (-1.79%) 17.00% <0.00%> (-1.00%)
...va/reactor/core/publisher/FluxFlattenIterable.java 91.68% <0.00%> (-0.26%) 8.00% <0.00%> (ø%)
.../main/java/reactor/core/publisher/FluxFlatMap.java 95.15% <0.00%> (ø) 21.00% <0.00%> (ø%)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a29a4d0...83009ca. Read the comment docs.

====

Be careful when using `Flux#name` and `Flux#tag` operators together: some monitoring systems like Prometheus require to have the exact same set of tags for each metric with the same name.
Copy link
Member

Choose a reason for hiding this comment

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

I'd turn this sentence around, indicating that using a name can be considered mandatory when using custom tags, since it would otherwise result in a different set of tags between two default-named sequences. then add the sentence about prometheus requiring exact same set of tags.

.name("events")
.tag("source", "kafka") <1>
Copy link
Member

Choose a reason for hiding this comment

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

I'd also annotate the name line above

=== Common tags

Every metric will have the following tags in common:
Every metric will have the following tag in common:
Copy link
Member

Choose a reason for hiding this comment

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

since we only have one now, I'd eliminate the table entirely and inline the description of the tag in the sentence. Also list the two possible values, Flux and Mono.

@@ -6001,12 +6001,16 @@ public int getPrefetch() {
* {@link #name(String) name} (and optionally {@link #tag(String, String) tag}) the
* sequence.
* <p>
* In case no name has been provided, the default name "reactor" will be applied.
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: add The name serves as a prefix in the reported metrics names. before that sentence

@@ -6022,9 +6026,16 @@ public int getPrefetch() {
/**
* Give a name to this sequence, which can be retrieved using {@link Scannable#name()}
* as long as this is the first reachable {@link Scannable#parents()}.
* <p>
* If {@link #metrics()} operator is called later in the chain, this name will be used for
* {@link io.micrometer.core.instrument.Meter}.
Copy link
Member

Choose a reason for hiding this comment

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

don't reference micrometer classes in the javadoc. this can be turned into this name will be used as a prefix for metrics names (or meters instead of metrics)

@@ -8289,10 +8300,17 @@ public final void subscribe(Subscriber<? super T> actual) {
* all tags throughout the publisher chain by using {@link Scannable#tags()} (as
* traversed
* by {@link Scannable#parents()}).
* <p>
* Note that some monitoring systems like Prometheus require to have the exact same set of
* tags for each {@link io.micrometer.core.instrument.Meter} bearing the same name.
Copy link
Member

Choose a reason for hiding this comment

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

don't link to micrometer classes in javadoc

.summary();

assertThat(meter).as("tagged find").isNull();
}

//see https://github.com/reactor/reactor-core/issues/1425
Copy link
Member

Choose a reason for hiding this comment

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

I'd still try to keep both of these tests, validating that a Mono.just and a Mono.error both have the same default set of tags. Just remove the .name (or make it the same). Same in the flux test.


| type | Publisher's type | "Mono"
=== Common tag
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if, given the size of this section, it couldn't be merged with the Custom Tags section below.

@aneveu aneveu merged commit 8732027 into master Aug 5, 2020
@aneveu aneveu deleted the 1928-updateNameBehavior branch August 5, 2020 15:49
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