Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closes #785 - Added autocompleter for declared metric names & fixed bug in ModelAutoCompleter #788

Merged
merged 5 commits into from
Jul 6, 2020

Conversation

MariusBrill
Copy link
Member

@MariusBrill MariusBrill commented Jun 23, 2020

This change is Reviewable

@codecov
Copy link

codecov bot commented Jun 25, 2020

Codecov Report

Merging #788 into master will decrease coverage by 0.10%.
The diff coverage is 79.65%.

@@             Coverage Diff              @@
##             master     #788      +/-   ##
============================================
- Coverage     83.00%   82.91%   -0.10%     
- Complexity     1736     1759      +23     
============================================
  Files           174      178       +4     
  Lines          5366     5470     +104     
  Branches        650      658       +8     
============================================
+ Hits           4454     4535      +81     
- Misses          675      694      +19     
- Partials        237      241       +4     
Impacted Files Coverage Δ Complexity Δ
...t/ocelot/config/model/tracing/TracingSettings.java 100.00% <ø> (ø) 0.00 <0.00> (ø)
...t/ocelot/config/validation/PropertyPathHelper.java 79.59% <0.00%> (-1.02%) 42.00 <0.00> (-1.00)
...lation/log/adapters/JBossLogmanagerMDCAdapter.java 66.67% <66.67%> (ø) 2.00 <2.00> (?)
...nstrumentation/context/ContextPropagationUtil.java 84.73% <70.37%> (-3.00%) 31.00 <3.00> (+5.00) ⬇️
...rumentation/context/propagation/DatadogFormat.java 77.14% <77.14%> (ø) 7.00 <7.00> (?)
...trumentation/context/PropagationFormatManager.java 80.00% <80.00%> (ø) 3.00 <3.00> (?)
...ocelot/config/model/tracing/PropagationFormat.java 100.00% <100.00%> (ø) 1.00 <1.00> (?)
...ore/instrumentation/correlation/log/MDCAccess.java 87.80% <100.00%> (+3.93%) 16.00 <3.00> (+3.00)
...ion/correlation/log/adapters/Log4J1MDCAdapter.java 80.00% <100.00%> (+2.22%) 4.00 <1.00> (+1.00)
...ion/correlation/log/adapters/Log4J2MDCAdapter.java 80.00% <100.00%> (+2.22%) 4.00 <1.00> (+1.00)
... and 11 more

Copy link
Member

@mariusoe mariusoe left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 4 files at r1.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @mbrill-nt)


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/autocomplete/autocompleterimpl/MetricsAutoCompleter.java, line 13 at r1 (raw file):

import java.util.List;

@Component

Small docs please :)


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/autocomplete/autocompleterimpl/MetricsAutoCompleter.java, line 22 at r1 (raw file):

     * The path under which metric names are defined.
     */
    private final static List<String> METRICS_DECLARATION_PATH = Arrays.asList("inspectit", "instrumentation", "metrics");

This does not exist. The metrics are defined under the key inspectit.metrics.definitions


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/autocomplete/autocompleterimpl/MetricsAutoCompleter.java, line 29 at r1 (raw file):

    private static final List<List<String>> RULE_SUGGESTION_PATHS = Arrays.asList(
            METRICS_DECLARATION_PATH,
            Arrays.asList("inspectit", "instrumentation", "rules", "*", "metrics")

There is another place where you can use these suggestions. You can define them under the following key as well:

inspectit.instrumentation.rules.*.metrics.*.metric


inspectit-ocelot-config/src/main/java/rocks/inspectit/ocelot/config/validation/PropertyPathHelper.java, line 119 at r1 (raw file):

            return ((Class<?>) type).isEnum()
                    || ((Class<?>) type).isPrimitive()
                    || InspectitConfigConversionService.getInstance().canConvert((Class<?>) type, String.class)

I think this is wrong. You can basically convert everything into a string..
As far as I understand this method, you want to check whether you can convert a simple string or number into an object, right?


inspectit-ocelot-config/src/test/java/rocks/inspectit/ocelot/config/validation/PropertyPathHelperTest.java, line 149 at r1 (raw file):

        @Test
        public void convertibles() {
            boolean result = PropertyPathHelper.isTerminal(MetricRecordingSettings.class);

Please recheck whether this is correct. Why is isTerminal returning true for this class? It's a complex type, basically a map, thus, returning true seems wrong because the property path is not terminating here (for example, the constant-tagsis defining more elements)

@mariusoe mariusoe self-assigned this Jul 6, 2020
Copy link
Member Author

@MariusBrill MariusBrill left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 of 4 files reviewed, 5 unresolved discussions (waiting on @mariusoe)


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/autocomplete/autocompleterimpl/MetricsAutoCompleter.java, line 13 at r1 (raw file):

Previously, mariusoe (Marius Oehler) wrote…

Small docs please :)

Done.


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/autocomplete/autocompleterimpl/MetricsAutoCompleter.java, line 22 at r1 (raw file):

Previously, mariusoe (Marius Oehler) wrote…

This does not exist. The metrics are defined under the key inspectit.metrics.definitions

Done.


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/autocomplete/autocompleterimpl/MetricsAutoCompleter.java, line 29 at r1 (raw file):

Previously, mariusoe (Marius Oehler) wrote…

There is another place where you can use these suggestions. You can define them under the following key as well:

inspectit.instrumentation.rules.*.metrics.*.metric

Done.


inspectit-ocelot-config/src/main/java/rocks/inspectit/ocelot/config/validation/PropertyPathHelper.java, line 119 at r1 (raw file):

Previously, mariusoe (Marius Oehler) wrote…

I think this is wrong. You can basically convert everything into a string..
As far as I understand this method, you want to check whether you can convert a simple string or number into an object, right?

I have talked to Jonas about this. You are right, the intention was to check if you can convert a string or a number into an object (which when thinking about it afterwards actually makes more sense). However the InspectionConfigConversionService is deprecated since it recognizes Strings and Numbers as being convertible to MetricRecordingSettings. As this is not the case anymore, Jonas suggested to use ApplicationConversionService instead.


inspectit-ocelot-config/src/test/java/rocks/inspectit/ocelot/config/validation/PropertyPathHelperTest.java, line 149 at r1 (raw file):

Previously, mariusoe (Marius Oehler) wrote…

Please recheck whether this is correct. Why is isTerminal returning true for this class? It's a complex type, basically a map, thus, returning true seems wrong because the property path is not terminating here (for example, the constant-tagsis defining more elements)

This test tests for the result to be false. I have changed the name of the test to make that clearer.

Copy link
Member

@mariusoe mariusoe left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@mariusoe mariusoe merged commit 592354a into inspectIT:master Jul 6, 2020
@MariusBrill MariusBrill deleted the Metrics_Autocompleter branch May 25, 2021 10:47
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend the auto-completion endpoint to provide auto-completion suggestions for metrics
2 participants