Search in sources :

Example 16 with DynamicProperty

use of com.netflix.config.DynamicProperty in project incubator-servicecomb-java-chassis by apache.

the class InspectorImpl method createPriorityPropertyView.

private PriorityPropertyView createPriorityPropertyView(PriorityProperty<?> priorityProperty) {
    PriorityPropertyView view = new PriorityPropertyView();
    view.setDynamicProperties(new ArrayList<>());
    for (DynamicProperty property : priorityProperty.getProperties()) {
        view.getDynamicProperties().add(createDynamicPropertyView(property));
    }
    view.setDefaultValue(String.valueOf(priorityProperty.getDefaultValue()));
    view.setValue(String.valueOf(priorityProperty.getValue()));
    return view;
}
Also used : DynamicProperty(com.netflix.config.DynamicProperty) PriorityPropertyView(org.apache.servicecomb.inspector.internal.model.PriorityPropertyView)

Example 17 with DynamicProperty

use of com.netflix.config.DynamicProperty in project incubator-servicecomb-java-chassis by apache.

the class InspectorImpl method dynamicProperties.

@Path("/dynamicProperties")
@GET
public List<DynamicPropertyView> dynamicProperties() {
    List<DynamicPropertyView> views = new ArrayList<>();
    for (DynamicProperty property : ConfigUtil.getAllDynamicProperties().values()) {
        views.add(createDynamicPropertyView(property));
    }
    // show more callback first, because maybe there is memory leak problem
    // show recently changed second
    // and sort by key
    views.sort(Comparator.comparing(DynamicPropertyView::getCallbackCount).thenComparing(DynamicPropertyView::getChangedTime).reversed().thenComparing(DynamicPropertyView::getKey));
    return views;
}
Also used : DynamicProperty(com.netflix.config.DynamicProperty) DynamicPropertyView(org.apache.servicecomb.inspector.internal.model.DynamicPropertyView) ArrayList(java.util.ArrayList) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Aggregations

DynamicProperty (com.netflix.config.DynamicProperty)17 ArrayList (java.util.ArrayList)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 TestConfigObjectFactory (org.apache.servicecomb.config.inject.TestConfigObjectFactory)2 DynamicPropertyView (org.apache.servicecomb.inspector.internal.model.DynamicPropertyView)2 PriorityPropertyView (org.apache.servicecomb.inspector.internal.model.PriorityPropertyView)2 AbstractQpsStrategy (org.apache.servicecomb.qps.strategy.AbstractQpsStrategy)2 Test (org.junit.Test)2 Test (org.junit.jupiter.api.Test)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2