-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* #29 TopGauge prevent NoopId * add linux os metrics export * lookoutRegistry (support proactive mode) and add access token ctrl
- Loading branch information
Showing
46 changed files
with
415 additions
and
390 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
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
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
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 |
---|---|---|
|
@@ -24,8 +24,8 @@ | |
import com.alipay.lookout.common.log.LookoutLoggerFactory; | ||
import com.alipay.lookout.common.utils.NetworkUtil; | ||
import com.alipay.lookout.core.CommonTagsAccessor; | ||
import com.alipay.lookout.remote.report.poller.MetricsHttpExporter; | ||
import com.google.common.base.Preconditions; | ||
|
||
import org.apache.commons.lang.StringUtils; | ||
import org.slf4j.Logger; | ||
|
||
|
@@ -35,9 +35,10 @@ | |
* Created by [email protected] on 2018/4/24. | ||
*/ | ||
abstract class AbstractLookoutClient implements LookoutClient { | ||
Logger logger = LookoutLoggerFactory.getLogger(this.getClass()); | ||
private final String appName; | ||
private CompositeRegistry globalRegistry = new CompositeRegistry(Clock.SYSTEM); | ||
Logger logger = LookoutLoggerFactory.getLogger(this.getClass()); | ||
private final String appName; | ||
private CompositeRegistry globalRegistry = new CompositeRegistry(Clock.SYSTEM); | ||
private MetricsHttpExporter metricsHttpExporter; | ||
|
||
/** | ||
* new an abstractLookoutClient | ||
|
@@ -100,4 +101,19 @@ protected void addDefaultCommonTags(CommonTagsAccessor commonTagsAccessor) { | |
commonTagsAccessor.setCommonTag("app", appName); | ||
} | ||
|
||
@Override | ||
public void close() throws Exception { | ||
MetricsHttpExporter metricsHttpExporter = getMetricsHttpExporter(); | ||
if (metricsHttpExporter != null) { | ||
metricsHttpExporter.close(); | ||
} | ||
} | ||
|
||
protected MetricsHttpExporter getMetricsHttpExporter() { | ||
return metricsHttpExporter; | ||
} | ||
|
||
protected void setMetricsHttpExporter(MetricsHttpExporter metricsHttpExporter) { | ||
this.metricsHttpExporter = metricsHttpExporter; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -18,8 +18,7 @@ | |
|
||
import com.alipay.lookout.api.Lookout; | ||
import com.alipay.lookout.api.MetricRegistry; | ||
import com.alipay.lookout.core.config.LookoutConfig; | ||
import com.alipay.lookout.remote.report.poller.ResettableStepRegistry; | ||
import com.alipay.lookout.remote.step.LookoutRegistry; | ||
|
||
/** | ||
* Created by [email protected] on 2017/10/4. | ||
|
@@ -45,6 +44,13 @@ public synchronized void addRegistry(MetricRegistry registry) { | |
registry.registerExtendedMetrics(); | ||
} | ||
super.addRegistry(registry); | ||
if (registry instanceof LookoutRegistry) { | ||
try { | ||
setMetricsHttpExporter(PollerUtils.exportHttp((LookoutRegistry) registry)); | ||
} catch (Exception e) { | ||
logger.error("fail to start MetricsHttpExporter", e); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
|
@@ -56,15 +62,4 @@ public synchronized void registerExtendedMetrics() { | |
//对已有registry补偿登记 | ||
super.registerExtendedMetrics(); | ||
} | ||
|
||
public synchronized void registerExporter(LookoutConfig config) { | ||
try { | ||
ResettableStepRegistry resettableStepRegistry = PollerUtils.exportHttp(config, this) | ||
.getController().getRegistry(); | ||
resettableStepRegistry.registerExtendedMetrics(); | ||
super.addRegistry(resettableStepRegistry); | ||
} catch (Exception e) { | ||
logger.error("fail to start MetricsHttpExporter", e); | ||
} | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.