-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch to no op monitor registry by default (#466)
Internally Servo is deprecated and delegates to Spectator. This change would reduce the overhead for things that are still using the Servo APIs. The main benefit is that the data would no longer be exported to JMX. Note, this could be quite disruptive to anyone else using Servo. Since it is all set up via system properties, there isn't a convenient way to only change the default we use internally. After making this change, I noticed that loading the JMX monitor registry explicitly using the property no longer worked. That has been fixed so the old behavior can be achieved using a system property.
- Loading branch information
1 parent
6480bc4
commit 0a3c21d
Showing
4 changed files
with
71 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
servo-core/src/main/java/com/netflix/servo/NoopMonitorRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2020 Netflix, Inc. | ||
* <p/> | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* <p/> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p/> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.netflix.servo; | ||
|
||
import com.netflix.servo.monitor.Monitor; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
|
||
/** | ||
* Monitor registry implementation that does as little as possible. | ||
*/ | ||
public class NoopMonitorRegistry implements MonitorRegistry { | ||
|
||
/** Create a new instance. */ | ||
public NoopMonitorRegistry() { | ||
} | ||
|
||
@Override | ||
public Collection<Monitor<?>> getRegisteredMonitors() { | ||
return Collections.emptyList(); | ||
} | ||
|
||
@Override | ||
public void register(Monitor<?> monitor) { | ||
} | ||
|
||
@Override | ||
public void unregister(Monitor<?> monitor) { | ||
} | ||
|
||
@Override | ||
public boolean isRegistered(Monitor<?> monitor) { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters