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

Write Endpoints for Spring Boot Actuator #308

Closed
kschlesselmann opened this issue Dec 5, 2018 · 5 comments · Fixed by #310
Closed

Write Endpoints for Spring Boot Actuator #308

kschlesselmann opened this issue Dec 5, 2018 · 5 comments · Fixed by #310
Milestone

Comments

@kschlesselmann
Copy link
Contributor

Is there a reason the togglz actuator endpoint is read only?

For anyone interested my current workaround looks like

@Component
@EndpointWebExtension(endpoint = TogglzEndpoint::class)
class TogglzEndpointExtension(
        private val featureProvider: FeatureProvider,
        private val featureManager: FeatureManager
) {

    @WriteOperation
    fun setFeatureState(@Selector featureName: String, enabled: Boolean): WebEndpointResponse<FeatureState> {
        val feature = featureProvider.features.first { it.name() == featureName }
        val state = FeatureState(feature, enabled)

        featureManager.setFeatureState(state)

        return WebEndpointResponse(state)
    }
}

this enables me to something like http POST :8080/actuator/togglz/SEND_TO_OPAL enabled=true to flip toggle states.

If there's no reason it is read only you could include my @WirteOperation in the current @Endpoint and I could just drop my extension :-)

@ruifigueira
Copy link
Contributor

@kschlesselmann, togglz actuator can definitely have that write operatin. If you want to contribute with a PR adding that operation TogglzEndpoint, I can review it and merge it.

@kschlesselmann
Copy link
Contributor Author

Hi @ruifigueira, I just opened #310. What do you think?

kschlesselmann added a commit to kschlesselmann/togglz that referenced this issue Dec 12, 2018
@kschlesselmann
Copy link
Contributor Author

HI @ruifigueira ! Any updates from your side? Currently I'm not sure if you're waiting on something else from me :-P

@ruifigueira
Copy link
Contributor

I'm sorry :) I think that ultimately we should go with the EndpointWebExtension but it's something we can address in a different MR. For now, I think we should not return null in the @WriteOperation, because semantically is not very clear. Everything else is perfect.

@ruifigueira
Copy link
Contributor

kschlesselmann added a commit to kschlesselmann/togglz that referenced this issue Dec 21, 2018
ruifigueira pushed a commit that referenced this issue Dec 22, 2018
…310)

* Add write operation to change toggle state via Spring Boot Actuator

Resolves: #308
@gsteinacker gsteinacker added this to the 2.7.0.Final milestone Oct 15, 2019
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 a pull request may close this issue.

3 participants