diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e4fa1a9 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: java +sudo: false + +jdk: +- oraclejdk8 + +install: +- mvn clean install -Dmaven.javadoc.skip=true -B -V + +script: +- sh ./check_format.sh + +after_success: +- mvn clean test cobertura:cobertura org.eluder.coveralls:coveralls-maven-plugin:report diff --git a/Formatter.xml b/Formatter.xml new file mode 100644 index 0000000..ed82325 --- /dev/null +++ b/Formatter.xml @@ -0,0 +1,278 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HEADER b/HEADER new file mode 100644 index 0000000..1745cfe --- /dev/null +++ b/HEADER @@ -0,0 +1,14 @@ +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You 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 + + http://www.apache.org/licenses/LICENSE-2.0 + +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. diff --git a/README.md b/README.md index d0fca9a..8ede0c9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ # SOFALookout + +[![Build Status](https://travis-ci.org/alipay/sofa-lookout.svg?branch=master)](https://travis-ci.org/alipay/sofa-lookout) +[![Coverage Status](https://coveralls.io/repos/github/alipay/sofa-lookout/badge.svg?branch=master)](https://coveralls.io/github/alipay/sofa-lookout?branch=master) +![license](https://img.shields.io/badge/license-Apache--2.0-green.svg) +![maven](https://img.shields.io/github/release/alipay/sofa-lookout.svg) + [English Document](./README_EN.md) 访问 [WIKI](https://github.com/alipay/sofa-lookout/wiki) 查看完整的文档使用指南。 diff --git a/README_EN.md b/README_EN.md index b1b968c..fb5750e 100644 --- a/README_EN.md +++ b/README_EN.md @@ -1,5 +1,12 @@ # SOFALookout + +[![Build Status](https://travis-ci.org/alipay/sofa-lookout.svg?branch=master)](https://travis-ci.org/alipay/sofa-lookout) +[![Coverage Status](https://coveralls.io/repos/github/alipay/sofa-lookout/badge.svg?branch=master)](https://coveralls.io/github/alipay/sofa-lookout?branch=master) +![license](https://img.shields.io/badge/license-Apache--2.0-green.svg) +![maven](https://img.shields.io/github/release/alipay/sofa-lookout.svg) + Visit [WIKI](https://github.com/alipay/sofa-lookout/wiki) for the full documentation, examples, and guides. + Lookout can help you to measure and monitor the status of the target system with its multi-dimensional metrics. Lookout's multi-dimensional metrics refer to the [Metrics 2.0](http://metrics20.org/) standard. diff --git a/check_format.sh b/check_format.sh new file mode 100644 index 0000000..fcf551d --- /dev/null +++ b/check_format.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +BASEDIR=$(dirname $0) + +cd ${BASEDIR} + +# make sure git has no un commit files +if [ -n "$(git status --untracked-files=no --porcelain)" ]; then + echo "Please commit your change before run this shell, un commit files:" + git status --untracked-files=no --porcelain + exit -1 +fi diff --git a/client/README.md b/client/README.md index a8f91d3..ffd6d35 100644 --- a/client/README.md +++ b/client/README.md @@ -15,6 +15,7 @@ lookout-api支持被单独依赖和使用,方便植入您的项目代码,收 lookout 客户端提供了 SPI 机制(只需要实现 `com.alipay.lookout.spi.MetricsImporter` 接口),支持可以扩展一些公共的Metrics收集模块,比如默认提供的: jvm(lookout-ext-jvm)、os(lookout-ext-os)。 ## 4.Metrics的注册表 + - lookout-reg-prometheus 模块可以提供简单的 metrics 的查询服务,作为 lookout 的 exporter 被 prometheus 抓取; - lookout-reg-server 模块可以定时向 lookout server 上报 metrics 数据; - lookout-reg-dropwizard 模块可以降维映射为 dropwizard 注册表上; diff --git a/client/lookout-ext-jvm/src/test/java/com.alipay.lookout.jvm.memory/JvmGcMetricsImporterTest.java b/client/lookout-api/src/test/java/com/alipay/lookout/api/DefaultIdTest.java similarity index 50% rename from client/lookout-ext-jvm/src/test/java/com.alipay.lookout.jvm.memory/JvmGcMetricsImporterTest.java rename to client/lookout-api/src/test/java/com/alipay/lookout/api/DefaultIdTest.java index 12ff4c1..9b2a8df 100644 --- a/client/lookout-ext-jvm/src/test/java/com.alipay.lookout.jvm.memory/JvmGcMetricsImporterTest.java +++ b/client/lookout-api/src/test/java/com/alipay/lookout/api/DefaultIdTest.java @@ -14,29 +14,28 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -//package com.alipay.lookout.jvm.memory; -// -///** -// * Created by kevin.luy@alipay.com on 2017/2/16. -// */ -//public class JvmGcMetricsImporterTest { -// -// @Test -// public void testGcInfo() { -// Registry registry = new DefaultRegistry(); -// JvmGcMetricsImporter jvmGcMetricsImporter = new JvmGcMetricsImporter(); -// jvmGcMetricsImporter.register(registry); -// -// for (int i = 0; i < 3; i++) { -// Iterator it = registry.iterator(); -// while (it.hasNext()) { -// Metric m = it.next(); -// m.measure(); -// } -// -// byte[] bytes = new byte[1024 * 1024 * 8]; -// System.gc(); -// } -// -// } -//} +package com.alipay.lookout.api; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Created by kevin.luy@alipay.com on 2018/5/16. + */ +public class DefaultIdTest { + + @Test + public void testEquals() { + + Id id1 = new DefaultId("name").withTag(new BasicTag("k1", "v1")).withTag( + new BasicTag("k2", "v2")); + + Tag[] tags = new Tag[] { new BasicTag("k2", "v2"), new BasicTag("k1", "v1") }; + Id id2 = new DefaultId("name").withTags(tags); + System.out.println(id1); + Assert.assertTrue(id1.equals(id2)); + Assert.assertEquals(id1, id2); + Assert.assertEquals(id1.hashCode(), id2.hashCode()); + + } +} diff --git a/client/lookout-api/src/test/java/com/alipay/lookout/api/IndicatorTest.java b/client/lookout-api/src/test/java/com/alipay/lookout/api/IndicatorTest.java new file mode 100644 index 0000000..01d1d7f --- /dev/null +++ b/client/lookout-api/src/test/java/com/alipay/lookout/api/IndicatorTest.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.alipay.lookout.api; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Created by kevin.luy@alipay.com on 2018/5/16. + */ +public class IndicatorTest { + + @Test + public void testAddMeasument() { + Indicator indicator = new Indicator(11l, NoopRegistry.INSTANCE.createId("name")); + indicator.addMeasurement("k", 1); + indicator.addMeasurement(new Measurement("K2", "V2")); + Assert.assertEquals(2, indicator.measurements().size()); + Assert.assertEquals(11l, indicator.getTimestamp()); + Assert.assertTrue(indicator.id() == NoopId.INSTANCE); + + } +} diff --git a/client/lookout-api/src/test/java/com/alipay/lookout/api/NoopRegistryTest.java b/client/lookout-api/src/test/java/com/alipay/lookout/api/NoopRegistryTest.java new file mode 100644 index 0000000..b0c8b44 --- /dev/null +++ b/client/lookout-api/src/test/java/com/alipay/lookout/api/NoopRegistryTest.java @@ -0,0 +1,118 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.alipay.lookout.api; + +import com.alipay.lookout.api.composite.MixinMetric; +import com.alipay.lookout.api.info.Info; +import org.junit.Assert; +import org.junit.Test; + +import java.util.concurrent.Callable; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * Created by kevin.luy@alipay.com on 2018/5/16. + */ +public class NoopRegistryTest { + private Registry r = NoopRegistry.INSTANCE; + + @Test + public void testNoopCounter() { + Counter counter = r.counter(r.createId("name")); + Assert.assertEquals(NoopCounter.INSTANCE, counter); + counter.inc(8); + counter.inc(); + counter.dec(1); + counter.dec(); + Assert.assertEquals(0, counter.count()); + } + + @Test + public void testNoopMixinMetric() { + MixinMetric mixinMetric = r.mixinMetric(r.createId("name")); + Assert.assertEquals(NoopMixinMetric.INSTANCE, mixinMetric); + Assert.assertEquals(NoopCounter.INSTANCE, mixinMetric.counter("c")); + Assert.assertEquals(NoopTimer.INSTANCE, mixinMetric.timer("t")); + Assert.assertEquals(NoopDistributionSummary.INSTANCE, mixinMetric.distributionSummary("t")); + Assert.assertEquals(null, mixinMetric.gauge("t", new Gauge() { + @Override + public Number value() { + return 1; + } + })); + } + + @Test + public void testNoopInfo() { + Info info = r.info(r.createId("name"), new Info() { + @Override + public String value() { + return "xx"; + } + }); + Assert.assertNull(null, info); + } + + @Test + public void testNoopGauge() { + Gauge gauge = r.gauge(r.createId("name"), new Gauge() { + @Override + public Long value() { + return 1l; + } + }); + Assert.assertNull(null, gauge); + } + + @Test + public void testNoopDistributionSummary() { + DistributionSummary ds = r.distributionSummary(r.createId("name")); + Assert.assertEquals(NoopDistributionSummary.INSTANCE, ds); + ds.record(20); + Assert.assertEquals(0, ds.count()); + Assert.assertEquals(0, ds.totalAmount()); + + } + + @Test + public void testNoopTimer() throws Exception { + Timer timer = r.timer(r.createId("name")); + Assert.assertEquals(NoopTimer.INSTANCE, timer); + timer.record(2, TimeUnit.SECONDS); + Assert.assertEquals(0, timer.count()); + Assert.assertEquals(0, timer.totalTime()); + + final AtomicInteger atomicInteger = new AtomicInteger(0); + + timer.record(new Runnable() { + @Override + public void run() { + atomicInteger.incrementAndGet(); + } + }); + timer.record(new Callable() { + @Override + public Long call() throws Exception { + atomicInteger.incrementAndGet(); + return 0l; + } + }); + Assert.assertEquals(2, atomicInteger.get()); + } + +} diff --git a/client/lookout-api/src/test/java/com/alipay/lookout/api/UtilsTest.java b/client/lookout-api/src/test/java/com/alipay/lookout/api/UtilsTest.java new file mode 100644 index 0000000..42bed8a --- /dev/null +++ b/client/lookout-api/src/test/java/com/alipay/lookout/api/UtilsTest.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.alipay.lookout.api; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Created by kevin.luy@alipay.com on 2018/5/16. + */ +public class UtilsTest { + + @Test + public void testGetTagValue() { + + Id id = new DefaultId("name").withTag("k1", "v1").withTag("k2", "v2"); + + Assert.assertEquals("v1", Utils.getTagValue(id, "k1")); + Assert.assertNull(Utils.getTagValue(id, "k3")); + + } +} diff --git a/client/lookout-api/src/test/java/com/alipay/lookout/api/composite/CompositeRegistryTest.java b/client/lookout-api/src/test/java/com/alipay/lookout/api/composite/CompositeRegistryTest.java new file mode 100644 index 0000000..2e724cc --- /dev/null +++ b/client/lookout-api/src/test/java/com/alipay/lookout/api/composite/CompositeRegistryTest.java @@ -0,0 +1,172 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.alipay.lookout.api.composite; + +import com.alipay.lookout.api.*; +import com.alipay.lookout.api.info.Info; +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * Created by kevin.luy@alipay.com on 2018/5/16. + */ +public class CompositeRegistryTest { + private static boolean registerExtentedMetrics = false; + + @Test + public void testAddAndRemoveReg() { + CompositeRegistry cr = new CompositeRegistry(Clock.SYSTEM); + MockRegistry mockRegistry1 = new MockRegistry(); + MockRegistry mockRegistry2 = new MockRegistry(); + + cr.add(mockRegistry1); + cr.add(mockRegistry2); + Assert.assertEquals(2, cr.getRegistries().size()); + + cr.remove(mockRegistry1); + Assert.assertEquals(1, cr.getRegistries().size()); + + cr.clear(); + Assert.assertEquals(0, cr.getRegistries().size()); + + } + + @Test + public void testRegisterExtendMetrics() { + CompositeRegistry cr = new CompositeRegistry(Clock.SYSTEM); + cr.add(new MockRegistry()); + Assert.assertFalse(registerExtentedMetrics); + cr.registerExtendedMetrics(); + Assert.assertTrue(registerExtentedMetrics); + } + + @Test + public void testGetCompositeCounter() { + Registry r = NoopRegistry.INSTANCE; + List list = new ArrayList(); + list.add(r); + Counter counter = new CompositeCounter(r.createId("xx"), list); + counter.dec(1); + counter.dec(); + counter.inc(2); + counter.inc(); + Assert.assertEquals(0, counter.count()); + } + + @Test + public void testGetCompositeTimer() { + Registry r = NoopRegistry.INSTANCE; + List list = new ArrayList(); + list.add(r); + Timer t = new CompositeTimer(r.createId("xx"), Clock.SYSTEM, list); + t.record(100, TimeUnit.SECONDS); + Assert.assertEquals(0, t.count()); + Assert.assertEquals(0, t.totalTime()); + } + + @Test + public void testGetCompositeDistributionSummary() { + Registry r = NoopRegistry.INSTANCE; + List list = new ArrayList(); + list.add(r); + DistributionSummary t = new CompositeDistributionSummary(r.createId("xx"), list); + t.record(100); + Assert.assertEquals(0, t.count()); + Assert.assertEquals(0, t.totalAmount()); + } + + @Test + public void testGetCompositeMixin() { + Registry r = NoopRegistry.INSTANCE; + List list = new ArrayList(); + list.add(r); + MixinMetric m = new CompositeMixinMetric(r.createId("xx"), Clock.SYSTEM, list); + Counter counter = m.counter("test"); + Assert.assertTrue(counter instanceof CompositeCounter); + Timer timer = m.timer("test"); + Assert.assertTrue(timer instanceof CompositeTimer); + DistributionSummary ds = m.distributionSummary("test"); + Assert.assertTrue(ds instanceof CompositeDistributionSummary); + } + + public static class MockRegistry extends MetricRegistry { + + public MockRegistry() { + super(Clock.SYSTEM); + } + + @Override + public void registerExtendedMetrics() { + registerExtentedMetrics = true; + } + + @Override + public void register(Metric metric) { + + } + + @Override + public Gauge gauge(Id id, Gauge gauge) { + return null; + } + + @Override + public void removeMetric(Id id) { + + } + + @Override + public > Info info(Id id, Y info) { + return null; + } + + @Override + public Counter counter(Id id) { + return null; + } + + @Override + public DistributionSummary distributionSummary(Id id) { + return null; + } + + @Override + public Timer timer(Id id) { + return null; + } + + @Override + public MixinMetric mixinMetric(Id id) { + return null; + } + + @Override + public X get(Id id) { + return null; + } + + @Override + public Iterator iterator() { + return null; + } + } +} diff --git a/client/lookout-api/src/test/java/com/alipay/lookout/api/info/AutoPollSuggestionTest.java b/client/lookout-api/src/test/java/com/alipay/lookout/api/info/AutoPollSuggestionTest.java new file mode 100644 index 0000000..13a4be3 --- /dev/null +++ b/client/lookout-api/src/test/java/com/alipay/lookout/api/info/AutoPollSuggestionTest.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.alipay.lookout.api.info; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.concurrent.TimeUnit; + +/** + * Created by kevin.luy@alipay.com on 2018/5/16. + */ +public class AutoPollSuggestionTest { + + @Test + public void testAutoPollSuggest() { + AutoPollSuggestion autoPollSuggestion = new AutoPollSuggestion(3, TimeUnit.SECONDS); + Assert.assertEquals(3000, autoPollSuggestion.intervalMills()); + } +} diff --git a/client/lookout-common/src/main/java/com/alipay/lookout/common/utils/TimeFormatUtil.java b/client/lookout-common/src/main/java/com/alipay/lookout/common/utils/TimeFormatUtil.java deleted file mode 100644 index 14b26f6..0000000 --- a/client/lookout-common/src/main/java/com/alipay/lookout/common/utils/TimeFormatUtil.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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.alipay.lookout.common.utils; - -import com.alipay.lookout.common.log.LookoutLoggerFactory; -import org.slf4j.Logger; - -import java.text.SimpleDateFormat; -import java.util.Date; - -/** - * - * @author wuqin - * @version $Id: TimeFormat.java, v 0.1 2017-03-26 下午9:33 wuqin Exp $$ - */ -public class TimeFormatUtil { - - private static final Logger logger = LookoutLoggerFactory.getLogger(TimeFormatUtil.class); - - public static Date convertDate(String dateStr, String format) { - Date date; - try { - if (format != null) { - SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format); - date = simpleDateFormat.parse(dateStr); - } else { - date = new Date(dateStr); - } - - } catch (Exception ex) { - logger.error("Failed to convert " + dateStr + " to Date, format:" + format); - return null; - } - return date; - } - - public static String convertStr(Date date, String format) { - String ret; - try { - - SimpleDateFormat sdf = new SimpleDateFormat(format); - - ret = sdf.format(date); - - } catch (Exception e) { - logger.error("Failed to convert " + date + " to String, format:" + format); - return null; - } - return ret; - } - - public static Date getYear(String dateStr) { - return convertDate(dateStr, "yyyy"); - } - - public static String getYear(Date date) { - return convertStr(date, "yyyy"); - } - - public static Date getMonth(String dateStr) { - return convertDate(dateStr, "yyyyMM"); - } - - public static String getMonth(Date date) { - return convertStr(date, "yyyyMM"); - } - - public static Date getDay(String dateStr) { - return convertDate(dateStr, "yyyyMMdd"); - } - - public static String getDay(Date date) { - return convertStr(date, "yyyyMMdd"); - } - - public static Date getHour(String dateStr) { - return convertDate(dateStr, "yyyyMMddHH"); - } - - public static String getHour(Date date) { - return convertStr(date, "yyyyMMddHH"); - } - - public static Date getMinute(String dateStr) { - return convertDate(dateStr, "yyyyMMddHHmm"); - } - - public static String getMinute(Date date) { - return convertStr(date, "yyyyMMddHHmm"); - } - - public static Date getSecond(String dateStr) { - return convertDate(dateStr, "yyyyMMddHHmmss"); - } - - public static String getSecond(Date date) { - return convertStr(date, "yyyyMMddHHmmss"); - } -} diff --git a/client/lookout-common/src/test/java/com/alipay/lookout/common/utils/ClassUtilTest.java b/client/lookout-common/src/test/java/com/alipay/lookout/common/utils/ClassUtilTest.java index 44496ff..690007b 100644 --- a/client/lookout-common/src/test/java/com/alipay/lookout/common/utils/ClassUtilTest.java +++ b/client/lookout-common/src/test/java/com/alipay/lookout/common/utils/ClassUtilTest.java @@ -16,10 +16,10 @@ */ package com.alipay.lookout.common.utils; +import org.junit.Assert; import org.junit.Test; import java.util.ArrayList; -import java.util.List; /** * Created by kevin.luy@alipay.com on 2018/4/4. @@ -28,11 +28,11 @@ public class ClassUtilTest { @Test public void testNewInstance() { - List list = ClassUtil.newInstance(ArrayList.class.getName(), null, null); - System.out.println(list.size()); - list = ClassUtil.newInstance(ArrayList.class.getName(), new Class[] { int.class }, - new Object[] { 5 }); - System.out.println(list.size()); + ArrayList list = ClassUtil.newInstance(ArrayList.class.getName(), null, null); + Assert.assertNotNull(list); + Integer integer = ClassUtil.newInstance(Integer.class.getName(), new Class[] { int.class }, + new Object[] { 5 }); + Assert.assertEquals("5", integer.toString()); } } diff --git a/client/lookout-common/src/main/java/com/alipay/lookout/common/utils/MetricsUtil.java b/client/lookout-common/src/test/java/com/alipay/lookout/common/utils/LookoutLoggerFactoryTest.java similarity index 59% rename from client/lookout-common/src/main/java/com/alipay/lookout/common/utils/MetricsUtil.java rename to client/lookout-common/src/test/java/com/alipay/lookout/common/utils/LookoutLoggerFactoryTest.java index 3f0d35c..1ed971c 100644 --- a/client/lookout-common/src/main/java/com/alipay/lookout/common/utils/MetricsUtil.java +++ b/client/lookout-common/src/test/java/com/alipay/lookout/common/utils/LookoutLoggerFactoryTest.java @@ -16,28 +16,20 @@ */ package com.alipay.lookout.common.utils; -import com.alipay.lookout.api.Metric; - -import java.util.*; +import com.alipay.lookout.common.log.LookoutLoggerFactory; +import org.junit.Assert; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.helpers.NOPLogger; /** - * Created by kevin.luy@alipay.com on 2017/5/15. + * Created by kevin.luy@alipay.com on 2018/5/15. */ -public abstract class MetricsUtil { - private MetricsUtil() { - } +public class LookoutLoggerFactoryTest { - public static Iterator sortedIterator(Iterator it, - Comparator comparator) { - if (it == null) { - return it; - } - List list = new ArrayList(); - while (it.hasNext()) { - list.add(it.next()); - } - Collections.sort(list, comparator); - return list.iterator(); + @Test + public void testLookoutLoggerFactory() { + Logger logger = LookoutLoggerFactory.getLogger(LookoutLoggerFactoryTest.class); + Assert.assertTrue(logger instanceof NOPLogger); } - } diff --git a/client/lookout-common/src/test/java/com/alipay/lookout/common/utils/NetworkUtilTest.java b/client/lookout-common/src/test/java/com/alipay/lookout/common/utils/NetworkUtilTest.java new file mode 100644 index 0000000..4382348 --- /dev/null +++ b/client/lookout-common/src/test/java/com/alipay/lookout/common/utils/NetworkUtilTest.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.alipay.lookout.common.utils; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Created by kevin.luy@alipay.com on 2018/5/15. + */ +public class NetworkUtilTest { + + @Test + public void testGetLocalAddress() { + Assert.assertNotNull(NetworkUtil.getLocalAddress().getHostAddress()); + } +} diff --git a/client/lookout-common/src/test/java/com/alipay/lookout/common/utils/PriorityTagUtilTest.java b/client/lookout-common/src/test/java/com/alipay/lookout/common/utils/PriorityTagUtilTest.java new file mode 100644 index 0000000..0b94fd7 --- /dev/null +++ b/client/lookout-common/src/test/java/com/alipay/lookout/common/utils/PriorityTagUtilTest.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.alipay.lookout.common.utils; + +import com.alipay.lookout.api.BasicTag; +import com.alipay.lookout.api.PRIORITY; +import com.alipay.lookout.api.Tag; +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static com.alipay.lookout.common.LookoutConstants.TAG_PRIORITY_KEY; + +/** + * Created by kevin.luy@alipay.com on 2018/5/15. + */ +public class PriorityTagUtilTest { + + @Test + public void testResolveHigh() { + List tags = new ArrayList(); + tags.add(new BasicTag("k1", "v1")); + tags.add(new BasicTag(TAG_PRIORITY_KEY, PRIORITY.HIGH.toString())); + Assert.assertEquals(PRIORITY.HIGH, PriorityTagUtil.resolve(tags)); + } + + @Test + public void testResolveNothing() { + List tags = new ArrayList(); + tags.add(new BasicTag("k1", "v1")); + Assert.assertNotEquals(PRIORITY.HIGH, PriorityTagUtil.resolve(tags)); + Assert.assertEquals(PRIORITY.NORMAL, PriorityTagUtil.resolve(tags)); + + } +} diff --git a/client/lookout-core/src/main/java/com/alipay/lookout/core/InfoWrapper.java b/client/lookout-core/src/main/java/com/alipay/lookout/core/InfoWrapper.java index 89ca0e3..e2f84e4 100644 --- a/client/lookout-core/src/main/java/com/alipay/lookout/core/InfoWrapper.java +++ b/client/lookout-core/src/main/java/com/alipay/lookout/core/InfoWrapper.java @@ -31,7 +31,7 @@ public class InfoWrapper> implements Info, Metric { protected static final Logger logger = LookoutLoggerFactory.getLogger(Info.class); public static final String EMPTY_STRING = ""; protected Y info; - private Clock clock; + protected Clock clock; private Id id; public InfoWrapper(Id id, Y info, Clock clock) { diff --git a/client/lookout-core/src/test/java/com/alipay/lookout/common/MetricsUtilTest.java b/client/lookout-core/src/test/java/com/alipay/lookout/common/MetricsUtilTest.java deleted file mode 100644 index 996d0ea..0000000 --- a/client/lookout-core/src/test/java/com/alipay/lookout/common/MetricsUtilTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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.alipay.lookout.common; - -import com.alipay.lookout.api.Metric; -import com.alipay.lookout.common.utils.MetricsUtil; -import com.alipay.lookout.core.DefaultRegistry; -import org.junit.Test; - -import java.util.Comparator; -import java.util.Iterator; - -/** - * Created by kevin.luy@alipay.com on 2017/5/15. - */ -public class MetricsUtilTest { - - @Test - public void testSortedIterator() { - DefaultRegistry registry = new DefaultRegistry(); - registry.counter(registry.createId("ebc")); - registry.counter(registry.createId("dxy")); - registry.counter(registry.createId("att")); - - Iterator newIt = MetricsUtil.sortedIterator(registry.iterator(), - new Comparator() { - @Override - public int compare(Metric o1, Metric o2) { - return o1.id().name().compareTo(o2.id().name()); - } - }); - - while (newIt.hasNext()) { - System.out.println(newIt.next().id().name()); - } - - } -} diff --git a/client/lookout-core/src/test/java/com/alipay/lookout/remote/LookoutMeasurementTest.java b/client/lookout-core/src/test/java/com/alipay/lookout/remote/LookoutMeasurementTest.java new file mode 100644 index 0000000..1204ec4 --- /dev/null +++ b/client/lookout-core/src/test/java/com/alipay/lookout/remote/LookoutMeasurementTest.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.alipay.lookout.remote; + +import com.alipay.lookout.api.Id; +import com.alipay.lookout.api.Registry; +import com.alipay.lookout.core.DefaultRegistry; +import com.alipay.lookout.remote.model.LookoutMeasurement; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * Created by kevin.luy@alipay.com on 2018/5/15. + */ +public class LookoutMeasurementTest { + + static List measurements; + static Registry registry = new DefaultRegistry(); + static Id id = registry.createId("aaaaaa.bbbbbbb.ccccc"); + + @BeforeClass + public static void init() { + + measurements = new ArrayList(); + for (int i = 0; i < 1000; i++) { + LookoutMeasurement measurement = new LookoutMeasurement(new Date(), id); + measurement.addTag("lsjdfljalsjdfljsalflsajfdljslfjlja" + i, "xxxxxxxxxxxx" + i); + measurement.addTag("woeurowuouroqwuroquoeruoqweuroquro" + i, "xxxxxxxxxxxx" + i); + measurement.addTag("xvjsdiuhsdifhsihfdsihfisdbsduisdhgish" + i, "xxxxxxxxxxxx" + i); + measurement.addTag("qweeh,fhe,whfqwhefwhfqwefhw,efhwehf,wefh" + i, "xxxxxxxxxxxx" + i); + measurement.addTag("zhisdhifhaisdhfiahsdihfiasdhfiahfihaif" + i, "xxxxxxxxxxxx" + i); + measurement.put("xxx" + i, i); + measurement.put("yyy" + i, i); + measurement.put("zzz" + i, i); + measurements.add(measurement); + } + + } + + @Test + public void testManuJson() { + Date date = new Date(); + LookoutMeasurement measurement = new LookoutMeasurement(date, id); + int i = 3; + measurement.addTag("lsjdfljalsjdfljsalflsajfdljslfjlja" + i, "xxxxxxxxxxxx" + i); + measurement.put("xxx" + i, i); + measurement.put("yyy" + i, i); + measurement.put("zzz" + i, i); + + String str = null; + long t1 = System.currentTimeMillis(); + str = measurement.toString(); + long t2 = System.currentTimeMillis(); + System.out.println("t2-t1:" + (t2 - t1)); + System.out.println(str); + + String jsonStr = "\"lsjdfljalsjdfljsalflsajfdljslfjlja3\":\"xxxxxxxxxxxx3\"},\"aaaaaa.bbbbbbb.ccccc\":{\"xxx3\":3,\"yyy3\":3,\"zzz3\":3}}"; + System.out.println(jsonStr); + Assert.assertTrue(str.contains(jsonStr)); + } + +} diff --git a/client/lookout-core/src/test/java/com/alipay/lookout/report/LogObserverTest.java b/client/lookout-core/src/test/java/com/alipay/lookout/report/LogObserverTest.java new file mode 100644 index 0000000..330b16f --- /dev/null +++ b/client/lookout-core/src/test/java/com/alipay/lookout/report/LogObserverTest.java @@ -0,0 +1,364 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.alipay.lookout.report; + +import com.alipay.lookout.api.Id; +import com.alipay.lookout.core.DefaultRegistry; +import com.alipay.lookout.remote.model.LookoutMeasurement; +import org.junit.Assert; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.Marker; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * Created by kevin.luy@alipay.com on 2018/5/15. + */ +public class LogObserverTest { + private static String str; + + @Test + public void testUseLogObserver() { + LogObserver logObserver = new LogObserver(new StringLog()); + Id id = new DefaultRegistry().createId("aa"); + LookoutMeasurement measurement = new LookoutMeasurement(new Date(), id); + measurement.addTag("k", "v"); + measurement.put("v", 2); + + List measurements = new ArrayList(); + measurements.add(measurement); + logObserver.update(measurements, null); + Assert.assertTrue(str.contains("\"tags\":{\"k\":\"v\"}")); + } + + @Test + public void testLogObserverEnable() { + LogObserver logObserver = new LogObserver(); + Assert.assertTrue(logObserver.isEnable()); + } + + private static class StringLog implements Logger { + @Override + public String getName() { + return null; + } + + @Override + public boolean isTraceEnabled() { + return false; + } + + @Override + public void trace(String s) { + + } + + @Override + public void trace(String s, Object o) { + + } + + @Override + public void trace(String s, Object o, Object o1) { + + } + + @Override + public void trace(String s, Object... objects) { + + } + + @Override + public void trace(String s, Throwable throwable) { + + } + + @Override + public boolean isTraceEnabled(Marker marker) { + return false; + } + + @Override + public void trace(Marker marker, String s) { + + } + + @Override + public void trace(Marker marker, String s, Object o) { + + } + + @Override + public void trace(Marker marker, String s, Object o, Object o1) { + + } + + @Override + public void trace(Marker marker, String s, Object... objects) { + + } + + @Override + public void trace(Marker marker, String s, Throwable throwable) { + + } + + @Override + public boolean isDebugEnabled() { + return false; + } + + @Override + public void debug(String s) { + + } + + @Override + public void debug(String s, Object o) { + + } + + @Override + public void debug(String s, Object o, Object o1) { + + } + + @Override + public void debug(String s, Object... objects) { + + } + + @Override + public void debug(String s, Throwable throwable) { + + } + + @Override + public boolean isDebugEnabled(Marker marker) { + return false; + } + + @Override + public void debug(Marker marker, String s) { + + } + + @Override + public void debug(Marker marker, String s, Object o) { + + } + + @Override + public void debug(Marker marker, String s, Object o, Object o1) { + + } + + @Override + public void debug(Marker marker, String s, Object... objects) { + + } + + @Override + public void debug(Marker marker, String s, Throwable throwable) { + + } + + @Override + public boolean isInfoEnabled() { + return false; + } + + @Override + public void info(String s) { + str = s; + } + + @Override + public void info(String s, Object o) { + + } + + @Override + public void info(String s, Object o, Object o1) { + + } + + @Override + public void info(String s, Object... objects) { + + } + + @Override + public void info(String s, Throwable throwable) { + + } + + @Override + public boolean isInfoEnabled(Marker marker) { + return false; + } + + @Override + public void info(Marker marker, String s) { + + } + + @Override + public void info(Marker marker, String s, Object o) { + + } + + @Override + public void info(Marker marker, String s, Object o, Object o1) { + + } + + @Override + public void info(Marker marker, String s, Object... objects) { + + } + + @Override + public void info(Marker marker, String s, Throwable throwable) { + + } + + @Override + public boolean isWarnEnabled() { + return false; + } + + @Override + public void warn(String s) { + + } + + @Override + public void warn(String s, Object o) { + + } + + @Override + public void warn(String s, Object... objects) { + + } + + @Override + public void warn(String s, Object o, Object o1) { + + } + + @Override + public void warn(String s, Throwable throwable) { + + } + + @Override + public boolean isWarnEnabled(Marker marker) { + return false; + } + + @Override + public void warn(Marker marker, String s) { + + } + + @Override + public void warn(Marker marker, String s, Object o) { + + } + + @Override + public void warn(Marker marker, String s, Object o, Object o1) { + + } + + @Override + public void warn(Marker marker, String s, Object... objects) { + + } + + @Override + public void warn(Marker marker, String s, Throwable throwable) { + + } + + @Override + public boolean isErrorEnabled() { + return false; + } + + @Override + public void error(String s) { + + } + + @Override + public void error(String s, Object o) { + + } + + @Override + public void error(String s, Object o, Object o1) { + + } + + @Override + public void error(String s, Object... objects) { + + } + + @Override + public void error(String s, Throwable throwable) { + + } + + @Override + public boolean isErrorEnabled(Marker marker) { + return false; + } + + @Override + public void error(Marker marker, String s) { + + } + + @Override + public void error(Marker marker, String s, Object o) { + + } + + @Override + public void error(Marker marker, String s, Object o, Object o1) { + + } + + @Override + public void error(Marker marker, String s, Object... objects) { + + } + + @Override + public void error(Marker marker, String s, Throwable throwable) { + + } + } + +} diff --git a/client/lookout-core/src/test/java/com/alipay/lookout/spi/DefaultMetricsImporterLocatorTest.java b/client/lookout-core/src/test/java/com/alipay/lookout/spi/DefaultMetricsImporterLocatorTest.java new file mode 100644 index 0000000..373827d --- /dev/null +++ b/client/lookout-core/src/test/java/com/alipay/lookout/spi/DefaultMetricsImporterLocatorTest.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.alipay.lookout.spi; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Created by kevin.luy@alipay.com on 2018/5/15. + */ +public class DefaultMetricsImporterLocatorTest { + + @Test + public void testLocateImporters() { + DefaultMetricsImporterLocator locator = new DefaultMetricsImporterLocator(); + locator.locate(); + Assert.assertEquals(0, locator.locate().size()); + } +} diff --git a/client/lookout-ext-jvm/src/test/java/com.alipay.lookout.jvm.memory/JvmInfoMetricsImporterTest.java b/client/lookout-ext-jvm/src/test/java/com.alipay.lookout.jvm.memory/JvmInfoMetricsImporterTest.java new file mode 100644 index 0000000..7a0ada7 --- /dev/null +++ b/client/lookout-ext-jvm/src/test/java/com.alipay.lookout.jvm.memory/JvmInfoMetricsImporterTest.java @@ -0,0 +1,171 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.alipay.lookout.jvm.memory; + +import com.alipay.lookout.BasicMetricsImporter; +import com.alipay.lookout.FileSystemSpaceMetricsImporter; +import com.alipay.lookout.api.*; +import com.alipay.lookout.api.composite.MixinMetric; +import com.alipay.lookout.api.info.Info; +import com.alipay.lookout.core.DefaultRegistry; +import com.alipay.lookout.jvm.*; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Iterator; + +/** + * Created by kevin.luy@alipay.com on 2017/2/16. + */ +public class JvmInfoMetricsImporterTest { + + @Test + public void testGcInfo() { + Registry registry = new DefaultRegistry(); + JvmGcMetricsImporter jvmGcMetricsImporter = new JvmGcMetricsImporter(); + jvmGcMetricsImporter.register(registry); + + Id id = registry.createId("jvm.gc"); + MixinMetric mixin = registry.mixinMetric(id); + Gauge gauge = mixin.gauge("young.count", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("young.time", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("old.count", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("old.time", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + } + + @Test + public void testMemInfo() { + Registry registry = new DefaultRegistry(); + JvmMemoryMetricsImporter jvmMemoryMetricsImporter = new JvmMemoryMetricsImporter(); + jvmMemoryMetricsImporter.register(registry); + + Id id = registry.createId("jvm.memory"); + MixinMetric mixin = registry.mixinMetric(id); + Gauge gauge = mixin.gauge("nonheap.init", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("nonheap.used", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("nonheap.committed", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("nonheap.max", null); + System.out.println(gauge.value().longValue()); + Assert.assertTrue(gauge.value().longValue() >= -1); + + gauge = mixin.gauge("heap.init", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("heap.used", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("heap.committed", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("heap.max", null); + Assert.assertTrue(gauge.value().longValue() >= -1); + } + + @Test + public void testThreadsInfo() { + Registry registry = new DefaultRegistry(); + JvmThreadsMetricsImporter importer = new JvmThreadsMetricsImporter(); + importer.register(registry); + + Id id = registry.createId("jvm.threads"); + MixinMetric mixin = registry.mixinMetric(id); + Gauge gauge = mixin.gauge("peak", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("daemon", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("totalStarted", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("active", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + } + + @Test + public void testSystemPropertiesInfo() { + Registry registry = new DefaultRegistry(); + JvmSystemPropertiesInfoMetricImporter importer = new JvmSystemPropertiesInfoMetricImporter(); + importer.register(registry); + + Id id = registry.createId("jvm.system.properties"); + Info info = registry.info(id, null); + Assert.assertNotNull(info.value()); + + Id envId = registry.createId("jvm.system.env"); + Info info2 = registry.info(envId, null); + Assert.assertNotNull(info2.value()); + } + + @Test + public void testBaseInfo() { + Registry registry = new DefaultRegistry(); + BasicMetricsImporter jvmGcMetricsImporter = new BasicMetricsImporter(); + jvmGcMetricsImporter.register(registry); + + Id id = registry.createId("instance"); + MixinMetric mixin = registry.mixinMetric(id); + + Gauge gauge = mixin.gauge("mem.total", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("mem.free", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("processors", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("uptime", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("systemload.average", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + } + + @Test + public void testJvmClassInfo() { + Registry registry = new DefaultRegistry(); + JvmClassesMetricsImporter importer = new JvmClassesMetricsImporter(); + importer.register(registry); + + Id id = registry.createId("jvm.classes"); + MixinMetric mixin = registry.mixinMetric(id); + + Gauge gauge = mixin.gauge("unloaded", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("total", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + gauge = mixin.gauge("loaded", null); + Assert.assertTrue(gauge.value().longValue() >= 0); + } + + @Test + public void testFileSystemMetricsInfo() { + Registry registry = new DefaultRegistry(); + FileSystemSpaceMetricsImporter jvmGcMetricsImporter = new FileSystemSpaceMetricsImporter(); + jvmGcMetricsImporter.register(registry); + Iterator iterator = registry.iterator(); + String ids = ""; + while (iterator.hasNext()) { + Metric m = iterator.next(); + if (m instanceof MixinMetric) { + MixinMetric mm = (MixinMetric) m; + for (Object x : mm.measure().measurements()) { + ids += x.toString(); + } + } + } + Assert.assertTrue(ids.contains("usabe.space")); + } +} diff --git a/client/lookout-ext-jvm/src/test/java/com.alipay.lookout.jvm.memory/JvmMemoryMetricsImporterTest.java b/client/lookout-ext-jvm/src/test/java/com.alipay.lookout.jvm.memory/JvmMemoryMetricsImporterTest.java deleted file mode 100644 index b2cc669..0000000 --- a/client/lookout-ext-jvm/src/test/java/com.alipay.lookout.jvm.memory/JvmMemoryMetricsImporterTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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.alipay.lookout.jvm.memory; - -import com.alipay.lookout.spi.DefaultMetricsImporterLocator; -import com.alipay.lookout.spi.MetricsImporter; -import com.alipay.lookout.spi.MetricsImporterLocator; -import org.junit.Assert; -import org.junit.Test; - -import java.util.Collection; - -/** - * Created by kevin.luy@alipay.com on 2017/2/16. - */ -public class JvmMemoryMetricsImporterTest { - - @Test - public void testServiceLocateIt() { - MetricsImporterLocator locator = new DefaultMetricsImporterLocator(); - Collection mis = locator.locate(); - System.out.println(mis); - Assert.assertTrue(mis.size() > 0); - } - - // @Test - // public void testJvmMemoryMetricsImporter() { - // Registry r = new DefaultRegistry(); - // JvmMemoryMetricsImporter jvmMemoryMetricsImporter = new JvmMemoryMetricsImporter(); - // jvmMemoryMetricsImporter.register(r); - // System.out.println("s"); - // } - - // @Test - // public void testDISK() { - // File[] roots = File.listRoots(); - // - // /* For each filesystem root, print some info */ - // for (File root : roots) { - // System.out.println("File system root: " + root.getAbsolutePath()); - // System.out.println("Total space (bytes): " + root.getTotalSpace()); - // System.out.println("Free space (bytes): " + root.getFreeSpace()); - // System.out.println("Usable space (bytes): " + root.getUsableSpace()); - // } - // } -} diff --git a/client/lookout-ext-os/src/main/java/com/alipay/lookout/os/utils/FileUtils.java b/client/lookout-ext-os/src/main/java/com/alipay/lookout/os/utils/FileUtils.java index 33925dc..d1cd541 100644 --- a/client/lookout-ext-os/src/main/java/com/alipay/lookout/os/utils/FileUtils.java +++ b/client/lookout-ext-os/src/main/java/com/alipay/lookout/os/utils/FileUtils.java @@ -16,12 +16,14 @@ */ package com.alipay.lookout.os.utils; -import java.io.*; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; import java.util.ArrayList; import java.util.List; /** - * * @author wuqin * @version $Id: FileUtils.java, v 0.1 2017-03-18 下午5:17 wuqin Exp $$ */ @@ -79,59 +81,4 @@ public static List readFileAsStringArray(String path) throws IOException } return lines; } - - /** - * Read the last N lines of file - * - * @param path the path to file - * @param numRead the number of line - * @return - */ - public static List readLastNLine(String path, int numRead) { - File file = new File(path); - if (!file.exists() || file.isDirectory() || !file.canRead()) { - return null; - } - - List result = new ArrayList(); - long count = 0; - RandomAccessFile fileRead = null; - try { - fileRead = new RandomAccessFile(file, "r"); - long length = fileRead.length(); - if (length == 0L) { - return result; - } else { - long pos = length - 1; - while (pos > 0) { - pos--; - fileRead.seek(pos); - if (fileRead.readByte() == '\n') { - String line = fileRead.readLine(); - result.add(line); - count++; - if (count == numRead) { - break; - } - } - } - if (pos == 0) { - fileRead.seek(0); - result.add(fileRead.readLine()); - } - } - } catch (IOException e) { - // ignore - } finally { - if (fileRead != null) { - try { - fileRead.close(); - } catch (Exception e) { - // ignore - } - } - } - - return result; - } } diff --git a/client/lookout-reg-dropwizard/src/test/java/com/alipay/lookout/dropwizard/metrics/NameUtilsTest.java b/client/lookout-reg-dropwizard/src/test/java/com/alipay/lookout/dropwizard/metrics/NameUtilsTest.java new file mode 100644 index 0000000..de54b5a --- /dev/null +++ b/client/lookout-reg-dropwizard/src/test/java/com/alipay/lookout/dropwizard/metrics/NameUtilsTest.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.alipay.lookout.dropwizard.metrics; + +import com.alipay.lookout.api.Clock; +import com.alipay.lookout.core.DefaultRegistry; +import org.junit.Assert; +import org.junit.Test; + +/** + * Created by kevin.luy@alipay.com on 2018/5/16. + */ +public class NameUtilsTest { + + @Test + public void testMetricname() { + String name = NameUtils.toMetricName(new DefaultRegistry(Clock.SYSTEM).createId("name") + .withTag("k", "v")); + System.out.println(name); + Assert.assertEquals("name.k-v", name); + } +} diff --git a/client/lookout-reg-server/src/main/java/com/alipay/lookout/remote/step/PollableInfoWrapper.java b/client/lookout-reg-server/src/main/java/com/alipay/lookout/remote/step/PollableInfoWrapper.java index a88843b..7c96f89 100644 --- a/client/lookout-reg-server/src/main/java/com/alipay/lookout/remote/step/PollableInfoWrapper.java +++ b/client/lookout-reg-server/src/main/java/com/alipay/lookout/remote/step/PollableInfoWrapper.java @@ -50,13 +50,13 @@ public boolean isAutoPolledAllowed(long stepMills) { // if (lastPolledTime > 0) { // return false; // } - // lastPolledTime = System.currentTimeMillis();//第一次执行后的时间 + // lastPolledTime = clock.wallTime();//第一次执行后的时间 // return true; // } if (suggestion == AutoPollSuggestion.POLL_WHEN_UPDATED) { //最近发生更新了 if (lastPolledTime <= ((AutoPollFriendlyInfo) info).lastModifiedTime()) { - lastPolledTime = System.currentTimeMillis(); + lastPolledTime = clock.wallTime(); return true; } return false; @@ -67,8 +67,8 @@ public boolean isAutoPolledAllowed(long stepMills) { } // 默认会有小于step的误差; if (lastPolledTime <= 0 - || (System.currentTimeMillis() - lastPolledTime >= suggestion.intervalMills())) { - lastPolledTime = System.currentTimeMillis(); + || (clock.wallTime() - lastPolledTime >= suggestion.intervalMills())) { + lastPolledTime = clock.wallTime(); return true; } return false; @@ -76,12 +76,12 @@ public boolean isAutoPolledAllowed(long stepMills) { @Override public Indicator measure() { - long start = System.currentTimeMillis(); + long start = clock.wallTime(); try { return super.measure(); } finally { //可能很耗时,超过1s先日志警告!! - long duration = System.currentTimeMillis() - start; + long duration = clock.wallTime() - start; if (duration > 1000) { logger.warn("Info metric id:{} value method invoke too long(duration:{})!", duration); diff --git a/client/lookout-reg-server/src/test/java/com/alipay/lookout/common/MetricObserverUtilTest.java b/client/lookout-reg-server/src/test/java/com/alipay/lookout/common/MetricObserverUtilTest.java index 7cb17ff..866b0d9 100644 --- a/client/lookout-reg-server/src/test/java/com/alipay/lookout/common/MetricObserverUtilTest.java +++ b/client/lookout-reg-server/src/test/java/com/alipay/lookout/common/MetricObserverUtilTest.java @@ -43,7 +43,7 @@ public void testAddMetricObserverWithCompositeRegistry() { LogObserver logObserver = new LogObserver(); CompositeRegistry compositeRegistry = new CompositeRegistry(Clock.SYSTEM); compositeRegistry.add(reg); - MetricObserverUtil.addMetricObservers(reg, logObserver); + MetricObserverUtil.addMetricObservers(compositeRegistry, logObserver); Assert.assertTrue(reg.getMetricObservers().contains(logObserver)); } } diff --git a/client/lookout-reg-server/src/test/java/com/alipay/lookout/remote/report/LookoutMeasurementTest.java b/client/lookout-reg-server/src/test/java/com/alipay/lookout/remote/report/LookoutMeasurementTest.java index 1233052..1aa330e 100644 --- a/client/lookout-reg-server/src/test/java/com/alipay/lookout/remote/report/LookoutMeasurementTest.java +++ b/client/lookout-reg-server/src/test/java/com/alipay/lookout/remote/report/LookoutMeasurementTest.java @@ -111,28 +111,6 @@ public Number value() { } - @Test - public void testManuJson() { - Date date = new Date(); - LookoutMeasurement measurement = new LookoutMeasurement(date, id); - int i = 3; - measurement.addTag("lsjdfljalsjdfljsalflsajfdljslfjlja" + i, "xxxxxxxxxxxx" + i); - measurement.put("xxx" + i, i); - measurement.put("yyy" + i, i); - measurement.put("zzz" + i, i); - - String str = null; - long t1 = System.currentTimeMillis(); - str = measurement.toString(); - long t2 = System.currentTimeMillis(); - System.out.println("t2-t1:" + (t2 - t1)); - System.out.println(str); - - String jsonStr = "\"lsjdfljalsjdfljsalflsajfdljslfjlja3\":\"xxxxxxxxxxxx3\"},\"aaaaaa.bbbbbbb.ccccc\":{\"xxx3\":3,\"yyy3\":3,\"zzz3\":3}}"; - System.out.println(jsonStr); - Assert.assertTrue(str.contains(jsonStr)); - } - @Test public void testJsonPerf() { long t1 = System.currentTimeMillis(); diff --git a/client/lookout-reg-server/src/test/java/com/alipay/lookout/remote/step/PollableInfoWrapperTest.java b/client/lookout-reg-server/src/test/java/com/alipay/lookout/remote/step/PollableInfoWrapperTest.java new file mode 100644 index 0000000..8881e28 --- /dev/null +++ b/client/lookout-reg-server/src/test/java/com/alipay/lookout/remote/step/PollableInfoWrapperTest.java @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.alipay.lookout.remote.step; + +import com.alipay.lookout.api.Clock; +import com.alipay.lookout.api.Registry; +import com.alipay.lookout.api.info.AutoPollFriendlyInfo; +import com.alipay.lookout.api.info.AutoPollSuggestion; +import com.alipay.lookout.core.DefaultRegistry; +import org.junit.Assert; +import org.junit.Test; + +import java.util.concurrent.TimeUnit; + +import static com.alipay.lookout.api.info.AutoPollSuggestion.POLL_WHEN_UPDATED; + +/** + * Created by kevin.luy@alipay.com on 2018/5/16. + */ +public class PollableInfoWrapperTest { + + @Test + public void testAutoPollSuggestion_POLL_WHEN_UPDATED() { + Clock clock = new MockClock(); + Registry r = new DefaultRegistry(clock); + PollableInfoWrapper pollableInfoWrapper = new PollableInfoWrapper(r.createId("name"), + new AutoPollFriendlyInfo() { + + @Override + public AutoPollSuggestion autoPollSuggest() { + return POLL_WHEN_UPDATED; + } + + @Override + public long lastModifiedTime() { + return 1; + } + + @Override + public String value() { + return "x"; + } + }, clock); + + Assert.assertTrue(pollableInfoWrapper.isAutoPolledAllowed(1000)); + Assert.assertTrue(pollableInfoWrapper.isAutoPolledAllowed(9000)); + } + + @Test + public void testAutoPollSuggestionAfterInterval() { + Clock clock = new MockClock(); + ((MockClock) clock).setWallTime(1); + Registry r = new DefaultRegistry(clock); + PollableInfoWrapper pollableInfoWrapper = new PollableInfoWrapper(r.createId("name"), + new AutoPollFriendlyInfo() { + + @Override + public AutoPollSuggestion autoPollSuggest() { + return new AutoPollSuggestion(2, TimeUnit.SECONDS); + } + + @Override + public long lastModifiedTime() { + return 1; + } + + @Override + public String value() { + return "x"; + } + }, clock); + + Assert.assertTrue(pollableInfoWrapper.isAutoPolledAllowed(1000)); + ((MockClock) clock).setWallTime(3000); + //让距离上次采集的间隔时间为:(3000-1)ms, 大于2000,所以继续 poll + Assert.assertTrue(pollableInfoWrapper.isAutoPolledAllowed(2000)); + } +} diff --git a/client/lookout-sofa-boot-starter/README.md b/client/lookout-sofa-boot-starter/README.md deleted file mode 100644 index 0632c2b..0000000 --- a/client/lookout-sofa-boot-starter/README.md +++ /dev/null @@ -1,17 +0,0 @@ -## 1. How to get the instance of `com.alipay.lookout.api.Registry`? - -- inject the instance by this type or by its name `registry` - - -## 2. Integrate with spring boot actuator - -- metrics collected by Lookout-api can be mapped to Actuator - -The dropwizard dependency is required as a bridge. - -```xml - - io.dropwizard.metrics - metrics-core - -``` diff --git a/client/lookout-sofa-boot-starter/pom.xml b/client/lookout-sofa-boot-starter/pom.xml index 96686a2..f5fbed2 100644 --- a/client/lookout-sofa-boot-starter/pom.xml +++ b/client/lookout-sofa-boot-starter/pom.xml @@ -55,6 +55,11 @@ provided + + org.springframework.boot + spring-boot-configuration-processor + true + com.alipay.sofa.lookout lookout-reg-dropwizard @@ -70,13 +75,12 @@ spring-boot-starter-actuator provided + org.springframework.boot - spring-boot-configuration-processor - true + spring-boot-starter-test + test - - junit junit diff --git a/client/lookout-sofa-boot-starter/src/main/java/com/alipay/lookout/starter/autoConfiguration/LookoutAutoConfiguration.java b/client/lookout-sofa-boot-starter/src/main/java/com/alipay/lookout/starter/autoConfiguration/LookoutAutoConfiguration.java index de6ce8a..d74c843 100644 --- a/client/lookout-sofa-boot-starter/src/main/java/com/alipay/lookout/starter/autoConfiguration/LookoutAutoConfiguration.java +++ b/client/lookout-sofa-boot-starter/src/main/java/com/alipay/lookout/starter/autoConfiguration/LookoutAutoConfiguration.java @@ -69,7 +69,7 @@ public void setBeanFactory(BeanFactory beanFactory) throws BeansException { public LookoutConfig lookoutConfig(LookoutClientProperties lookoutClientProperties, Environment environment) { String appName = environment.getProperty("spring.application.name"); - Assert.notNull(appName); + Assert.notNull(appName, "spring.application.name can not be null!"); LookoutConfig config = buildLookoutConfig(lookoutClientProperties); config.setProperty(APP_NAME, appName); return config; diff --git a/client/lookout-sofa-boot-starter/src/test/java/com/alipay/lookout/starter/LookoutStarterTest.java b/client/lookout-sofa-boot-starter/src/test/java/com/alipay/lookout/starter/LookoutStarterTest.java new file mode 100644 index 0000000..991eb11 --- /dev/null +++ b/client/lookout-sofa-boot-starter/src/test/java/com/alipay/lookout/starter/LookoutStarterTest.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.alipay.lookout.starter; + +import com.alipay.lookout.api.Gauge; +import com.alipay.lookout.api.Id; +import com.alipay.lookout.api.Registry; +import com.alipay.lookout.api.composite.CompositeRegistry; +import com.alipay.lookout.api.composite.MixinMetric; +import com.alipay.lookout.dropwizard.metrics.DropWizardMetricsRegistry; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.stereotype.Component; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.concurrent.TimeUnit; + +/** + * Created by kevin.luy@alipay.com on 2018/5/15. + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = LookoutStarterTest.class) +@Component +@ComponentScan +@SpringBootApplication +public class LookoutStarterTest { + + @Autowired + Registry registry; + + @Test + public void testDropwizardMetrics() { + Id id = registry.createId("test_status").withTag("k1", "v1"); + MixinMetric mixinMetric = registry.mixinMetric(id); + mixinMetric.distributionSummary("dstest").record(100); + mixinMetric.counter("counttest").inc(); + mixinMetric.timer("timetest").record(2, TimeUnit.SECONDS); + mixinMetric.gauge("guagetest", new Gauge() { + @Override + public Integer value() { + return 1; + } + }); + + Assert.assertTrue(registry instanceof CompositeRegistry); + CompositeRegistry compositeRegistry = (CompositeRegistry) registry; + DropWizardMetricsRegistry dwr = null; + for (Registry r : compositeRegistry.getRegistries()) { + if (r instanceof DropWizardMetricsRegistry) { + dwr = (DropWizardMetricsRegistry) r; + break; + } + } + + MixinMetric mixinMetric2 = dwr.mixinMetric(id); + Assert.assertEquals(1, mixinMetric2.counter("counttest").count()); + Assert.assertEquals(1, mixinMetric2.timer("timetest").count()); + Assert.assertEquals(1, mixinMetric2.distributionSummary("dstest").count()); + + } + +} diff --git a/client/lookout-sofa-boot-starter/src/test/resources/application.properties b/client/lookout-sofa-boot-starter/src/test/resources/application.properties new file mode 100644 index 0000000..8dfdf67 --- /dev/null +++ b/client/lookout-sofa-boot-starter/src/test/resources/application.properties @@ -0,0 +1,5 @@ +spring.application.name=start-test +com.alipay.sofa.lookout.enable=true +com.alipay.sofa.lookout.agent-host-address +com.alipay.sofa.lookout.max-metrics-num=1000 +com.alipay.sofa.lookout.prometheus-exporter-server-port=9494 \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..56e0087 --- /dev/null +++ b/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + com.alipay.sofa.lookout + lookout-parent + 1.4.0 + pom + + UTF-8 + + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + kevin.luy + kevin.luy@antfin.com + Ant Financial + https://www.alipay.com/ + + + + client + server + + diff --git a/server/pom.xml b/server/pom.xml new file mode 100644 index 0000000..768eae7 --- /dev/null +++ b/server/pom.xml @@ -0,0 +1,9 @@ + + + 4.0.0 + com.alipay.sofa.lookout + lookout-server-parent + 1.4.0 + pom +