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 #1290 - Add an endpoint to the Configuration Server to obtain a configuration documentation #1314

Conversation

aaronweissler
Copy link
Member

@aaronweissler aaronweissler commented Feb 23, 2022

This change is Reviewable

Actually get Configuration based on Mapping instead of based on Mapping's Attributes
Throw JsonProcessingException in ConfigParser to be able to handle it better in ConfigurationController.
Copy link
Member Author

@aaronweissler aaronweissler 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: 0 of 8 files reviewed, 1 unresolved discussion (waiting on @MariusBrill)


components/inspectit-ocelot-configurationserver/src/test/java/rocks/inspectit/ocelot/rest/configuration/ConfigurationControllerTest.java, line 90 at r1 (raw file):

            String mappingName = "name";
            AgentMapping agentMapping = AgentMapping.builder().build();

I could not mock these two easily, because they are final classes due to their Value Annotation and mockito only supports mocking final classes when using mockito-inline instead (https://javadoc.io/doc/org.mockito/mockito-core/2.23.0/org/mockito/Mockito.html#Mocking_Final) and I did not want to add that for something rather small like this, but of course I could if you think it would be worth it :)

Copy link
Contributor

@heiko-holz heiko-holz 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: 0 of 8 files reviewed, 1 unresolved discussion (waiting on @aaronweissler and @MariusBrill)


components/inspectit-ocelot-configurationserver/src/test/java/rocks/inspectit/ocelot/rest/configuration/ConfigurationControllerTest.java, line 90 at r1 (raw file):

Previously, aaronweissler wrote…

I could not mock these two easily, because they are final classes due to their Value Annotation and mockito only supports mocking final classes when using mockito-inline instead (https://javadoc.io/doc/org.mockito/mockito-core/2.23.0/org/mockito/Mockito.html#Mocking_Final) and I did not want to add that for something rather small like this, but of course I could if you think it would be worth it :)

We agreed to not use mockito-inline as as it does not work with IBM JDK8.

Copy link
Member Author

@aaronweissler aaronweissler 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: 0 of 8 files reviewed, all discussions resolved (waiting on @MariusBrill)


components/inspectit-ocelot-configurationserver/src/test/java/rocks/inspectit/ocelot/rest/configuration/ConfigurationControllerTest.java, line 90 at r1 (raw file):

Previously, heiko-holz (Heiko Holz) wrote…

We agreed to not use mockito-inline as as it does not work with IBM JDK8.

Okay, thank you! Then that question is settled.

Copy link
Member

@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.

Reviewed 8 of 8 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @aaronweissler)


components/inspectit-ocelot-configdocsgenerator/build.gradle, line 33 at r1 (raw file):

            project(':inspectit-ocelot-config'),
            'ch.qos.logback:logback-classic:0.9.26',
            'org.apache.commons:commons-lang3:3.12.0',

Just a reminder to update THIRD-PARTY-LICENCES.txt :)


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/agentconfiguration/AgentConfigurationManager.java, line 97 at r1 (raw file):

    /**
     * Fetches the configuration given an AgentMapping the configuration should be for.

This sentence is not quite right - Maybe something like "Takes an instance of AgentMapping and returns the befitting instance of AgentConfiguration" ?


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/agentconfiguration/AgentConfigurationManager.java, line 101 at r1 (raw file):

     * @param agentMapping AgentMapping for which the configuration should be returned.
     *
     * @return The configuration for this AgentMapping or null if no configuration for that mapping found.

Here you could also add that the first matching instance of AgentConfiguration is returned in case there are more than one matching instances.


components/inspectit-ocelot-configurationserver/src/test/java/rocks/inspectit/ocelot/rest/configuration/ConfigurationControllerTest.java, line 81 at r1 (raw file):

        }
    }

Maybe we could here add a third test case for the Situation that a JsonProcessingException is thrown?

You can provoke an exception in configDocsGenerator.generateConfigDocs with a when-thenThrow method in Mockito

@aaronweissler aaronweissler force-pushed the feature/config-server-config-doc-endpoint branch from f12127c to 2531144 Compare February 24, 2022 13:23
@codecov
Copy link

codecov bot commented Feb 24, 2022

Codecov Report

Merging #1314 (2531144) into master (d37a7dc) will decrease coverage by 2.20%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##             master    #1314      +/-   ##
============================================
- Coverage     83.00%   80.80%   -2.20%     
- Complexity     1736     2026     +290     
============================================
  Files           174      204      +30     
  Lines          5366     6460    +1094     
  Branches        650      769     +119     
============================================
+ Hits           4454     5220     +766     
- Misses          675      950     +275     
- Partials        237      290      +53     
Impacted Files Coverage Δ
...spectit/ocelot/core/utils/WeakMethodReference.java 0.00% <0.00%> (-77.27%) ⬇️
...strap/correlation/noop/NoopLogTraceCorrelator.java 28.57% <0.00%> (-42.86%) ⬇️
...ial/ScheduledExecutorContextPropagationSensor.java 82.05% <0.00%> (-12.39%) ⬇️
...pectit/ocelot/config/loaders/ConfigFileLoader.java 82.61% <0.00%> (-8.70%) ⬇️
...lot/bootstrap/context/noop/NoopContextManager.java 10.00% <0.00%> (-6.67%) ⬇️
...core/instrumentation/InstrumentationTriggerer.java 85.19% <0.00%> (-5.63%) ⬇️
...t/ocelot/config/validation/PropertyPathHelper.java 75.56% <0.00%> (-5.06%) ⬇️
...rocks/inspectit/ocelot/config/utils/CaseUtils.java 90.48% <0.00%> (-4.98%) ⬇️
...t/ocelot/core/instrumentation/hook/MethodHook.java 95.35% <0.00%> (-4.65%) ⬇️
...del/metrics/definition/ViewDefinitionSettings.java 45.45% <0.00%> (-4.55%) ⬇️
... and 94 more

Copy link
Member Author

@aaronweissler aaronweissler 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: 6 of 9 files reviewed, 4 unresolved discussions (waiting on @MariusBrill)


components/inspectit-ocelot-configdocsgenerator/build.gradle, line 33 at r1 (raw file):

Previously, MariusBrill (Marius Brill) wrote…

Just a reminder to update THIRD-PARTY-LICENCES.txt :)

Done.


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/agentconfiguration/AgentConfigurationManager.java, line 97 at r1 (raw file):

Previously, MariusBrill (Marius Brill) wrote…

This sentence is not quite right - Maybe something like "Takes an instance of AgentMapping and returns the befitting instance of AgentConfiguration" ?

Done.


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/agentconfiguration/AgentConfigurationManager.java, line 101 at r1 (raw file):

Previously, MariusBrill (Marius Brill) wrote…

Here you could also add that the first matching instance of AgentConfiguration is returned in case there are more than one matching instances.

Done.
As talked about, there can only be one configuration per Mapping.


components/inspectit-ocelot-configurationserver/src/test/java/rocks/inspectit/ocelot/rest/configuration/ConfigurationControllerTest.java, line 81 at r1 (raw file):

Previously, MariusBrill (Marius Brill) wrote…

Maybe we could here add a third test case for the Situation that a JsonProcessingException is thrown?

You can provoke an exception in configDocsGenerator.generateConfigDocs with a when-thenThrow method in Mockito

Done.

Copy link
Member

@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.

Reviewed 3 of 3 files at r2, 1 of 1 files at r3.
Reviewable status: all files reviewed (commit messages unreviewed), all discussions resolved (waiting on @aaronweissler)

Copy link
Member

@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.

Reviewed all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @aaronweissler)

@MariusBrill MariusBrill merged commit 8a85d78 into inspectIT:master Feb 24, 2022
@aaronweissler aaronweissler deleted the feature/config-server-config-doc-endpoint branch June 7, 2022 12:34
# 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.

Add an endpoint to the Configuration Server to obtain a configuration documentation
3 participants