-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2024 NAVER Corp. | ||
* | ||
* 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 | ||
* | ||
* 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.navercorp.pinpoint.collector.applicationmap; | ||
|
||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
/** | ||
* @author intr3p1d | ||
*/ | ||
@Configuration(proxyBeanMethods = false) | ||
@ComponentScan(basePackages = { | ||
"com.navercorp.pinpoint.collector.applicationmap", | ||
"com.navercorp.pinpoint.collector.applicationmap.dao", | ||
"com.navercorp.pinpoint.collector.applicationmap.redis", | ||
"com.navercorp.pinpoint.collector.applicationmap.service", | ||
}) | ||
public class ApplicationMapModule { | ||
Check warning on line 31 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/ApplicationMapModule.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/ApplicationMapModule.java#L31
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2024 NAVER Corp. | ||
* | ||
* 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 | ||
* | ||
* 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.navercorp.pinpoint.collector.applicationmap.dao; | ||
|
||
import com.navercorp.pinpoint.collector.dao.CachedStatisticsDao; | ||
import com.navercorp.pinpoint.common.trace.ServiceType; | ||
|
||
/** | ||
* @author intr3p1d | ||
*/ | ||
public interface InboundDao extends CachedStatisticsDao { | ||
// src -> dest | ||
// inbound (rowKey dest <- columnName src) | ||
// outbound (rowKey src -> columnName dest) | ||
void update( | ||
String srcServiceName, String srcApplicationName, ServiceType srcApplicationType, | ||
String destServiceName, String destApplicationName, ServiceType destApplicationType, | ||
String srcHost, int elapsed, boolean isError | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2024 NAVER Corp. | ||
* | ||
* 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 | ||
* | ||
* 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.navercorp.pinpoint.collector.applicationmap.dao; | ||
|
||
import com.navercorp.pinpoint.collector.dao.CachedStatisticsDao; | ||
import com.navercorp.pinpoint.common.trace.ServiceType; | ||
|
||
/** | ||
* @author intr3p1d | ||
*/ | ||
public interface OutboundDao extends CachedStatisticsDao { | ||
// src -> dest | ||
// inbound (rowKey dest <- columnName src) | ||
// outbound (rowKey src -> columnName dest) | ||
void update( | ||
String srcServiceName, String srcApplicationName, ServiceType srcApplicationType, | ||
String destServiceName, String destApplicationName, ServiceType destApplicationType, | ||
String srcHost, int elapsed, boolean isError | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright 2024 NAVER Corp. | ||
* | ||
* 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 | ||
* | ||
* 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.navercorp.pinpoint.collector.applicationmap.dao; | ||
|
||
|
||
import com.navercorp.pinpoint.collector.dao.CachedStatisticsDao; | ||
import com.navercorp.pinpoint.common.trace.ServiceType; | ||
|
||
/** | ||
* @author intr3p1d | ||
*/ | ||
public interface SelfDao extends CachedStatisticsDao { | ||
void received(String serviceName, String applicationName, ServiceType applicationType, int elapsed, boolean isError); | ||
void updatePing(String serviceName, String applicationName, ServiceType applicationType, int elapsed, boolean isError); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/* | ||
* Copyright 2024 NAVER Corp. | ||
* | ||
* 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 | ||
* | ||
* 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.navercorp.pinpoint.collector.applicationmap.redis; | ||
|
||
import com.navercorp.pinpoint.collector.applicationmap.dao.InboundDao; | ||
import com.navercorp.pinpoint.collector.applicationmap.redis.schema.ApplicationMapTable; | ||
import com.navercorp.pinpoint.collector.applicationmap.redis.schema.TimeSeriesKey; | ||
import com.navercorp.pinpoint.collector.applicationmap.redis.schema.TimeSeriesValue; | ||
import com.navercorp.pinpoint.collector.dao.hbase.IgnoreStatFilter; | ||
import com.navercorp.pinpoint.collector.dao.hbase.statistics.MapLinkConfiguration; | ||
import com.navercorp.pinpoint.collector.applicationmap.redis.statistics.RedisBulkWriter; | ||
import com.navercorp.pinpoint.common.server.util.AcceptedTimeService; | ||
import com.navercorp.pinpoint.common.server.util.ApplicationMapStatisticsUtils; | ||
import com.navercorp.pinpoint.common.server.util.TimeSlot; | ||
import com.navercorp.pinpoint.common.trace.HistogramSchema; | ||
import com.navercorp.pinpoint.common.trace.ServiceType; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* @author intr3p1d | ||
*/ | ||
@Repository | ||
public class RedisInboundDao implements InboundDao { | ||
|
||
private final Logger logger = LogManager.getLogger(this.getClass()); | ||
Check warning on line 43 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L43
|
||
|
||
private final AcceptedTimeService acceptedTimeService; | ||
private final IgnoreStatFilter ignoreStatFilter; | ||
private final RedisBulkWriter bulkWriter; | ||
private final MapLinkConfiguration mapLinkConfiguration; | ||
|
||
public RedisInboundDao( | ||
MapLinkConfiguration mapLinkConfiguration, | ||
AcceptedTimeService acceptedTimeService, | ||
IgnoreStatFilter ignoreStatFilter, | ||
@Qualifier("inboundBulkWriter") RedisBulkWriter bulkWriter | ||
) { | ||
this.mapLinkConfiguration = Objects.requireNonNull(mapLinkConfiguration, "mapLinkConfiguration"); | ||
this.acceptedTimeService = Objects.requireNonNull(acceptedTimeService, "acceptedTimeService"); | ||
this.ignoreStatFilter = Objects.requireNonNull(ignoreStatFilter, "ignoreStatFilter"); | ||
this.bulkWriter = Objects.requireNonNull(bulkWriter, "inboundBulkWriter"); | ||
} | ||
Check warning on line 60 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L55-L60
|
||
|
||
|
||
@Override | ||
public void update( | ||
String srcServiceName, String srcApplicationName, ServiceType srcApplicationType, | ||
String destServiceName, String destApplicationName, ServiceType destApplicationType, | ||
String srcHost, int elapsed, boolean isError | ||
) { | ||
Objects.requireNonNull(srcServiceName, "srcServiceName"); | ||
Objects.requireNonNull(destServiceName, "destServiceName"); | ||
Objects.requireNonNull(srcApplicationName, "srcApplicationName"); | ||
Objects.requireNonNull(destServiceName, "destApplicationName"); | ||
Check warning on line 72 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L69-L72
|
||
|
||
if (logger.isDebugEnabled()) { | ||
logger.debug("[Inbound] {} {}({}) <- {} {}({})[{}]", | ||
Check warning on line 75 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L75
|
||
destServiceName, destApplicationName, destApplicationType, | ||
srcServiceName, srcApplicationName, srcApplicationType, srcHost | ||
); | ||
} | ||
|
||
if (ignoreStatFilter.filter(srcApplicationType, srcHost)) { | ||
logger.debug("[Ignore-Inbound] {} {}({}) <- {} {}({})[{}]", | ||
Check warning on line 82 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L82
|
||
destServiceName, destApplicationName, destApplicationType, | ||
srcServiceName, srcApplicationName, srcApplicationType, srcHost | ||
); | ||
return; | ||
Check warning on line 86 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L86
|
||
} | ||
|
||
final short srcSlotNumber = ApplicationMapStatisticsUtils.getSlotNumber(srcApplicationType, elapsed, isError); | ||
HistogramSchema histogramSchema = srcApplicationType.getHistogramSchema(); | ||
final long acceptedTime = acceptedTimeService.getAcceptedTime(); | ||
Check warning on line 91 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L89-L91
|
||
|
||
// for inbound, main is destination | ||
// and sub is source | ||
final TimeSeriesKey applicationTypeKey = new TimeSeriesKey( | ||
Check warning on line 95 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L95
|
||
ApplicationMapTable.Inbound, "tenantId", | ||
destServiceName, destApplicationName, | ||
srcServiceName, srcApplicationName, srcSlotNumber | ||
); | ||
TimeSeriesValue addOne = new TimeSeriesValue(acceptedTime); | ||
this.bulkWriter.increment(applicationTypeKey, addOne); | ||
Check warning on line 101 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L100-L101
|
||
|
||
if (mapLinkConfiguration.isEnableAvg()) { | ||
final TimeSeriesKey sumStatKey = new TimeSeriesKey( | ||
Check warning on line 104 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L104
|
||
ApplicationMapTable.Inbound, "tenantId", | ||
destServiceName, destApplicationName, | ||
srcServiceName, srcApplicationName, | ||
histogramSchema.getSumStatSlot().getSlotTime() | ||
Check warning on line 108 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L108
|
||
); | ||
final TimeSeriesValue sumValue = new TimeSeriesValue(acceptedTime); | ||
this.bulkWriter.increment(sumStatKey, sumValue, elapsed); | ||
Check warning on line 111 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L110-L111
|
||
} | ||
if (mapLinkConfiguration.isEnableMax()) { | ||
final TimeSeriesKey maxStatKey = new TimeSeriesKey( | ||
Check warning on line 114 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L114
|
||
ApplicationMapTable.Inbound, "tenantId", | ||
destServiceName, destApplicationName, | ||
srcServiceName, srcApplicationName, | ||
histogramSchema.getMaxStatSlot().getSlotTime() | ||
Check warning on line 118 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L118
|
||
); | ||
final TimeSeriesValue maxValue = new TimeSeriesValue(acceptedTime); | ||
this.bulkWriter.updateMax(maxStatKey, maxValue, elapsed); | ||
Check warning on line 121 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L120-L121
|
||
} | ||
|
||
} | ||
Check warning on line 124 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L124
|
||
|
||
@Override | ||
public void flushLink() { | ||
this.bulkWriter.flushLink(); | ||
} | ||
Check warning on line 129 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L128-L129
|
||
|
||
@Override | ||
public void flushAvgMax() { | ||
this.bulkWriter.flushAvgMax(); | ||
} | ||
Check warning on line 134 in collector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java Codecov / codecov/patchcollector/src/main/java/com/navercorp/pinpoint/collector/applicationmap/redis/RedisInboundDao.java#L133-L134
|
||
|
||
} |