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

Closes #786 - Added endpoint which fires a file changed event when triggered. #791

Merged
merged 8 commits into from
Aug 4, 2020

Conversation

MariusBrill
Copy link
Member

@MariusBrill MariusBrill commented Jun 25, 2020

With the endpoint "configuration/reload" file reloads can you be triggered manually.


This change is Reviewable


This change is Reviewable


This change is Reviewable


This change is Reviewable


This change is Reviewable


This change is Reviewable


This change is Reviewable


This change is Reviewable


This change is Reviewable


This change is Reviewable


This change is Reviewable


This change is Reviewable


This change is Reviewable


This change is Reviewable


This change is Reviewable


This change is Reviewable


This change is Reviewable

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 1 of 1 files at r1.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @mbrill-nt)


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/rest/configuration/ConfigurationController.java, line 12 at r1 (raw file):

@RestController
public class ConfigurationController extends AbstractBaseController {

Small docs please


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/rest/configuration/ConfigurationController.java, line 34 at r1 (raw file):

            "servers working directory.")
    @GetMapping(value = "configuration/reload", produces = "text/plain")
    public void reloadConfiguration() {

Imo it would be better to secure this endpoint as well.
Maybe it is best if we use the Write permission, because this event would occure as a result of a file modification.


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/rest/configuration/ConfigurationController.java, line 34 at r1 (raw file):

            "servers working directory.")
    @GetMapping(value = "configuration/reload", produces = "text/plain")
    public void reloadConfiguration() {

Can you add a small unit test that a event is fire if this method is called?

@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: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @mariusoe)


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/rest/configuration/ConfigurationController.java, line 12 at r1 (raw file):

Previously, mariusoe (Marius Oehler) wrote…

Small docs please

Done.


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/rest/configuration/ConfigurationController.java, line 34 at r1 (raw file):

Previously, mariusoe (Marius Oehler) wrote…

Imo it would be better to secure this endpoint as well.
Maybe it is best if we use the Write permission, because this event would occure as a result of a file modification.

Done.


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/rest/configuration/ConfigurationController.java, line 34 at r1 (raw file):

Previously, mariusoe (Marius Oehler) wrote…

Can you add a small unit test that a event is fire if this method is called?

Done.

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 9 files at r3, 3 of 3 files at r4.
Reviewable status: 7 of 9 files reviewed, 3 unresolved discussions (waiting on @JonasKunz, @mariusoe, and @mbrill-nt)


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/file/versioning/ExternalChangeDetector.java, line 27 at r4 (raw file):

public class ExternalChangeDetector {

    private String latestWorkspaceId;

can you add a short doc to the latestWorkspaceId and latestLiveId field


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/file/versioning/ExternalChangeDetector.java, line 52 at r4 (raw file):

        latestWorkspaceId = fileManager.getWorkspaceRevision().getRevisionId();
        latestLiveId = fileManager.getLiveRevision().getRevisionId();
        updateTask = executor.scheduleAtFixedRate(this::checkForUpdates, 1, 1, TimeUnit.SECONDS);

1 second feels quite heavy. How about increasing this to maybe 5 seconds?


components/inspectit-ocelot-configurationserver/src/main/java/rocks/inspectit/ocelot/file/versioning/ExternalChangeDetector.java, line 52 at r4 (raw file):

        latestWorkspaceId = fileManager.getWorkspaceRevision().getRevisionId();
        latestLiveId = fileManager.getLiveRevision().getRevisionId();
        updateTask = executor.scheduleAtFixedRate(this::checkForUpdates, 1, 1, TimeUnit.SECONDS);

You could remove this line and the executer and all the future logic and just annotate the checkForUpdates method with the following @Scheduled(fixedRate = 1000)

Then Spring will handle this for you and you can also remove the synchroized because it will not execute them in parallel, unless you also would add @Async

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 1 of 9 files at r3, 3 of 3 files at r5.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @JonasKunz)

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.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @JonasKunz)

@JonasKunz JonasKunz merged commit 62c5c9c into inspectIT:master Aug 4, 2020
@MariusBrill MariusBrill deleted the Config_Reload_Endpoint branch May 25, 2021 10:47
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.

Add endpoint to configuration server to trigger a configuration reload
3 participants