diff --git a/.github/workflows/ci-it.yaml b/.github/workflows/ci-it.yaml index f489fee05d2308e70c8a57bc20f3cfe21f0cb148..667fd83b9b979d08cc90da4f530c4d73dfbabf18 100644 --- a/.github/workflows/ci-it.yaml +++ b/.github/workflows/ci-it.yaml @@ -28,7 +28,7 @@ on: jobs: CI: runs-on: ubuntu-18.04 - timeout-minutes: 180 + timeout-minutes: 90 strategy: fail-fast: true steps: @@ -52,7 +52,7 @@ jobs: CI-on-Windows: runs-on: Windows-latest - timeout-minutes: 180 + timeout-minutes: 90 strategy: fail-fast: true steps: @@ -74,7 +74,7 @@ jobs: CI-on-MacOS: runs-on: macos-latest - timeout-minutes: 180 + timeout-minutes: 90 strategy: fail-fast: true steps: diff --git a/.github/workflows/docker-ci.yaml b/.github/workflows/docker-ci.yaml index 99b3c1a6063c3aced1efee686bafdc0d6cf09af9..c1202c7d682903eeaff4efac5b8c53662639930a 100644 --- a/.github/workflows/docker-ci.yaml +++ b/.github/workflows/docker-ci.yaml @@ -24,6 +24,7 @@ env: jobs: build: runs-on: ubuntu-16.04 + timeout-minutes: 90 strategy: matrix: es: [es6, es7] diff --git a/.github/workflows/e2e.cluster.yaml b/.github/workflows/e2e.cluster.yaml index 8337feb834159ea24d0f2182e0975e5cac88f2c4..1fbd3b3739bfd026db3209ef34704db2fad88a77 100644 --- a/.github/workflows/e2e.cluster.yaml +++ b/.github/workflows/e2e.cluster.yaml @@ -30,6 +30,7 @@ env: jobs: CoordinatorsStorage: name: Coordinators & Storage + timeout-minutes: 90 runs-on: ubuntu-latest strategy: matrix: @@ -59,6 +60,7 @@ jobs: Cluster: runs-on: ubuntu-latest + timeout-minutes: 90 needs: [CoordinatorsStorage] steps: - name: Call me by your name diff --git a/.github/workflows/e2e.jdk-versions.yaml b/.github/workflows/e2e.jdk-versions.yaml index ef5d6181eeb8e996e77c7c1a9a8eedee9dd2b9c7..c96e0a4d85566b607a21481de17f1bd129509ff5 100644 --- a/.github/workflows/e2e.jdk-versions.yaml +++ b/.github/workflows/e2e.jdk-versions.yaml @@ -31,6 +31,7 @@ jobs: JavaVersions: name: Agent Java Versions runs-on: ubuntu-latest + timeout-minutes: 90 strategy: matrix: jdk: [8, 9, 10, 11, 12, 13, 14] @@ -58,6 +59,7 @@ jobs: Single: runs-on: ubuntu-latest + timeout-minutes: 90 needs: [JavaVersions] steps: - name: Singles Bar diff --git a/.github/workflows/e2e.php.yaml b/.github/workflows/e2e.php.yaml index 383cad82cdcec19c4906ae4ebbaca1f4db475b5e..387c9a4456bb473665c8341034569cdac159087f 100644 --- a/.github/workflows/e2e.php.yaml +++ b/.github/workflows/e2e.php.yaml @@ -32,6 +32,7 @@ jobs: PHPAgent: name: PHP runs-on: ubuntu-latest + timeout-minutes: 90 steps: - uses: actions/checkout@v2 - name: checkout submodules diff --git a/.github/workflows/e2e.profiling.yaml b/.github/workflows/e2e.profiling.yaml index d039bbb53d950b6b02d53b6a2584ec20adb48023..235495a14b348acd77d5666f405c3a539886be9a 100644 --- a/.github/workflows/e2e.profiling.yaml +++ b/.github/workflows/e2e.profiling.yaml @@ -31,6 +31,7 @@ jobs: Profiling: name: Profiling runs-on: ubuntu-latest + timeout-minutes: 90 strategy: matrix: storage: ['h2', 'mysql', 'es6', 'es7', 'influxdb'] diff --git a/.github/workflows/e2e.storages.yaml b/.github/workflows/e2e.storages.yaml index 0113e3642cbe4622c84a54fecfad9be3b975b191..b1d4ac0b18b64a4341f812b1cf213f76847de8c7 100644 --- a/.github/workflows/e2e.storages.yaml +++ b/.github/workflows/e2e.storages.yaml @@ -31,6 +31,7 @@ jobs: StoragePlugins: name: Storage runs-on: ubuntu-latest + timeout-minutes: 90 strategy: matrix: storage: ['mysql', 'es6', 'es7', 'influxdb'] @@ -57,6 +58,7 @@ jobs: Storage: runs-on: ubuntu-latest + timeout-minutes: 90 needs: [StoragePlugins] steps: - name: To pass or not pass diff --git a/.github/workflows/e2e.ttl.yaml b/.github/workflows/e2e.ttl.yaml index 58381ad2c9ca55477c977129dbc7ae4b9b9f01c2..cec82a10b1afd7a6a6b932dadd2b7922ffb50f9b 100644 --- a/.github/workflows/e2e.ttl.yaml +++ b/.github/workflows/e2e.ttl.yaml @@ -31,6 +31,7 @@ jobs: TTL: name: Storage TTL runs-on: ubuntu-latest + timeout-minutes: 90 strategy: matrix: storage: ['es6', 'es7', 'influxdb'] diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 554f9b97b5903c248a3285e253dd992044b363ab..2f101fe3a18dd511582f672024a255529cdf033e 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -32,6 +32,7 @@ jobs: FeatureGroup01: name: Feature runs-on: ubuntu-latest + timeout-minutes: 90 strategy: matrix: case: [auth, compatibility, ssl] @@ -59,6 +60,7 @@ jobs: FeatureGroup02: name: Agent Reboot & Lua Nginx runs-on: ubuntu-latest + timeout-minutes: 90 steps: - uses: actions/checkout@v2 - name: checkout submodules @@ -83,6 +85,7 @@ jobs: FeatureGroup03: name: Gateway runs-on: ubuntu-latest + timeout-minutes: 90 steps: - uses: actions/checkout@v2 - name: checkout submodules diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/commands/executor/ServiceResetCommandExecutor.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/commands/executor/ServiceResetCommandExecutor.java index 4443ffbb2ca703ec93099c1f3872d71481998307..57f639f7b84bf8303d433d48a1b17872381e9578 100755 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/commands/executor/ServiceResetCommandExecutor.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/commands/executor/ServiceResetCommandExecutor.java @@ -22,11 +22,10 @@ import org.apache.skywalking.apm.agent.core.commands.CommandExecutionException; import org.apache.skywalking.apm.agent.core.commands.CommandExecutor; import org.apache.skywalking.apm.agent.core.conf.RemoteDownstreamConfig; import org.apache.skywalking.apm.agent.core.dictionary.DictionaryUtil; -import org.apache.skywalking.apm.agent.core.dictionary.EndpointNameDictionary; import org.apache.skywalking.apm.agent.core.dictionary.NetworkAddressDictionary; import org.apache.skywalking.apm.agent.core.logging.api.ILog; import org.apache.skywalking.apm.agent.core.logging.api.LogManager; -import org.apache.skywalking.apm.agent.core.remote.ServiceAndEndpointRegisterClient; +import org.apache.skywalking.apm.agent.core.remote.ServiceRegisterClient; import org.apache.skywalking.apm.network.trace.component.command.BaseCommand; import org.apache.skywalking.apm.network.trace.component.command.ServiceResetCommand; @@ -40,13 +39,12 @@ public class ServiceResetCommandExecutor implements CommandExecutor { public void execute(final BaseCommand command) throws CommandExecutionException { LOGGER.warn("Received ServiceResetCommand, a re-register task is scheduled."); - ServiceManager.INSTANCE.findService(ServiceAndEndpointRegisterClient.class).coolDown(); + ServiceManager.INSTANCE.findService(ServiceRegisterClient.class).coolDown(); RemoteDownstreamConfig.Agent.SERVICE_ID = DictionaryUtil.nullValue(); RemoteDownstreamConfig.Agent.SERVICE_INSTANCE_ID = DictionaryUtil.nullValue(); RemoteDownstreamConfig.Agent.INSTANCE_REGISTERED_TIME = DictionaryUtil.nullValue(); NetworkAddressDictionary.INSTANCE.clear(); - EndpointNameDictionary.INSTANCE.clear(); } } diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Constants.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Constants.java index 98baf0d6ef23dd78efbbdfb43b3c015683995550..4e3bcf4c9ea781029affb465e5a6a26d2f91725a 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Constants.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/conf/Constants.java @@ -22,4 +22,6 @@ public class Constants { public static String PATH_SEPARATOR = System.getProperty("file.separator", "/"); public static String LINE_SEPARATOR = System.getProperty("line.separator", "\n"); + + public static String EMPTY_STRING = ""; } diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ContextCarrier.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ContextCarrier.java index d6281af3de342cb1dea64a9eecdf16a694c9a51b..293265af6137577c594092a4d35c1361b9eda1fc 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ContextCarrier.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ContextCarrier.java @@ -165,18 +165,10 @@ public class ContextCarrier implements Serializable { this.entryEndpointName = '#' + entryEndpointName; } - void setEntryEndpointId(int entryOperationId) { - this.entryEndpointName = entryOperationId + ""; - } - void setParentEndpointName(String parentEndpointName) { this.parentEndpointName = '#' + parentEndpointName; } - void setParentEndpointId(int parentOperationId) { - this.parentEndpointName = parentOperationId + ""; - } - public ID getTraceSegmentId() { return traceSegmentId; } diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/TracingContext.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/TracingContext.java index 509d98fcc0fa37cc9c9117be7c56dbc15cbde03c..0c36f2a38079c9e3f176bc5f77653e4d8be1dbc3 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/TracingContext.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/TracingContext.java @@ -131,7 +131,8 @@ public class TracingContext implements AbstractTracerContext { if (PROFILE_TASK_EXECUTION_SERVICE == null) { PROFILE_TASK_EXECUTION_SERVICE = ServiceManager.INSTANCE.findService(ProfileTaskExecutionService.class); } - this.profileStatus = PROFILE_TASK_EXECUTION_SERVICE.addProfiling(this, segment.getTraceSegmentId(), firstOPName); + this.profileStatus = PROFILE_TASK_EXECUTION_SERVICE.addProfiling( + this, segment.getTraceSegmentId(), firstOPName); this.correlationContext = new CorrelationContext(); } @@ -184,56 +185,21 @@ public class TracingContext implements AbstractTracerContext { String firstSpanOperationName = firstSpan.getOperationName(); List refs = this.segment.getRefs(); - int operationId = DictionaryUtil.inexistence(); String operationName = ""; int entryApplicationInstanceId; if (refs != null && refs.size() > 0) { TraceSegmentRef ref = refs.get(0); - operationId = ref.getEntryEndpointId(); operationName = ref.getEntryEndpointName(); entryApplicationInstanceId = ref.getEntryServiceInstanceId(); } else { - if (firstSpan.isEntry()) { - /* - * Since 6.6.0, if first span is not entry span, then this is an internal segment(no RPC), - * rather than an endpoint. - */ - operationId = firstSpan.getOperationId(); - operationName = firstSpanOperationName; - } + operationName = firstSpanOperationName; entryApplicationInstanceId = this.segment.getApplicationInstanceId(); - - } - carrier.setEntryServiceInstanceId(entryApplicationInstanceId); - - if (operationId == DictionaryUtil.nullValue()) { - if (!StringUtil.isEmpty(operationName)) { - carrier.setEntryEndpointName(operationName); - } else { - /* - * Since 6.6.0, if first span is not entry span, then this is an internal segment(no RPC), - * rather than an endpoint. - */ - } - } else { - carrier.setEntryEndpointId(operationId); } - int parentOperationId = firstSpan.getOperationId(); - if (parentOperationId == DictionaryUtil.nullValue()) { - if (firstSpan.isEntry() && !StringUtil.isEmpty(firstSpanOperationName)) { - carrier.setParentEndpointName(firstSpanOperationName); - } else { - /* - * Since 6.6.0, if first span is not entry span, then this is an internal segment(no RPC), - * rather than an endpoint. - */ - carrier.setParentEndpointId(DictionaryUtil.inexistence()); - } - } else { - carrier.setParentEndpointId(parentOperationId); - } + carrier.setEntryServiceInstanceId(entryApplicationInstanceId); + carrier.setEntryEndpointName(operationName); + carrier.setParentEndpointName(firstSpanOperationName); carrier.setDistributedTraceIds(this.segment.getRelatedGlobalTraces()); @@ -267,7 +233,9 @@ public class TracingContext implements AbstractTracerContext { public ContextSnapshot capture() { List refs = this.segment.getRefs(); ContextSnapshot snapshot = new ContextSnapshot( - segment.getTraceSegmentId(), activeSpan().getSpanId(), segment.getRelatedGlobalTraces(), this.correlationContext); + segment.getTraceSegmentId(), activeSpan().getSpanId(), segment.getRelatedGlobalTraces(), + this.correlationContext + ); int entryOperationId; String entryOperationName = ""; int entryApplicationInstanceId; @@ -276,51 +244,16 @@ public class TracingContext implements AbstractTracerContext { if (refs != null && refs.size() > 0) { TraceSegmentRef ref = refs.get(0); - entryOperationId = ref.getEntryEndpointId(); entryOperationName = ref.getEntryEndpointName(); entryApplicationInstanceId = ref.getEntryServiceInstanceId(); } else { - if (firstSpan.isEntry()) { - entryOperationId = firstSpan.getOperationId(); - entryOperationName = firstSpanOperationName; - } else { - /* - * Since 6.6.0, if first span is not entry span, then this is an internal segment(no RPC), - * rather than an endpoint. - */ - entryOperationId = DictionaryUtil.inexistence(); - } + entryOperationName = firstSpanOperationName; entryApplicationInstanceId = this.segment.getApplicationInstanceId(); } snapshot.setEntryApplicationInstanceId(entryApplicationInstanceId); + snapshot.setEntryOperationName(entryOperationName); + snapshot.setParentOperationName(firstSpanOperationName); - if (entryOperationId == DictionaryUtil.nullValue()) { - if (!StringUtil.isEmpty(entryOperationName)) { - snapshot.setEntryOperationName(entryOperationName); - } else { - /* - * Since 6.6.0, if first span is not entry span, then this is an internal segment(no RPC), - * rather than an endpoint. - */ - } - } else { - snapshot.setEntryOperationId(entryOperationId); - } - - int parentOperationId = firstSpan.getOperationId(); - if (parentOperationId == DictionaryUtil.nullValue()) { - if (firstSpan.isEntry() && !StringUtil.isEmpty(firstSpanOperationName)) { - snapshot.setParentOperationName(firstSpanOperationName); - } else { - /* - * Since 6.6.0, if first span is not entry span, then this is an internal segment(no RPC), - * rather than an endpoint. - */ - snapshot.setParentOperationId(DictionaryUtil.inexistence()); - } - } else { - snapshot.setParentOperationId(parentOperationId); - } return snapshot; } @@ -368,25 +301,14 @@ public class TracingContext implements AbstractTracerContext { * as the operation name could be overrided. */ profilingRecheck(parentSpan, operationName); - entrySpan = (AbstractTracingSpan) DictionaryManager.findEndpointSection() - .findOnly(segment.getServiceId(), operationName) - .doInCondition( - parentSpan::setOperationId, () -> parentSpan - .setOperationName(operationName)); + parentSpan.setOperationName(operationName); + entrySpan = parentSpan; return entrySpan.start(); } else { - entrySpan = (AbstractTracingSpan) DictionaryManager.findEndpointSection() - .findOnly(segment.getServiceId(), operationName) - .doInCondition( - operationId -> new EntrySpan(spanIdGenerator++, - parentSpanId, - operationId, owner - ), () -> { - return new EntrySpan( - spanIdGenerator++, parentSpanId, - operationName, owner - ); - }); + entrySpan = new EntrySpan( + spanIdGenerator++, parentSpanId, + operationName, owner + ); entrySpan.start(); return push(entrySpan); } diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/AbstractSpan.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/AbstractSpan.java index 75946d3aa29055002e86fa27ed126b411e9ee674..01bb44257d04f07ed9e373cd9b14db17de6b9456 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/AbstractSpan.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/AbstractSpan.java @@ -110,12 +110,8 @@ public interface AbstractSpan extends AsyncSpan { */ int getSpanId(); - int getOperationId(); - String getOperationName(); - AbstractSpan setOperationId(int operationId); - /** * Reference other trace segment. * diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/AbstractTracingSpan.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/AbstractTracingSpan.java index 001f9343434d971e7990c1a865eab7099a17ae89..de593def63b5d64de6ac966820d89c7070baa51f 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/AbstractTracingSpan.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/AbstractTracingSpan.java @@ -43,7 +43,6 @@ public abstract class AbstractTracingSpan implements AbstractSpan { protected int parentSpanId; protected List tags; protected String operationName; - protected int operationId; protected SpanLayer layer; /** * The span has been tagged in async mode, required async stop to finish. @@ -90,15 +89,6 @@ public abstract class AbstractTracingSpan implements AbstractSpan { protected AbstractTracingSpan(int spanId, int parentSpanId, String operationName, TracingContext owner) { this.operationName = operationName; - this.operationId = DictionaryUtil.nullValue(); - this.spanId = spanId; - this.parentSpanId = parentSpanId; - this.owner = owner; - } - - protected AbstractTracingSpan(int spanId, int parentSpanId, int operationId, TracingContext owner) { - this.operationName = null; - this.operationId = operationId; this.spanId = spanId; this.parentSpanId = parentSpanId; this.owner = owner; @@ -167,7 +157,10 @@ public abstract class AbstractTracingSpan implements AbstractSpan { logs.add(new LogDataEntity.Builder().add(new KeyValuePair("event", "error")) .add(new KeyValuePair("error.kind", t.getClass().getName())) .add(new KeyValuePair("message", t.getMessage())) - .add(new KeyValuePair("stack", ThrowableTransformer.INSTANCE.convert2String(t, 4000))) + .add(new KeyValuePair( + "stack", + ThrowableTransformer.INSTANCE.convert2String(t, 4000) + )) .build(System.currentTimeMillis())); return this; } @@ -211,19 +204,6 @@ public abstract class AbstractTracingSpan implements AbstractSpan { @Override public AbstractTracingSpan setOperationName(String operationName) { this.operationName = operationName; - this.operationId = DictionaryUtil.nullValue(); - return this; - } - - /** - * Set the operation id, which compress by the name. - * - * @return span instance, for chaining. - */ - @Override - public AbstractTracingSpan setOperationId(int operationId) { - this.operationId = operationId; - this.operationName = null; return this; } @@ -232,11 +212,6 @@ public abstract class AbstractTracingSpan implements AbstractSpan { return spanId; } - @Override - public int getOperationId() { - return operationId; - } - @Override public String getOperationName() { return operationName; @@ -283,11 +258,7 @@ public abstract class AbstractTracingSpan implements AbstractSpan { spanBuilder.setParentSpanId(parentSpanId); spanBuilder.setStartTime(startTime); spanBuilder.setEndTime(endTime); - if (operationId != DictionaryUtil.nullValue()) { - spanBuilder.setOperationNameId(operationId); - } else { - spanBuilder.setOperationName(operationName); - } + spanBuilder.setOperationName(operationName); if (isEntry()) { spanBuilder.setSpanType(SpanType.Entry); } else if (isExit()) { diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/EntrySpan.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/EntrySpan.java index 70d0f42837ea89944df1e1dd9f1671eb0a4e3c4b..37ad142761c5246df1e895407df1aac440039dea 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/EntrySpan.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/EntrySpan.java @@ -41,11 +41,6 @@ public class EntrySpan extends StackBasedTracingSpan { this.currentMaxDepth = 0; } - public EntrySpan(int spanId, int parentSpanId, int operationId, TracingContext owner) { - super(spanId, parentSpanId, operationId, owner); - this.currentMaxDepth = 0; - } - /** * Set the {@link #startTime}, when the first start, which means the first service provided. */ @@ -102,15 +97,6 @@ public class EntrySpan extends StackBasedTracingSpan { } } - @Override - public AbstractTracingSpan setOperationId(int operationId) { - if (stackDepth == currentMaxDepth) { - return super.setOperationId(operationId); - } else { - return this; - } - } - @Override public EntrySpan log(Throwable t) { super.log(t); diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/ExitSpan.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/ExitSpan.java index 345163fde143f779d933976302f7268ca3d0b2ef..d872a0673544e0e24436784b59408df1cdced752 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/ExitSpan.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/ExitSpan.java @@ -118,14 +118,6 @@ public class ExitSpan extends StackBasedTracingSpan implements ExitTypeSpan { } } - /** - * Illegal operation. Operation name id is the registered endpoint, only work for entry span. - */ - @Override - public AbstractTracingSpan setOperationId(int operationId) { - throw new UnsupportedOperationException("Exit span doesn't support operation id"); - } - @Override public int getPeerId() { return peerId; diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/LocalSpan.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/LocalSpan.java index 91bc47f3499b7129b6300c67c18cec7441421957..7bd6cbfc24ef6b87fe3797369cd9f66094860959 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/LocalSpan.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/LocalSpan.java @@ -25,10 +25,6 @@ import org.apache.skywalking.apm.agent.core.context.TracingContext; */ public class LocalSpan extends AbstractTracingSpan { - public LocalSpan(int spanId, int parentSpanId, int operationId, TracingContext owner) { - super(spanId, parentSpanId, operationId, owner); - } - public LocalSpan(int spanId, int parentSpanId, String operationName, TracingContext owner) { super(spanId, parentSpanId, operationName, owner); } @@ -47,12 +43,4 @@ public class LocalSpan extends AbstractTracingSpan { public AbstractSpan setPeer(String remotePeer) { return this; } - - /** - * Illegal operation. Operation name id is the registered endpoint, only work for entry span. - */ - @Override - public AbstractTracingSpan setOperationId(int operationId) { - throw new UnsupportedOperationException("Exit span doesn't support operation id"); - } } diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/NoopSpan.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/NoopSpan.java index 234af2d721b48a8e75be366cb4e941f90eda9914..422b5d85ac820ec2cc8c8bd02c77bf684974eb13 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/NoopSpan.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/NoopSpan.java @@ -100,21 +100,11 @@ public class NoopSpan implements AbstractSpan { return 0; } - @Override - public int getOperationId() { - return 0; - } - @Override public String getOperationName() { return ""; } - @Override - public AbstractSpan setOperationId(int operationId) { - return this; - } - @Override public void ref(TraceSegmentRef ref) { } diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/StackBasedTracingSpan.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/StackBasedTracingSpan.java index d6ba150c633a4864502dbc45c93f3225eb3936a0..55a0c779a1cd9f149c345df190055c934a0dd18a 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/StackBasedTracingSpan.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/StackBasedTracingSpan.java @@ -40,25 +40,6 @@ public abstract class StackBasedTracingSpan extends AbstractTracingSpan { this.peerId = DictionaryUtil.nullValue(); } - protected StackBasedTracingSpan(int spanId, int parentSpanId, int operationId, TracingContext owner) { - super(spanId, parentSpanId, operationId, owner); - this.stackDepth = 0; - this.peer = null; - this.peerId = DictionaryUtil.nullValue(); - } - - public StackBasedTracingSpan(int spanId, int parentSpanId, int operationId, int peerId, TracingContext owner) { - super(spanId, parentSpanId, operationId, owner); - this.peer = null; - this.peerId = peerId; - } - - public StackBasedTracingSpan(int spanId, int parentSpanId, int operationId, String peer, TracingContext owner) { - super(spanId, parentSpanId, operationId, owner); - this.peer = peer; - this.peerId = DictionaryUtil.nullValue(); - } - protected StackBasedTracingSpan(int spanId, int parentSpanId, String operationName, String peer, TracingContext owner) { super(spanId, parentSpanId, operationName, owner); @@ -89,17 +70,6 @@ public abstract class StackBasedTracingSpan extends AbstractTracingSpan { @Override public boolean finish(TraceSegment owner) { if (--stackDepth == 0) { - /* - * Since 6.6.0, only entry span requires the op name register, which is endpoint. - */ - if (this.isEntry()) { - if (this.operationId == DictionaryUtil.nullValue()) { - this.operationId = - (Integer) DictionaryManager.findEndpointSection() - .findOrPrepare4Register(owner.getServiceId(), operationName) - .doInCondition(value -> value, DictionaryUtil::nullValue); - } - } return super.finish(owner); } else { return false; diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/TraceSegmentRef.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/TraceSegmentRef.java index cf4082ed03f94a618ff48b91dba26f74c37284c7..384d79337c1656fc256d85b25995c33f6a33962e 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/TraceSegmentRef.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/trace/TraceSegmentRef.java @@ -18,6 +18,7 @@ package org.apache.skywalking.apm.agent.core.context.trace; +import org.apache.skywalking.apm.agent.core.conf.Constants; import org.apache.skywalking.apm.agent.core.conf.RemoteDownstreamConfig; import org.apache.skywalking.apm.agent.core.context.ContextCarrier; import org.apache.skywalking.apm.agent.core.context.ContextSnapshot; @@ -47,13 +48,9 @@ public class TraceSegmentRef { private int parentServiceInstanceId; - private String entryEndpointName; + private String entryEndpointName = Constants.EMPTY_STRING; - private int entryEndpointId = DictionaryUtil.nullValue(); - - private String parentEndpointName; - - private int parentEndpointId = DictionaryUtil.nullValue(); + private String parentEndpointName = Constants.EMPTY_STRING; /** * Transform a {@link ContextCarrier} to the TraceSegmentRef @@ -76,16 +73,12 @@ public class TraceSegmentRef { if (!StringUtil.isEmpty(entryOperationName)) { if (entryOperationName.charAt(0) == '#') { this.entryEndpointName = entryOperationName.substring(1); - } else { - this.entryEndpointId = Integer.parseInt(entryOperationName); } } String parentOperationName = carrier.getParentEndpointName(); if (!StringUtil.isEmpty(parentOperationName)) { if (parentOperationName.charAt(0) == '#') { this.parentEndpointName = parentOperationName.substring(1); - } else { - this.parentEndpointId = Integer.parseInt(parentOperationName); } } } @@ -100,16 +93,12 @@ public class TraceSegmentRef { if (!StringUtil.isEmpty(entryOperationName)) { if (entryOperationName.charAt(0) == '#') { this.entryEndpointName = entryOperationName.substring(1); - } else { - this.entryEndpointId = Integer.parseInt(entryOperationName); } } String parentOperationName = snapshot.getParentOperationName(); if (!StringUtil.isEmpty(parentOperationName)) { if (parentOperationName.charAt(0) == '#') { this.parentEndpointName = parentOperationName.substring(1); - } else { - this.parentEndpointId = Integer.parseInt(parentOperationName); } } } @@ -118,10 +107,6 @@ public class TraceSegmentRef { return entryEndpointName; } - public int getEntryEndpointId() { - return entryEndpointId; - } - public int getEntryServiceInstanceId() { return entryServiceInstanceId; } @@ -143,25 +128,9 @@ public class TraceSegmentRef { refBuilder.setEntryServiceInstanceId(entryServiceInstanceId); refBuilder.setParentTraceSegmentId(traceSegmentId.transform()); refBuilder.setParentSpanId(spanId); - /* - * entryEndpointId/entryEndpointName and parentEndpointId/parentEndpointName could be empty at same time. - * This is accepted in v2 format. - * - */ - if (entryEndpointId == DictionaryUtil.nullValue()) { - if (!StringUtil.isEmpty(entryEndpointName)) { - refBuilder.setEntryEndpoint(entryEndpointName); - } - } else { - refBuilder.setEntryEndpointId(entryEndpointId); - } - if (parentEndpointId == DictionaryUtil.nullValue()) { - if (!StringUtil.isEmpty(parentEndpointName)) { - refBuilder.setParentEndpoint(parentEndpointName); - } - } else { - refBuilder.setParentEndpointId(parentEndpointId); - } + refBuilder.setEntryEndpoint(entryEndpointName); + refBuilder.setParentEndpoint(parentEndpointName); + return refBuilder.build(); } diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/DictionaryManager.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/DictionaryManager.java index b0fc1ab90a4057d7e8c05dd0f9c04b45d46235ba..53841044938c17664d03e7dc3915a7b9da39b260 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/DictionaryManager.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/DictionaryManager.java @@ -25,11 +25,4 @@ public class DictionaryManager { public static NetworkAddressDictionary findNetworkAddressSection() { return NetworkAddressDictionary.INSTANCE; } - - /** - * @return {@link EndpointNameDictionary} to find service id. - */ - public static EndpointNameDictionary findEndpointSection() { - return EndpointNameDictionary.INSTANCE; - } } diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/DictionaryUtil.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/DictionaryUtil.java index bf184b86d1dc4f5943a73ed9254a38e54d581c62..d02356528d562191f8678ab23fbb02992097d434 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/DictionaryUtil.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/DictionaryUtil.java @@ -26,11 +26,4 @@ public class DictionaryUtil { public static boolean isNull(int id) { return id == nullValue(); } - - /** - * @return -1 represent the object doesn't exist. - */ - public static int inexistence() { - return -1; - } } diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/EndpointNameDictionary.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/EndpointNameDictionary.java deleted file mode 100755 index 721fb09b7e5c2f5f245511d9d1643c6288eb95e0..0000000000000000000000000000000000000000 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/dictionary/EndpointNameDictionary.java +++ /dev/null @@ -1,123 +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 org.apache.skywalking.apm.agent.core.dictionary; - -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.ToString; -import org.apache.skywalking.apm.network.common.DetectPoint; -import org.apache.skywalking.apm.network.register.v2.Endpoint; -import org.apache.skywalking.apm.network.register.v2.EndpointMapping; -import org.apache.skywalking.apm.network.register.v2.EndpointMappingElement; -import org.apache.skywalking.apm.network.register.v2.Endpoints; -import org.apache.skywalking.apm.network.register.v2.RegisterGrpc; - -import static org.apache.skywalking.apm.agent.core.conf.Config.Dictionary.ENDPOINT_NAME_BUFFER_SIZE; - -public enum EndpointNameDictionary { - INSTANCE; - - private Map endpointDictionary = new ConcurrentHashMap<>(); - private Set unRegisterEndpoints = ConcurrentHashMap.newKeySet(); - - public PossibleFound findOrPrepare4Register(int serviceId, String endpointName) { - return find0(serviceId, endpointName, true); - } - - public PossibleFound findOnly(int serviceId, String endpointName) { - return find0(serviceId, endpointName, false); - } - - private PossibleFound find0(int serviceId, String endpointName, boolean registerWhenNotFound) { - if (endpointName == null || endpointName.length() == 0) { - return new NotFound(); - } - OperationNameKey key = new OperationNameKey(serviceId, endpointName); - Integer operationId = endpointDictionary.get(key); - if (operationId != null) { - return new Found(operationId); - } else { - if (registerWhenNotFound && endpointDictionary.size() + unRegisterEndpoints.size() < ENDPOINT_NAME_BUFFER_SIZE) { - unRegisterEndpoints.add(key); - } - return new NotFound(); - } - } - - public void syncRemoteDictionary(RegisterGrpc.RegisterBlockingStub serviceNameDiscoveryServiceBlockingStub) { - if (unRegisterEndpoints.size() > 0) { - Endpoints.Builder builder = Endpoints.newBuilder(); - for (OperationNameKey operationNameKey : unRegisterEndpoints) { - Endpoint endpoint = Endpoint.newBuilder() - .setServiceId(operationNameKey.getServiceId()) - .setEndpointName(operationNameKey.getEndpointName()) - .setFrom(DetectPoint.server) - .build(); - builder.addEndpoints(endpoint); - } - EndpointMapping serviceNameMappingCollection = serviceNameDiscoveryServiceBlockingStub.doEndpointRegister(builder - .build()); - if (serviceNameMappingCollection.getElementsCount() > 0) { - for (EndpointMappingElement element : serviceNameMappingCollection.getElementsList()) { - OperationNameKey key = new OperationNameKey(element.getServiceId(), element.getEndpointName()); - unRegisterEndpoints.remove(key); - endpointDictionary.put(key, element.getEndpointId()); - } - } - } - } - - public void clear() { - endpointDictionary.clear(); - } - - @Getter - @ToString - @RequiredArgsConstructor - private static class OperationNameKey { - private final int serviceId; - private final String endpointName; - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - OperationNameKey key = (OperationNameKey) o; - - boolean isServiceEndpointMatch = false; - if (serviceId == key.serviceId && endpointName.equals(key.endpointName)) { - isServiceEndpointMatch = true; - } - return isServiceEndpointMatch; - } - - @Override - public int hashCode() { - int result = serviceId; - result = 31 * result + endpointName.hashCode(); - return result; - } - } -} diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/ServiceAndEndpointRegisterClient.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/ServiceRegisterClient.java similarity index 92% rename from apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/ServiceAndEndpointRegisterClient.java rename to apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/ServiceRegisterClient.java index 6307c3b8aeefa6be4a4c2167f1ff232e29e2afdc..3af141dafb9a0cc469592323907ab03b6b3adc42 100755 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/ServiceAndEndpointRegisterClient.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/ServiceRegisterClient.java @@ -33,7 +33,6 @@ import org.apache.skywalking.apm.agent.core.commands.CommandService; import org.apache.skywalking.apm.agent.core.conf.Config; import org.apache.skywalking.apm.agent.core.conf.RemoteDownstreamConfig; import org.apache.skywalking.apm.agent.core.dictionary.DictionaryUtil; -import org.apache.skywalking.apm.agent.core.dictionary.EndpointNameDictionary; import org.apache.skywalking.apm.agent.core.dictionary.NetworkAddressDictionary; import org.apache.skywalking.apm.agent.core.logging.api.ILog; import org.apache.skywalking.apm.agent.core.logging.api.LogManager; @@ -57,15 +56,15 @@ import org.apache.skywalking.apm.util.StringUtil; import static org.apache.skywalking.apm.agent.core.conf.Config.Collector.GRPC_UPSTREAM_TIMEOUT; @DefaultImplementor -public class ServiceAndEndpointRegisterClient implements BootService, Runnable, GRPCChannelListener { - private static final ILog logger = LogManager.getLogger(ServiceAndEndpointRegisterClient.class); +public class ServiceRegisterClient implements BootService, Runnable, GRPCChannelListener { + private static final ILog logger = LogManager.getLogger(ServiceRegisterClient.class); private static String INSTANCE_UUID; private static List SERVICE_INSTANCE_PROPERTIES; private volatile GRPCChannelStatus status = GRPCChannelStatus.DISCONNECT; private volatile RegisterGrpc.RegisterBlockingStub registerBlockingStub; private volatile ServiceInstancePingGrpc.ServiceInstancePingBlockingStub serviceInstancePingStub; - private volatile ScheduledFuture applicationRegisterFuture; + private volatile ScheduledFuture serviceRegisterFuture; private volatile long coolDownStartTime = -1; @Override @@ -101,8 +100,8 @@ public class ServiceAndEndpointRegisterClient implements BootService, Runnable, @Override public void boot() { - applicationRegisterFuture = Executors.newSingleThreadScheduledExecutor( - new DefaultNamedThreadFactory("ServiceAndEndpointRegisterClient") + serviceRegisterFuture = Executors.newSingleThreadScheduledExecutor( + new DefaultNamedThreadFactory("ServiceRegisterClient") ).scheduleAtFixedRate( new RunnableWithExceptionProtection( this, @@ -118,12 +117,12 @@ public class ServiceAndEndpointRegisterClient implements BootService, Runnable, @Override public void shutdown() { - applicationRegisterFuture.cancel(true); + serviceRegisterFuture.cancel(true); } @Override public void run() { - logger.debug("ServiceAndEndpointRegisterClient running, status:{}.", status); + logger.debug("ServiceRegisterClient running, status:{}.", status); if (coolDownStartTime > 0) { final long coolDownDurationInMillis = TimeUnit.MINUTES.toMillis(Config.Agent.COOL_DOWN_THRESHOLD); @@ -201,14 +200,12 @@ public class ServiceAndEndpointRegisterClient implements BootService, Runnable, NetworkAddressDictionary.INSTANCE.syncRemoteDictionary( registerBlockingStub.withDeadlineAfter(GRPC_UPSTREAM_TIMEOUT, TimeUnit.SECONDS)); - EndpointNameDictionary.INSTANCE.syncRemoteDictionary( - registerBlockingStub.withDeadlineAfter(GRPC_UPSTREAM_TIMEOUT, TimeUnit.SECONDS)); ServiceManager.INSTANCE.findService(CommandService.class).receiveCommand(commands); } } } } catch (Throwable t) { - logger.error(t, "ServiceAndEndpointRegisterClient execute fail."); + logger.error(t, "ServiceRegisterClient execute fail."); ServiceManager.INSTANCE.findService(GRPCChannelManager.class).reportError(t); } } diff --git a/apm-sniffer/apm-agent-core/src/main/resources/META-INF/services/org.apache.skywalking.apm.agent.core.boot.BootService b/apm-sniffer/apm-agent-core/src/main/resources/META-INF/services/org.apache.skywalking.apm.agent.core.boot.BootService index 392600c769f7fe99bd181a03bc2668a79af94989..d21536b5f1825930b2ac5fdc3076ea231421b0d2 100644 --- a/apm-sniffer/apm-agent-core/src/main/resources/META-INF/services/org.apache.skywalking.apm.agent.core.boot.BootService +++ b/apm-sniffer/apm-agent-core/src/main/resources/META-INF/services/org.apache.skywalking.apm.agent.core.boot.BootService @@ -21,7 +21,7 @@ org.apache.skywalking.apm.agent.core.context.ContextManager org.apache.skywalking.apm.agent.core.sampling.SamplingService org.apache.skywalking.apm.agent.core.remote.GRPCChannelManager org.apache.skywalking.apm.agent.core.jvm.JVMService -org.apache.skywalking.apm.agent.core.remote.ServiceAndEndpointRegisterClient +org.apache.skywalking.apm.agent.core.remote.ServiceRegisterClient org.apache.skywalking.apm.agent.core.context.ContextManagerExtendService org.apache.skywalking.apm.agent.core.commands.CommandService org.apache.skywalking.apm.agent.core.commands.CommandExecutorService diff --git a/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/context/ContextCarrierV2HeaderTest.java b/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/context/ContextCarrierV2HeaderTest.java index 8bd53df8a335c9199299695a0e16b413129b3962..19c9494d55bf91ba45827016f900bf4e38cf38d7 100644 --- a/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/context/ContextCarrierV2HeaderTest.java +++ b/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/context/ContextCarrierV2HeaderTest.java @@ -59,7 +59,7 @@ public class ContextCarrierV2HeaderTest { contextCarrier.setParentServiceInstanceId(1); contextCarrier.setPeerHost("127.0.0.1:8080"); contextCarrier.setEntryEndpointName("/portal"); - contextCarrier.setParentEndpointId(123); + contextCarrier.setParentEndpointName("/app"); contextCarrier.getCorrelationContext().put("test", "true"); @@ -72,7 +72,7 @@ public class ContextCarrierV2HeaderTest { * "1-3.4.5-1.2.3-4-1-1-#127.0.0.1:8080-#/portal-123" */ if (next.getHeadKey().equals(SW6CarrierItem.HEADER_NAME)) { - Assert.assertEquals("1-My40LjU=-MS4yLjM=-4-1-1-IzEyNy4wLjAuMTo4MDgw-Iy9wb3J0YWw=-MTIz", next.getHeadValue()); + Assert.assertEquals("1-My40LjU=-MS4yLjM=-4-1-1-IzEyNy4wLjAuMTo4MDgw-Iy9wb3J0YWw=-Iy9hcHA=", next.getHeadValue()); } else if (next.getHeadKey().equals(SW7CorrelationCarrierItem.HEADER_NAME)) { /** * customKey:customValue @@ -89,7 +89,7 @@ public class ContextCarrierV2HeaderTest { while (next.hasNext()) { next = next.next(); if (next.getHeadKey().equals(SW6CarrierItem.HEADER_NAME)) { - Assert.assertEquals("1-My40LjU=-MS4yLjM=-4-1-1-IzEyNy4wLjAuMTo4MDgw-Iy9wb3J0YWw=-MTIz", next.getHeadValue()); + Assert.assertEquals("1-My40LjU=-MS4yLjM=-4-1-1-IzEyNy4wLjAuMTo4MDgw-Iy9wb3J0YWw=-Iy9hcHA=", next.getHeadValue()); } else if (next.getHeadKey().equals(SW7CorrelationCarrierItem.HEADER_NAME)) { Assert.assertEquals("dGVzdA==:dHJ1ZQ==", next.getHeadValue()); } else { @@ -113,7 +113,7 @@ public class ContextCarrierV2HeaderTest { contextCarrier.setParentServiceInstanceId(1); contextCarrier.setPeerHost("127.0.0.1:8080"); contextCarrier.setEntryEndpointName("/portal"); - contextCarrier.setParentEndpointId(123); + contextCarrier.setParentEndpointName("/app"); contextCarrier.getCorrelationContext().put("test", "true"); diff --git a/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/context/ContextManagerTest.java b/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/context/ContextManagerTest.java index fc010ff425fabceaa2cb3f895b9dd0627d2653d5..f1d90069fc7c3e09b83bb54dffeaa84a42840307 100644 --- a/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/context/ContextManagerTest.java +++ b/apm-sniffer/apm-agent-core/src/test/java/org/apache/skywalking/apm/agent/core/context/ContextManagerTest.java @@ -141,7 +141,6 @@ public class ContextManagerTest { TraceSegmentRef ref = actualSegment.getRefs().get(0); MatcherAssert.assertThat(TraceSegmentRefHelper.getPeerHost(ref), is("127.0.0.1:8080")); assertThat(ref.getEntryEndpointName(), is("/portal/")); - assertThat(ref.getEntryEndpointId(), is(0)); List spanList = SegmentHelper.getSpan(actualSegment); assertThat(spanList.size(), is(2)); diff --git a/docs/en/guides/Plugin-test.md b/docs/en/guides/Plugin-test.md index a739ebd0f1c11862e70bfc6cd503cfc8fe7405c2..168e35527391cfc36ceb4f9e77c485919c9dd54b 100644 --- a/docs/en/guides/Plugin-test.md +++ b/docs/en/guides/Plugin-test.md @@ -221,7 +221,6 @@ registryItems: - { SERVICE_CODE: INSTANCE_COUNT(int) } ... operationNames: - - SERVICE_CODE: [ ENTRY_SPAN_OPERATION(string), ... ] ... ``` @@ -230,7 +229,7 @@ registryItems: | --- | --- | services | The registered service codes. Normally, not 0 should be enough. | instances | The number of service instances exists in this test case. -| operationNames | Operation names of entry spans. Since 6.6.0, only these span name would do register, due to they are real endpoints. +| operationNames | Since 7.1.0, there is no operation name register. Ignore this. **Segment verify description format** diff --git a/docs/en/protocols/README.md b/docs/en/protocols/README.md index d1f5bb4e63ddbc277bf1d39f343d97a83808a506..7ce29d26540505a4a2e0bab3212e821cd6b4c2cc 100644 --- a/docs/en/protocols/README.md +++ b/docs/en/protocols/README.md @@ -16,7 +16,8 @@ Service, Service Instance, Network address and Endpoint could do register to get ### Language based native agent protocol There is two types of protocols to make language agents work in distributed environments. -1. **Cross Process Propagation Headers Protocol** is in wire data format, agent/SDK usually uses HTTP/MQ/HTTP2 headers +1. **Cross Process Propagation Headers Protocol** and **Cross Process Correlation Headers Protocol** are in wire data format, +agent/SDK usually uses HTTP/MQ/HTTP2 headers to carry the data with rpc request. The remote agent will receive this in the request handler, and bind the context with this specific request. 1. **Trace Data Protocol** is out of wire data, agent/SDK uses this to send traces and metrics to skywalking or other @@ -25,10 +26,14 @@ compatible backend. [Cross Process Propagation Headers Protocol v2](Skywalking-Cross-Process-Propagation-Headers-Protocol-v2.md) is the new protocol for in-wire context propagation, started in 6.0.0-beta release, v1 is no longer supported. -Since SkyWalking v6.0.0-beta, SkyWalking agent and backend are using Trace Data Protocol v2. -[SkyWalking Trace Data Protocol v2](Trace-Data-Protocol-v2.md) defines the communication way and format between agent and backend. +[Cross Process Correlation Headers Protocol v1](Skywalking-Cross-Process-Correlation-Headers-Protocol-v1.md) is a new in-wire context propagation additional and optional protocols. +Please read SkyWalking language agents documentations to see whether it is supported. +This protocol defines the data format of transporting custom data with `Cross Process Propagation Headers Protocol v2`. +SkyWalking javaagent begins to support this since 7.1.0. + +Since SkyWalking v7.1.0, SkyWalking agent and backend are using Trace Data Protocol v2.1. +[SkyWalking Trace Data Protocol v2.1](Trace-Data-Protocol-v2.md) defines the communication way and format between agent and backend. -* [Cross Process Correlation Headers Protocol v1](Skywalking-Cross-Process-Correlation-Headers-Protocol-v1.md) is a new in-wire context propagation additional and optional protocols. Please read SkyWalking language agents documentations to see whether it is supported. This protocol defines the data format of transporting custom data with `Cross Process Propagation Headers Protocol v2`. SkyWalking javaagent begins to support this since 7.1.0. ### Service Mesh probe protocol The probe in sidecar or proxy could use this protocol to send data to backendEnd. This service provided by gRPC, requires diff --git a/docs/en/protocols/Skywalking-Cross-Process-Propagation-Headers-Protocol-v2.md b/docs/en/protocols/Skywalking-Cross-Process-Propagation-Headers-Protocol-v2.md index de40c4ce9367ff3bab0445345c0fb3a2fd07adf4..e7824318135a8a5c94c4252002c6b30ebfc21c30 100644 --- a/docs/en/protocols/Skywalking-Cross-Process-Propagation-Headers-Protocol-v2.md +++ b/docs/en/protocols/Skywalking-Cross-Process-Propagation-Headers-Protocol-v2.md @@ -1,5 +1,5 @@ # SkyWalking Cross Process Propagation Headers Protocol -* Version 2.0 +* Version 2.1 SkyWalking is more likely an APM system, rather than common distributed tracing system. The Headers is much more complex than them in order to improving analysis performance of collector. @@ -8,12 +8,6 @@ You can find many similar mechanism in other commercial APM system. (Some are ev ## Abstract SkyWalking Cross Process Propagation Headers Protocol v2 is also named as sw6 protocol, which is for context propagation. -## Differences from v1 -The major differences of v2 and v1, comes from SkyWalking's evolution, including -1. Mesh and languages are not same always, some info in headers should be optional. -1. BASE64 encoding required. -1. Sampling flag is included. - ## Header Item * Header Name: `sw6` * Header Value: Split by `-`, the parts are following. The length of header value should be less than 2k(default). @@ -36,13 +30,19 @@ service. _This value can use exchange/compress collector service to get the id(i - Optional(s) Optional values could not exist if the agent/SDK haven't those info or the length of header is over the threshold(2k default). -1. Entry endpoint of the trace. **String(BASE64 encoded)**. -_This value can use exchange/compress collector service to get the id(integer) to represent the string. If you use the string, it must start with `#`, others use integer directly._ -1. Parent endpoint of the parent service. **String(BASE64 encoded)**. -_This value can use exchange/compress collector service to get the id(integer) to represent the string. If you use the string, it must start with `#`, others use integer directly._ - -endpoint id = -1 and parent endpoint name is empty mean there is no real parent endpoint. Since 6.6.0 +1. Entry endpoint of the trace. Add `#` as the prefix. **String(BASE64 encoded)**. +1. Parent endpoint of the parent service. Add `#` as the prefix. **String(BASE64 encoded)**. ## Sample values 1. Short version, `1-TRACEID-SEGMENTID-3-5-2-IPPORT` 1. Complete version, `1-TRACEID-SEGMENTID-3-5-2-IPPORT-ENTRYURI-PARENTURI` + +## Differences from v2 +The entry and parent endpoints in the header doesn't support ID format. Always use the literal string. +[SkyWalking v2](https://github.com/apache/skywalking/blob/v7.0.0/docs/en/protocols/Trace-Data-Protocol-v2.md) + +## Differences from v1 +The major differences of v2 and v1, comes from SkyWalking's evolution, including +1. Mesh and languages are not same always, some info in headers should be optional. +1. BASE64 encoding required. +1. Sampling flag is included. diff --git a/docs/en/setup/backend/backend-alarm.md b/docs/en/setup/backend/backend-alarm.md index c1080d88de170202b1f833e14c8d60d844e6134e..b812036207f902a0aba034b7e4201eb8263fc57a 100644 --- a/docs/en/setup/backend/backend-alarm.md +++ b/docs/en/setup/backend/backend-alarm.md @@ -97,8 +97,8 @@ Example as following "scopeId": 1, "scope": "SERVICE", "name": "serviceA", - "id0": 12, - "id1": 0, + "id0": "12", + "id1": "", "ruleName": "service_resp_time_rule", "alarmMessage": "alarmMessage xxxx", "startTime": 1560524171000 @@ -106,8 +106,8 @@ Example as following "scopeId": 1, "scope": "SERVICE", "name": "serviceB", - "id0": 23, - "id1": 0, + "id0": "23", + "id1": "", "ruleName": "service_resp_time_rule", "alarmMessage": "alarmMessage yyy", "startTime": 1560524171000 @@ -124,8 +124,8 @@ message AlarmMessage { int64 scopeId = 1; string scope = 2; string name = 3; - int64 id0 = 4; - int64 id1 = 5; + string id0 = 4; + string id1 = 5; string ruleName = 6; string alarmMessage = 7; int64 startTime = 8; diff --git a/oap-server/exporter/src/main/java/org/apache/skywalking/oap/server/exporter/provider/MetricFormatter.java b/oap-server/exporter/src/main/java/org/apache/skywalking/oap/server/exporter/provider/MetricFormatter.java index 1060a7a122c55ea5d59ebee9aba6b8fd4934a86d..138240166f172764ade4ca39f7f28ea2349e90b7 100644 --- a/oap-server/exporter/src/main/java/org/apache/skywalking/oap/server/exporter/provider/MetricFormatter.java +++ b/oap-server/exporter/src/main/java/org/apache/skywalking/oap/server/exporter/provider/MetricFormatter.java @@ -19,8 +19,8 @@ package org.apache.skywalking.oap.server.exporter.provider; import lombok.Setter; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.analysis.metrics.MetricsMetaInfo; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInstanceInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; import org.apache.skywalking.oap.server.core.source.DefaultScopeDefine; @@ -29,7 +29,6 @@ import org.apache.skywalking.oap.server.core.source.DefaultScopeDefine; public class MetricFormatter { private ServiceInventoryCache serviceInventoryCache; private ServiceInstanceInventoryCache serviceInstanceInventoryCache; - private EndpointInventoryCache endpointInventoryCache; protected String getEntityName(MetricsMetaInfo meta) { int scope = meta.getScope(); @@ -40,8 +39,7 @@ public class MetricFormatter { int entityId = Integer.valueOf(meta.getId()); return serviceInstanceInventoryCache.get(entityId).getName(); } else if (DefaultScopeDefine.inEndpointCatalog(scope)) { - int entityId = Integer.valueOf(meta.getId()); - return endpointInventoryCache.get(entityId).getName(); + return EndpointTraffic.splitID(meta.getId()).getEndpointName(); } else if (scope == DefaultScopeDefine.ALL) { return ""; } else { diff --git a/oap-server/exporter/src/main/java/org/apache/skywalking/oap/server/exporter/provider/grpc/GRPCExporterProvider.java b/oap-server/exporter/src/main/java/org/apache/skywalking/oap/server/exporter/provider/grpc/GRPCExporterProvider.java index b7875ee39d14a50902e04361bc9e7b2b8e295a58..bb74d1f47415011ee5091913ae8d27499dae73ea 100644 --- a/oap-server/exporter/src/main/java/org/apache/skywalking/oap/server/exporter/provider/grpc/GRPCExporterProvider.java +++ b/oap-server/exporter/src/main/java/org/apache/skywalking/oap/server/exporter/provider/grpc/GRPCExporterProvider.java @@ -19,7 +19,6 @@ package org.apache.skywalking.oap.server.exporter.provider.grpc; import org.apache.skywalking.oap.server.core.CoreModule; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInstanceInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; import org.apache.skywalking.oap.server.core.exporter.ExporterModule; @@ -67,7 +66,6 @@ public class GRPCExporterProvider extends ModuleProvider { ModuleServiceHolder serviceHolder = getManager().find(CoreModule.NAME).provider(); exporter.setServiceInventoryCache(serviceHolder.getService(ServiceInventoryCache.class)); exporter.setServiceInstanceInventoryCache(serviceHolder.getService(ServiceInstanceInventoryCache.class)); - exporter.setEndpointInventoryCache(serviceHolder.getService(EndpointInventoryCache.class)); exporter.initSubscriptionList(); } diff --git a/oap-server/exporter/src/test/java/org/apache/skywalking/oap/server/exporter/provider/grpc/GRPCExporterProviderTest.java b/oap-server/exporter/src/test/java/org/apache/skywalking/oap/server/exporter/provider/grpc/GRPCExporterProviderTest.java index 6590728e94f0c2b576eb887b056cbde882c836b8..d809c24576b33d15fbeede72bee8cce66e32439d 100644 --- a/oap-server/exporter/src/test/java/org/apache/skywalking/oap/server/exporter/provider/grpc/GRPCExporterProviderTest.java +++ b/oap-server/exporter/src/test/java/org/apache/skywalking/oap/server/exporter/provider/grpc/GRPCExporterProviderTest.java @@ -21,7 +21,6 @@ package org.apache.skywalking.oap.server.exporter.provider.grpc; import java.util.Iterator; import java.util.ServiceLoader; import org.apache.skywalking.oap.server.core.CoreModule; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInstanceInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; import org.apache.skywalking.oap.server.core.exporter.ExporterModule; @@ -97,7 +96,6 @@ public class GRPCExporterProviderTest { when(serviceHolder.getService(ServiceInventoryCache.class)).thenReturn(null); when(serviceHolder.getService(ServiceInstanceInventoryCache.class)).thenReturn(null); - when(serviceHolder.getService(EndpointInventoryCache.class)).thenReturn(null); doNothing().when(exporter).initSubscriptionList(); diff --git a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/NotifyHandler.java b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/NotifyHandler.java index 2b4b547fa64b6e96744b4eda5531bbeb0f9c37e0..54f3e410060780cd9d7b220b24cdeb4a956ee96b 100644 --- a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/NotifyHandler.java +++ b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/NotifyHandler.java @@ -21,6 +21,7 @@ package org.apache.skywalking.oap.server.core.alarm.provider; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import lombok.extern.slf4j.Slf4j; import org.apache.skywalking.oap.server.core.CoreModule; import org.apache.skywalking.oap.server.core.alarm.AlarmCallback; import org.apache.skywalking.oap.server.core.alarm.EndpointMetaInAlarm; @@ -29,22 +30,21 @@ import org.apache.skywalking.oap.server.core.alarm.MetricsNotify; import org.apache.skywalking.oap.server.core.alarm.ServiceInstanceMetaInAlarm; import org.apache.skywalking.oap.server.core.alarm.ServiceMetaInAlarm; import org.apache.skywalking.oap.server.core.alarm.provider.grpc.GRPCCallback; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics; import org.apache.skywalking.oap.server.core.analysis.metrics.MetricsMetaInfo; import org.apache.skywalking.oap.server.core.analysis.metrics.WithMetadata; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInstanceInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; -import org.apache.skywalking.oap.server.core.register.EndpointInventory; import org.apache.skywalking.oap.server.core.register.ServiceInstanceInventory; import org.apache.skywalking.oap.server.core.register.ServiceInventory; import org.apache.skywalking.oap.server.core.source.DefaultScopeDefine; import org.apache.skywalking.oap.server.library.module.ModuleManager; +@Slf4j public class NotifyHandler implements MetricsNotify { private ServiceInventoryCache serviceInventoryCache; private ServiceInstanceInventoryCache serviceInstanceInventoryCache; - private EndpointInventoryCache endpointInventoryCache; private final AlarmCore core; private final AlarmRulesWatcher alarmRulesWatcher; @@ -60,7 +60,8 @@ public class NotifyHandler implements MetricsNotify { MetricsMetaInfo meta = withMetadata.getMeta(); int scope = meta.getScope(); - if (!DefaultScopeDefine.inServiceCatalog(scope) && !DefaultScopeDefine.inServiceInstanceCatalog(scope) && !DefaultScopeDefine + if (!DefaultScopeDefine.inServiceCatalog(scope) && !DefaultScopeDefine.inServiceInstanceCatalog( + scope) && !DefaultScopeDefine .inEndpointCatalog(scope)) { return; } @@ -71,7 +72,7 @@ public class NotifyHandler implements MetricsNotify { ServiceInventory serviceInventory = serviceInventoryCache.get(serviceId); ServiceMetaInAlarm serviceMetaInAlarm = new ServiceMetaInAlarm(); serviceMetaInAlarm.setMetricsName(meta.getMetricsName()); - serviceMetaInAlarm.setId(serviceId); + serviceMetaInAlarm.setId(String.valueOf(serviceId)); serviceMetaInAlarm.setName(serviceInventory.getName()); metaInAlarm = serviceMetaInAlarm; } else if (DefaultScopeDefine.inServiceInstanceCatalog(scope)) { @@ -79,21 +80,18 @@ public class NotifyHandler implements MetricsNotify { ServiceInstanceInventory serviceInstanceInventory = serviceInstanceInventoryCache.get(serviceInstanceId); ServiceInstanceMetaInAlarm instanceMetaInAlarm = new ServiceInstanceMetaInAlarm(); instanceMetaInAlarm.setMetricsName(meta.getMetricsName()); - instanceMetaInAlarm.setId(serviceInstanceId); + instanceMetaInAlarm.setId(String.valueOf(serviceInstanceId)); instanceMetaInAlarm.setName(serviceInstanceInventory.getName()); metaInAlarm = instanceMetaInAlarm; } else if (DefaultScopeDefine.inEndpointCatalog(scope)) { - int endpointId = Integer.parseInt(meta.getId()); - EndpointInventory endpointInventory = endpointInventoryCache.get(endpointId); EndpointMetaInAlarm endpointMetaInAlarm = new EndpointMetaInAlarm(); endpointMetaInAlarm.setMetricsName(meta.getMetricsName()); - endpointMetaInAlarm.setId(endpointId); - int serviceId = endpointInventory.getServiceId(); - ServiceInventory serviceInventory = serviceInventoryCache.get(serviceId); - - String textName = endpointInventory.getName() + " in " + serviceInventory.getName(); + final EndpointTraffic.EndpointID endpointID = EndpointTraffic.splitID(meta.getId()); + ServiceInventory serviceInventory = serviceInventoryCache.get(endpointID.getServiceId()); + String textName = endpointID.getEndpointName() + " in " + serviceInventory.getName(); + endpointMetaInAlarm.setId(meta.getId()); endpointMetaInAlarm.setName(textName); metaInAlarm = endpointMetaInAlarm; } else { @@ -120,8 +118,5 @@ public class NotifyHandler implements MetricsNotify { serviceInstanceInventoryCache = moduleManager.find(CoreModule.NAME) .provider() .getService(ServiceInstanceInventoryCache.class); - endpointInventoryCache = moduleManager.find(CoreModule.NAME) - .provider() - .getService(EndpointInventoryCache.class); } } diff --git a/oap-server/server-alarm-plugin/src/main/proto/alarm-hook.proto b/oap-server/server-alarm-plugin/src/main/proto/alarm-hook.proto index 1e2e63878195f488c7a1e281dbcac4f92a3b6550..1f3a34fd50a48f145b7bc1bbfc2ba03141df815d 100644 --- a/oap-server/server-alarm-plugin/src/main/proto/alarm-hook.proto +++ b/oap-server/server-alarm-plugin/src/main/proto/alarm-hook.proto @@ -30,8 +30,8 @@ message AlarmMessage { int64 scopeId = 1; string scope = 2; string name = 3; - int64 id0 = 4; - int64 id1 = 5; + string id0 = 4; + string id1 = 5; string ruleName = 6; string alarmMessage = 7; int64 startTime = 8; diff --git a/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmMessageFormatterTest.java b/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmMessageFormatterTest.java index 659147db9234e9f5339defd24188ccf9a88b0397..9f61d2b498e1b65735580e9cc80e53cedb3864dc 100644 --- a/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmMessageFormatterTest.java +++ b/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmMessageFormatterTest.java @@ -49,13 +49,13 @@ public class AlarmMessageFormatterTest { } @Override - public int getId0() { - return 0; + public String getId0() { + return ""; } @Override - public int getId1() { - return 0; + public String getId1() { + return ""; } }); @@ -88,13 +88,13 @@ public class AlarmMessageFormatterTest { } @Override - public int getId0() { - return 1290; + public String getId0() { + return "1290"; } @Override - public int getId1() { - return 0; + public String getId1() { + return ""; } }); Assert.assertEquals("abc} words service - 1290 .. {", message); diff --git a/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/NotifyHandlerTest.java b/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/NotifyHandlerTest.java index cd211f45b4f979bb73c5dc6ccfde055f6dd0d4db..6110683afa921378c0a46f0515f658c27131490c 100644 --- a/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/NotifyHandlerTest.java +++ b/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/NotifyHandlerTest.java @@ -25,16 +25,16 @@ import org.apache.skywalking.oap.server.core.alarm.EndpointMetaInAlarm; import org.apache.skywalking.oap.server.core.alarm.MetaInAlarm; import org.apache.skywalking.oap.server.core.alarm.ServiceInstanceMetaInAlarm; import org.apache.skywalking.oap.server.core.alarm.ServiceMetaInAlarm; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics; import org.apache.skywalking.oap.server.core.analysis.metrics.MetricsMetaInfo; import org.apache.skywalking.oap.server.core.analysis.metrics.WithMetadata; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInstanceInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; -import org.apache.skywalking.oap.server.core.register.EndpointInventory; import org.apache.skywalking.oap.server.core.register.ServiceInstanceInventory; import org.apache.skywalking.oap.server.core.register.ServiceInventory; import org.apache.skywalking.oap.server.core.source.DefaultScopeDefine; +import org.apache.skywalking.oap.server.core.source.DetectPoint; import org.apache.skywalking.oap.server.library.module.ModuleManager; import org.apache.skywalking.oap.server.library.module.ModuleProviderHolder; import org.apache.skywalking.oap.server.library.module.ModuleServiceHolder; @@ -76,8 +76,6 @@ public class NotifyHandlerTest { private ServiceInstanceInventoryCache serviceInstanceInventoryCache; - private EndpointInventoryCache endpointInventoryCache; - private MockMetrics metrics; private MetricsMetaInfo metadata; @@ -96,16 +94,15 @@ public class NotifyHandlerTest { when(DefaultScopeDefine.inEndpointCatalog(0)).thenReturn(true); String endpointInventoryName = "endpoint-inventory-name"; - EndpointInventory endpointInventory = mock(EndpointInventory.class); - when(endpointInventory.getName()).thenReturn(endpointInventoryName); + EndpointTraffic endpointTraffic = mock(EndpointTraffic.class); + when(endpointTraffic.getName()).thenReturn(endpointInventoryName); String serviceInventoryName = "service-inventory-name"; ServiceInventory serviceInventory = mock(ServiceInventory.class); when(serviceInventory.getName()).thenReturn(serviceInventoryName); when(serviceInventoryCache.get(anyInt())).thenReturn(serviceInventory); - - when(endpointInventoryCache.get(anyInt())).thenReturn(endpointInventory); + when(metadata.getId()).thenReturn(EndpointTraffic.buildId(1, endpointInventoryName, DetectPoint.SERVER)); ArgumentCaptor metaCaptor = ArgumentCaptor.forClass(MetaInAlarm.class); @@ -115,7 +112,7 @@ public class NotifyHandlerTest { MetaInAlarm metaInAlarm = metaCaptor.getValue(); assertTrue(metaInAlarm instanceof EndpointMetaInAlarm); - assertEquals(mockId, metaInAlarm.getId0()); + assertEquals("1_ZW5kcG9pbnQtaW52ZW50b3J5LW5hbWU=_0", metaInAlarm.getId0()); assertEquals(DefaultScopeDefine.ENDPOINT_CATALOG_NAME, metaInAlarm.getScope()); assertEquals(metricsName, metaInAlarm.getMetricsName()); assertEquals(endpointInventoryName + " in " + serviceInventoryName, metaInAlarm.getName()); @@ -148,7 +145,7 @@ public class NotifyHandlerTest { assertTrue(metaInAlarm instanceof ServiceInstanceMetaInAlarm); assertEquals(metricsName, metaInAlarm.getMetricsName()); - assertEquals(mockId, metaInAlarm.getId0()); + assertEquals(mockId + "", metaInAlarm.getId0()); assertEquals(DefaultScopeDefine.SERVICE_INSTANCE_CATALOG_NAME, metaInAlarm.getScope()); assertEquals(instanceInventoryName, metaInAlarm.getName()); assertEquals(DefaultScopeDefine.SERVICE_INSTANCE, metaInAlarm.getScopeId()); @@ -177,7 +174,7 @@ public class NotifyHandlerTest { assertTrue(metaInAlarm instanceof ServiceMetaInAlarm); assertEquals(metricsName, metaInAlarm.getMetricsName()); - assertEquals(mockId, metaInAlarm.getId0()); + assertEquals(mockId + "", metaInAlarm.getId0()); assertEquals(DefaultScopeDefine.SERVICE_CATALOG_NAME, metaInAlarm.getScope()); assertEquals(serviceInventoryName, metaInAlarm.getName()); assertEquals(DefaultScopeDefine.SERVICE, metaInAlarm.getScopeId()); @@ -238,11 +235,10 @@ public class NotifyHandlerTest { serviceInventoryCache = mock(ServiceInventoryCache.class); serviceInstanceInventoryCache = mock(ServiceInstanceInventoryCache.class); - endpointInventoryCache = mock(EndpointInventoryCache.class); when(moduleServiceHolder.getService(ServiceInventoryCache.class)).thenReturn(serviceInventoryCache); - when(moduleServiceHolder.getService(ServiceInstanceInventoryCache.class)).thenReturn(serviceInstanceInventoryCache); - when(moduleServiceHolder.getService(EndpointInventoryCache.class)).thenReturn(endpointInventoryCache); + when(moduleServiceHolder.getService(ServiceInstanceInventoryCache.class)).thenReturn( + serviceInstanceInventoryCache); AlarmCore core = mock(AlarmCore.class); diff --git a/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRuleTest.java b/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRuleTest.java index ef57dff8003e37f14609fc2b1555117cb51b1a52..d2187c5ace5abd13a94634301e1c88a3b47ad69a 100644 --- a/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRuleTest.java +++ b/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRuleTest.java @@ -23,6 +23,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Objects; +import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.alarm.AlarmCallback; import org.apache.skywalking.oap.server.core.alarm.AlarmMessage; import org.apache.skywalking.oap.server.core.alarm.MetaInAlarm; @@ -143,8 +144,9 @@ public class RunningRuleTest { // check at 201808301442 alarmMessages = runningRule.check(); Assert.assertEquals(1, alarmMessages.size()); - Assert.assertEquals("response percentile of endpoint Service_123 is lower than expected values", alarmMessages.get(0) - .getAlarmMessage()); + Assert.assertEquals( + "response percentile of endpoint Service_123 is lower than expected values", alarmMessages.get(0) + .getAlarmMessage()); } @Test @@ -283,19 +285,19 @@ public class RunningRuleTest { } @Override - public int getId0() { - return id; + public String getId0() { + return "" + id; } @Override - public int getId1() { - return 0; + public String getId1() { + return Const.EMPTY_STRING; } @Override public boolean equals(Object o) { MetaInAlarm target = (MetaInAlarm) o; - return id == target.getId0(); + return (id + "").equals(target.getId0()); } @Override diff --git a/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/grpc/GRPChookCallbackTest.java b/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/grpc/GRPChookCallbackTest.java index 5af3e2a12e126f2a43c1dd7237d3558188498a70..e5cc0521999401d48a98f9e8c09e2467949eb47a 100644 --- a/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/grpc/GRPChookCallbackTest.java +++ b/oap-server/server-alarm-plugin/src/test/java/org/apache/skywalking/oap/server/core/alarm/provider/grpc/GRPChookCallbackTest.java @@ -66,8 +66,8 @@ public class GRPChookCallbackTest { private void mockAlarmMessage() { AlarmMessage alarmMessage = new AlarmMessage(); - alarmMessage.setId0(1); - alarmMessage.setId1(2); + alarmMessage.setId0("1"); + alarmMessage.setId1("2"); alarmMessage.setScope(Scope.Service.name()); alarmMessage.setName("mock alarm message"); alarmMessage.setAlarmMessage("message"); diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/Const.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/Const.java index 213f482d593228aad79d26abd715a8c8156bc03c..cc1f2c84b772956bc2a07083a52c152a8cac726a 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/Const.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/Const.java @@ -21,6 +21,7 @@ package org.apache.skywalking.oap.server.core; public class Const { public static final int NONE = 0; public static final String ID_SPLIT = "_"; + public static final String ID_PARSER_SPLIT = "\\_"; public static final String LINE = "-"; public static final String SPACE = " "; public static final String KEY_VALUE_SPLIT = ","; @@ -28,7 +29,7 @@ public class Const { public static final String ARRAY_PARSER_SPLIT = "\\|"; public static final int USER_SERVICE_ID = 1; public static final int USER_INSTANCE_ID = 1; - public static final int USER_ENDPOINT_ID = 1; + public static final String USER_ENDPOINT_NAME = "User"; public static final int INEXISTENCE_ENDPOINT_ID = -1; public static final String USER_CODE = "User"; public static final String SEGMENT_SPAN_SPLIT = "S"; diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModule.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModule.java index e7fa4af64c041093945548b661a81e3b4917dfdc..12609036836112e28e8f6e0ac7063aa6f8df5d7b 100755 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModule.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModule.java @@ -20,7 +20,6 @@ package org.apache.skywalking.oap.server.core; import java.util.ArrayList; import java.util.List; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; import org.apache.skywalking.oap.server.core.cache.NetworkAddressInventoryCache; import org.apache.skywalking.oap.server.core.cache.ProfileTaskCache; import org.apache.skywalking.oap.server.core.cache.ServiceInstanceInventoryCache; @@ -39,7 +38,6 @@ import org.apache.skywalking.oap.server.core.query.ProfileTaskQueryService; import org.apache.skywalking.oap.server.core.query.TopNRecordsQueryService; import org.apache.skywalking.oap.server.core.query.TopologyQueryService; import org.apache.skywalking.oap.server.core.query.TraceQueryService; -import org.apache.skywalking.oap.server.core.register.service.IEndpointInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.INetworkAddressInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.IServiceInstanceInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.IServiceInventoryRegister; @@ -122,14 +120,12 @@ public class CoreModule extends ModuleDefine { private void addRegisterService(List classes) { classes.add(IServiceInventoryRegister.class); classes.add(IServiceInstanceInventoryRegister.class); - classes.add(IEndpointInventoryRegister.class); classes.add(INetworkAddressInventoryRegister.class); } private void addCacheService(List classes) { classes.add(ServiceInventoryCache.class); classes.add(ServiceInstanceInventoryCache.class); - classes.add(EndpointInventoryCache.class); classes.add(NetworkAddressInventoryCache.class); } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java index cd4c63946f73bd7028e9a96aac554f330735e119..b7d0fa5c8abd3d972408a1e0995fc005cda51989 100755 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java @@ -30,7 +30,6 @@ import org.apache.skywalking.oap.server.core.analysis.worker.MetricsStreamProces import org.apache.skywalking.oap.server.core.analysis.worker.TopNStreamProcessor; import org.apache.skywalking.oap.server.core.annotation.AnnotationScan; import org.apache.skywalking.oap.server.core.cache.CacheUpdateTimer; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; import org.apache.skywalking.oap.server.core.cache.NetworkAddressInventoryCache; import org.apache.skywalking.oap.server.core.cache.ProfileTaskCache; import org.apache.skywalking.oap.server.core.cache.ServiceInstanceInventoryCache; @@ -55,8 +54,6 @@ import org.apache.skywalking.oap.server.core.query.ProfileTaskQueryService; import org.apache.skywalking.oap.server.core.query.TopNRecordsQueryService; import org.apache.skywalking.oap.server.core.query.TopologyQueryService; import org.apache.skywalking.oap.server.core.query.TraceQueryService; -import org.apache.skywalking.oap.server.core.register.service.EndpointInventoryRegister; -import org.apache.skywalking.oap.server.core.register.service.IEndpointInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.INetworkAddressInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.IServiceInstanceInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.IServiceInventoryRegister; @@ -170,7 +167,8 @@ public class CoreModuleProvider extends ModuleProvider { if (moduleConfig.isGRPCSslEnabled()) { grpcServer = new GRPCServer(moduleConfig.getGRPCHost(), moduleConfig.getGRPCPort(), Paths.get(moduleConfig.getGRPCSslCertChainPath()).toFile(), - Paths.get(moduleConfig.getGRPCSslKeyPath()).toFile()); + Paths.get(moduleConfig.getGRPCSslKeyPath()).toFile() + ); } else { grpcServer = new GRPCServer(moduleConfig.getGRPCHost(), moduleConfig.getGRPCPort()); } @@ -222,11 +220,6 @@ public class CoreModuleProvider extends ModuleProvider { this.registerServiceImplementation( IServiceInstanceInventoryRegister.class, new ServiceInstanceInventoryRegister(getManager())); - this.registerServiceImplementation( - EndpointInventoryCache.class, new EndpointInventoryCache(getManager(), moduleConfig)); - this.registerServiceImplementation( - IEndpointInventoryRegister.class, new EndpointInventoryRegister(getManager())); - this.registerServiceImplementation( NetworkAddressInventoryCache.class, new NetworkAddressInventoryCache(getManager(), moduleConfig)); this.registerServiceImplementation( @@ -254,7 +247,9 @@ public class CoreModuleProvider extends ModuleProvider { if (moduleConfig.isGRPCSslEnabled()) { this.remoteClientManager = new RemoteClientManager(getManager(), moduleConfig.getRemoteTimeout(), - Paths.get(moduleConfig.getGRPCSslTrustedCAPath()).toFile()); + Paths.get(moduleConfig.getGRPCSslTrustedCAPath()) + .toFile() + ); } else { this.remoteClientManager = new RemoteClientManager(getManager(), moduleConfig.getRemoteTimeout()); } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmMessage.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmMessage.java index 0ee654f2a7b0ff9390a1ec5956cab7e5c055022b..e47503a588d162bd2de3e960b016350be9b7501c 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmMessage.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmMessage.java @@ -34,8 +34,8 @@ public class AlarmMessage { private int scopeId; private String scope; private String name; - private int id0; - private int id1; + private String id0; + private String id1; private String ruleName; private String alarmMessage; private long startTime; diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmRecord.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmRecord.java index 18093940c48df8668b9df58a23576b1034d1e455..2632234ba2fb05a8701e371c78cdb62646f824ce 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmRecord.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmRecord.java @@ -57,9 +57,9 @@ public class AlarmRecord extends Record { @Column(columnName = NAME) private String name; @Column(columnName = ID0) - private int id0; + private String id0; @Column(columnName = ID1) - private int id1; + private String id1; @Column(columnName = START_TIME) private long startTime; @Column(columnName = ALARM_MESSAGE, matchQuery = true) @@ -85,8 +85,8 @@ public class AlarmRecord extends Record { AlarmRecord record = new AlarmRecord(); record.setScope(((Number) dbMap.get(SCOPE)).intValue()); record.setName((String) dbMap.get(NAME)); - record.setId0(((Number) dbMap.get(ID0)).intValue()); - record.setId1(((Number) dbMap.get(ID1)).intValue()); + record.setId0((String) dbMap.get(ID0)); + record.setId1((String) dbMap.get(ID1)); record.setAlarmMessage((String) dbMap.get(ALARM_MESSAGE)); record.setStartTime(((Number) dbMap.get(START_TIME)).longValue()); record.setTimeBucket(((Number) dbMap.get(TIME_BUCKET)).longValue()); diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/EndpointMetaInAlarm.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/EndpointMetaInAlarm.java index 1b0d769b8b5d27a4062435fe8e60fc450ad50619..cccd674d66869ee0755e5ab998b0593a40bfcd0e 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/EndpointMetaInAlarm.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/EndpointMetaInAlarm.java @@ -21,6 +21,7 @@ package org.apache.skywalking.oap.server.core.alarm; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; +import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.source.DefaultScopeDefine; @Getter(AccessLevel.PUBLIC) @@ -28,7 +29,7 @@ import org.apache.skywalking.oap.server.core.source.DefaultScopeDefine; public class EndpointMetaInAlarm extends MetaInAlarm { private String metricsName; - private int id; + private String id; private String name; private String[] tags; private String[] properties; @@ -44,12 +45,12 @@ public class EndpointMetaInAlarm extends MetaInAlarm { } @Override - public int getId0() { + public String getId0() { return id; } @Override - public int getId1() { - return 0; + public String getId1() { + return Const.EMPTY_STRING; } } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/MetaInAlarm.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/MetaInAlarm.java index c94dcae7fcbe5e01bb1d4127fe3afc566d43e4fb..56d2cf570b7c2a29ce4a53a622cb965c80ca2ddd 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/MetaInAlarm.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/MetaInAlarm.java @@ -36,12 +36,12 @@ public abstract class MetaInAlarm { * * @return the primary id. */ - public abstract int getId0(); + public abstract String getId0(); /** * Only exist in multiple IDs case, Such as ServiceRelation, id1 represents the dest service id */ - public abstract int getId1(); + public abstract String getId1(); @Override public boolean equals(Object o) { @@ -50,7 +50,7 @@ public abstract class MetaInAlarm { if (o == null || getClass() != o.getClass()) return false; MetaInAlarm that = (MetaInAlarm) o; - return getId0() == that.getId0() && getId1() == that.getId1(); + return getId0().equals(that.getId0()) && getId1().equals(that.getId1()); } @Override diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/ServiceInstanceMetaInAlarm.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/ServiceInstanceMetaInAlarm.java index 76518fb15cf556a9e2e13fdf819b69ab41170fa3..e78d441dc301f8effdaf44d732621e54d427ff61 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/ServiceInstanceMetaInAlarm.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/ServiceInstanceMetaInAlarm.java @@ -21,6 +21,7 @@ package org.apache.skywalking.oap.server.core.alarm; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; +import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.source.DefaultScopeDefine; @Getter(AccessLevel.PUBLIC) @@ -28,7 +29,7 @@ import org.apache.skywalking.oap.server.core.source.DefaultScopeDefine; public class ServiceInstanceMetaInAlarm extends MetaInAlarm { private String metricsName; - private int id; + private String id; private String name; private String[] tags; private String[] properties; @@ -44,12 +45,12 @@ public class ServiceInstanceMetaInAlarm extends MetaInAlarm { } @Override - public int getId0() { + public String getId0() { return id; } @Override - public int getId1() { - return 0; + public String getId1() { + return Const.EMPTY_STRING; } } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/ServiceMetaInAlarm.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/ServiceMetaInAlarm.java index d03022535eacc35ec03e6f20d24df5571c0b5f61..c5698a0069010d1960d97fda86178cee5505e2ae 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/ServiceMetaInAlarm.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/ServiceMetaInAlarm.java @@ -21,6 +21,7 @@ package org.apache.skywalking.oap.server.core.alarm; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; +import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.source.DefaultScopeDefine; @Getter(AccessLevel.PUBLIC) @@ -28,7 +29,7 @@ import org.apache.skywalking.oap.server.core.source.DefaultScopeDefine; public class ServiceMetaInAlarm extends MetaInAlarm { private String metricsName; - private int id; + private String id; private String name; private String[] tags; private String[] properties; @@ -44,12 +45,12 @@ public class ServiceMetaInAlarm extends MetaInAlarm { } @Override - public int getId0() { + public String getId0() { return id; } @Override - public int getId1() { - return 0; + public String getId1() { + return Const.EMPTY_STRING; } } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Stream.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Stream.java index 0cf0f38f3196dc825ee2f7102e40901580e85c1d..35fd888ce8b66b3343d5052fa5873f989b856d1a 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Stream.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Stream.java @@ -59,4 +59,9 @@ public @interface Stream { * InventoryStreamProcessor}, {@link TopNStreamProcessor} and {@link NoneStreamingProcessor} for more details. */ Class processor(); + + /** + * @return true if this metrics stream support down sampling. + */ + boolean supportDownSampling() default true; } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/RelationDefineUtil.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/RelationDefineUtil.java index 9aa698e9ddc88d8c1e31c7391f906a314dd70d86..7efd78f27face4f0b23450c355e6196cafe58241 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/RelationDefineUtil.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/RelationDefineUtil.java @@ -18,12 +18,20 @@ package org.apache.skywalking.oap.server.core.analysis.manual; +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import lombok.EqualsAndHashCode; import lombok.Getter; +import lombok.RequiredArgsConstructor; import org.apache.skywalking.oap.server.core.Const; +import org.apache.skywalking.oap.server.core.UnexpectedException; public class RelationDefineUtil { + /** + * @return the service or instance relationship string id. + */ public static String buildEntityId(RelationDefine define) { - return String.valueOf(define.source) + Const.ID_SPLIT + String.valueOf(define.dest) + Const.ID_SPLIT + String.valueOf(define.componentId); + return define.source + Const.ID_SPLIT + define.dest + Const.ID_SPLIT + define.componentId; } /** @@ -37,16 +45,54 @@ public class RelationDefineUtil { return new RelationDefine(Integer.parseInt(parts[0]), Integer.parseInt(parts[1]), Integer.parseInt(parts[2])); } + /** + * @return the endpoint relationship string id. + */ + public static String buildEndpointRelationEntityId(EndpointRelationDefine define) { + return define.sourceServiceId + + Const.ID_SPLIT + + new String( + Base64.getEncoder().encode(define.source.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8) + + Const.ID_SPLIT + + define.destServiceId + + Const.ID_SPLIT + + new String( + Base64.getEncoder().encode(define.dest.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8) + + Const.ID_SPLIT + + define.componentId; + } + + public static EndpointRelationDefine splitEndpointRelationEntityId(String entityId) { + String[] parts = entityId.split(Const.ID_SPLIT); + if (parts.length != 5) { + throw new UnexpectedException("Illegal endpoint Relation entity id, " + entityId); + } + return new EndpointRelationDefine( + Integer.parseInt(parts[0]), + new String(Base64.getDecoder().decode(parts[1]), StandardCharsets.UTF_8), + Integer.parseInt(parts[2]), + new String(Base64.getDecoder().decode(parts[3]), StandardCharsets.UTF_8), + Integer.parseInt(parts[4]) + ); + } + + @RequiredArgsConstructor @Getter + @EqualsAndHashCode public static class RelationDefine { - private int source; - private int dest; - private int componentId; - - public RelationDefine(int source, int dest, int componentId) { - this.source = source; - this.dest = dest; - this.componentId = componentId; - } + private final int source; + private final int dest; + private final int componentId; + } + + @RequiredArgsConstructor + @Getter + @EqualsAndHashCode + public static class EndpointRelationDefine { + private final int sourceServiceId; + private final String source; + private final int destServiceId; + private final String dest; + private final int componentId; } } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/EndpointInventory.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/endpoint/EndpointTraffic.java similarity index 51% rename from oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/EndpointInventory.java rename to oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/endpoint/EndpointTraffic.java index d4ad3fe1fd56c0397597294ebd7858fc89e5d1e6..230e9736120c0f7ff33b8136dad10dea8dd9eca0 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/EndpointInventory.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/endpoint/EndpointTraffic.java @@ -16,29 +16,37 @@ * */ -package org.apache.skywalking.oap.server.core.register; +package org.apache.skywalking.oap.server.core.analysis.manual.endpoint; import com.google.common.base.Strings; +import java.nio.charset.StandardCharsets; +import java.util.Base64; import java.util.HashMap; import java.util.Map; import lombok.Getter; +import lombok.RequiredArgsConstructor; import lombok.Setter; import org.apache.skywalking.oap.server.core.Const; +import org.apache.skywalking.oap.server.core.UnexpectedException; import org.apache.skywalking.oap.server.core.analysis.Stream; -import org.apache.skywalking.oap.server.core.register.worker.InventoryStreamProcessor; +import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics; +import org.apache.skywalking.oap.server.core.analysis.worker.MetricsStreamProcessor; import org.apache.skywalking.oap.server.core.remote.grpc.proto.RemoteData; import org.apache.skywalking.oap.server.core.source.DefaultScopeDefine; +import org.apache.skywalking.oap.server.core.source.DetectPoint; import org.apache.skywalking.oap.server.core.source.ScopeDeclaration; import org.apache.skywalking.oap.server.core.storage.StorageBuilder; import org.apache.skywalking.oap.server.core.storage.annotation.Column; -import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.ENDPOINT_INVENTORY; +import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.ENDPOINT_TRAFFIC; -@ScopeDeclaration(id = ENDPOINT_INVENTORY, name = "EndpointInventory") -@Stream(name = EndpointInventory.INDEX_NAME, scopeId = DefaultScopeDefine.ENDPOINT_INVENTORY, builder = EndpointInventory.Builder.class, processor = InventoryStreamProcessor.class) -public class EndpointInventory extends RegisterSource { +@ScopeDeclaration(id = ENDPOINT_TRAFFIC, name = "EndpointTraffic") +@Stream(name = EndpointTraffic.INDEX_NAME, scopeId = DefaultScopeDefine.ENDPOINT_TRAFFIC, + builder = EndpointTraffic.Builder.class, processor = MetricsStreamProcessor.class, + supportDownSampling = false) +public class EndpointTraffic extends Metrics { - public static final String INDEX_NAME = "endpoint_inventory"; + public static final String INDEX_NAME = "endpoint_traffic"; public static final String SERVICE_ID = "service_id"; public static final String NAME = "name"; @@ -57,21 +65,59 @@ public class EndpointInventory extends RegisterSource { @Column(columnName = DETECT_POINT) private int detectPoint; - public static String buildId(int serviceId, String endpointName, int detectPoint) { - return serviceId + Const.ID_SPLIT + endpointName + Const.ID_SPLIT + detectPoint; + public static String buildId(int serviceId, String endpointName, DetectPoint detectPoint) { + return buildId(serviceId, endpointName, detectPoint.value()); + } + + public static String buildId(EndpointTraffic endpointTraffic) { + return buildId(endpointTraffic.serviceId, endpointTraffic.name, endpointTraffic.detectPoint); + } + + private static String buildId(int serviceId, String endpointName, int detectPoint) { + return serviceId + Const.ID_SPLIT + + new String( + Base64.getEncoder().encode(endpointName.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8) + + Const.ID_SPLIT + detectPoint; + } + + /** + * @param id in the storage of endpoint traffic + * @return [serviceId, endpointName, detectPoint] + */ + public static EndpointID splitID(String id) { + final String[] strings = id.split(Const.ID_PARSER_SPLIT); + if (strings.length != 3) { + throw new UnexpectedException("Can't split endpoint id into 3 parts, " + id); + } + return new EndpointID( + Integer.parseInt(strings[0]), new String(Base64.getDecoder().decode(strings[1]), StandardCharsets.UTF_8), + DetectPoint.valueOf(Integer.parseInt(strings[2])) + ); + } + + @RequiredArgsConstructor + public static class EndpointID { + @Getter + private final int serviceId; + @Getter + private final String endpointName; + @Getter + private final DetectPoint detectPoint; } @Override public String id() { - return buildId(serviceId, name, detectPoint); + // Downgrade the time bucket to day level only. + // supportDownSampling == false for this entity. + String splitJointId = String.valueOf(getTimeBucket() / 10000); + splitJointId += Const.ID_SPLIT + buildId(this); + return splitJointId; } @Override public int hashCode() { int result = 17; - result = 31 * result + serviceId; - result = 31 * result + name.hashCode(); - result = 31 * result + detectPoint; + result = 31 * result + buildId(this).hashCode(); return result; } @@ -84,7 +130,7 @@ public class EndpointInventory extends RegisterSource { if (getClass() != obj.getClass()) return false; - EndpointInventory source = (EndpointInventory) obj; + EndpointTraffic source = (EndpointTraffic) obj; if (serviceId != source.getServiceId()) return false; if (!name.equals(source.getName())) @@ -95,13 +141,10 @@ public class EndpointInventory extends RegisterSource { @Override public RemoteData.Builder serialize() { RemoteData.Builder remoteBuilder = RemoteData.newBuilder(); - remoteBuilder.addDataIntegers(getSequence()); remoteBuilder.addDataIntegers(serviceId); remoteBuilder.addDataIntegers(detectPoint); - remoteBuilder.addDataLongs(getRegisterTime()); - remoteBuilder.addDataLongs(getHeartbeatTime()); - remoteBuilder.addDataLongs(getLastUpdateTime()); + remoteBuilder.addDataLongs(getTimeBucket()); remoteBuilder.addDataStrings(Strings.isNullOrEmpty(name) ? Const.EMPTY_STRING : name); return remoteBuilder; @@ -109,47 +152,67 @@ public class EndpointInventory extends RegisterSource { @Override public void deserialize(RemoteData remoteData) { - setSequence(remoteData.getDataIntegers(0)); - setServiceId(remoteData.getDataIntegers(1)); - setDetectPoint(remoteData.getDataIntegers(2)); + setServiceId(remoteData.getDataIntegers(0)); + setDetectPoint(remoteData.getDataIntegers(1)); - setRegisterTime(remoteData.getDataLongs(0)); - setHeartbeatTime(remoteData.getDataLongs(1)); - setLastUpdateTime(remoteData.getDataLongs(2)); + setTimeBucket(remoteData.getDataLongs(0)); setName(remoteData.getDataStrings(0)); } @Override public int remoteHashCode() { - return 0; + int result = 17; + result = 31 * result + serviceId; + result = 31 * result + name.hashCode(); + result = 31 * result + detectPoint; + return result; + } + + @Override + public void combine(final Metrics metrics) { + + } + + @Override + public void calculate() { + + } + + @Override + public Metrics toHour() { + return null; + } + + @Override + public Metrics toDay() { + return null; + } + + @Override + public Metrics toMonth() { + return null; } - public static class Builder implements StorageBuilder { + public static class Builder implements StorageBuilder { @Override - public EndpointInventory map2Data(Map dbMap) { - EndpointInventory inventory = new EndpointInventory(); - inventory.setSequence(((Number) dbMap.get(SEQUENCE)).intValue()); + public EndpointTraffic map2Data(Map dbMap) { + EndpointTraffic inventory = new EndpointTraffic(); inventory.setServiceId(((Number) dbMap.get(SERVICE_ID)).intValue()); inventory.setName((String) dbMap.get(NAME)); inventory.setDetectPoint(((Number) dbMap.get(DETECT_POINT)).intValue()); - inventory.setRegisterTime(((Number) dbMap.get(REGISTER_TIME)).longValue()); - inventory.setHeartbeatTime(((Number) dbMap.get(HEARTBEAT_TIME)).longValue()); - inventory.setLastUpdateTime(((Number) dbMap.get(LAST_UPDATE_TIME)).longValue()); + inventory.setTimeBucket(((Number) dbMap.get(TIME_BUCKET)).longValue()); return inventory; } @Override - public Map data2Map(EndpointInventory storageData) { + public Map data2Map(EndpointTraffic storageData) { Map map = new HashMap<>(); - map.put(SEQUENCE, storageData.getSequence()); map.put(SERVICE_ID, storageData.getServiceId()); map.put(NAME, storageData.getName()); map.put(DETECT_POINT, storageData.getDetectPoint()); - map.put(REGISTER_TIME, storageData.getRegisterTime()); - map.put(HEARTBEAT_TIME, storageData.getHeartbeatTime()); - map.put(LAST_UPDATE_TIME, storageData.getLastUpdateTime()); + map.put(TIME_BUCKET, storageData.getTimeBucket()); return map; } } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/IEndpointInventoryRegister.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/endpoint/EndpointTrafficDispatcher.java similarity index 50% rename from oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/IEndpointInventoryRegister.java rename to oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/endpoint/EndpointTrafficDispatcher.java index 581f8d03e4f8e55f95426bf2ef81a8bab06daf0d..95db3645ae55715b2c5052d11f7adb1c9ac52791 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/IEndpointInventoryRegister.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/endpoint/EndpointTrafficDispatcher.java @@ -16,16 +16,26 @@ * */ -package org.apache.skywalking.oap.server.core.register.service; +package org.apache.skywalking.oap.server.core.analysis.manual.endpoint; +import org.apache.skywalking.oap.server.core.analysis.SourceDispatcher; +import org.apache.skywalking.oap.server.core.analysis.worker.MetricsStreamProcessor; import org.apache.skywalking.oap.server.core.source.DetectPoint; -import org.apache.skywalking.oap.server.library.module.Service; +import org.apache.skywalking.oap.server.core.source.Endpoint; -public interface IEndpointInventoryRegister extends Service { +public class EndpointTrafficDispatcher implements SourceDispatcher { - int getOrCreate(int serviceId, String endpointName, DetectPoint detectPoint); + @Override + public void dispatch(final Endpoint source) { + generateTraffic(source); + } - int get(int serviceId, String endpointName, DetectPoint detectPoint); - - void heartbeat(int endpointId, long heartBeatTime); + public void generateTraffic(final Endpoint source) { + EndpointTraffic traffic = new EndpointTraffic(); + traffic.setTimeBucket(source.getTimeBucket()); + traffic.setName(source.getName()); + traffic.setServiceId(source.getServiceId()); + traffic.setDetectPoint(DetectPoint.SERVER.value()); + MetricsStreamProcessor.getInstance().in(traffic); + } } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/endpointrelation/EndpointCallRelationDispatcher.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/endpointrelation/EndpointCallRelationDispatcher.java index f72e94896f1dbd3fb5f7ba224d805d104540034e..0120eb05221a4a9ac924a2521024ffabc7d79ebb 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/endpointrelation/EndpointCallRelationDispatcher.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/endpointrelation/EndpointCallRelationDispatcher.java @@ -19,7 +19,9 @@ package org.apache.skywalking.oap.server.core.analysis.manual.endpointrelation; import org.apache.skywalking.oap.server.core.analysis.SourceDispatcher; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.analysis.worker.MetricsStreamProcessor; +import org.apache.skywalking.oap.server.core.source.DetectPoint; import org.apache.skywalking.oap.server.core.source.EndpointRelation; public class EndpointCallRelationDispatcher implements SourceDispatcher { @@ -36,10 +38,12 @@ public class EndpointCallRelationDispatcher implements SourceDispatcher dbMap) { EndpointRelationServerSideMetrics metrics = new EndpointRelationServerSideMetrics(); - metrics.setSourceEndpointId(((Number) dbMap.get(SOURCE_ENDPOINT_ID)).intValue()); - metrics.setDestEndpointId(((Number) dbMap.get(DEST_ENDPOINT_ID)).intValue()); + metrics.setSourceEndpoint((String) dbMap.get(SOURCE_ENDPOINT)); + metrics.setDestEndpoint((String) dbMap.get(DEST_ENDPOINT)); metrics.setComponentId(((Number) dbMap.get(COMPONENT_ID)).intValue()); metrics.setTimeBucket(((Number) dbMap.get(TIME_BUCKET)).longValue()); metrics.setEntityId((String) dbMap.get(ENTITY_ID)); @@ -201,8 +191,8 @@ public class EndpointRelationServerSideMetrics extends Metrics { @Override public Map data2Map(EndpointRelationServerSideMetrics storageData) { Map map = new HashMap<>(); - map.put(SOURCE_ENDPOINT_ID, storageData.getSourceEndpointId()); - map.put(DEST_ENDPOINT_ID, storageData.getDestEndpointId()); + map.put(SOURCE_ENDPOINT, storageData.getSourceEndpoint()); + map.put(DEST_ENDPOINT, storageData.getDestEndpoint()); map.put(COMPONENT_ID, storageData.getComponentId()); map.put(TIME_BUCKET, storageData.getTimeBucket()); map.put(ENTITY_ID, storageData.getEntityId()); diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/log/AbstractLogRecord.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/log/AbstractLogRecord.java index a11b53e255b1aebfd1359e4b58e989fa55ed04fc..a35da2ba06ab16e363a802eee11c64a64e503fad 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/log/AbstractLogRecord.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/log/AbstractLogRecord.java @@ -32,6 +32,7 @@ public abstract class AbstractLogRecord extends Record { public static final String SERVICE_ID = "service_id"; public static final String SERVICE_INSTANCE_ID = "service_instance_id"; + public static final String ENDPOINT_NAME = "endpoint_name"; public static final String ENDPOINT_ID = "endpoint_id"; public static final String TRACE_ID = "trace_id"; public static final String IS_ERROR = "is_error"; @@ -51,7 +52,11 @@ public abstract class AbstractLogRecord extends Record { @Setter @Getter @Column(columnName = ENDPOINT_ID) - private int endpointId; + private String endpointId; + @Setter + @Getter + @Column(columnName = ENDPOINT_NAME) + private String endpointName; @Setter @Getter @Column(columnName = TRACE_ID) @@ -86,7 +91,8 @@ public abstract class AbstractLogRecord extends Record { protected void map2Data(T record, Map dbMap) { record.setServiceId(((Number) dbMap.get(SERVICE_ID)).intValue()); record.setServiceInstanceId(((Number) dbMap.get(SERVICE_INSTANCE_ID)).intValue()); - record.setEndpointId(((Number) dbMap.get(ENDPOINT_ID)).intValue()); + record.setEndpointId((String) dbMap.get(ENDPOINT_ID)); + record.setEndpointName((String) dbMap.get(ENDPOINT_NAME)); record.setIsError(((Number) dbMap.get(IS_ERROR)).intValue()); record.setTraceId((String) dbMap.get(TRACE_ID)); record.setStatusCode((String) dbMap.get(STATUS_CODE)); @@ -102,6 +108,7 @@ public abstract class AbstractLogRecord extends Record { map.put(SERVICE_ID, record.getServiceId()); map.put(SERVICE_INSTANCE_ID, record.getServiceInstanceId()); map.put(ENDPOINT_ID, record.getEndpointId()); + map.put(ENDPOINT_NAME, record.getEndpointName()); map.put(TRACE_ID, record.getTraceId()); map.put(IS_ERROR, record.getIsError()); map.put(STATUS_CODE, record.getStatusCode()); diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/log/HTTPAccessLogDispatcher.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/log/HTTPAccessLogDispatcher.java index f92eced2d4cbb1012ba24cf47449fc88426a9889..0bbde3fbecf32f7b2c0d2e199710e2c82dcbcfcb 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/log/HTTPAccessLogDispatcher.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/log/HTTPAccessLogDispatcher.java @@ -32,6 +32,7 @@ public class HTTPAccessLogDispatcher implements SourceDispatcher record.setServiceId(source.getServiceId()); record.setServiceInstanceId(source.getServiceInstanceId()); record.setEndpointId(source.getEndpointId()); + record.setEndpointName(source.getEndpointName()); record.setTraceId(source.getTraceId()); record.setIsError(source.getIsError()); record.setStatusCode(source.getStatusCode()); diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/relation/service/ServiceRelationClientSideMetrics.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/relation/service/ServiceRelationClientSideMetrics.java index 7782d59c99e202ac674527b77d2a200939b90d18..cee1d36fd073afeaaa498a358003b13b7034793e 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/relation/service/ServiceRelationClientSideMetrics.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/relation/service/ServiceRelationClientSideMetrics.java @@ -71,10 +71,8 @@ public class ServiceRelationClientSideMetrics extends Metrics { } public void buildEntityId() { - String splitJointId = String.valueOf(sourceServiceId); - splitJointId += Const.ID_SPLIT + String.valueOf(destServiceId); - splitJointId += Const.ID_SPLIT + String.valueOf(componentId); - entityId = splitJointId; + entityId = RelationDefineUtil.buildEntityId( + new RelationDefineUtil.RelationDefine(sourceServiceId, destServiceId, componentId)); } @Override diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/relation/service/ServiceRelationServerSideMetrics.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/relation/service/ServiceRelationServerSideMetrics.java index bb2a562b52c2f1126fc8aecc2efca1100edf8aab..52c175b921cea49a397060501f4a8d0bacaa17d5 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/relation/service/ServiceRelationServerSideMetrics.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/relation/service/ServiceRelationServerSideMetrics.java @@ -66,15 +66,14 @@ public class ServiceRelationServerSideMetrics extends Metrics { @Override public String id() { String splitJointId = String.valueOf(getTimeBucket()); - splitJointId += Const.ID_SPLIT + RelationDefineUtil.buildEntityId(new RelationDefineUtil.RelationDefine(sourceServiceId, destServiceId, componentId)); + splitJointId += Const.ID_SPLIT + RelationDefineUtil.buildEntityId( + new RelationDefineUtil.RelationDefine(sourceServiceId, destServiceId, componentId)); return splitJointId; } public void buildEntityId() { - String splitJointId = String.valueOf(sourceServiceId); - splitJointId += Const.ID_SPLIT + String.valueOf(destServiceId); - splitJointId += Const.ID_SPLIT + String.valueOf(componentId); - entityId = splitJointId; + entityId = RelationDefineUtil.buildEntityId( + new RelationDefineUtil.RelationDefine(sourceServiceId, destServiceId, componentId)); } @Override diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/segment/SegmentRecord.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/segment/SegmentRecord.java index b5f94ccf0ce986ba3f1c0037b2b7ccc11b076a26..a36e69cf26d981731d10d4333d1d4ef57ca1c0ee 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/segment/SegmentRecord.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/manual/segment/SegmentRecord.java @@ -73,7 +73,7 @@ public class SegmentRecord extends Record { @Setter @Getter @Column(columnName = ENDPOINT_ID) - private int endpointId; + private String endpointId; @Setter @Getter @Column(columnName = START_TIME) @@ -137,7 +137,7 @@ public class SegmentRecord extends Record { record.setServiceId(((Number) dbMap.get(SERVICE_ID)).intValue()); record.setServiceInstanceId(((Number) dbMap.get(SERVICE_INSTANCE_ID)).intValue()); record.setEndpointName((String) dbMap.get(ENDPOINT_NAME)); - record.setEndpointId(((Number) dbMap.get(ENDPOINT_ID)).intValue()); + record.setEndpointId((String) dbMap.get(ENDPOINT_ID)); record.setStartTime(((Number) dbMap.get(START_TIME)).longValue()); record.setEndTime(((Number) dbMap.get(END_TIME)).longValue()); record.setLatency(((Number) dbMap.get(LATENCY)).intValue()); diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsStreamProcessor.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsStreamProcessor.java index 54c28612d2ecc8557ca735b086e949466e7e2934..6f4f6084c9dab69f2f272414fcb5a43fa264f821 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsStreamProcessor.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/worker/MetricsStreamProcessor.java @@ -113,24 +113,27 @@ public class MetricsStreamProcessor implements StreamProcessor { MetricsPersistentWorker dayPersistentWorker = null; MetricsPersistentWorker monthPersistentWorker = null; - if (configService.shouldToHour()) { - Model model = modelSetter.putIfAbsent( - metricsClass, stream.scopeId(), new Storage(stream.name(), true, true, Downsampling.Hour), false); - hourPersistentWorker = worker(moduleDefineHolder, metricsDAO, model); + MetricsTransWorker transWorker = null; + if (stream.supportDownSampling()) { + if (configService.shouldToHour()) { + Model model = modelSetter.putIfAbsent( + metricsClass, stream.scopeId(), new Storage(stream.name(), true, true, Downsampling.Hour), false); + hourPersistentWorker = worker(moduleDefineHolder, metricsDAO, model); + } + if (configService.shouldToDay()) { + Model model = modelSetter.putIfAbsent( + metricsClass, stream.scopeId(), new Storage(stream.name(), true, true, Downsampling.Day), false); + dayPersistentWorker = worker(moduleDefineHolder, metricsDAO, model); + } + if (configService.shouldToMonth()) { + Model model = modelSetter.putIfAbsent( + metricsClass, stream.scopeId(), new Storage(stream.name(), true, true, Downsampling.Month), false); + monthPersistentWorker = worker(moduleDefineHolder, metricsDAO, model); + } + + transWorker = new MetricsTransWorker( + moduleDefineHolder, stream.name(), hourPersistentWorker, dayPersistentWorker, monthPersistentWorker); } - if (configService.shouldToDay()) { - Model model = modelSetter.putIfAbsent( - metricsClass, stream.scopeId(), new Storage(stream.name(), true, true, Downsampling.Day), false); - dayPersistentWorker = worker(moduleDefineHolder, metricsDAO, model); - } - if (configService.shouldToMonth()) { - Model model = modelSetter.putIfAbsent( - metricsClass, stream.scopeId(), new Storage(stream.name(), true, true, Downsampling.Month), false); - monthPersistentWorker = worker(moduleDefineHolder, metricsDAO, model); - } - - MetricsTransWorker transWorker = new MetricsTransWorker( - moduleDefineHolder, stream.name(), hourPersistentWorker, dayPersistentWorker, monthPersistentWorker); Model model = modelSetter.putIfAbsent( metricsClass, stream.scopeId(), new Storage(stream.name(), true, true, Downsampling.Minute), false); diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cache/EndpointInventoryCache.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cache/EndpointInventoryCache.java deleted file mode 100644 index 4181a5151f8ba0a377637b5ce62f97b4abd7784b..0000000000000000000000000000000000000000 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/cache/EndpointInventoryCache.java +++ /dev/null @@ -1,108 +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 org.apache.skywalking.oap.server.core.cache; - -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import java.util.Objects; -import org.apache.skywalking.oap.server.core.Const; -import org.apache.skywalking.oap.server.core.CoreModuleConfig; -import org.apache.skywalking.oap.server.core.register.EndpointInventory; -import org.apache.skywalking.oap.server.core.storage.StorageModule; -import org.apache.skywalking.oap.server.core.storage.cache.IEndpointInventoryCacheDAO; -import org.apache.skywalking.oap.server.library.module.ModuleManager; -import org.apache.skywalking.oap.server.library.module.Service; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -public class EndpointInventoryCache implements Service { - - private static final Logger logger = LoggerFactory.getLogger(EndpointInventoryCache.class); - - private final ModuleManager moduleManager; - private final EndpointInventory userEndpoint; - private final Cache endpointNameCache; - private final Cache endpointIdCache; - - private IEndpointInventoryCacheDAO cacheDAO; - - public EndpointInventoryCache(ModuleManager moduleManager, CoreModuleConfig moduleConfig) { - this.moduleManager = moduleManager; - - this.userEndpoint = new EndpointInventory(); - this.userEndpoint.setSequence(Const.USER_ENDPOINT_ID); - this.userEndpoint.setName(Const.USER_CODE); - this.userEndpoint.setServiceId(Const.USER_SERVICE_ID); - - long initialSize = moduleConfig.getMaxSizeOfEndpointInventory() / 10L; - int initialCapacitySize = (int) (initialSize > Integer.MAX_VALUE ? Integer.MAX_VALUE : initialSize); - - endpointNameCache = CacheBuilder.newBuilder() - .initialCapacity(initialCapacitySize) - .maximumSize(moduleConfig.getMaxSizeOfEndpointInventory()) - .build(); - endpointIdCache = CacheBuilder.newBuilder() - .initialCapacity(initialCapacitySize) - .maximumSize(moduleConfig.getMaxSizeOfEndpointInventory()) - .build(); - } - - private IEndpointInventoryCacheDAO getCacheDAO() { - if (isNull(cacheDAO)) { - cacheDAO = moduleManager.find(StorageModule.NAME).provider().getService(IEndpointInventoryCacheDAO.class); - } - return cacheDAO; - } - - public int getEndpointId(int serviceId, String endpointName, int detectPoint) { - String id = EndpointInventory.buildId(serviceId, endpointName, detectPoint); - - Integer endpointId = endpointNameCache.getIfPresent(id); - - if (Objects.isNull(endpointId) || endpointId == Const.NONE) { - endpointId = getCacheDAO().getEndpointId(serviceId, endpointName, detectPoint); - if (endpointId != Const.NONE) { - endpointNameCache.put(id, endpointId); - } - } - return endpointId; - } - - public EndpointInventory get(int endpointId) { - if (Const.USER_ENDPOINT_ID == endpointId) { - return userEndpoint; - } - - EndpointInventory endpointInventory = endpointIdCache.getIfPresent(endpointId); - - if (isNull(endpointInventory)) { - endpointInventory = getCacheDAO().get(endpointId); - if (nonNull(endpointInventory)) { - endpointIdCache.put(endpointId, endpointInventory); - } else { - logger.warn("EndpointInventory id {} is not in cache and persistent storage.", endpointId); - } - } - - return endpointInventory; - } -} diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/AggregationQueryService.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/AggregationQueryService.java index 7c8d644ac27edd7f20aadf336d4258982aff2c32..b0bf8e220901cd3b06c19fc3ea8fee6387c74ed8 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/AggregationQueryService.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/AggregationQueryService.java @@ -22,12 +22,11 @@ import java.io.IOException; import java.util.List; import org.apache.skywalking.oap.server.core.CoreModule; import org.apache.skywalking.oap.server.core.analysis.Downsampling; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.cache.ServiceInstanceInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; import org.apache.skywalking.oap.server.core.query.entity.Order; import org.apache.skywalking.oap.server.core.query.entity.TopNEntity; -import org.apache.skywalking.oap.server.core.register.EndpointInventory; import org.apache.skywalking.oap.server.core.register.ServiceInstanceInventory; import org.apache.skywalking.oap.server.core.register.ServiceInventory; import org.apache.skywalking.oap.server.core.storage.StorageModule; @@ -55,8 +54,9 @@ public class AggregationQueryService implements Service { } public List getServiceTopN(final String indName, final int topN, final Downsampling downsampling, - final long startTB, final long endTB, final Order order) throws IOException { - List topNEntities = getAggregationQueryDAO().getServiceTopN(indName, ValueColumnMetadata.INSTANCE.getValueCName(indName), topN, downsampling, startTB, endTB, order); + final long startTB, final long endTB, final Order order) throws IOException { + List topNEntities = getAggregationQueryDAO().getServiceTopN( + indName, ValueColumnMetadata.INSTANCE.getValueCName(indName), topN, downsampling, startTB, endTB, order); for (TopNEntity entity : topNEntities) { ServiceInventory inventory = moduleManager.find(CoreModule.NAME) .provider() @@ -69,10 +69,15 @@ public class AggregationQueryService implements Service { return topNEntities; } - public List getAllServiceInstanceTopN(final String indName, final int topN, - final Downsampling downsampling, final long startTB, final long endTB, final Order order) throws IOException { - List topNEntities = getAggregationQueryDAO().getAllServiceInstanceTopN(indName, ValueColumnMetadata.INSTANCE - .getValueCName(indName), topN, downsampling, startTB, endTB, order); + public List getAllServiceInstanceTopN(final String indName, + final int topN, + final Downsampling downsampling, + final long startTB, + final long endTB, + final Order order) throws IOException { + List topNEntities = getAggregationQueryDAO().getAllServiceInstanceTopN( + indName, ValueColumnMetadata.INSTANCE + .getValueCName(indName), topN, downsampling, startTB, endTB, order); for (TopNEntity entity : topNEntities) { ServiceInstanceInventory inventory = moduleManager.find(CoreModule.NAME) .provider() @@ -85,10 +90,16 @@ public class AggregationQueryService implements Service { return topNEntities; } - public List getServiceInstanceTopN(final int serviceId, final String indName, final int topN, - final Downsampling downsampling, final long startTB, final long endTB, final Order order) throws IOException { - List topNEntities = getAggregationQueryDAO().getServiceInstanceTopN(serviceId, indName, ValueColumnMetadata.INSTANCE - .getValueCName(indName), topN, downsampling, startTB, endTB, order); + public List getServiceInstanceTopN(final int serviceId, + final String indName, + final int topN, + final Downsampling downsampling, + final long startTB, + final long endTB, + final Order order) throws IOException { + List topNEntities = getAggregationQueryDAO().getServiceInstanceTopN( + serviceId, indName, ValueColumnMetadata.INSTANCE + .getValueCName(indName), topN, downsampling, startTB, endTB, order); for (TopNEntity entity : topNEntities) { ServiceInstanceInventory inventory = moduleManager.find(CoreModule.NAME) .provider() @@ -101,33 +112,33 @@ public class AggregationQueryService implements Service { return topNEntities; } - public List getAllEndpointTopN(final String indName, final int topN, final Downsampling downsampling, - final long startTB, final long endTB, final Order order) throws IOException { - List topNEntities = getAggregationQueryDAO().getAllEndpointTopN(indName, ValueColumnMetadata.INSTANCE.getValueCName(indName), topN, downsampling, startTB, endTB, order); + public List getAllEndpointTopN(final String indName, + final int topN, + final Downsampling downsampling, + final long startTB, + final long endTB, + final Order order) throws IOException { + List topNEntities = getAggregationQueryDAO().getAllEndpointTopN( + indName, ValueColumnMetadata.INSTANCE.getValueCName(indName), topN, downsampling, startTB, endTB, order); + for (TopNEntity entity : topNEntities) { - EndpointInventory inventory = moduleManager.find(CoreModule.NAME) - .provider() - .getService(EndpointInventoryCache.class) - .get(Integer.parseInt(entity.getId())); - if (inventory != null) { - entity.setName(inventory.getName()); - } + entity.setName(EndpointTraffic.splitID(entity.getId()).getEndpointName()); } return topNEntities; } - public List getEndpointTopN(final int serviceId, final String indName, final int topN, - final Downsampling downsampling, final long startTB, final long endTB, final Order order) throws IOException { - List topNEntities = getAggregationQueryDAO().getEndpointTopN(serviceId, indName, ValueColumnMetadata.INSTANCE - .getValueCName(indName), topN, downsampling, startTB, endTB, order); + public List getEndpointTopN(final int serviceId, + final String indName, + final int topN, + final Downsampling downsampling, + final long startTB, + final long endTB, + final Order order) throws IOException { + List topNEntities = getAggregationQueryDAO().getEndpointTopN( + serviceId, indName, ValueColumnMetadata.INSTANCE + .getValueCName(indName), topN, downsampling, startTB, endTB, order); for (TopNEntity entity : topNEntities) { - EndpointInventory inventory = moduleManager.find(CoreModule.NAME) - .provider() - .getService(EndpointInventoryCache.class) - .get(Integer.parseInt(entity.getId())); - if (inventory != null) { - entity.setName(inventory.getName()); - } + entity.setName(EndpointTraffic.splitID(entity.getId()).getEndpointName()); } return topNEntities; } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/LogQueryService.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/LogQueryService.java index 13b8631512ef32b4a3ba68e64c689707b6eafa3b..1444a76b9daf6fa55c7b46d598d8cb73bd27c4f8 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/LogQueryService.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/LogQueryService.java @@ -21,7 +21,6 @@ package org.apache.skywalking.oap.server.core.query; import java.io.IOException; import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.CoreModule; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInstanceInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; import org.apache.skywalking.oap.server.core.query.entity.LogState; @@ -38,7 +37,6 @@ public class LogQueryService implements Service { private ILogQueryDAO logQueryDAO; private ServiceInventoryCache serviceInventoryCache; private ServiceInstanceInventoryCache serviceInstanceInventoryCache; - private EndpointInventoryCache endpointInventoryCache; public LogQueryService(ModuleManager moduleManager) { this.moduleManager = moduleManager; @@ -69,21 +67,21 @@ public class LogQueryService implements Service { return serviceInstanceInventoryCache; } - private EndpointInventoryCache getEndpointInventoryCache() { - if (endpointInventoryCache == null) { - this.endpointInventoryCache = moduleManager.find(CoreModule.NAME) - .provider() - .getService(EndpointInventoryCache.class); - } - return endpointInventoryCache; - } - - public Logs queryLogs(final String metricName, int serviceId, int serviceInstanceId, int endpointId, String traceId, - LogState state, String stateCode, Pagination paging, final long startTB, final long endTB) throws IOException { + public Logs queryLogs(final String metricName, + int serviceId, + int serviceInstanceId, + String endpointId, + String traceId, + LogState state, + String stateCode, + Pagination paging, + final long startTB, + final long endTB) throws IOException { PaginationUtils.Page page = PaginationUtils.INSTANCE.exchange(paging); - Logs logs = getLogQueryDAO().queryLogs(metricName, serviceId, serviceInstanceId, endpointId, traceId, state, stateCode, paging, page - .getFrom(), page.getLimit(), startTB, endTB); + Logs logs = getLogQueryDAO().queryLogs( + metricName, serviceId, serviceInstanceId, endpointId, traceId, state, stateCode, paging, page + .getFrom(), page.getLimit(), startTB, endTB); logs.getLogs().forEach(log -> { if (log.getServiceId() != Const.NONE) { log.setServiceName(getServiceInventoryCache().get(log.getServiceId()).getName()); @@ -92,9 +90,7 @@ public class LogQueryService implements Service { log.setServiceInstanceName(getServiceInstanceInventoryCache().get(log.getServiceInstanceId()) .getName()); } - if (log.getEndpointId() != Const.NONE) { - log.setEndpointName(getEndpointInventoryCache().get(log.getEndpointId()).getName()); - } + log.setEndpointId(log.getEndpointId()); }); return logs; } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/MetadataQueryService.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/MetadataQueryService.java index bae70a7bc3ea3958717ec1825428c0491fd69845..28af1e5f276a0427def1566bb6b0742994144809 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/MetadataQueryService.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/MetadataQueryService.java @@ -21,7 +21,7 @@ package org.apache.skywalking.oap.server.core.query; import java.io.IOException; import java.util.List; import org.apache.skywalking.oap.server.core.CoreModule; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; import org.apache.skywalking.oap.server.core.query.entity.ClusterBrief; import org.apache.skywalking.oap.server.core.query.entity.Database; @@ -29,7 +29,6 @@ import org.apache.skywalking.oap.server.core.query.entity.Endpoint; import org.apache.skywalking.oap.server.core.query.entity.EndpointInfo; import org.apache.skywalking.oap.server.core.query.entity.Service; import org.apache.skywalking.oap.server.core.query.entity.ServiceInstance; -import org.apache.skywalking.oap.server.core.register.EndpointInventory; import org.apache.skywalking.oap.server.core.register.NodeType; import org.apache.skywalking.oap.server.core.storage.StorageModule; import org.apache.skywalking.oap.server.core.storage.query.IMetadataQueryDAO; @@ -40,7 +39,6 @@ public class MetadataQueryService implements org.apache.skywalking.oap.server.li private final ModuleManager moduleManager; private IMetadataQueryDAO metadataQueryDAO; private ServiceInventoryCache serviceInventoryCache; - private EndpointInventoryCache endpointInventoryCache; public MetadataQueryService(ModuleManager moduleManager) { this.moduleManager = moduleManager; @@ -62,15 +60,6 @@ public class MetadataQueryService implements org.apache.skywalking.oap.server.li return serviceInventoryCache; } - private EndpointInventoryCache getEndpointInventoryCache() { - if (endpointInventoryCache == null) { - endpointInventoryCache = moduleManager.find(CoreModule.NAME) - .provider() - .getService(EndpointInventoryCache.class); - } - return endpointInventoryCache; - } - public ClusterBrief getGlobalBrief(final long startTimestamp, final long endTimestamp) throws IOException { ClusterBrief clusterBrief = new ClusterBrief(); clusterBrief.setNumOfService(getMetadataQueryDAO().numOfService(startTimestamp, endTimestamp)); @@ -94,17 +83,17 @@ public class MetadataQueryService implements org.apache.skywalking.oap.server.li } public List searchServices(final long startTimestamp, final long endTimestamp, - final String keyword) throws IOException { + final String keyword) throws IOException { return getMetadataQueryDAO().searchServices(startTimestamp, endTimestamp, keyword); } public List getServiceInstances(final long startTimestamp, final long endTimestamp, - final String serviceId) throws IOException { + final String serviceId) throws IOException { return getMetadataQueryDAO().getServiceInstances(startTimestamp, endTimestamp, serviceId); } - public List searchEndpoint(final String keyword, final String serviceId, - final int limit) throws IOException { + public List searchEndpoint(final String keyword, final int serviceId, + final int limit) throws IOException { return getMetadataQueryDAO().searchEndpoint(keyword, serviceId, limit); } @@ -112,14 +101,15 @@ public class MetadataQueryService implements org.apache.skywalking.oap.server.li return getMetadataQueryDAO().searchService(serviceCode); } - public EndpointInfo getEndpointInfo(final int endpointId) throws IOException { - EndpointInventory endpointInventory = getEndpointInventoryCache().get(endpointId); + public EndpointInfo getEndpointInfo(final String endpointId) throws IOException { + final EndpointTraffic.EndpointID endpointID = EndpointTraffic.splitID(endpointId); + int serviceId = endpointID.getServiceId(); EndpointInfo endpointInfo = new EndpointInfo(); - endpointInfo.setId(endpointInventory.getSequence()); - endpointInfo.setName(endpointInventory.getName()); - endpointInfo.setServiceId(endpointInventory.getServiceId()); - endpointInfo.setServiceName(getServiceInventoryCache().get(endpointInventory.getServiceId()).getName()); + endpointInfo.setId(endpointId); + endpointInfo.setName(endpointID.getEndpointName()); + endpointInfo.setServiceId(serviceId); + endpointInfo.setServiceName(getServiceInventoryCache().get(serviceId).getName()); return endpointInfo; } } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/ProfileTaskQueryService.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/ProfileTaskQueryService.java index 156e88f33fe05cef5634138c2d34906cdc1f6814..dcc10e846aacc2e71c91626ce2a0c224b6a02f8c 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/ProfileTaskQueryService.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/ProfileTaskQueryService.java @@ -24,13 +24,10 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; - import org.apache.skywalking.apm.network.language.agent.v2.SegmentObject; -import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.CoreModule; import org.apache.skywalking.oap.server.core.CoreModuleConfig; import org.apache.skywalking.oap.server.core.analysis.manual.segment.SegmentRecord; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; import org.apache.skywalking.oap.server.core.cache.NetworkAddressInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInstanceInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; @@ -45,7 +42,6 @@ import org.apache.skywalking.oap.server.core.query.entity.ProfileTask; import org.apache.skywalking.oap.server.core.query.entity.ProfileTaskLog; import org.apache.skywalking.oap.server.core.query.entity.ProfiledSegment; import org.apache.skywalking.oap.server.core.query.entity.ProfiledSpan; -import org.apache.skywalking.oap.server.core.register.EndpointInventory; import org.apache.skywalking.oap.server.core.register.ServiceInstanceInventory; import org.apache.skywalking.oap.server.core.register.ServiceInventory; import org.apache.skywalking.oap.server.core.storage.StorageModule; @@ -57,7 +53,6 @@ import org.apache.skywalking.oap.server.library.module.Service; import org.apache.skywalking.oap.server.library.util.CollectionUtils; import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; /** * handle profile task queries @@ -71,13 +66,15 @@ public class ProfileTaskQueryService implements Service { private ServiceInstanceInventoryCache serviceInstanceInventoryCache; private NetworkAddressInventoryCache networkAddressInventoryCache; private IComponentLibraryCatalogService componentLibraryCatalogService; - private EndpointInventoryCache endpointInventoryCache; private final ProfileAnalyzer profileAnalyzer; public ProfileTaskQueryService(ModuleManager moduleManager, CoreModuleConfig moduleConfig) { this.moduleManager = moduleManager; - this.profileAnalyzer = new ProfileAnalyzer(moduleManager, moduleConfig.getMaxPageSizeOfQueryProfileSnapshot(), moduleConfig.getMaxSizeOfAnalyzeProfileSnapshot()); + this.profileAnalyzer = new ProfileAnalyzer( + moduleManager, moduleConfig.getMaxPageSizeOfQueryProfileSnapshot(), + moduleConfig.getMaxSizeOfAnalyzeProfileSnapshot() + ); } private IProfileTaskQueryDAO getProfileTaskDAO() { @@ -143,15 +140,6 @@ public class ProfileTaskQueryService implements Service { return componentLibraryCatalogService; } - private EndpointInventoryCache getEndpointInventoryCache() { - if (endpointInventoryCache == null) { - this.endpointInventoryCache = moduleManager.find(CoreModule.NAME) - .provider() - .getService(EndpointInventoryCache.class); - } - return endpointInventoryCache; - } - /** * search profile task list * @@ -180,7 +168,8 @@ public class ProfileTaskQueryService implements Service { // filter all task logs task.setLogs(taskLogList.stream().filter(l -> Objects.equal(l.getTaskId(), task.getId())).map(l -> { // get instance name from cache - final ServiceInstanceInventory instanceInventory = serviceInstanceInventoryCache.get(l.getInstanceId()); + final ServiceInstanceInventory instanceInventory = serviceInstanceInventoryCache.get( + l.getInstanceId()); if (instanceInventory != null) { l.setInstanceName(instanceInventory.getName()); } @@ -199,7 +188,8 @@ public class ProfileTaskQueryService implements Service { return getProfileThreadSnapshotQueryDAO().queryProfiledSegments(taskId); } - public ProfileAnalyzation getProfileAnalyze(final String segmentId, final List timeRanges) throws IOException { + public ProfileAnalyzation getProfileAnalyze(final String segmentId, + final List timeRanges) throws IOException { return profileAnalyzer.analyze(segmentId, timeRanges); } @@ -228,6 +218,7 @@ public class ProfileTaskQueryService implements Service { span.setError(spanObject.getIsError()); span.setLayer(spanObject.getSpanLayer().name()); span.setType(spanObject.getSpanType().name()); + span.setEndpointName(spanObject.getOperationName()); if (spanObject.getPeerId() == 0) { span.setPeer(spanObject.getPeer()); @@ -235,17 +226,6 @@ public class ProfileTaskQueryService implements Service { span.setPeer(getNetworkAddressInventoryCache().get(spanObject.getPeerId()).getName()); } - String endpointName = spanObject.getOperationName(); - if (spanObject.getOperationNameId() != 0) { - EndpointInventory endpointInventory = getEndpointInventoryCache().get(spanObject.getOperationNameId()); - if (nonNull(endpointInventory)) { - endpointName = endpointInventory.getName(); - } else { - endpointName = Const.EMPTY_STRING; - } - } - span.setEndpointName(endpointName); - final ServiceInventory serviceInventory = getServiceInventoryCache().get(segmentObject.getServiceId()); if (serviceInventory != null) { span.setServiceCode(serviceInventory.getName()); diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/ServiceInstanceTopologyBuilder.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/ServiceInstanceTopologyBuilder.java index 486f486e1987805b986f4c2449366f017b05ebf8..895b725f1f2b97f75189a78969b21a50bdb5f603 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/ServiceInstanceTopologyBuilder.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/ServiceInstanceTopologyBuilder.java @@ -60,16 +60,14 @@ public class ServiceInstanceTopologyBuilder { ServiceInstanceTopology build(List serviceInstanceRelationClientCalls, List serviceInstanceRelationServerCalls) { - filterZeroSourceOrTargetReference(serviceInstanceRelationClientCalls); - filterZeroSourceOrTargetReference(serviceInstanceRelationServerCalls); Map nodes = new HashMap<>(); List calls = new LinkedList<>(); HashMap callMap = new HashMap<>(); for (Call.CallDetail clientCall : serviceInstanceRelationClientCalls) { - ServiceInstanceInventory sourceInstance = serviceInstanceInventoryCache.get(clientCall.getSource()); - ServiceInstanceInventory targetInstance = serviceInstanceInventoryCache.get(clientCall.getTarget()); + ServiceInstanceInventory sourceInstance = serviceInstanceInventoryCache.get(Integer.parseInt(clientCall.getSource())); + ServiceInstanceInventory targetInstance = serviceInstanceInventoryCache.get(Integer.parseInt(clientCall.getTarget())); if (isNull(sourceInstance) || isNull(targetInstance)) { continue; @@ -113,8 +111,8 @@ public class ServiceInstanceTopologyBuilder { } for (Call.CallDetail serverCall : serviceInstanceRelationServerCalls) { - ServiceInstanceInventory sourceInstance = serviceInstanceInventoryCache.get(serverCall.getSource()); - ServiceInstanceInventory targetInstance = serviceInstanceInventoryCache.get(serverCall.getTarget()); + ServiceInstanceInventory sourceInstance = serviceInstanceInventoryCache.get(Integer.parseInt(serverCall.getSource())); + ServiceInstanceInventory targetInstance = serviceInstanceInventoryCache.get(Integer.parseInt(serverCall.getTarget())); if (isNull(sourceInstance) || isNull(targetInstance)) { continue; @@ -202,13 +200,4 @@ public class ServiceInstanceTopologyBuilder { } return instanceNode; } - - private void filterZeroSourceOrTargetReference(List serviceRelationClientCalls) { - for (int i = serviceRelationClientCalls.size() - 1; i >= 0; i--) { - Call.CallDetail call = serviceRelationClientCalls.get(i); - if (call.getSource() == 0 || call.getTarget() == 0) { - serviceRelationClientCalls.remove(i); - } - } - } } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/TopologyBuilder.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/TopologyBuilder.java index 8aeb8ad11b56a2976c5e17a7ea16bd1368cec8e2..2c6ad73374e51f98026dc51bf337cd336d128a4a 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/TopologyBuilder.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/TopologyBuilder.java @@ -55,16 +55,14 @@ class TopologyBuilder { } Topology build(List serviceRelationClientCalls, List serviceRelationServerCalls) { - filterZeroSourceOrTargetReference(serviceRelationClientCalls); - filterZeroSourceOrTargetReference(serviceRelationServerCalls); Map nodes = new HashMap<>(); List calls = new LinkedList<>(); HashMap callMap = new HashMap<>(); for (Call.CallDetail clientCall : serviceRelationClientCalls) { - ServiceInventory source = serviceInventoryCache.get(clientCall.getSource()); - ServiceInventory target = serviceInventoryCache.get(clientCall.getTarget()); + ServiceInventory source = serviceInventoryCache.get(Integer.parseInt(clientCall.getSource())); + ServiceInventory target = serviceInventoryCache.get(Integer.parseInt(clientCall.getTarget())); if (isNull(source) || isNull(target)) { continue; @@ -107,8 +105,8 @@ class TopologyBuilder { } for (Call.CallDetail serverCall : serviceRelationServerCalls) { - ServiceInventory source = serviceInventoryCache.get(serverCall.getSource()); - ServiceInventory target = serviceInventoryCache.get(serverCall.getTarget()); + ServiceInventory source = serviceInventoryCache.get(Integer.parseInt(serverCall.getSource())); + ServiceInventory target = serviceInventoryCache.get(Integer.parseInt(serverCall.getTarget())); if (isNull(source) || isNull(target)) { continue; @@ -117,7 +115,7 @@ class TopologyBuilder { if (source.getSequence() == Const.USER_SERVICE_ID) { if (!nodes.containsKey(source.getSequence())) { Node visualUserNode = new Node(); - visualUserNode.setId(source.getSequence()); + visualUserNode.setId(String.valueOf(source.getSequence())); visualUserNode.setName(Const.USER_CODE); visualUserNode.setType(Const.USER_CODE.toUpperCase()); visualUserNode.setReal(false); @@ -128,7 +126,7 @@ class TopologyBuilder { if (BooleanUtils.valueToBoolean(source.getIsAddress())) { if (!nodes.containsKey(source.getSequence())) { Node conjecturalNode = new Node(); - conjecturalNode.setId(source.getSequence()); + conjecturalNode.setId(String.valueOf(source.getSequence())); conjecturalNode.setName(source.getName()); conjecturalNode.setType( componentLibraryCatalogService.getServerNameBasedOnComponent(serverCall.getComponentId())); @@ -178,7 +176,7 @@ class TopologyBuilder { private Node buildNode(ServiceInventory serviceInventory) { Node serviceNode = new Node(); - serviceNode.setId(serviceInventory.getSequence()); + serviceNode.setId(String.valueOf(serviceInventory.getSequence())); serviceNode.setName(serviceInventory.getName()); if (BooleanUtils.valueToBoolean(serviceInventory.getIsAddress())) { serviceNode.setReal(false); @@ -187,13 +185,4 @@ class TopologyBuilder { } return serviceNode; } - - private void filterZeroSourceOrTargetReference(List serviceRelationClientCalls) { - for (int i = serviceRelationClientCalls.size() - 1; i >= 0; i--) { - Call.CallDetail call = serviceRelationClientCalls.get(i); - if (call.getSource() == 0 || call.getTarget() == 0) { - serviceRelationClientCalls.remove(i); - } - } - } } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/TopologyQueryService.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/TopologyQueryService.java index 980a577f0f65dd80cfe1e0de88b05835e5e2fe84..c5db93b8896bf610c9f63bf023910fb49d477c53 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/TopologyQueryService.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/TopologyQueryService.java @@ -27,7 +27,7 @@ import java.util.Set; import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.CoreModule; import org.apache.skywalking.oap.server.core.analysis.Downsampling; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.config.IComponentLibraryCatalogService; import org.apache.skywalking.oap.server.core.query.entity.Call; import org.apache.skywalking.oap.server.core.query.entity.Node; @@ -50,7 +50,6 @@ public class TopologyQueryService implements Service { private final ModuleManager moduleManager; private ITopologyQueryDAO topologyQueryDAO; private IMetadataQueryDAO metadataQueryDAO; - private EndpointInventoryCache endpointInventoryCache; private IComponentLibraryCatalogService componentLibraryCatalogService; public TopologyQueryService(ModuleManager moduleManager) { @@ -80,15 +79,6 @@ public class TopologyQueryService implements Service { return componentLibraryCatalogService; } - private EndpointInventoryCache getEndpointInventoryCache() { - if (endpointInventoryCache == null) { - endpointInventoryCache = moduleManager.find(CoreModule.NAME) - .provider() - .getService(EndpointInventoryCache.class); - } - return endpointInventoryCache; - } - public Topology getGlobalTopology(final Downsampling downsampling, final long startTB, final long endTB) throws IOException { logger.debug("Downsampling: {}, startTimeBucket: {}, endTimeBucket: {}", downsampling, startTB, endTB); @@ -121,7 +111,7 @@ public class TopologyQueryService implements Service { // Client side relationships exclude the given services(#serviceIds) // The given services(#serviceIds)'s component names have been included inside `serviceRelationServerCalls` if (!serviceIds.contains(call.getSource())) { - outScopeSourceServiceIds.add(call.getSource()); + outScopeSourceServiceIds.add(Integer.parseInt(call.getSource())); } }); if (CollectionUtils.isNotEmpty(outScopeSourceServiceIds)) { @@ -131,7 +121,7 @@ public class TopologyQueryService implements Service { topology.getNodes().forEach(node -> { if (Strings.isNullOrEmpty(node.getType())) { for (Call.CallDetail call : sourceCalls) { - if (node.getId() == call.getTarget()) { + if (node.getId().equals(call.getTarget())) { node.setType(getComponentLibraryCatalogService().getComponentName(call.getComponentId())); break; } @@ -163,7 +153,7 @@ public class TopologyQueryService implements Service { } public Topology getEndpointTopology(final Downsampling downsampling, final long startTB, final long endTB, - final int endpointId) throws IOException { + final String endpointId) throws IOException { List serverSideCalls = getTopologyQueryDAO().loadSpecifiedDestOfServerSideEndpointRelations( downsampling, startTB, endTB, endpointId); @@ -177,7 +167,7 @@ public class TopologyQueryService implements Service { topology.getCalls().add(call); }); - Set nodeIds = new HashSet<>(); + Set nodeIds = new HashSet<>(); serverSideCalls.forEach(call -> { if (!nodeIds.contains(call.getSource())) { topology.getNodes().add(buildEndpointNode(call.getSource())); @@ -192,10 +182,11 @@ public class TopologyQueryService implements Service { return topology; } - private Node buildEndpointNode(int endpointId) { + private Node buildEndpointNode(String endpointId) { Node node = new Node(); node.setId(endpointId); - node.setName(getEndpointInventoryCache().get(endpointId).getName()); + final EndpointTraffic.EndpointID endpointID = EndpointTraffic.splitID(endpointId); + node.setName(endpointID.getEndpointName()); node.setType(Const.EMPTY_STRING); node.setReal(true); return node; diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/TraceQueryService.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/TraceQueryService.java index a04347c8cd5256cc98d08e72503df4d060cee6b9..940938bef25a12ac2157f6d912dc6968c289102a 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/TraceQueryService.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/TraceQueryService.java @@ -30,7 +30,6 @@ import org.apache.skywalking.apm.network.language.agent.v2.SpanObjectV2; import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.CoreModule; import org.apache.skywalking.oap.server.core.analysis.manual.segment.SegmentRecord; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; import org.apache.skywalking.oap.server.core.cache.NetworkAddressInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; import org.apache.skywalking.oap.server.core.config.IComponentLibraryCatalogService; @@ -44,7 +43,6 @@ import org.apache.skywalking.oap.server.core.query.entity.Span; import org.apache.skywalking.oap.server.core.query.entity.Trace; import org.apache.skywalking.oap.server.core.query.entity.TraceBrief; import org.apache.skywalking.oap.server.core.query.entity.TraceState; -import org.apache.skywalking.oap.server.core.register.EndpointInventory; import org.apache.skywalking.oap.server.core.register.ServiceInventory; import org.apache.skywalking.oap.server.core.storage.StorageModule; import org.apache.skywalking.oap.server.core.storage.query.ITraceQueryDAO; @@ -59,7 +57,6 @@ public class TraceQueryService implements Service { private final ModuleManager moduleManager; private ITraceQueryDAO traceQueryDAO; private ServiceInventoryCache serviceInventoryCache; - private EndpointInventoryCache endpointInventoryCache; private NetworkAddressInventoryCache networkAddressInventoryCache; private IComponentLibraryCatalogService componentLibraryCatalogService; @@ -83,15 +80,6 @@ public class TraceQueryService implements Service { return serviceInventoryCache; } - private EndpointInventoryCache getEndpointInventoryCache() { - if (endpointInventoryCache == null) { - this.endpointInventoryCache = moduleManager.find(CoreModule.NAME) - .provider() - .getService(EndpointInventoryCache.class); - } - return endpointInventoryCache; - } - private NetworkAddressInventoryCache getNetworkAddressInventoryCache() { if (networkAddressInventoryCache == null) { this.networkAddressInventoryCache = moduleManager.find(CoreModule.NAME) @@ -110,14 +98,25 @@ public class TraceQueryService implements Service { return componentLibraryCatalogService; } - public TraceBrief queryBasicTraces(final int serviceId, final int serviceInstanceId, final int endpointId, - final String traceId, final String endpointName, final int minTraceDuration, int maxTraceDuration, - final TraceState traceState, final QueryOrder queryOrder, final Pagination paging, final long startTB, - final long endTB) throws IOException { + public TraceBrief queryBasicTraces(final int serviceId, + final int serviceInstanceId, + final String endpointId, + final String traceId, + final String endpointName, + final int minTraceDuration, + int maxTraceDuration, + final TraceState traceState, + final QueryOrder queryOrder, + final Pagination paging, + final long startTB, + final long endTB) throws IOException { PaginationUtils.Page page = PaginationUtils.INSTANCE.exchange(paging); - return getTraceQueryDAO().queryBasicTraces(startTB, endTB, minTraceDuration, maxTraceDuration, endpointName, serviceId, serviceInstanceId, endpointId, traceId, page - .getLimit(), page.getFrom(), traceState, queryOrder); + return getTraceQueryDAO().queryBasicTraces( + startTB, endTB, minTraceDuration, maxTraceDuration, endpointName, serviceId, serviceInstanceId, endpointId, + traceId, page + .getLimit(), page.getFrom(), traceState, queryOrder + ); } public Trace queryTrace(final String traceId) throws IOException { @@ -131,7 +130,9 @@ public class TraceQueryService implements Service { if (nonNull(segment)) { SegmentObject segmentObject = SegmentObject.parseFrom(segment.getDataBinary()); trace.getSpans() - .addAll(buildSpanV2List(traceId, segment.getSegmentId(), segment.getServiceId(), segmentObject.getSpansList())); + .addAll(buildSpanV2List(traceId, segment.getSegmentId(), segment.getServiceId(), + segmentObject.getSpansList() + )); } } } @@ -156,7 +157,7 @@ public class TraceQueryService implements Service { } private List buildSpanV2List(String traceId, String segmentId, int serviceId, - List spanObjects) { + List spanObjects) { List spans = new ArrayList<>(); spanObjects.forEach(spanObject -> { @@ -183,16 +184,7 @@ public class TraceQueryService implements Service { span.setPeer(getNetworkAddressInventoryCache().get(spanObject.getPeerId()).getName()); } - String endpointName = spanObject.getOperationName(); - if (spanObject.getOperationNameId() != 0) { - EndpointInventory endpointInventory = getEndpointInventoryCache().get(spanObject.getOperationNameId()); - if (nonNull(endpointInventory)) { - endpointName = endpointInventory.getName(); - } else { - endpointName = Const.EMPTY_STRING; - } - } - span.setEndpointName(endpointName); + span.setEndpointName(spanObject.getOperationName()); final ServiceInventory serviceInventory = getServiceInventoryCache().get(serviceId); if (serviceInventory != null) { @@ -228,7 +220,8 @@ public class TraceQueryService implements Service { .collect(Collectors.joining(".")); ref.setParentSegmentId(parentSegmentId); - span.setSegmentParentSpanId(ref.getParentSegmentId() + Const.SEGMENT_SPAN_SPLIT + ref.getParentSpanId()); + span.setSegmentParentSpanId( + ref.getParentSegmentId() + Const.SEGMENT_SPAN_SPLIT + ref.getParentSpanId()); span.getRefs().add(ref); }); diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/Call.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/Call.java index e54f9a5b371ab5f6e407f06bd4354fe5bdf917e9..4f1da3d814082684c45d021e88a51c842ffdfde2 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/Call.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/Call.java @@ -29,8 +29,8 @@ import org.apache.skywalking.oap.server.core.source.DetectPoint; @Getter @Setter public class Call { - private Integer source; - private Integer target; + private String source; + private String target; private List sourceComponents; private List targetComponents; private String id; @@ -45,11 +45,11 @@ public class Call { detectPoints = new ArrayList<>(); } - public void setSource(int source) { + public void setSource(String source) { this.source = source; } - public void setTarget(int target) { + public void setTarget(String target) { this.target = target; } @@ -84,8 +84,8 @@ public class Call { public static class CallDetail { @Setter(AccessLevel.PRIVATE) private String id; - private Integer source; - private Integer target; + private String source; + private String target; private DetectPoint detectPoint; private Integer componentId; diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/Endpoint.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/Endpoint.java index dc8696ccc0aa25c573c746cf4adb86dd2ab57001..73e5cf878b30945855f1f456776af72eabd548d0 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/Endpoint.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/Endpoint.java @@ -24,6 +24,6 @@ import lombok.Setter; @Getter @Setter public class Endpoint { - private int id; + private String id; private String name; } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/EndpointInfo.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/EndpointInfo.java index e9981f5f51aacebb2922575d64d910eae56f7d09..4554dde91e83208db247c1f74648dc9e9c54706f 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/EndpointInfo.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/EndpointInfo.java @@ -24,7 +24,7 @@ import lombok.Setter; @Getter @Setter public class EndpointInfo { - private int id; + private String id; private String name; private int serviceId; private String serviceName; diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/Log.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/Log.java index a0192f6f4434dd0e4bc9abdf024b45e0e3e0aedb..b570cb32840f0cea76fa0e6530e940a5119f793c 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/Log.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/Log.java @@ -28,8 +28,8 @@ public class Log { private int serviceId; private String serviceInstanceName; private int serviceInstanceId; + private String endpointId; private String endpointName; - private int endpointId; private String traceId; private String timestamp; private boolean isError; diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/Node.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/Node.java index 4ee3afe68ea32e68e395e72bf1d3679fb7a5a6b2..906a063852a1fd0ca723f4907466be1294093209 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/Node.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/entity/Node.java @@ -24,7 +24,7 @@ import lombok.Setter; @Getter @Setter public class Node { - private int id; + private String id; private String name; private String type; private boolean isReal; diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/EndpointInventoryRegister.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/EndpointInventoryRegister.java deleted file mode 100644 index 330ee651796b907a882f0910e2666bb8fbd1e16c..0000000000000000000000000000000000000000 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/register/service/EndpointInventoryRegister.java +++ /dev/null @@ -1,87 +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 org.apache.skywalking.oap.server.core.register.service; - -import java.util.Objects; -import org.apache.skywalking.oap.server.core.Const; -import org.apache.skywalking.oap.server.core.CoreModule; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; -import org.apache.skywalking.oap.server.core.register.EndpointInventory; -import org.apache.skywalking.oap.server.core.register.worker.InventoryStreamProcessor; -import org.apache.skywalking.oap.server.core.source.DetectPoint; -import org.apache.skywalking.oap.server.library.module.ModuleDefineHolder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static java.util.Objects.isNull; - -public class EndpointInventoryRegister implements IEndpointInventoryRegister { - - private static final Logger logger = LoggerFactory.getLogger(EndpointInventoryRegister.class); - - private final ModuleDefineHolder moduleDefineHolder; - private EndpointInventoryCache cacheService; - - public EndpointInventoryRegister(ModuleDefineHolder moduleDefineHolder) { - this.moduleDefineHolder = moduleDefineHolder; - } - - private EndpointInventoryCache getCacheService() { - if (isNull(cacheService)) { - cacheService = moduleDefineHolder.find(CoreModule.NAME).provider().getService(EndpointInventoryCache.class); - } - return cacheService; - } - - @Override - public int getOrCreate(int serviceId, String endpointName, DetectPoint detectPoint) { - int endpointId = getCacheService().getEndpointId(serviceId, endpointName, detectPoint.ordinal()); - - if (endpointId == Const.NONE) { - EndpointInventory endpointInventory = new EndpointInventory(); - endpointInventory.setServiceId(serviceId); - endpointInventory.setName(endpointName); - endpointInventory.setDetectPoint(detectPoint.ordinal()); - - long now = System.currentTimeMillis(); - endpointInventory.setRegisterTime(now); - endpointInventory.setHeartbeatTime(now); - - InventoryStreamProcessor.getInstance().in(endpointInventory); - } - return endpointId; - } - - @Override - public int get(int serviceId, String endpointName, DetectPoint detectPoint) { - return getCacheService().getEndpointId(serviceId, endpointName, detectPoint.ordinal()); - } - - @Override - public void heartbeat(int endpointId, long heartBeatTime) { - EndpointInventory endpointInventory = getCacheService().get(endpointId); - if (Objects.nonNull(endpointInventory)) { - endpointInventory.setHeartbeatTime(heartBeatTime); - - InventoryStreamProcessor.getInstance().in(endpointInventory); - } else { - logger.warn("Endpoint {} heartbeat, but not found in storage.", endpointId); - } - } -} diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/AbstractLog.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/AbstractLog.java index c91002b7f610266ee9ff0ac1391753a3bc3b7934..165e2d16852c88df8c5765c6f06dba5525dc5880 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/AbstractLog.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/AbstractLog.java @@ -30,7 +30,8 @@ public abstract class AbstractLog extends Source { private long timestamp; private int serviceId; private int serviceInstanceId; - private int endpointId; + private String endpointId; + private String endpointName; private String traceId; private int isError; private String statusCode; diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DefaultScopeDefine.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DefaultScopeDefine.java index f6314b231e9af347c6c5a7eef903f67e08650a0a..bfc8f5d70c5238068a8974171512b398a2e43573 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DefaultScopeDefine.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DefaultScopeDefine.java @@ -54,7 +54,7 @@ public class DefaultScopeDefine { public static final int ALARM = 13; public static final int SERVICE_INVENTORY = 14; public static final int SERVICE_INSTANCE_INVENTORY = 15; - public static final int ENDPOINT_INVENTORY = 16; + public static final int ENDPOINT_TRAFFIC = 16; public static final int DATABASE_ACCESS = 17; public static final int DATABASE_SLOW_STATEMENT = 18; public static final int SERVICE_INSTANCE_CLR_CPU = 19; diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DetectPoint.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DetectPoint.java index 9e405128960ce99f13fdf723569094276f749101..e5d38d3d052133d597fe35bc42ff41b3b23671a4 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DetectPoint.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/DetectPoint.java @@ -18,10 +18,14 @@ package org.apache.skywalking.oap.server.core.source; +import lombok.RequiredArgsConstructor; import org.apache.skywalking.apm.network.language.agent.SpanType; +@RequiredArgsConstructor public enum DetectPoint { - SERVER, CLIENT, PROXY, UNRECOGNIZED; + SERVER(0), CLIENT(1), PROXY(2), UNRECOGNIZED(3); + + private final int value; public static DetectPoint fromSpanType(SpanType spanType) { switch (spanType) { @@ -36,17 +40,20 @@ public enum DetectPoint { } } - public static DetectPoint fromNetworkProtocolDetectPoint( - org.apache.skywalking.apm.network.common.DetectPoint detectPoint) { - switch (detectPoint) { - case client: - return CLIENT; - case server: + public static DetectPoint valueOf(int value) { + switch (value) { + case 0: return SERVER; - case proxy: - case UNRECOGNIZED: + case 1: + return CLIENT; + case 2: + return PROXY; default: return UNRECOGNIZED; } } + + public int value() { + return this.value; + } } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/Endpoint.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/Endpoint.java index 370907b62e85b408d51c6fdfa74d8def6a96f0a4..821f768c5408563bcedc6bff9f103e84d840c055 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/Endpoint.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/Endpoint.java @@ -20,6 +20,7 @@ package org.apache.skywalking.oap.server.core.source; import lombok.Getter; import lombok.Setter; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.ENDPOINT; import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.ENDPOINT_CATALOG_NAME; @@ -32,14 +33,14 @@ public class Endpoint extends Source { return DefaultScopeDefine.ENDPOINT; } + /** + * @since 7.1.0 SkyWalking doesn't do endpoint register. Use name directly. + */ @Override public String getEntityId() { - return String.valueOf(id); + return EndpointTraffic.buildId(serviceId, name, DetectPoint.SERVER); } - @Getter - @Setter - private int id; @Getter @Setter @ScopeDefaultColumn.DefinedByField(columnName = "name", requireDynamicActive = true) diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/EndpointRelation.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/EndpointRelation.java index 5a87d30f5f08a2da4c22c3f091cfc2013832bf86..4536929c40a46ce6ec10b250a371deeec9d96eb6 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/EndpointRelation.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/EndpointRelation.java @@ -20,7 +20,7 @@ package org.apache.skywalking.oap.server.core.source; import lombok.Getter; import lombok.Setter; -import org.apache.skywalking.oap.server.core.Const; +import org.apache.skywalking.oap.server.core.analysis.manual.RelationDefineUtil; import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.ENDPOINT_RELATION; @@ -33,17 +33,19 @@ public class EndpointRelation extends Source { return DefaultScopeDefine.ENDPOINT_RELATION; } + /** + * @since 7.1.0 SkyWalking doesn't do endpoint register. Use name directly. + */ @Override public String getEntityId() { - return String.valueOf(endpointId) + Const.ID_SPLIT + String.valueOf(childEndpointId); + return RelationDefineUtil.buildEndpointRelationEntityId(new RelationDefineUtil.EndpointRelationDefine( + serviceId, endpoint, childServiceId, childEndpoint, componentId + )); } @Getter @Setter - private int endpointId; - @Getter - @Setter - @ScopeDefaultColumn.DefinedByField(columnName = "source_endpoint_name", requireDynamicActive = true) + @ScopeDefaultColumn.DefinedByField(columnName = "source_endpoint_name") private String endpoint; @Getter @Setter @@ -62,10 +64,7 @@ public class EndpointRelation extends Source { @Getter @Setter - private int childEndpointId; - @Getter - @Setter - @ScopeDefaultColumn.DefinedByField(columnName = "child_endpoint_name", requireDynamicActive = true) + @ScopeDefaultColumn.DefinedByField(columnName = "child_endpoint_name") private String childEndpoint; @Getter @Setter diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/Segment.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/Segment.java index 21bd7274b24c7af6b2facb5fd5ca9eb805d12d9a..1660ba31ad12cf76c35df28e20b2dbfde438bb1e 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/Segment.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/source/Segment.java @@ -53,7 +53,7 @@ public class Segment extends Source { private String endpointName; @Setter @Getter - private int endpointId; + private String endpointId; @Setter @Getter private long startTime; diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/StorageModule.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/StorageModule.java index a3194b6e064dbea8a5a5c8eb43098aaf0ed6413c..be4d34013b6ed72524bf4bd903fc4860e3e19025 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/StorageModule.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/StorageModule.java @@ -18,7 +18,6 @@ package org.apache.skywalking.oap.server.core.storage; -import org.apache.skywalking.oap.server.core.storage.cache.IEndpointInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.INetworkAddressInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.IServiceInstanceInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.IServiceInventoryCacheDAO; @@ -56,7 +55,6 @@ public class StorageModule extends ModuleDefine { IHistoryDeleteDAO.class, IServiceInventoryCacheDAO.class, IServiceInstanceInventoryCacheDAO.class, - IEndpointInventoryCacheDAO.class, INetworkAddressInventoryCacheDAO.class, ITopologyQueryDAO.class, IMetricsQueryDAO.class, diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/cache/IEndpointInventoryCacheDAO.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/cache/IEndpointInventoryCacheDAO.java deleted file mode 100644 index 6afa34aad30e6f8ab61d1b53b3b4bad543dadbbb..0000000000000000000000000000000000000000 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/cache/IEndpointInventoryCacheDAO.java +++ /dev/null @@ -1,29 +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 org.apache.skywalking.oap.server.core.storage.cache; - -import org.apache.skywalking.oap.server.core.register.EndpointInventory; -import org.apache.skywalking.oap.server.core.storage.DAO; - -public interface IEndpointInventoryCacheDAO extends DAO { - - int getEndpointId(int serviceId, String endpointName, int detectPoint); - - EndpointInventory get(int endpointId); -} diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/ILogQueryDAO.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/ILogQueryDAO.java index 0dc122f6f721e7eaf32bbfd8fa4ad8414d87d801..69b5e6f7bbe48e7a43056bf3726c86e5881df8f9 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/ILogQueryDAO.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/ILogQueryDAO.java @@ -25,7 +25,7 @@ import org.apache.skywalking.oap.server.core.query.entity.Pagination; import org.apache.skywalking.oap.server.library.module.Service; public interface ILogQueryDAO extends Service { - Logs queryLogs(final String metricName, int serviceId, int serviceInstanceId, int endpointId, String traceId, + Logs queryLogs(final String metricName, int serviceId, int serviceInstanceId, String endpointId, String traceId, LogState state, String stateCode, Pagination paging, int from, int limit, final long startTB, final long endTB) throws IOException; } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/IMetadataQueryDAO.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/IMetadataQueryDAO.java index 55ed3d01a81aec0e47d13820617b20096bbc4b1a..dca92cd9053892f2ae45e867ea4ac0a5149ce58f 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/IMetadataQueryDAO.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/IMetadataQueryDAO.java @@ -45,7 +45,7 @@ public interface IMetadataQueryDAO extends DAO { Service searchService(final String serviceCode) throws IOException; - List searchEndpoint(final String keyword, final String serviceId, final int limit) throws IOException; + List searchEndpoint(final String keyword, final int serviceId, final int limit) throws IOException; List getServiceInstances(final long startTimestamp, final long endTimestamp, final String serviceId) throws IOException; diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/ITopologyQueryDAO.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/ITopologyQueryDAO.java index ba2618f7caccecba71ed0478468bdf670bacaf66..0dbdde7193acdbfa50ee550d4d3715acbdc5e5aa 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/ITopologyQueryDAO.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/ITopologyQueryDAO.java @@ -79,5 +79,5 @@ public interface ITopologyQueryDAO extends Service { List loadSpecifiedDestOfServerSideEndpointRelations(Downsampling downsampling, long startTB, long endTB, - int destEndpointId) throws IOException; + String destEndpointId) throws IOException; } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/ITraceQueryDAO.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/ITraceQueryDAO.java index 693f0a1546a1d8a339848d57a5289e1a217489c8..b47d2fa8d7cbc51ed1afa20201b8b58a9b9238c2 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/ITraceQueryDAO.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/query/ITraceQueryDAO.java @@ -30,7 +30,7 @@ import org.apache.skywalking.oap.server.library.module.Service; public interface ITraceQueryDAO extends Service { TraceBrief queryBasicTraces(long startSecondTB, long endSecondTB, long minDuration, long maxDuration, - String endpointName, int serviceId, int serviceInstanceId, int endpointId, String traceId, int limit, int from, + String endpointName, int serviceId, int serviceInstanceId, String endpointId, String traceId, int limit, int from, TraceState traceState, QueryOrder queryOrder) throws IOException; List queryByTraceId(String traceId) throws IOException; diff --git a/oap-server/server-core/src/test/java/org/apache/skywalking/oap/server/core/analysis/manual/RelationDefineUtilTest.java b/oap-server/server-core/src/test/java/org/apache/skywalking/oap/server/core/analysis/manual/RelationDefineUtilTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b4322a7ce5ae51204ad95aa74d59705facc8c4f9 --- /dev/null +++ b/oap-server/server-core/src/test/java/org/apache/skywalking/oap/server/core/analysis/manual/RelationDefineUtilTest.java @@ -0,0 +1,45 @@ +/* + * 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 org.apache.skywalking.oap.server.core.analysis.manual; + +import org.junit.Assert; +import org.junit.Test; + +public class RelationDefineUtilTest { + @Test + public void testRelationID() { + RelationDefineUtil.RelationDefine define = new RelationDefineUtil.RelationDefine(1, 2, 0); + final RelationDefineUtil.RelationDefine relationDefine = RelationDefineUtil.splitEntityId( + RelationDefineUtil.buildEntityId(define)); + Assert.assertEquals(define, relationDefine); + } + + @Test + public void testEndpointRelationID() { + final RelationDefineUtil.EndpointRelationDefine endpointRelationDefine = new RelationDefineUtil.EndpointRelationDefine( + 1, "/source/endpoint", + 2, "/dest/endpoint", + 0 + ); + final RelationDefineUtil.EndpointRelationDefine anotherRelation = RelationDefineUtil.splitEndpointRelationEntityId( + RelationDefineUtil.buildEndpointRelationEntityId(endpointRelationDefine)); + Assert.assertEquals(endpointRelationDefine, anotherRelation); + + } +} diff --git a/oap-server/server-core/src/test/java/org/apache/skywalking/oap/server/core/analysis/manual/endpoint/EndpointTrafficTest.java b/oap-server/server-core/src/test/java/org/apache/skywalking/oap/server/core/analysis/manual/endpoint/EndpointTrafficTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9bf3d06dad521d92062a895dda097762f99d4e62 --- /dev/null +++ b/oap-server/server-core/src/test/java/org/apache/skywalking/oap/server/core/analysis/manual/endpoint/EndpointTrafficTest.java @@ -0,0 +1,79 @@ +/* + * 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 org.apache.skywalking.oap.server.core.analysis.manual.endpoint; + +import org.apache.skywalking.oap.server.core.source.DetectPoint; +import org.junit.Assert; +import org.junit.Test; + +public class EndpointTrafficTest { + @Test + public void testBuildID() { + int serviceId = 4; + String endpointName = "/endpoint-123"; + DetectPoint detectPoint = DetectPoint.SERVER; + + EndpointTraffic endpointTraffic = new EndpointTraffic(); + endpointTraffic.setServiceId(serviceId); + endpointTraffic.setName(endpointName); + endpointTraffic.setDetectPoint(detectPoint.value()); + + Assert.assertEquals( + EndpointTraffic.buildId(serviceId, endpointName, detectPoint), EndpointTraffic.buildId(endpointTraffic)); + + final EndpointTraffic.EndpointID endpointID = EndpointTraffic.splitID(EndpointTraffic.buildId(endpointTraffic)); + Assert.assertEquals(endpointName, endpointID.getEndpointName()); + } + + @Test + public void testSerialization() { + int serviceId = 4; + String endpointName = "/endpoint-123"; + DetectPoint detectPoint = DetectPoint.SERVER; + + EndpointTraffic endpointTraffic = new EndpointTraffic(); + endpointTraffic.setTimeBucket(202003281420L); + endpointTraffic.setServiceId(serviceId); + endpointTraffic.setName(endpointName); + endpointTraffic.setDetectPoint(detectPoint.value()); + + EndpointTraffic another = new EndpointTraffic(); + another.deserialize(endpointTraffic.serialize().build()); + + Assert.assertEquals(endpointTraffic, another); + } + + @Test + public void testPersistence() { + int serviceId = 4; + String endpointName = "/endpoint-123"; + DetectPoint detectPoint = DetectPoint.SERVER; + + EndpointTraffic endpointTraffic = new EndpointTraffic(); + endpointTraffic.setTimeBucket(202003281420L); + endpointTraffic.setServiceId(serviceId); + endpointTraffic.setName(endpointName); + endpointTraffic.setDetectPoint(detectPoint.value()); + + final EndpointTraffic.Builder builder = new EndpointTraffic.Builder(); + final EndpointTraffic another = builder.map2Data(builder.data2Map(endpointTraffic)); + + Assert.assertEquals(endpointTraffic, another); + } +} diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/MetadataQuery.java b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/MetadataQuery.java index bfe4adf2761f3ef35667b16b0f1d9f45f0584a5d..aa8187db3847f31d996a66bb0842ee87fed68b8c 100644 --- a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/MetadataQuery.java +++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/MetadataQuery.java @@ -77,7 +77,7 @@ public class MetadataQuery implements GraphQLQueryResolver { } public List searchServices(final Duration duration, - final String keyword) throws IOException, ParseException { + final String keyword) throws IOException, ParseException { long startTimestamp = DurationUtils.INSTANCE.startTimeToTimestamp(duration.getStep(), duration.getStart()); long endTimestamp = DurationUtils.INSTANCE.endTimeToTimestamp(duration.getStep(), duration.getEnd()); @@ -89,19 +89,19 @@ public class MetadataQuery implements GraphQLQueryResolver { } public List getServiceInstances(final Duration duration, - final String serviceId) throws IOException, ParseException { + final String serviceId) throws IOException, ParseException { long startTimestamp = DurationUtils.INSTANCE.startTimeToTimestamp(duration.getStep(), duration.getStart()); long endTimestamp = DurationUtils.INSTANCE.endTimeToTimestamp(duration.getStep(), duration.getEnd()); return getMetadataQueryService().getServiceInstances(startTimestamp, endTimestamp, serviceId); } - public List searchEndpoint(final String keyword, final String serviceId, - final int limit) throws IOException { + public List searchEndpoint(final String keyword, final int serviceId, + final int limit) throws IOException { return getMetadataQueryService().searchEndpoint(keyword, serviceId, limit); } - public EndpointInfo getEndpointInfo(final int endpointId) throws IOException { + public EndpointInfo getEndpointInfo(final String endpointId) throws IOException { return getMetadataQueryService().getEndpointInfo(endpointId); } diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/TopologyQuery.java b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/TopologyQuery.java index 37ff28cb2fdc5270b5f9df9a9929adf9bd6b8355..e76e765b037ecc6868e6f7d0ad7116fed0b1bc00 100644 --- a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/TopologyQuery.java +++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/TopologyQuery.java @@ -81,7 +81,7 @@ public class TopologyQuery implements GraphQLQueryResolver { ); } - public Topology getEndpointTopology(final int endpointId, final Duration duration) throws IOException { + public Topology getEndpointTopology(final String endpointId, final Duration duration) throws IOException { long startTimeBucket = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart()); long endTimeBucket = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd()); diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/TraceQuery.java b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/TraceQuery.java index ce4c2e5be61eb52177bd9e300e8f72f98d2bda5d..6e2b72cd7c41fba025890ec80b7a483c54cb9279 100644 --- a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/TraceQuery.java +++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/TraceQuery.java @@ -75,7 +75,7 @@ public class TraceQuery implements GraphQLQueryResolver { int maxDuration = condition.getMaxTraceDuration(); String endpointName = condition.getEndpointName(); int serviceId = StringUtils.isEmpty(condition.getServiceId()) ? 0 : Integer.parseInt(condition.getServiceId()); - int endpointId = StringUtils.isEmpty(condition.getEndpointId()) ? 0 : Integer.parseInt(condition.getEndpointId()); + String endpointId = condition.getEndpointId(); int serviceInstanceId = StringUtils.isEmpty(condition.getServiceInstanceId()) ? 0 : Integer.parseInt(condition.getServiceInstanceId()); TraceState traceState = condition.getTraceState(); QueryOrder queryOrder = condition.getQueryOrder(); diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/type/LogQueryCondition.java b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/type/LogQueryCondition.java index d4a15c11ea2de542e7e9c3ca4ddad7acb2fdbf5d..69ceaa09cf8346c11f54a3691030583ab2c1fa0d 100644 --- a/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/type/LogQueryCondition.java +++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/type/LogQueryCondition.java @@ -29,7 +29,7 @@ public class LogQueryCondition { private String metricName; private int serviceId; private int serviceInstanceId; - private int endpointId; + private String endpointId; private String traceId; private LogState state; private String stateCode; diff --git a/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol b/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol index 28f18ae8dab49e60eb3d2e5cfd1a5c884a897ad0..3bd7111b9363033752d38982551ca7324a8dd74c 160000 --- a/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol +++ b/oap-server/server-query-plugin/query-graphql-plugin/src/main/resources/query-protocol @@ -1 +1 @@ -Subproject commit 28f18ae8dab49e60eb3d2e5cfd1a5c884a897ad0 +Subproject commit 3bd7111b9363033752d38982551ca7324a8dd74c diff --git a/oap-server/server-receiver-plugin/jaeger-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/jaeger/JaegerGRPCHandler.java b/oap-server/server-receiver-plugin/jaeger-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/jaeger/JaegerGRPCHandler.java index b18ebf8484b89aaae20b2677d786dabd775753f5..4f38fb7fc2c0be72591a70ef9b62bc650ed65925 100644 --- a/oap-server/server-receiver-plugin/jaeger-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/jaeger/JaegerGRPCHandler.java +++ b/oap-server/server-receiver-plugin/jaeger-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/jaeger/JaegerGRPCHandler.java @@ -29,6 +29,7 @@ import java.util.Base64; import org.apache.skywalking.apm.util.StringUtil; import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.analysis.TimeBucket; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.source.DetectPoint; import org.apache.skywalking.oap.server.core.source.SourceReceiver; import org.apache.skywalking.oap.server.library.util.BooleanUtils; @@ -49,7 +50,7 @@ public class JaegerGRPCHandler extends CollectorServiceGrpc.CollectorServiceImpl } public void postSpans(Collector.PostSpansRequest request, - StreamObserver responseObserver) { + StreamObserver responseObserver) { request.getBatch().getSpansList().forEach(span -> { try { @@ -119,13 +120,8 @@ public class JaegerGRPCHandler extends CollectorServiceGrpc.CollectorServiceImpl if ("server".equals(kind) || "consumer".equals(kind)) { String endpointName = span.getOperationName(); jaegerSpan.setEndpointName(endpointName); - int endpointId = CoreRegisterLinker.getEndpointInventoryCache() - .getEndpointId(finalServiceId, endpointName, DetectPoint.SERVER - .ordinal()); - if (endpointId != Const.NONE) { - CoreRegisterLinker.getEndpointInventoryRegister() - .getOrCreate(finalServiceId, endpointName, DetectPoint.SERVER); - } + jaegerSpan.setEndpointId( + EndpointTraffic.buildId(finalServiceId, endpointName, DetectPoint.SERVER)); } } }); diff --git a/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/ServiceMeshMetricDataDecorator.java b/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/ServiceMeshMetricDataDecorator.java index 0e1d5f77542f3944fec390c5057bed89c5a9873a..0d04075679f7d2650a2b11ad52ff562269a26508 100644 --- a/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/ServiceMeshMetricDataDecorator.java +++ b/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/ServiceMeshMetricDataDecorator.java @@ -19,7 +19,6 @@ package org.apache.skywalking.aop.server.receiver.mesh; import com.google.gson.JsonObject; -import org.apache.skywalking.apm.network.common.DetectPoint; import org.apache.skywalking.apm.network.servicemesh.ServiceMeshMetric; import org.apache.skywalking.apm.util.StringUtil; import org.apache.skywalking.oap.server.core.Const; @@ -30,7 +29,6 @@ public class ServiceMeshMetricDataDecorator { private ServiceMeshMetric origin; private ServiceMeshMetric rebuiltData; private ServiceMeshMetric.Builder newDataBuilder; - private int endpointId; public ServiceMeshMetricDataDecorator(ServiceMeshMetric origin) { this.origin = origin; @@ -60,9 +58,12 @@ public class ServiceMeshMetricDataDecorator { sourceServiceInstanceId = origin.getSourceServiceInstanceId(); if (sourceServiceId != Const.NONE && sourceServiceInstanceId == Const.NONE) { sourceServiceInstanceId = CoreRegisterLinker.getServiceInstanceInventoryRegister() - .getOrCreate(sourceServiceId, origin.getSourceServiceInstance(), origin - .getSourceServiceInstance(), origin.getEndTime(), getOSInfoForMesh(origin - .getSourceServiceInstance())); + .getOrCreate( + sourceServiceId, origin.getSourceServiceInstance(), origin + .getSourceServiceInstance(), origin.getEndTime(), + getOSInfoForMesh(origin + .getSourceServiceInstance()) + ); if (sourceServiceInstanceId != Const.NONE) { getNewDataBuilder().setSourceServiceInstanceId(sourceServiceInstanceId); } else { @@ -82,26 +83,18 @@ public class ServiceMeshMetricDataDecorator { destServiceInstanceId = origin.getDestServiceInstanceId(); if (destServiceId != Const.NONE && destServiceInstanceId == Const.NONE) { destServiceInstanceId = CoreRegisterLinker.getServiceInstanceInventoryRegister() - .getOrCreate(destServiceId, origin.getDestServiceInstance(), origin - .getDestServiceInstance(), origin.getEndTime(), getOSInfoForMesh(origin - .getDestServiceInstance())); + .getOrCreate( + destServiceId, origin.getDestServiceInstance(), origin + .getDestServiceInstance(), origin.getEndTime(), + getOSInfoForMesh(origin + .getDestServiceInstance()) + ); if (destServiceInstanceId != Const.NONE) { getNewDataBuilder().setDestServiceInstanceId(destServiceInstanceId); } else { isRegistered = false; } } - String endpoint = origin.getEndpoint(); - - // Service mesh doesn't register client side endpoint. - DetectPoint point = origin.getDetectPoint(); - if (DetectPoint.server.equals(point)) { - if (destServiceId != Const.NONE) { - endpointId = CoreRegisterLinker.getEndpointInventoryRegister() - .getOrCreate(destServiceId, endpoint, org.apache.skywalking.oap.server.core.source.DetectPoint - .fromNetworkProtocolDetectPoint(point)); - } - } return isRegistered; } @@ -117,10 +110,6 @@ public class ServiceMeshMetricDataDecorator { } } - public int getEndpointId() { - return endpointId; - } - private ServiceMeshMetric.Builder getNewDataBuilder() { if (newDataBuilder == null) { newDataBuilder = origin.toBuilder(); diff --git a/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/TelemetryDataDispatcher.java b/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/TelemetryDataDispatcher.java index 1023162486b4c658377bed57031b89683062ee3f..8a550fcb2ae3f06c05a46bb8979b0ec34ea50bfb 100644 --- a/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/TelemetryDataDispatcher.java +++ b/oap-server/server-receiver-plugin/skywalking-mesh-receiver-plugin/src/main/java/org/apache/skywalking/aop/server/receiver/mesh/TelemetryDataDispatcher.java @@ -78,7 +78,8 @@ public class TelemetryDataDispatcher { } public static void preProcess(ServiceMeshMetric data) { - String service = data.getDestServiceId() == Const.NONE ? data.getDestServiceName() : SERVICE_CACHE.get(data.getDestServiceId()) + String service = data.getDestServiceId() == Const.NONE ? data.getDestServiceName() : SERVICE_CACHE.get( + data.getDestServiceId()) .getName(); String endpointName = data.getEndpoint(); StringFormatGroup.FormatResult formatResult = EndpointNameFormater.format(service, endpointName); @@ -134,11 +135,13 @@ public class TelemetryDataDispatcher { if (Objects.nonNull(serviceInstanceInventory)) { if (metrics.getEndTime() - serviceInstanceInventory.getHeartbeatTime() > heartbeatCycle) { // trigger heartbeat every 10s. - SERVICE_INSTANCE_INVENTORY_REGISTER.heartbeat(metrics.getSourceServiceInstanceId(), metrics.getEndTime()); + SERVICE_INSTANCE_INVENTORY_REGISTER.heartbeat( + metrics.getSourceServiceInstanceId(), metrics.getEndTime()); SERVICE_INVENTORY_REGISTER.heartbeat(serviceInstanceInventory.getServiceId(), metrics.getEndTime()); } } else { - logger.warn("Can't found service by service instance id from cache, service instance id is: {}", instanceId); + logger.warn( + "Can't found service by service instance id from cache, service instance id is: {}", instanceId); } } @@ -152,7 +155,8 @@ public class TelemetryDataDispatcher { SERVICE_INVENTORY_REGISTER.heartbeat(serviceInstanceInventory.getServiceId(), metrics.getEndTime()); } } else { - logger.warn("Can't found service by service instance id from cache, service instance id is: {}", instanceId); + logger.warn( + "Can't found service by service instance id from cache, service instance id is: {}", instanceId); } } @@ -161,7 +165,8 @@ public class TelemetryDataDispatcher { All all = new All(); all.setTimeBucket(minuteTimeBucket); all.setName(getServiceName(metrics.getDestServiceId(), metrics.getDestServiceName())); - all.setServiceInstanceName(getServiceInstanceName(metrics.getDestServiceInstanceId(), metrics.getDestServiceInstance())); + all.setServiceInstanceName( + getServiceInstanceName(metrics.getDestServiceInstanceId(), metrics.getDestServiceInstance())); all.setEndpointName(metrics.getEndpoint()); all.setLatency(metrics.getLatency()); all.setStatus(metrics.getStatus()); @@ -177,7 +182,8 @@ public class TelemetryDataDispatcher { service.setTimeBucket(minuteTimeBucket); service.setId(metrics.getDestServiceId()); service.setName(getServiceName(metrics.getDestServiceId(), metrics.getDestServiceName())); - service.setServiceInstanceName(getServiceInstanceName(metrics.getDestServiceInstanceId(), metrics.getDestServiceInstance())); + service.setServiceInstanceName( + getServiceInstanceName(metrics.getDestServiceInstanceId(), metrics.getDestServiceInstance())); service.setEndpointName(metrics.getEndpoint()); service.setLatency(metrics.getLatency()); service.setStatus(metrics.getStatus()); @@ -192,13 +198,16 @@ public class TelemetryDataDispatcher { ServiceRelation serviceRelation = new ServiceRelation(); serviceRelation.setTimeBucket(minuteTimeBucket); serviceRelation.setSourceServiceId(metrics.getSourceServiceId()); - serviceRelation.setSourceServiceName(getServiceName(metrics.getSourceServiceId(), metrics.getSourceServiceName())); - serviceRelation.setSourceServiceInstanceName(getServiceInstanceName(metrics.getSourceServiceInstanceId(), metrics - .getSourceServiceInstance())); + serviceRelation.setSourceServiceName( + getServiceName(metrics.getSourceServiceId(), metrics.getSourceServiceName())); + serviceRelation.setSourceServiceInstanceName( + getServiceInstanceName(metrics.getSourceServiceInstanceId(), metrics + .getSourceServiceInstance())); serviceRelation.setDestServiceId(metrics.getDestServiceId()); serviceRelation.setDestServiceName(getServiceName(metrics.getDestServiceId(), metrics.getDestServiceName())); - serviceRelation.setDestServiceInstanceName(getServiceInstanceName(metrics.getDestServiceInstanceId(), metrics.getDestServiceInstance())); + serviceRelation.setDestServiceInstanceName( + getServiceInstanceName(metrics.getDestServiceInstanceId(), metrics.getDestServiceInstance())); serviceRelation.setEndpoint(metrics.getEndpoint()); serviceRelation.setLatency(metrics.getLatency()); @@ -216,7 +225,8 @@ public class TelemetryDataDispatcher { ServiceInstance serviceInstance = new ServiceInstance(); serviceInstance.setTimeBucket(minuteTimeBucket); serviceInstance.setId(metrics.getDestServiceInstanceId()); - serviceInstance.setName(getServiceInstanceName(metrics.getDestServiceInstanceId(), metrics.getDestServiceInstance())); + serviceInstance.setName( + getServiceInstanceName(metrics.getDestServiceInstanceId(), metrics.getDestServiceInstance())); serviceInstance.setServiceId(metrics.getDestServiceId()); serviceInstance.setServiceName(getServiceName(metrics.getDestServiceId(), metrics.getDestServiceName())); serviceInstance.setEndpointName(metrics.getEndpoint()); @@ -233,13 +243,16 @@ public class TelemetryDataDispatcher { ServiceInstanceRelation serviceRelation = new ServiceInstanceRelation(); serviceRelation.setTimeBucket(minuteTimeBucket); serviceRelation.setSourceServiceInstanceId(metrics.getSourceServiceInstanceId()); - serviceRelation.setSourceServiceInstanceName(getServiceInstanceName(metrics.getSourceServiceInstanceId(), metrics - .getSourceServiceInstance())); + serviceRelation.setSourceServiceInstanceName( + getServiceInstanceName(metrics.getSourceServiceInstanceId(), metrics + .getSourceServiceInstance())); serviceRelation.setSourceServiceId(metrics.getSourceServiceId()); - serviceRelation.setSourceServiceName(getServiceName(metrics.getSourceServiceId(), metrics.getSourceServiceName())); + serviceRelation.setSourceServiceName( + getServiceName(metrics.getSourceServiceId(), metrics.getSourceServiceName())); serviceRelation.setDestServiceInstanceId(metrics.getDestServiceInstanceId()); - serviceRelation.setDestServiceInstanceName(getServiceInstanceName(metrics.getDestServiceInstanceId(), metrics.getDestServiceInstance())); + serviceRelation.setDestServiceInstanceName( + getServiceInstanceName(metrics.getDestServiceInstanceId(), metrics.getDestServiceInstance())); serviceRelation.setDestServiceId(metrics.getDestServiceId()); serviceRelation.setDestServiceName(getServiceName(metrics.getDestServiceId(), metrics.getDestServiceName())); @@ -255,19 +268,15 @@ public class TelemetryDataDispatcher { } private static void toEndpoint(ServiceMeshMetricDataDecorator decorator, long minuteTimeBucket) { - if (decorator.getEndpointId() == Const.NONE) { - logger.warn("Received service mesh data {} with an id == 0", decorator); - return; - } ServiceMeshMetric metrics = decorator.getMetric(); Endpoint endpoint = new Endpoint(); endpoint.setTimeBucket(minuteTimeBucket); - endpoint.setId(decorator.getEndpointId()); endpoint.setName(metrics.getEndpoint()); endpoint.setServiceId(metrics.getDestServiceId()); endpoint.setServiceName(getServiceName(metrics.getDestServiceId(), metrics.getDestServiceName())); endpoint.setServiceInstanceId(metrics.getDestServiceInstanceId()); - endpoint.setServiceInstanceName(getServiceInstanceName(metrics.getDestServiceInstanceId(), metrics.getDestServiceInstance())); + endpoint.setServiceInstanceName( + getServiceInstanceName(metrics.getDestServiceInstanceId(), metrics.getDestServiceInstance())); endpoint.setLatency(metrics.getLatency()); endpoint.setStatus(metrics.getStatus()); diff --git a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v6/grpc/RegisterServiceHandler.java b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v6/grpc/RegisterServiceHandler.java index 798ac67eda61480b4a1cf14e049d91495aea27b6..a7385be536e439c51d9a8b34f3144c3d0b3eaebe 100644 --- a/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v6/grpc/RegisterServiceHandler.java +++ b/oap-server/server-receiver-plugin/skywalking-register-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/register/provider/handler/v6/grpc/RegisterServiceHandler.java @@ -27,7 +27,6 @@ import org.apache.skywalking.apm.network.common.KeyIntValuePair; import org.apache.skywalking.apm.network.common.KeyStringValuePair; import org.apache.skywalking.apm.network.common.ServiceType; import org.apache.skywalking.apm.network.register.v2.EndpointMapping; -import org.apache.skywalking.apm.network.register.v2.EndpointMappingElement; import org.apache.skywalking.apm.network.register.v2.Endpoints; import org.apache.skywalking.apm.network.register.v2.NetAddressMapping; import org.apache.skywalking.apm.network.register.v2.NetAddresses; @@ -45,11 +44,9 @@ import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; import org.apache.skywalking.oap.server.core.register.NodeType; import org.apache.skywalking.oap.server.core.register.ServiceInstanceInventory; import org.apache.skywalking.oap.server.core.register.ServiceInventory; -import org.apache.skywalking.oap.server.core.register.service.IEndpointInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.INetworkAddressInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.IServiceInstanceInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.IServiceInventoryRegister; -import org.apache.skywalking.oap.server.core.source.DetectPoint; import org.apache.skywalking.oap.server.library.module.ModuleManager; import org.apache.skywalking.oap.server.library.server.grpc.GRPCHandler; import org.slf4j.Logger; @@ -76,7 +73,6 @@ public class RegisterServiceHandler extends RegisterGrpc.RegisterImplBase implem private final ServiceInstanceInventoryCache serviceInstanceInventoryCache; private final IServiceInventoryRegister serviceInventoryRegister; private final IServiceInstanceInventoryRegister serviceInstanceInventoryRegister; - private final IEndpointInventoryRegister inventoryService; private final INetworkAddressInventoryRegister networkAddressInventoryRegister; public RegisterServiceHandler(ModuleManager moduleManager) { @@ -92,9 +88,6 @@ public class RegisterServiceHandler extends RegisterGrpc.RegisterImplBase implem this.serviceInstanceInventoryRegister = moduleManager.find(CoreModule.NAME) .provider() .getService(IServiceInstanceInventoryRegister.class); - this.inventoryService = moduleManager.find(CoreModule.NAME) - .provider() - .getService(IEndpointInventoryRegister.class); this.networkAddressInventoryRegister = moduleManager.find(CoreModule.NAME) .provider() .getService(INetworkAddressInventoryRegister.class); @@ -199,31 +192,13 @@ public class RegisterServiceHandler extends RegisterGrpc.RegisterImplBase implem responseObserver.onCompleted(); } + /** + * @since 7.1.0 There is no endpoint / operation name register anymore. + */ + @Deprecated @Override public void doEndpointRegister(Endpoints request, StreamObserver responseObserver) { - EndpointMapping.Builder builder = EndpointMapping.newBuilder(); - - request.getEndpointsList().forEach(endpoint -> { - int serviceId = endpoint.getServiceId(); - String endpointName = endpoint.getEndpointName(); - - DetectPoint detectPoint = DetectPoint.fromNetworkProtocolDetectPoint(endpoint.getFrom()); - if (DetectPoint.SERVER.equals(detectPoint)) { - int endpointId = inventoryService.getOrCreate(serviceId, endpointName, detectPoint); - - if (endpointId != Const.NONE) { - builder.addElements(EndpointMappingElement.newBuilder() - .setServiceId(serviceId) - .setEndpointName(endpointName) - .setEndpointId(endpointId) - .setFrom(endpoint.getFrom())); - } - } else { - logger.warn("Unexpected endpoint register, endpoint isn't detected from server side. {}", request); - } - }); - - responseObserver.onNext(builder.build()); + responseObserver.onNext(EndpointMapping.newBuilder().build()); responseObserver.onCompleted(); } diff --git a/oap-server/server-receiver-plugin/skywalking-sharing-server-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/sharing/server/CoreRegisterLinker.java b/oap-server/server-receiver-plugin/skywalking-sharing-server-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/sharing/server/CoreRegisterLinker.java index 98316fb192dce7639ac4c0640df39bc1fec0f594..16777620f65f409480b2651d7953a2b73325e5ce 100644 --- a/oap-server/server-receiver-plugin/skywalking-sharing-server-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/sharing/server/CoreRegisterLinker.java +++ b/oap-server/server-receiver-plugin/skywalking-sharing-server-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/sharing/server/CoreRegisterLinker.java @@ -19,9 +19,7 @@ package org.apache.skywalking.oap.server.receiver.sharing.server; import org.apache.skywalking.oap.server.core.CoreModule; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; -import org.apache.skywalking.oap.server.core.register.service.IEndpointInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.IServiceInstanceInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.IServiceInventoryRegister; import org.apache.skywalking.oap.server.library.module.ModuleManager; @@ -30,9 +28,7 @@ public class CoreRegisterLinker { private static volatile ModuleManager MODULE_MANAGER; private static volatile IServiceInventoryRegister SERVICE_INVENTORY_REGISTER; private static volatile IServiceInstanceInventoryRegister SERVICE_INSTANCE_INVENTORY_REGISTER; - private static volatile IEndpointInventoryRegister ENDPOINT_INVENTORY_REGISTER; private static volatile ServiceInventoryCache SERVICE_INVENTORY_CACHE; - private static volatile EndpointInventoryCache ENDPOINT_INVENTORY_CACHE; public static void setModuleManager(ModuleManager moduleManager) { CoreRegisterLinker.MODULE_MANAGER = moduleManager; @@ -56,15 +52,6 @@ public class CoreRegisterLinker { return SERVICE_INSTANCE_INVENTORY_REGISTER; } - public static IEndpointInventoryRegister getEndpointInventoryRegister() { - if (ENDPOINT_INVENTORY_REGISTER == null) { - ENDPOINT_INVENTORY_REGISTER = MODULE_MANAGER.find(CoreModule.NAME) - .provider() - .getService(IEndpointInventoryRegister.class); - } - return ENDPOINT_INVENTORY_REGISTER; - } - public static ServiceInventoryCache getServiceInventoryCache() { if (SERVICE_INVENTORY_CACHE == null) { SERVICE_INVENTORY_CACHE = MODULE_MANAGER.find(CoreModule.NAME) @@ -73,13 +60,4 @@ public class CoreRegisterLinker { } return SERVICE_INVENTORY_CACHE; } - - public static EndpointInventoryCache getEndpointInventoryCache() { - if (ENDPOINT_INVENTORY_CACHE == null) { - ENDPOINT_INVENTORY_CACHE = MODULE_MANAGER.find(CoreModule.NAME) - .provider() - .getService(EndpointInventoryCache.class); - } - return ENDPOINT_INVENTORY_CACHE; - } } diff --git a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/decorator/ReferenceDecorator.java b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/decorator/ReferenceDecorator.java index 8ebfa21ab33a29106a5596dbc99fa13acf471c1f..05c71568498855b1757f2cc5964e006870e30bea 100644 --- a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/decorator/ReferenceDecorator.java +++ b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/decorator/ReferenceDecorator.java @@ -38,21 +38,6 @@ public class ReferenceDecorator implements StandardBuilder { this.isOrigin = false; } - public int getEntryEndpointId() { - if (isOrigin) { - return referenceObjectV2.getEntryEndpointId(); - } else { - return referenceBuilderV2.getEntryEndpointId(); - } - } - - public void setEntryEndpointId(int value) { - if (isOrigin) { - toBuilder(); - } - referenceBuilderV2.setEntryEndpointId(value); - } - public String getEntryEndpointName() { if (isOrigin) { return referenceObjectV2.getEntryEndpoint(); @@ -61,13 +46,6 @@ public class ReferenceDecorator implements StandardBuilder { } } - public void setEntryEndpointName(String value) { - if (isOrigin) { - toBuilder(); - } - referenceBuilderV2.setEntryEndpoint(value); - } - public int getEntryServiceInstanceId() { if (isOrigin) { return referenceObjectV2.getEntryServiceInstanceId(); @@ -84,21 +62,6 @@ public class ReferenceDecorator implements StandardBuilder { } } - public int getParentEndpointId() { - if (isOrigin) { - return referenceObjectV2.getParentEndpointId(); - } else { - return referenceBuilderV2.getParentEndpointId(); - } - } - - public void setParentEndpointId(int value) { - if (isOrigin) { - toBuilder(); - } - referenceBuilderV2.setParentEndpointId(value); - } - public String getParentEndpointName() { if (isOrigin) { return referenceObjectV2.getParentEndpoint(); @@ -107,13 +70,6 @@ public class ReferenceDecorator implements StandardBuilder { } } - public void setParentEndpointName(String value) { - if (isOrigin) { - toBuilder(); - } - referenceBuilderV2.setParentEndpoint(value); - } - public int getNetworkAddressId() { if (isOrigin) { return referenceObjectV2.getNetworkAddressId(); diff --git a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/decorator/SpanDecorator.java b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/decorator/SpanDecorator.java index 8632ba6efe82a20782336b648ba7d3e08a4c77f5..620ca78b119b5fbaca25e78837362c10bdeffe46 100644 --- a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/decorator/SpanDecorator.java +++ b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/decorator/SpanDecorator.java @@ -158,21 +158,6 @@ public class SpanDecorator implements StandardBuilder { spanBuilderV2.setPeer(peer); } - public int getOperationNameId() { - if (isOrigin) { - return spanObjectV2.getOperationNameId(); - } else { - return spanBuilderV2.getOperationNameId(); - } - } - - public void setOperationNameId(int value) { - if (isOrigin) { - toBuilder(); - } - spanBuilderV2.setOperationNameId(value); - } - public String getOperationName() { if (isOrigin) { return spanObjectV2.getOperationName(); diff --git a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/endpoint/MultiScopesSpanListener.java b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/endpoint/MultiScopesSpanListener.java index 68f9deb5416af85e0fc763fa27c071ab84718214..ec703985db9b408ab89879b37dee5646fc37bdc4 100755 --- a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/endpoint/MultiScopesSpanListener.java +++ b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/endpoint/MultiScopesSpanListener.java @@ -22,7 +22,6 @@ import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; - import lombok.extern.slf4j.Slf4j; import org.apache.skywalking.apm.network.common.KeyStringValuePair; import org.apache.skywalking.apm.network.language.agent.SpanLayer; @@ -31,7 +30,6 @@ import org.apache.skywalking.apm.util.StringUtil; import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.CoreModule; import org.apache.skywalking.oap.server.core.analysis.TimeBucket; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; import org.apache.skywalking.oap.server.core.cache.NetworkAddressInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInstanceInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; @@ -66,7 +64,6 @@ public class MultiScopesSpanListener implements EntrySpanListener, ExitSpanListe private final SourceReceiver sourceReceiver; private final ServiceInstanceInventoryCache instanceInventoryCache; private final ServiceInventoryCache serviceInventoryCache; - private final EndpointInventoryCache endpointInventoryCache; private final List entrySourceBuilders; private final List exitSourceBuilders; @@ -88,9 +85,6 @@ public class MultiScopesSpanListener implements EntrySpanListener, ExitSpanListe this.serviceInventoryCache = moduleManager.find(CoreModule.NAME) .provider() .getService(ServiceInventoryCache.class); - this.endpointInventoryCache = moduleManager.find(CoreModule.NAME) - .provider() - .getService(EndpointInventoryCache.class); this.networkAddressInventoryCache = moduleManager.find(CoreModule.NAME) .provider() .getService(NetworkAddressInventoryCache.class); @@ -121,10 +115,10 @@ public class MultiScopesSpanListener implements EntrySpanListener, ExitSpanListe for (int i = 0; i < spanDecorator.getRefsCount(); i++) { ReferenceDecorator reference = spanDecorator.getRefs(i); SourceBuilder sourceBuilder = new SourceBuilder(); - if (reference.getParentEndpointId() == Const.INEXISTENCE_ENDPOINT_ID) { - sourceBuilder.setSourceEndpointId(Const.USER_ENDPOINT_ID); + if (StringUtil.isEmpty(reference.getParentEndpointName())) { + sourceBuilder.setSourceEndpointName(Const.USER_ENDPOINT_NAME); } else { - sourceBuilder.setSourceEndpointId(reference.getParentEndpointId()); + sourceBuilder.setSourceEndpointName(reference.getParentEndpointName()); } final int networkAddressId = reference.getNetworkAddressId(); @@ -142,7 +136,7 @@ public class MultiScopesSpanListener implements EntrySpanListener, ExitSpanListe sourceBuilder.setSourceServiceId(instanceInventoryCache.get(reference.getParentServiceInstanceId()) .getServiceId()); } - sourceBuilder.setDestEndpointId(spanDecorator.getOperationNameId()); + sourceBuilder.setDestEndpointName(spanDecorator.getOperationName()); sourceBuilder.setDestServiceInstanceId(segmentCoreInfo.getServiceInstanceId()); sourceBuilder.setDestServiceId(segmentCoreInfo.getServiceId()); sourceBuilder.setDetectPoint(DetectPoint.SERVER); @@ -152,10 +146,10 @@ public class MultiScopesSpanListener implements EntrySpanListener, ExitSpanListe } } else { SourceBuilder sourceBuilder = new SourceBuilder(); - sourceBuilder.setSourceEndpointId(Const.USER_ENDPOINT_ID); + sourceBuilder.setSourceEndpointName(Const.USER_ENDPOINT_NAME); sourceBuilder.setSourceServiceInstanceId(Const.USER_INSTANCE_ID); sourceBuilder.setSourceServiceId(Const.USER_SERVICE_ID); - sourceBuilder.setDestEndpointId(spanDecorator.getOperationNameId()); + sourceBuilder.setDestEndpointName(spanDecorator.getOperationName()); sourceBuilder.setDestServiceInstanceId(segmentCoreInfo.getServiceInstanceId()); sourceBuilder.setDestServiceId(segmentCoreInfo.getServiceId()); sourceBuilder.setDetectPoint(DetectPoint.SERVER); @@ -262,16 +256,9 @@ public class MultiScopesSpanListener implements EntrySpanListener, ExitSpanListe sourceBuilder.setSourceServiceInstanceName( instanceInventoryCache.get(sourceBuilder.getSourceServiceInstanceId()) .getName()); - if (sourceBuilder.getSourceEndpointId() != Const.NONE) { - sourceBuilder.setSourceEndpointName(endpointInventoryCache.get(sourceBuilder.getSourceEndpointId()) - .getName()); - } sourceBuilder.setDestServiceName(serviceInventoryCache.get(sourceBuilder.getDestServiceId()).getName()); sourceBuilder.setDestServiceInstanceName(instanceInventoryCache.get(sourceBuilder.getDestServiceInstanceId()) .getName()); - if (sourceBuilder.getDestEndpointId() != Const.NONE) { - sourceBuilder.setDestEndpointName(endpointInventoryCache.get(sourceBuilder.getDestEndpointId()).getName()); - } } @Override @@ -300,12 +287,10 @@ public class MultiScopesSpanListener implements EntrySpanListener, ExitSpanListe exitSourceBuilders.forEach(exitSourceBuilder -> { if (nonNull(entrySpanDecorator)) { - exitSourceBuilder.setSourceEndpointId(entrySpanDecorator.getOperationNameId()); + exitSourceBuilder.setSourceEndpointName(entrySpanDecorator.getOperationName()); } else { - exitSourceBuilder.setSourceEndpointId(Const.USER_ENDPOINT_ID); + exitSourceBuilder.setSourceEndpointName(Const.USER_ENDPOINT_NAME); } - exitSourceBuilder.setSourceEndpointName(endpointInventoryCache.get(exitSourceBuilder.getSourceEndpointId()) - .getName()); exitSourceBuilder.setTimeBucket(minuteTimeBucket); sourceReceiver.receive(exitSourceBuilder.toServiceRelation()); @@ -313,7 +298,8 @@ public class MultiScopesSpanListener implements EntrySpanListener, ExitSpanListe /* * Some of the agent can not have the upstream real network address, such as https://github.com/apache/skywalking-nginx-lua. */ - String sourceLanguage = instanceInventoryCache.getServiceInstanceLanguage(exitSourceBuilder.getSourceServiceInstanceId()); + String sourceLanguage = instanceInventoryCache.getServiceInstanceLanguage( + exitSourceBuilder.getSourceServiceInstanceId()); if (!config.getNoUpstreamRealAddressAgents().contains(sourceLanguage)) { sourceReceiver.receive(exitSourceBuilder.toServiceInstanceRelation()); } diff --git a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/endpoint/SourceBuilder.java b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/endpoint/SourceBuilder.java index f6483bea97f6a43271ce03472b70e1c5a4593f47..ff2ebb2888f46447897aed161983572ef92d4494 100644 --- a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/endpoint/SourceBuilder.java +++ b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/endpoint/SourceBuilder.java @@ -48,9 +48,6 @@ class SourceBuilder { private String sourceServiceInstanceName; @Getter @Setter - private int sourceEndpointId; - @Getter - @Setter private String sourceEndpointName; @Getter @Setter @@ -66,9 +63,6 @@ class SourceBuilder { private String destServiceInstanceName; @Getter @Setter - private int destEndpointId; - @Getter - @Setter private String destEndpointName; @Getter @Setter @@ -176,7 +170,6 @@ class SourceBuilder { Endpoint toEndpoint() { Endpoint endpoint = new Endpoint(); - endpoint.setId(destEndpointId); endpoint.setName(destEndpointName); endpoint.setServiceId(destServiceId); endpoint.setServiceName(destServiceName); @@ -195,13 +188,11 @@ class SourceBuilder { return null; } EndpointRelation endpointRelation = new EndpointRelation(); - endpointRelation.setEndpointId(sourceEndpointId); endpointRelation.setEndpoint(sourceEndpointName); endpointRelation.setServiceId(sourceServiceId); endpointRelation.setServiceName(sourceServiceName); endpointRelation.setServiceInstanceId(sourceServiceInstanceId); endpointRelation.setServiceInstanceName(sourceServiceInstanceName); - endpointRelation.setChildEndpointId(destEndpointId); endpointRelation.setChildEndpoint(destEndpointName); endpointRelation.setChildServiceId(destServiceId); endpointRelation.setChildServiceName(destServiceName); diff --git a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/segment/SegmentSpanListener.java b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/segment/SegmentSpanListener.java index bbb399b7ad3dac58f4585747fa737392070b9cd1..544d87ca875a597ddc25bcdb7358fa9636f96e9b 100644 --- a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/segment/SegmentSpanListener.java +++ b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/listener/segment/SegmentSpanListener.java @@ -21,10 +21,10 @@ package org.apache.skywalking.oap.server.receiver.trace.provider.parser.listener import java.util.stream.Collectors; import lombok.extern.slf4j.Slf4j; import org.apache.skywalking.apm.network.language.agent.UniqueId; -import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.CoreModule; import org.apache.skywalking.oap.server.core.analysis.TimeBucket; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; +import org.apache.skywalking.oap.server.core.source.DetectPoint; import org.apache.skywalking.oap.server.core.source.Segment; import org.apache.skywalking.oap.server.core.source.SourceReceiver; import org.apache.skywalking.oap.server.library.module.ModuleManager; @@ -46,18 +46,13 @@ public class SegmentSpanListener implements FirstSpanListener, EntrySpanListener private final SourceReceiver sourceReceiver; private final TraceSegmentSampler sampler; private final Segment segment = new Segment(); - private final EndpointInventoryCache serviceNameCacheService; private SAMPLE_STATUS sampleStatus = SAMPLE_STATUS.UNKNOWN; - private int entryEndpointId = 0; - private int firstEndpointId = 0; - private String firstEndpointName = ""; + private String endpointId = ""; + private String endpointName = ""; private SegmentSpanListener(ModuleManager moduleManager, TraceSegmentSampler sampler) { this.sampler = sampler; this.sourceReceiver = moduleManager.find(CoreModule.NAME).provider().getService(SourceReceiver.class); - this.serviceNameCacheService = moduleManager.find(CoreModule.NAME) - .provider() - .getService(EndpointInventoryCache.class); } @Override @@ -84,13 +79,18 @@ public class SegmentSpanListener implements FirstSpanListener, EntrySpanListener segment.setDataBinary(segmentCoreInfo.getDataBinary()); segment.setVersion(segmentCoreInfo.getVersion().number()); - firstEndpointId = spanDecorator.getOperationNameId(); - firstEndpointName = spanDecorator.getOperationName(); + endpointId = EndpointTraffic.buildId(segmentCoreInfo.getServiceId(), spanDecorator.getOperationName(), + DetectPoint.fromSpanType(spanDecorator.getSpanType()) + ); + endpointName = spanDecorator.getOperationName(); } @Override public void parseEntry(SpanDecorator spanDecorator, SegmentCoreInfo segmentCoreInfo) { - entryEndpointId = spanDecorator.getOperationNameId(); + endpointId = EndpointTraffic.buildId(segmentCoreInfo.getServiceId(), spanDecorator.getOperationName(), + DetectPoint.fromSpanType(spanDecorator.getSpanType()) + ); + endpointName = spanDecorator.getOperationName(); } @Override @@ -121,23 +121,8 @@ public class SegmentSpanListener implements FirstSpanListener, EntrySpanListener return; } - if (entryEndpointId == Const.NONE) { - if (firstEndpointId != Const.NONE) { - /* - * Since 6.6.0, only entry span is treated as an endpoint. Other span's endpoint id == 0. - */ - segment.setEndpointId(firstEndpointId); - segment.setEndpointName(serviceNameCacheService.get(firstEndpointId).getName()); - } else { - /* - * Only fill first operation name for the trace list query, as no endpoint id. - */ - segment.setEndpointName(firstEndpointName); - } - } else { - segment.setEndpointId(entryEndpointId); - segment.setEndpointName(serviceNameCacheService.get(entryEndpointId).getName()); - } + segment.setEndpointId(endpointId); + segment.setEndpointName(endpointName); sourceReceiver.receive(segment); } diff --git a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/ReferenceIdExchanger.java b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/ReferenceIdExchanger.java index 5203b8627d0e9d97d303dc471ea4772144dd91d7..44e09f3211ce7df6bbaab0fafe17ccebedd212b0 100644 --- a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/ReferenceIdExchanger.java +++ b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/ReferenceIdExchanger.java @@ -23,9 +23,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.CoreModule; import org.apache.skywalking.oap.server.core.cache.ServiceInstanceInventoryCache; -import org.apache.skywalking.oap.server.core.register.service.IEndpointInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.INetworkAddressInventoryRegister; -import org.apache.skywalking.oap.server.core.source.DetectPoint; import org.apache.skywalking.oap.server.library.module.ModuleManager; import org.apache.skywalking.oap.server.receiver.trace.provider.parser.decorator.ReferenceDecorator; @@ -39,7 +37,6 @@ import org.apache.skywalking.oap.server.receiver.trace.provider.parser.decorator @Slf4j public class ReferenceIdExchanger implements IdExchanger { private static ReferenceIdExchanger EXCHANGER; - private final IEndpointInventoryRegister endpointInventoryRegister; private final ServiceInstanceInventoryCache serviceInstanceInventoryCache; private final INetworkAddressInventoryRegister networkAddressInventoryRegister; @@ -51,9 +48,6 @@ public class ReferenceIdExchanger implements IdExchanger { } private ReferenceIdExchanger(ModuleManager moduleManager) { - this.endpointInventoryRegister = moduleManager.find(CoreModule.NAME) - .provider() - .getService(IEndpointInventoryRegister.class); this.networkAddressInventoryRegister = moduleManager.find(CoreModule.NAME) .provider() .getService(INetworkAddressInventoryRegister.class); @@ -62,65 +56,13 @@ public class ReferenceIdExchanger implements IdExchanger { .getService(ServiceInstanceInventoryCache.class); } + /** + * @since 7.1.0 Endpoint doesn't register anymore. Therefore, exchange of ref only relates to the network address only. + */ @Override public boolean exchange(ReferenceDecorator standardBuilder, int serviceId) { boolean exchanged = true; - if (standardBuilder.getEntryEndpointId() == 0) { - String entryEndpointName = Strings.isNullOrEmpty( - standardBuilder.getEntryEndpointName()) ? Const.DOMAIN_OPERATION_NAME : standardBuilder - .getEntryEndpointName(); - int entryServiceId = serviceInstanceInventoryCache.get(standardBuilder.getEntryServiceInstanceId()) - .getServiceId(); - int entryEndpointId = getEndpointId(entryServiceId, entryEndpointName); - if (entryEndpointId == 0) { - if (log.isDebugEnabled()) { - log.debug( - "entry endpoint name: {} from service id: {} exchange failed", entryEndpointName, - entryServiceId - ); - } - - exchanged = false; - } else { - standardBuilder.toBuilder(); - standardBuilder.setEntryEndpointId(entryEndpointId); - standardBuilder.setEntryEndpointName(Const.EMPTY_STRING); - } - } else { - /** - * Since 6.6.0, endpoint id could be -1, as it is not an endpoint. Such as local span and exist span. - */ - } - - if (standardBuilder.getParentEndpointId() == 0) { - String parentEndpointName = Strings.isNullOrEmpty( - standardBuilder.getParentEndpointName()) ? Const.DOMAIN_OPERATION_NAME : standardBuilder - .getParentEndpointName(); - int parentServiceId = serviceInstanceInventoryCache.get(standardBuilder.getParentServiceInstanceId()) - .getServiceId(); - int parentEndpointId = getEndpointId(parentServiceId, parentEndpointName); - - if (parentEndpointId == 0) { - if (log.isDebugEnabled()) { - log.debug( - "parent endpoint name: {} from service id: {} exchange failed", parentEndpointName, - parentServiceId - ); - } - - exchanged = false; - } else { - standardBuilder.toBuilder(); - standardBuilder.setParentEndpointId(parentEndpointId); - standardBuilder.setParentEndpointName(Const.EMPTY_STRING); - } - } else { - /** - * Since 6.6.0, endpoint id could be -1, as it is not an endpoint. Such as local span and exist span. - */ - } - if (standardBuilder.getNetworkAddressId() == 0 && !Strings.isNullOrEmpty(standardBuilder.getNetworkAddress())) { int networkAddressId = networkAddressInventoryRegister.getOrCreate( standardBuilder.getNetworkAddress(), null); @@ -142,16 +84,4 @@ public class ReferenceIdExchanger implements IdExchanger { } return exchanged; } - - /** - * @since 6.6.0 The endpoint in the ref should be server endpoint only. The agent will/should use `-1`, when it can't - * find the endpoint of entry span in the current tracing context when build the ref. - * @since 5.0 Endpoint in ref could be local or exit span's operation name. Especially if it is local span operation - * name, * exchange may not happen at agent, such as Java agent, then put literal endpoint string in the header, - * Need to try * to get the id by assuming the endpoint name is detected at server, local or client. *

* If - * agent does the exchange, then always use endpoint id. - */ - private int getEndpointId(int serviceId, String endpointName) { - return endpointInventoryRegister.getOrCreate(serviceId, endpointName, DetectPoint.SERVER); - } } diff --git a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/SpanExchanger.java b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/SpanExchanger.java index c0383b2b12aa91bf5282705ec1e30c17a955ff4f..c9489907b8c25518612a3b82fca6d47b15db8df9 100644 --- a/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/SpanExchanger.java +++ b/oap-server/server-receiver-plugin/skywalking-trace-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/trace/provider/parser/standardization/SpanExchanger.java @@ -24,7 +24,6 @@ import java.util.List; import lombok.extern.slf4j.Slf4j; import org.apache.skywalking.apm.network.common.KeyStringValuePair; import org.apache.skywalking.apm.network.language.agent.SpanLayer; -import org.apache.skywalking.apm.network.language.agent.SpanType; import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.CoreModule; import org.apache.skywalking.oap.server.core.cache.ServiceInstanceInventoryCache; @@ -33,11 +32,9 @@ import org.apache.skywalking.oap.server.core.config.IComponentLibraryCatalogServ import org.apache.skywalking.oap.server.core.register.NodeType; import org.apache.skywalking.oap.server.core.register.ServiceInstanceInventory; import org.apache.skywalking.oap.server.core.register.ServiceInventory; -import org.apache.skywalking.oap.server.core.register.service.IEndpointInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.INetworkAddressInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.IServiceInstanceInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.IServiceInventoryRegister; -import org.apache.skywalking.oap.server.core.source.DetectPoint; import org.apache.skywalking.oap.server.library.module.ModuleManager; import org.apache.skywalking.oap.server.receiver.trace.provider.parser.decorator.SpanDecorator; @@ -54,7 +51,6 @@ public class SpanExchanger implements IdExchanger { private final IServiceInventoryRegister serviceInventoryRegister; private final ServiceInstanceInventoryCache serviceInstanceInventoryCacheDAO; private final IServiceInstanceInventoryRegister serviceInstanceInventoryRegister; - private final IEndpointInventoryRegister endpointInventoryRegister; private final INetworkAddressInventoryRegister networkAddressInventoryRegister; private final IComponentLibraryCatalogService componentLibraryCatalogService; @@ -78,9 +74,6 @@ public class SpanExchanger implements IdExchanger { this.serviceInstanceInventoryRegister = moduleManager.find(CoreModule.NAME) .provider() .getService(IServiceInstanceInventoryRegister.class); - this.endpointInventoryRegister = moduleManager.find(CoreModule.NAME) - .provider() - .getService(IEndpointInventoryRegister.class); this.networkAddressInventoryRegister = moduleManager.find(CoreModule.NAME) .provider() .getService(INetworkAddressInventoryRegister.class); @@ -154,32 +147,6 @@ public class SpanExchanger implements IdExchanger { serviceInstanceInventoryRegister.update(newServiceInstanceInventory.getSequence(), nodeType, properties); } - if (standardBuilder.getOperationNameId() == Const.NONE) { - /** - * Only operation name of entry span is being treated as an endpoint, - * so, since 6.6.0, only it triggers register. - */ - if (SpanType.Entry.equals(standardBuilder.getSpanType())) { - String endpointName = Strings.isNullOrEmpty( - standardBuilder.getOperationName()) ? Const.DOMAIN_OPERATION_NAME : standardBuilder - .getOperationName(); - int endpointId = endpointInventoryRegister.getOrCreate( - serviceId, endpointName, DetectPoint.fromSpanType(standardBuilder - .getSpanType())); - - if (endpointId == 0) { - if (log.isDebugEnabled()) { - log.debug("endpoint name: {} from service id: {} exchange failed", endpointName, serviceId); - } - - exchanged = false; - } else { - standardBuilder.toBuilder(); - standardBuilder.setOperationNameId(endpointId); - standardBuilder.setOperationName(Const.EMPTY_STRING); - } - } - } return exchanged; } diff --git a/oap-server/server-receiver-plugin/zipkin-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/zipkin/handler/SpanProcessor.java b/oap-server/server-receiver-plugin/zipkin-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/zipkin/handler/SpanProcessor.java index f27c2a427c5609adef13fd00a9ef0764b55c9b9d..a99c60941aa2c03d1ff7609c5ff6f5424860b100 100644 --- a/oap-server/server-receiver-plugin/zipkin-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/zipkin/handler/SpanProcessor.java +++ b/oap-server/server-receiver-plugin/zipkin-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/zipkin/handler/SpanProcessor.java @@ -24,7 +24,6 @@ import java.io.InputStream; import java.util.List; import java.util.zip.GZIPInputStream; import javax.servlet.http.HttpServletRequest; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; import org.apache.skywalking.oap.server.core.source.SourceReceiver; import org.apache.skywalking.oap.server.receiver.zipkin.ZipkinReceiverConfig; @@ -36,14 +35,11 @@ import zipkin2.codec.SpanBytesDecoder; public class SpanProcessor { private SourceReceiver receiver; private ServiceInventoryCache serviceInventoryCache; - private EndpointInventoryCache endpointInventoryCache; private int encode; - public SpanProcessor(SourceReceiver receiver, ServiceInventoryCache serviceInventoryCache, - EndpointInventoryCache endpointInventoryCache, int encode) { + public SpanProcessor(SourceReceiver receiver, ServiceInventoryCache serviceInventoryCache, int encode) { this.receiver = receiver; this.serviceInventoryCache = serviceInventoryCache; - this.endpointInventoryCache = endpointInventoryCache; this.encode = encode; } @@ -63,7 +59,7 @@ public class SpanProcessor { ZipkinSkyWalkingTransfer transfer = new ZipkinSkyWalkingTransfer(); transfer.doTransfer(config, spanList); } else { - SpanForward forward = new SpanForward(config, receiver, serviceInventoryCache, endpointInventoryCache, encode); + SpanForward forward = new SpanForward(config, receiver, serviceInventoryCache, encode); forward.send(spanList); } } diff --git a/oap-server/server-receiver-plugin/zipkin-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/zipkin/handler/SpanV1JettyHandler.java b/oap-server/server-receiver-plugin/zipkin-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/zipkin/handler/SpanV1JettyHandler.java index 2301102dce34d7a7fa91484d276e5e2e4ca1cd02..4561d96c8590aeddcb4018a83fbf4a494c33b494 100644 --- a/oap-server/server-receiver-plugin/zipkin-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/zipkin/handler/SpanV1JettyHandler.java +++ b/oap-server/server-receiver-plugin/zipkin-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/zipkin/handler/SpanV1JettyHandler.java @@ -21,7 +21,6 @@ package org.apache.skywalking.oap.server.receiver.zipkin.handler; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.skywalking.oap.server.core.CoreModule; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; import org.apache.skywalking.oap.server.core.source.SourceReceiver; import org.apache.skywalking.oap.server.library.module.ModuleManager; @@ -37,12 +36,10 @@ public class SpanV1JettyHandler extends JettyHandler { private ZipkinReceiverConfig config; private SourceReceiver sourceReceiver; private ServiceInventoryCache serviceInventoryCache; - private EndpointInventoryCache endpointInventoryCache; public SpanV1JettyHandler(ZipkinReceiverConfig config, ModuleManager manager) { sourceReceiver = manager.find(CoreModule.NAME).provider().getService(SourceReceiver.class); serviceInventoryCache = manager.find(CoreModule.NAME).provider().getService(ServiceInventoryCache.class); - endpointInventoryCache = manager.find(CoreModule.NAME).provider().getService(EndpointInventoryCache.class); this.config = config; } @@ -63,7 +60,7 @@ public class SpanV1JettyHandler extends JettyHandler { SpanBytesDecoder decoder = SpanEncode.isThrift(encode) ? SpanBytesDecoder.THRIFT : SpanBytesDecoder.JSON_V1; - SpanProcessor processor = new SpanProcessor(sourceReceiver, serviceInventoryCache, endpointInventoryCache, encode); + SpanProcessor processor = new SpanProcessor(sourceReceiver, serviceInventoryCache, encode); processor.convert(config, decoder, request); response.setStatus(202); diff --git a/oap-server/server-receiver-plugin/zipkin-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/zipkin/handler/SpanV2JettyHandler.java b/oap-server/server-receiver-plugin/zipkin-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/zipkin/handler/SpanV2JettyHandler.java index 09cf07a4371e9cb0328c62b221c9a9fcde201dbb..2a10b397b59f9bea3501baf90889fd7cabc2fd55 100644 --- a/oap-server/server-receiver-plugin/zipkin-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/zipkin/handler/SpanV2JettyHandler.java +++ b/oap-server/server-receiver-plugin/zipkin-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/zipkin/handler/SpanV2JettyHandler.java @@ -21,7 +21,6 @@ package org.apache.skywalking.oap.server.receiver.zipkin.handler; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.skywalking.oap.server.core.CoreModule; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; import org.apache.skywalking.oap.server.core.source.SourceReceiver; import org.apache.skywalking.oap.server.library.module.ModuleManager; @@ -37,12 +36,10 @@ public class SpanV2JettyHandler extends JettyHandler { private ZipkinReceiverConfig config; private SourceReceiver sourceReceiver; private ServiceInventoryCache serviceInventoryCache; - private EndpointInventoryCache endpointInventoryCache; public SpanV2JettyHandler(ZipkinReceiverConfig config, ModuleManager manager) { sourceReceiver = manager.find(CoreModule.NAME).provider().getService(SourceReceiver.class); serviceInventoryCache = manager.find(CoreModule.NAME).provider().getService(ServiceInventoryCache.class); - endpointInventoryCache = manager.find(CoreModule.NAME).provider().getService(EndpointInventoryCache.class); this.config = config; } @@ -63,7 +60,7 @@ public class SpanV2JettyHandler extends JettyHandler { SpanBytesDecoder decoder = SpanEncode.isProto3(encode) ? SpanBytesDecoder.PROTO3 : SpanBytesDecoder.JSON_V2; - SpanProcessor processor = new SpanProcessor(sourceReceiver, serviceInventoryCache, endpointInventoryCache, encode); + SpanProcessor processor = new SpanProcessor(sourceReceiver, serviceInventoryCache, encode); processor.convert(config, decoder, request); response.setStatus(202); diff --git a/oap-server/server-receiver-plugin/zipkin-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/zipkin/trace/SpanForward.java b/oap-server/server-receiver-plugin/zipkin-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/zipkin/trace/SpanForward.java index 5d39bf9f618e73eb476f9b729e7609f4a10a6338..1b1edbcd9f9f9dfcaa39084661ecab25960cc4b1 100644 --- a/oap-server/server-receiver-plugin/zipkin-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/zipkin/trace/SpanForward.java +++ b/oap-server/server-receiver-plugin/zipkin-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/zipkin/trace/SpanForward.java @@ -22,7 +22,7 @@ import java.util.List; import org.apache.skywalking.apm.util.StringUtil; import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.analysis.TimeBucket; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; import org.apache.skywalking.oap.server.core.source.DetectPoint; import org.apache.skywalking.oap.server.core.source.SourceReceiver; @@ -38,15 +38,13 @@ public class SpanForward { private ZipkinReceiverConfig config; private SourceReceiver receiver; private ServiceInventoryCache serviceInventoryCache; - private EndpointInventoryCache endpointInventoryCache; private int encode; public SpanForward(ZipkinReceiverConfig config, SourceReceiver receiver, - ServiceInventoryCache serviceInventoryCache, EndpointInventoryCache endpointInventoryCache, int encode) { + ServiceInventoryCache serviceInventoryCache, int encode) { this.config = config; this.receiver = receiver; this.serviceInventoryCache = serviceInventoryCache; - this.endpointInventoryCache = endpointInventoryCache; this.encode = encode; } @@ -76,13 +74,7 @@ public class SpanForward { case SERVER: case CONSUMER: if (!StringUtil.isEmpty(spanName) && serviceId != Const.NONE) { - int endpointId = endpointInventoryCache.getEndpointId(serviceId, spanName, DetectPoint.SERVER.ordinal()); - if (endpointId != Const.NONE) { - zipkinSpan.setEndpointId(endpointId); - } else if (config.isRegisterZipkinEndpoint()) { - CoreRegisterLinker.getEndpointInventoryRegister() - .getOrCreate(serviceId, spanName, DetectPoint.SERVER); - } + zipkinSpan.setEndpointId(EndpointTraffic.buildId(serviceId, spanName, DetectPoint.SERVER)); } } if (!StringUtil.isEmpty(spanName)) { diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/StorageModuleElasticsearchProvider.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/StorageModuleElasticsearchProvider.java index af7c4bb40175c3e926fa9fe3cb58d34425923807..e89eb09d046ec20d0566faebbc59ab999fd067d8 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/StorageModuleElasticsearchProvider.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/StorageModuleElasticsearchProvider.java @@ -40,7 +40,6 @@ import org.apache.skywalking.oap.server.core.storage.IRegisterLockDAO; import org.apache.skywalking.oap.server.core.storage.StorageDAO; import org.apache.skywalking.oap.server.core.storage.StorageException; import org.apache.skywalking.oap.server.core.storage.StorageModule; -import org.apache.skywalking.oap.server.core.storage.cache.IEndpointInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.INetworkAddressInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.IServiceInstanceInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.IServiceInventoryCacheDAO; @@ -68,7 +67,6 @@ import org.apache.skywalking.oap.server.storage.plugin.elasticsearch.base.Histor import org.apache.skywalking.oap.server.storage.plugin.elasticsearch.base.StorageEsDAO; import org.apache.skywalking.oap.server.storage.plugin.elasticsearch.base.StorageEsInstaller; import org.apache.skywalking.oap.server.storage.plugin.elasticsearch.base.TimeSeriesUtils; -import org.apache.skywalking.oap.server.storage.plugin.elasticsearch.cache.EndpointInventoryCacheEsDAO; import org.apache.skywalking.oap.server.storage.plugin.elasticsearch.cache.NetworkAddressInventoryCacheEsDAO; import org.apache.skywalking.oap.server.storage.plugin.elasticsearch.cache.ServiceInstanceInventoryCacheDAO; import org.apache.skywalking.oap.server.storage.plugin.elasticsearch.cache.ServiceInventoryCacheEsDAO; @@ -176,8 +174,6 @@ public class StorageModuleElasticsearchProvider extends ModuleProvider { this.registerServiceImplementation( IServiceInstanceInventoryCacheDAO.class, new ServiceInstanceInventoryCacheDAO(elasticSearchClient, config .getResultWindowMaxSize())); - this.registerServiceImplementation( - IEndpointInventoryCacheDAO.class, new EndpointInventoryCacheEsDAO(elasticSearchClient)); this.registerServiceImplementation( INetworkAddressInventoryCacheDAO.class, new NetworkAddressInventoryCacheEsDAO(elasticSearchClient, config .getResultWindowMaxSize())); diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/EndpointInventoryCacheEsDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/EndpointInventoryCacheEsDAO.java deleted file mode 100644 index c41a623528a32bfb52db26f19e877b74e088454f..0000000000000000000000000000000000000000 --- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/EndpointInventoryCacheEsDAO.java +++ /dev/null @@ -1,80 +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 org.apache.skywalking.oap.server.storage.plugin.elasticsearch.cache; - -import org.apache.skywalking.oap.server.core.Const; -import org.apache.skywalking.oap.server.core.register.EndpointInventory; -import org.apache.skywalking.oap.server.core.register.RegisterSource; -import org.apache.skywalking.oap.server.core.storage.cache.IEndpointInventoryCacheDAO; -import org.apache.skywalking.oap.server.library.client.elasticsearch.ElasticSearchClient; -import org.apache.skywalking.oap.server.storage.plugin.elasticsearch.base.EsDAO; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class EndpointInventoryCacheEsDAO extends EsDAO implements IEndpointInventoryCacheDAO { - - private static final Logger logger = LoggerFactory.getLogger(EndpointInventoryCacheEsDAO.class); - - protected final EndpointInventory.Builder builder = new EndpointInventory.Builder(); - - public EndpointInventoryCacheEsDAO(ElasticSearchClient client) { - super(client); - } - - @Override - public int getEndpointId(int serviceId, String endpointName, int detectPoint) { - try { - String id = EndpointInventory.buildId(serviceId, endpointName, detectPoint); - GetResponse response = getClient().get(EndpointInventory.INDEX_NAME, id); - if (response.isExists()) { - return (int) response.getSource().getOrDefault(RegisterSource.SEQUENCE, 0); - } else { - return Const.NONE; - } - } catch (Throwable e) { - logger.error(e.getMessage(), e); - return Const.NONE; - } - } - - @Override - public EndpointInventory get(int endpointId) { - try { - SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); - searchSourceBuilder.query(QueryBuilders.termQuery(EndpointInventory.SEQUENCE, endpointId)); - searchSourceBuilder.size(1); - - SearchResponse response = getClient().search(EndpointInventory.INDEX_NAME, searchSourceBuilder); - if (response.getHits().totalHits == 1) { - SearchHit searchHit = response.getHits().getAt(0); - return builder.map2Data(searchHit.getSourceAsMap()); - } else { - return null; - } - } catch (Throwable e) { - logger.error(e.getMessage(), e); - return null; - } - } -} diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/AggregationQueryEsDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/AggregationQueryEsDAO.java index e03c9bd55524fb7a0dd1c33ef4a1ba88f5c5d04b..d2bed082c8cd29f54921c439a6bf85d19449470b 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/AggregationQueryEsDAO.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/AggregationQueryEsDAO.java @@ -25,7 +25,7 @@ import org.apache.skywalking.oap.server.core.analysis.Downsampling; import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics; import org.apache.skywalking.oap.server.core.query.entity.Order; import org.apache.skywalking.oap.server.core.query.entity.TopNEntity; -import org.apache.skywalking.oap.server.core.register.EndpointInventory; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.register.ServiceInstanceInventory; import org.apache.skywalking.oap.server.core.storage.model.ModelName; import org.apache.skywalking.oap.server.core.storage.query.IAggregationQueryDAO; @@ -104,7 +104,7 @@ public class AggregationQueryEsDAO extends EsDAO implements IAggregationQueryDAO sourceBuilder.query(boolQueryBuilder); boolQueryBuilder.must().add(QueryBuilders.rangeQuery(Metrics.TIME_BUCKET).lte(endTB).gte(startTB)); - boolQueryBuilder.must().add(QueryBuilders.termQuery(EndpointInventory.SERVICE_ID, serviceId)); + boolQueryBuilder.must().add(QueryBuilders.termQuery(EndpointTraffic.SERVICE_ID, serviceId)); return aggregation(indexName, valueCName, sourceBuilder, topN, order); } diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/LogQueryEsDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/LogQueryEsDAO.java index a76ed67d8248eed91c041da943951205cf08154a..ee99ae5db8864b64b2ed089e8189bbd487c7321b 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/LogQueryEsDAO.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/LogQueryEsDAO.java @@ -21,6 +21,7 @@ package org.apache.skywalking.oap.server.storage.plugin.elasticsearch.query; import com.google.common.base.Strings; import java.io.IOException; import java.util.List; +import org.apache.skywalking.apm.util.StringUtil; import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord; import org.apache.skywalking.oap.server.core.analysis.record.Record; @@ -48,9 +49,9 @@ public class LogQueryEsDAO extends EsDAO implements ILogQueryDAO { } @Override - public Logs queryLogs(String metricName, int serviceId, int serviceInstanceId, int endpointId, String traceId, - LogState state, String stateCode, Pagination paging, int from, int limit, long startSecondTB, - long endSecondTB) throws IOException { + public Logs queryLogs(String metricName, int serviceId, int serviceInstanceId, String endpointId, String traceId, + LogState state, String stateCode, Pagination paging, int from, int limit, long startSecondTB, + long endSecondTB) throws IOException { SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery(); @@ -68,7 +69,7 @@ public class LogQueryEsDAO extends EsDAO implements ILogQueryDAO { boolQueryBuilder.must() .add(QueryBuilders.termQuery(AbstractLogRecord.SERVICE_INSTANCE_ID, serviceInstanceId)); } - if (endpointId != Const.NONE) { + if (StringUtil.isNotEmpty(endpointId)) { boolQueryBuilder.must().add(QueryBuilders.termQuery(AbstractLogRecord.ENDPOINT_ID, endpointId)); } if (!Strings.isNullOrEmpty(stateCode)) { @@ -79,10 +80,13 @@ public class LogQueryEsDAO extends EsDAO implements ILogQueryDAO { } if (LogState.ERROR.equals(state)) { boolQueryBuilder.must() - .add(QueryBuilders.termQuery(AbstractLogRecord.IS_ERROR, BooleanUtils.booleanToValue(true))); + .add( + QueryBuilders.termQuery(AbstractLogRecord.IS_ERROR, BooleanUtils.booleanToValue(true))); } else if (LogState.SUCCESS.equals(state)) { boolQueryBuilder.must() - .add(QueryBuilders.termQuery(AbstractLogRecord.IS_ERROR, BooleanUtils.booleanToValue(false))); + .add(QueryBuilders.termQuery(AbstractLogRecord.IS_ERROR, + BooleanUtils.booleanToValue(false) + )); } sourceBuilder.size(limit); @@ -98,12 +102,14 @@ public class LogQueryEsDAO extends EsDAO implements ILogQueryDAO { log.setServiceId(((Number) searchHit.getSourceAsMap().get(AbstractLogRecord.SERVICE_ID)).intValue()); log.setServiceInstanceId(((Number) searchHit.getSourceAsMap() .get(AbstractLogRecord.SERVICE_INSTANCE_ID)).intValue()); - log.setEndpointId(((Number) searchHit.getSourceAsMap().get(AbstractLogRecord.ENDPOINT_ID)).intValue()); + log.setEndpointId((String) searchHit.getSourceAsMap().get(AbstractLogRecord.ENDPOINT_ID)); + log.setEndpointName((String) searchHit.getSourceAsMap().get(AbstractLogRecord.ENDPOINT_NAME)); log.setError(BooleanUtils.valueToBoolean(((Number) searchHit.getSourceAsMap() .get(AbstractLogRecord.IS_ERROR)).intValue())); log.setStatusCode((String) searchHit.getSourceAsMap().get(AbstractLogRecord.STATUS_CODE)); log.setContentType(ContentType.instanceOf(((Number) searchHit.getSourceAsMap() - .get(AbstractLogRecord.CONTENT_TYPE)).intValue())); + .get( + AbstractLogRecord.CONTENT_TYPE)).intValue())); log.setContent((String) searchHit.getSourceAsMap().get(AbstractLogRecord.CONTENT)); logs.getLogs().add(log); diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetadataQueryEsDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetadataQueryEsDAO.java index 8e2369423a45ca00727db0f5fdd2c66366028dd8..ff42b4abc72501ed881721e6125ce92f44919010 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetadataQueryEsDAO.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/MetadataQueryEsDAO.java @@ -26,13 +26,14 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.query.entity.Attribute; import org.apache.skywalking.oap.server.core.query.entity.Database; import org.apache.skywalking.oap.server.core.query.entity.Endpoint; import org.apache.skywalking.oap.server.core.query.entity.LanguageTrans; import org.apache.skywalking.oap.server.core.query.entity.Service; import org.apache.skywalking.oap.server.core.query.entity.ServiceInstance; -import org.apache.skywalking.oap.server.core.register.EndpointInventory; import org.apache.skywalking.oap.server.core.register.NodeType; import org.apache.skywalking.oap.server.core.register.RegisterSource; import org.apache.skywalking.oap.server.core.register.ServiceInstanceInventory; @@ -83,6 +84,9 @@ public class MetadataQueryEsDAO extends EsDAO implements IMetadataQueryDAO { return (int) response.getHits().getTotalHits(); } + /** + * @since 7.0.0, as EndpointInventory has been replaced by EndpointTraffic. This is not an accurate number anymore. + */ @Override public int numOfEndpoint() throws IOException { SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); @@ -90,12 +94,12 @@ public class MetadataQueryEsDAO extends EsDAO implements IMetadataQueryDAO { BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery(); boolQueryBuilder.must() - .add(QueryBuilders.termQuery(EndpointInventory.DETECT_POINT, DetectPoint.SERVER.ordinal())); + .add(QueryBuilders.termQuery(EndpointTraffic.DETECT_POINT, DetectPoint.SERVER.value())); sourceBuilder.query(boolQueryBuilder); sourceBuilder.size(0); - SearchResponse response = getClient().search(EndpointInventory.INDEX_NAME, sourceBuilder); + SearchResponse response = getClient().search(EndpointTraffic.INDEX_NAME, sourceBuilder); return (int) response.getHits().getTotalHits(); } @@ -214,41 +218,50 @@ public class MetadataQueryEsDAO extends EsDAO implements IMetadataQueryDAO { } @Override - public List searchEndpoint(String keyword, String serviceId, int limit) throws IOException { + public List searchEndpoint(String keyword, int serviceId, int limit) throws IOException { SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery(); - boolQueryBuilder.must().add(QueryBuilders.termQuery(EndpointInventory.SERVICE_ID, serviceId)); + boolQueryBuilder.must().add(QueryBuilders.termQuery(EndpointTraffic.SERVICE_ID, serviceId)); if (!Strings.isNullOrEmpty(keyword)) { - String matchCName = MatchCNameBuilder.INSTANCE.build(EndpointInventory.NAME); + String matchCName = MatchCNameBuilder.INSTANCE.build(EndpointTraffic.NAME); boolQueryBuilder.must().add(QueryBuilders.matchQuery(matchCName, keyword)); } boolQueryBuilder.must() - .add(QueryBuilders.termQuery(EndpointInventory.DETECT_POINT, DetectPoint.SERVER.ordinal())); + .add(QueryBuilders.termQuery(EndpointTraffic.DETECT_POINT, DetectPoint.SERVER.value())); sourceBuilder.query(boolQueryBuilder); - sourceBuilder.size(limit); + /** + * Query the dataset by a larger limit condition and distinct in the memory, + * in order to avoid the storage level distinct. + * This is a match query only, don't need 100% accurate. + */ + sourceBuilder.size(limit * 7); - SearchResponse response = getClient().search(EndpointInventory.INDEX_NAME, sourceBuilder); + SearchResponse response = getClient().search(EndpointTraffic.INDEX_NAME, sourceBuilder); List endpoints = new ArrayList<>(); for (SearchHit searchHit : response.getHits()) { Map sourceAsMap = searchHit.getSourceAsMap(); + final EndpointTraffic endpointTraffic = new EndpointTraffic.Builder().map2Data(sourceAsMap); + Endpoint endpoint = new Endpoint(); - endpoint.setId(((Number) sourceAsMap.get(EndpointInventory.SEQUENCE)).intValue()); - endpoint.setName((String) sourceAsMap.get(EndpointInventory.NAME)); + endpoint.setId(EndpointTraffic.buildId(endpointTraffic)); + endpoint.setName((String) sourceAsMap.get(EndpointTraffic.NAME)); endpoints.add(endpoint); } - return endpoints; + final List endpointList = endpoints.stream().distinct().collect(Collectors.toList()); + + return endpointList.size() > limit ? endpointList.subList(0, limit) : endpointList; } @Override public List getServiceInstances(long startTimestamp, long endTimestamp, - String serviceId) throws IOException { + String serviceId) throws IOException { SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery(); @@ -285,8 +298,9 @@ public class MetadataQueryEsDAO extends EsDAO implements IMetadataQueryDAO { } else if (key.equals(PROCESS_NO)) { serviceInstance.getAttributes().add(new Attribute(PROCESS_NO, value)); } else if (key.equals(IPV4S)) { - List ipv4s = ServiceInstanceInventory.PropertyUtil.ipv4sDeserialize(properties.get(IPV4S) - .getAsString()); + List ipv4s = ServiceInstanceInventory.PropertyUtil.ipv4sDeserialize( + properties.get(IPV4S) + .getAsString()); for (String ipv4 : ipv4s) { serviceInstance.getAttributes() .add(new Attribute(ServiceInstanceInventory.PropertyUtil.IPV4S, ipv4)); diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/TopologyQueryEsDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/TopologyQueryEsDAO.java index 27b66bbe998dec72d4825ea851ccad0747caa374..9a6695b34d309241323d1eb9a9bd45a6b159dcbf 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/TopologyQueryEsDAO.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/TopologyQueryEsDAO.java @@ -18,9 +18,13 @@ package org.apache.skywalking.oap.server.storage.plugin.elasticsearch.query; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import org.apache.skywalking.oap.server.core.UnexpectedException; import org.apache.skywalking.oap.server.core.analysis.Downsampling; import org.apache.skywalking.oap.server.core.analysis.manual.RelationDefineUtil; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.analysis.manual.endpointrelation.EndpointRelationServerSideMetrics; import org.apache.skywalking.oap.server.core.analysis.manual.relation.instance.ServiceInstanceRelationClientSideMetrics; import org.apache.skywalking.oap.server.core.analysis.manual.relation.instance.ServiceInstanceRelationServerSideMetrics; @@ -41,10 +45,6 @@ import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.builder.SearchSourceBuilder; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO { public TopologyQueryEsDAO(ElasticSearchClient client) { @@ -52,8 +52,10 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO { } @Override - public List loadSpecifiedServerSideServiceRelations(Downsampling downsampling, long startTB, - long endTB, List serviceIds) throws IOException { + public List loadSpecifiedServerSideServiceRelations(Downsampling downsampling, + long startTB, + long endTB, + List serviceIds) throws IOException { if (CollectionUtils.isEmpty(serviceIds)) { throw new UnexpectedException("Service id is empty"); } @@ -67,8 +69,10 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO { } @Override - public List loadSpecifiedClientSideServiceRelations(Downsampling downsampling, long startTB, - long endTB, List serviceIds) throws IOException { + public List loadSpecifiedClientSideServiceRelations(Downsampling downsampling, + long startTB, + long endTB, + List serviceIds) throws IOException { if (CollectionUtils.isEmpty(serviceIds)) { throw new UnexpectedException("Service id is empty"); } @@ -82,7 +86,7 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO { } private void setQueryCondition(SearchSourceBuilder sourceBuilder, long startTB, long endTB, - List serviceIds) { + List serviceIds) { BoolQueryBuilder boolQuery = QueryBuilders.boolQuery(); boolQuery.must() .add(QueryBuilders.rangeQuery(ServiceRelationServerSideMetrics.TIME_BUCKET).gte(startTB).lte(endTB)); @@ -92,22 +96,32 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO { if (serviceIds.size() == 1) { serviceIdBoolQuery.should() - .add(QueryBuilders.termQuery(ServiceRelationServerSideMetrics.SOURCE_SERVICE_ID, serviceIds - .get(0))); + .add( + QueryBuilders.termQuery(ServiceRelationServerSideMetrics.SOURCE_SERVICE_ID, serviceIds + .get(0))); serviceIdBoolQuery.should() - .add(QueryBuilders.termQuery(ServiceRelationServerSideMetrics.DEST_SERVICE_ID, serviceIds.get(0))); + .add(QueryBuilders.termQuery( + ServiceRelationServerSideMetrics.DEST_SERVICE_ID, + serviceIds.get(0) + )); } else { serviceIdBoolQuery.should() - .add(QueryBuilders.termsQuery(ServiceRelationServerSideMetrics.SOURCE_SERVICE_ID, serviceIds)); + .add(QueryBuilders.termsQuery( + ServiceRelationServerSideMetrics.SOURCE_SERVICE_ID, + serviceIds + )); serviceIdBoolQuery.should() - .add(QueryBuilders.termsQuery(ServiceRelationServerSideMetrics.DEST_SERVICE_ID, serviceIds)); + .add(QueryBuilders.termsQuery( + ServiceRelationServerSideMetrics.DEST_SERVICE_ID, + serviceIds + )); } sourceBuilder.query(boolQuery); } @Override public List loadServerSideServiceRelations(Downsampling downsampling, long startTB, - long endTB) throws IOException { + long endTB) throws IOException { String indexName = ModelName.build(downsampling, ServiceRelationServerSideMetrics.INDEX_NAME); SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); sourceBuilder.query(QueryBuilders.rangeQuery(ServiceRelationServerSideMetrics.TIME_BUCKET) @@ -120,7 +134,7 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO { @Override public List loadClientSideServiceRelations(Downsampling downsampling, long startTB, - long endTB) throws IOException { + long endTB) throws IOException { String indexName = ModelName.build(downsampling, ServiceRelationClientSideMetrics.INDEX_NAME); SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); sourceBuilder.query(QueryBuilders.rangeQuery(ServiceRelationServerSideMetrics.TIME_BUCKET) @@ -132,8 +146,11 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO { } @Override - public List loadServerSideServiceInstanceRelations(int clientServiceId, int serverServiceId, - Downsampling downsampling, long startTB, long endTB) throws IOException { + public List loadServerSideServiceInstanceRelations(int clientServiceId, + int serverServiceId, + Downsampling downsampling, + long startTB, + long endTB) throws IOException { String indexName = ModelName.build(downsampling, ServiceInstanceRelationServerSideMetrics.INDEX_NAME); SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); sourceBuilder.size(0); @@ -143,8 +160,11 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO { } @Override - public List loadClientSideServiceInstanceRelations(int clientServiceId, int serverServiceId, - Downsampling downsampling, long startTB, long endTB) throws IOException { + public List loadClientSideServiceInstanceRelations(int clientServiceId, + int serverServiceId, + Downsampling downsampling, + long startTB, + long endTB) throws IOException { String indexName = ModelName.build(downsampling, ServiceInstanceRelationClientSideMetrics.INDEX_NAME); SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); sourceBuilder.size(0); @@ -154,7 +174,7 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO { } private void setInstanceQueryCondition(SearchSourceBuilder sourceBuilder, long startTB, long endTB, - int clientServiceId, int serverServiceId) { + int clientServiceId, int serverServiceId) { BoolQueryBuilder boolQuery = QueryBuilders.boolQuery(); boolQuery.must() .add(QueryBuilders.rangeQuery(EndpointRelationServerSideMetrics.TIME_BUCKET).gte(startTB).lte(endTB)); @@ -165,21 +185,27 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO { BoolQueryBuilder serverRelationBoolQuery = new BoolQueryBuilder(); serviceIdBoolQuery.should(serverRelationBoolQuery); - serverRelationBoolQuery.must(QueryBuilders.termQuery(ServiceInstanceRelationServerSideMetrics.SOURCE_SERVICE_ID, clientServiceId)); - serverRelationBoolQuery.must(QueryBuilders.termQuery(ServiceInstanceRelationServerSideMetrics.DEST_SERVICE_ID, serverServiceId)); + serverRelationBoolQuery.must( + QueryBuilders.termQuery(ServiceInstanceRelationServerSideMetrics.SOURCE_SERVICE_ID, clientServiceId)); + serverRelationBoolQuery.must( + QueryBuilders.termQuery(ServiceInstanceRelationServerSideMetrics.DEST_SERVICE_ID, serverServiceId)); BoolQueryBuilder clientRelationBoolQuery = new BoolQueryBuilder(); serviceIdBoolQuery.should(clientRelationBoolQuery); - clientRelationBoolQuery.must(QueryBuilders.termQuery(ServiceInstanceRelationServerSideMetrics.DEST_SERVICE_ID, clientServiceId)); - clientRelationBoolQuery.must(QueryBuilders.termQuery(ServiceInstanceRelationServerSideMetrics.SOURCE_SERVICE_ID, serverServiceId)); + clientRelationBoolQuery.must( + QueryBuilders.termQuery(ServiceInstanceRelationServerSideMetrics.DEST_SERVICE_ID, clientServiceId)); + clientRelationBoolQuery.must( + QueryBuilders.termQuery(ServiceInstanceRelationServerSideMetrics.SOURCE_SERVICE_ID, serverServiceId)); sourceBuilder.query(boolQuery); } @Override - public List loadSpecifiedDestOfServerSideEndpointRelations(Downsampling downsampling, long startTB, - long endTB, int destEndpointId) throws IOException { + public List loadSpecifiedDestOfServerSideEndpointRelations(Downsampling downsampling, + long startTB, + long endTB, + String destEndpointId) throws IOException { String indexName = ModelName.build(downsampling, EndpointRelationServerSideMetrics.INDEX_NAME); SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); @@ -192,17 +218,21 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO { BoolQueryBuilder serviceIdBoolQuery = QueryBuilders.boolQuery(); boolQuery.must().add(serviceIdBoolQuery); serviceIdBoolQuery.should() - .add(QueryBuilders.termQuery(EndpointRelationServerSideMetrics.SOURCE_ENDPOINT_ID, destEndpointId)); + .add(QueryBuilders.termQuery( + EndpointRelationServerSideMetrics.SOURCE_ENDPOINT, + destEndpointId + )); serviceIdBoolQuery.should() - .add(QueryBuilders.termQuery(EndpointRelationServerSideMetrics.DEST_ENDPOINT_ID, destEndpointId)); + .add( + QueryBuilders.termQuery(EndpointRelationServerSideMetrics.DEST_ENDPOINT, destEndpointId)); sourceBuilder.query(boolQuery); - return load(sourceBuilder, indexName, DetectPoint.SERVER); + return loadEndpoint(sourceBuilder, indexName, DetectPoint.SERVER); } private List load(SearchSourceBuilder sourceBuilder, String indexName, - DetectPoint detectPoint) throws IOException { + DetectPoint detectPoint) throws IOException { sourceBuilder.aggregation(AggregationBuilders.terms(Metrics.ENTITY_ID).field(Metrics.ENTITY_ID).size(1000)); SearchResponse response = getClient().search(indexName, sourceBuilder); @@ -214,8 +244,36 @@ public class TopologyQueryEsDAO extends EsDAO implements ITopologyQueryDAO { RelationDefineUtil.RelationDefine relationDefine = RelationDefineUtil.splitEntityId(entityId); Call.CallDetail call = new Call.CallDetail(); - call.setSource(relationDefine.getSource()); - call.setTarget(relationDefine.getDest()); + call.setSource(String.valueOf(relationDefine.getSource())); + call.setTarget(String.valueOf(relationDefine.getDest())); + call.setComponentId(relationDefine.getComponentId()); + call.setDetectPoint(detectPoint); + call.generateID(); + calls.add(call); + } + return calls; + } + + private List loadEndpoint(SearchSourceBuilder sourceBuilder, String indexName, + DetectPoint detectPoint) throws IOException { + sourceBuilder.aggregation(AggregationBuilders.terms(Metrics.ENTITY_ID).field(Metrics.ENTITY_ID).size(1000)); + + SearchResponse response = getClient().search(indexName, sourceBuilder); + + List calls = new ArrayList<>(); + Terms entityTerms = response.getAggregations().get(Metrics.ENTITY_ID); + for (Terms.Bucket entityBucket : entityTerms.getBuckets()) { + String entityId = entityBucket.getKeyAsString(); + + RelationDefineUtil.EndpointRelationDefine relationDefine = RelationDefineUtil.splitEndpointRelationEntityId( + entityId); + Call.CallDetail call = new Call.CallDetail(); + call.setSource(EndpointTraffic.buildId(relationDefine.getSourceServiceId(), relationDefine.getSource(), + detectPoint + )); + call.setTarget(EndpointTraffic.buildId(relationDefine.getDestServiceId(), relationDefine.getDest(), + detectPoint + )); call.setComponentId(relationDefine.getComponentId()); call.setDetectPoint(detectPoint); call.generateID(); diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/TraceQueryEsDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/TraceQueryEsDAO.java index 65ca71333d00842bb45be63dafbc5a106fac925a..e1330453af086d15c444bb59b482b668b76f60e3 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/TraceQueryEsDAO.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/query/TraceQueryEsDAO.java @@ -54,9 +54,19 @@ public class TraceQueryEsDAO extends EsDAO implements ITraceQueryDAO { } @Override - public TraceBrief queryBasicTraces(long startSecondTB, long endSecondTB, long minDuration, long maxDuration, - String endpointName, int serviceId, int serviceInstanceId, int endpointId, String traceId, int limit, int from, - TraceState traceState, QueryOrder queryOrder) throws IOException { + public TraceBrief queryBasicTraces(long startSecondTB, + long endSecondTB, + long minDuration, + long maxDuration, + String endpointName, + int serviceId, + int serviceInstanceId, + String endpointId, + String traceId, + int limit, + int from, + TraceState traceState, + QueryOrder queryOrder) throws IOException { SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery(); @@ -87,7 +97,7 @@ public class TraceQueryEsDAO extends EsDAO implements ITraceQueryDAO { if (serviceInstanceId != 0) { boolQueryBuilder.must().add(QueryBuilders.termQuery(SegmentRecord.SERVICE_INSTANCE_ID, serviceInstanceId)); } - if (endpointId != 0) { + if (!Strings.isNullOrEmpty(endpointId)) { boolQueryBuilder.must().add(QueryBuilders.termQuery(SegmentRecord.ENDPOINT_ID, endpointId)); } if (!Strings.isNullOrEmpty(traceId)) { @@ -125,7 +135,8 @@ public class TraceQueryEsDAO extends EsDAO implements ITraceQueryDAO { basicTrace.getEndpointNames().add((String) searchHit.getSourceAsMap().get(SegmentRecord.ENDPOINT_NAME)); basicTrace.setDuration(((Number) searchHit.getSourceAsMap().get(SegmentRecord.LATENCY)).intValue()); basicTrace.setError(BooleanUtils.valueToBoolean(((Number) searchHit.getSourceAsMap() - .get(SegmentRecord.IS_ERROR)).intValue())); + .get( + SegmentRecord.IS_ERROR)).intValue())); basicTrace.getTraceIds().add((String) searchHit.getSourceAsMap().get(SegmentRecord.TRACE_ID)); traceBrief.getTraces().add(basicTrace); } diff --git a/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/StorageModuleElasticsearch7Provider.java b/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/StorageModuleElasticsearch7Provider.java index 0951c40eb52772fb0c0b1d25285e0683fe1607e2..21a8685e9ddfce47c22160fe38ad7ab1e0501c28 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/StorageModuleElasticsearch7Provider.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/StorageModuleElasticsearch7Provider.java @@ -34,7 +34,6 @@ import org.apache.skywalking.oap.server.core.storage.IRegisterLockDAO; import org.apache.skywalking.oap.server.core.storage.StorageDAO; import org.apache.skywalking.oap.server.core.storage.StorageException; import org.apache.skywalking.oap.server.core.storage.StorageModule; -import org.apache.skywalking.oap.server.core.storage.cache.IEndpointInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.INetworkAddressInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.IServiceInstanceInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.IServiceInventoryCacheDAO; @@ -63,7 +62,6 @@ import org.apache.skywalking.oap.server.storage.plugin.elasticsearch.query.TopNR import org.apache.skywalking.oap.server.storage.plugin.elasticsearch.query.TopologyQueryEsDAO; import org.apache.skywalking.oap.server.storage.plugin.elasticsearch.ttl.ElasticsearchStorageTTL; import org.apache.skywalking.oap.server.storage.plugin.elasticsearch7.base.StorageEs7Installer; -import org.apache.skywalking.oap.server.storage.plugin.elasticsearch7.cache.EndpointInventoryCacheEs7DAO; import org.apache.skywalking.oap.server.storage.plugin.elasticsearch7.cache.NetworkAddressInventoryCacheEs7DAO; import org.apache.skywalking.oap.server.storage.plugin.elasticsearch7.cache.ServiceInstanceInventoryCacheEs7DAO; import org.apache.skywalking.oap.server.storage.plugin.elasticsearch7.cache.ServiceInventoryCacheEs7DAO; @@ -171,8 +169,6 @@ public class StorageModuleElasticsearch7Provider extends ModuleProvider { elasticSearch7Client, config.getResultWindowMaxSize() )); - this.registerServiceImplementation( - IEndpointInventoryCacheDAO.class, new EndpointInventoryCacheEs7DAO(elasticSearch7Client)); this.registerServiceImplementation( INetworkAddressInventoryCacheDAO.class, new NetworkAddressInventoryCacheEs7DAO( elasticSearch7Client, diff --git a/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/cache/EndpointInventoryCacheEs7DAO.java b/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/cache/EndpointInventoryCacheEs7DAO.java deleted file mode 100644 index ea6b65196242a2020ed3951f193b3c28ecbce314..0000000000000000000000000000000000000000 --- a/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/cache/EndpointInventoryCacheEs7DAO.java +++ /dev/null @@ -1,58 +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 org.apache.skywalking.oap.server.storage.plugin.elasticsearch7.cache; - -import org.apache.skywalking.oap.server.core.register.EndpointInventory; -import org.apache.skywalking.oap.server.library.client.elasticsearch.ElasticSearchClient; -import org.apache.skywalking.oap.server.storage.plugin.elasticsearch.cache.EndpointInventoryCacheEsDAO; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class EndpointInventoryCacheEs7DAO extends EndpointInventoryCacheEsDAO { - - private static final Logger logger = LoggerFactory.getLogger(EndpointInventoryCacheEs7DAO.class); - - public EndpointInventoryCacheEs7DAO(ElasticSearchClient client) { - super(client); - } - - @Override - public EndpointInventory get(int endpointId) { - try { - SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); - searchSourceBuilder.query(QueryBuilders.termQuery(EndpointInventory.SEQUENCE, endpointId)); - searchSourceBuilder.size(1); - - SearchResponse response = getClient().search(EndpointInventory.INDEX_NAME, searchSourceBuilder); - if (response.getHits().getTotalHits().value == 1) { - SearchHit searchHit = response.getHits().getAt(0); - return builder.map2Data(searchHit.getSourceAsMap()); - } else { - return null; - } - } catch (Throwable e) { - logger.error(e.getMessage(), e); - return null; - } - } -} diff --git a/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/query/LogQueryEs7DAO.java b/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/query/LogQueryEs7DAO.java index ff17d726e9b30a97495089ee7447dc4b051ae4fa..5683eea2bebf3538a47239560cd1b554441f5989 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/query/LogQueryEs7DAO.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/query/LogQueryEs7DAO.java @@ -19,6 +19,9 @@ package org.apache.skywalking.oap.server.storage.plugin.elasticsearch7.query; import com.google.common.base.Strings; +import java.io.IOException; +import java.util.List; +import org.apache.skywalking.apm.util.StringUtil; import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord; import org.apache.skywalking.oap.server.core.analysis.record.Record; @@ -38,9 +41,6 @@ import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.builder.SearchSourceBuilder; -import java.io.IOException; -import java.util.List; - import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.TRACE_ID; public class LogQueryEs7DAO extends EsDAO implements ILogQueryDAO { @@ -49,9 +49,9 @@ public class LogQueryEs7DAO extends EsDAO implements ILogQueryDAO { } @Override - public Logs queryLogs(String metricName, int serviceId, int serviceInstanceId, int endpointId, String traceId, - LogState state, String stateCode, Pagination paging, int from, int limit, long startSecondTB, - long endSecondTB) throws IOException { + public Logs queryLogs(String metricName, int serviceId, int serviceInstanceId, String endpointId, String traceId, + LogState state, String stateCode, Pagination paging, int from, int limit, long startSecondTB, + long endSecondTB) throws IOException { SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery(); @@ -69,7 +69,7 @@ public class LogQueryEs7DAO extends EsDAO implements ILogQueryDAO { boolQueryBuilder.must() .add(QueryBuilders.termQuery(AbstractLogRecord.SERVICE_INSTANCE_ID, serviceInstanceId)); } - if (endpointId != Const.NONE) { + if (StringUtil.isNotEmpty(endpointId)) { boolQueryBuilder.must().add(QueryBuilders.termQuery(AbstractLogRecord.ENDPOINT_ID, endpointId)); } if (!Strings.isNullOrEmpty(stateCode)) { @@ -80,10 +80,13 @@ public class LogQueryEs7DAO extends EsDAO implements ILogQueryDAO { } if (LogState.ERROR.equals(state)) { boolQueryBuilder.must() - .add(QueryBuilders.termQuery(AbstractLogRecord.IS_ERROR, BooleanUtils.booleanToValue(true))); + .add( + QueryBuilders.termQuery(AbstractLogRecord.IS_ERROR, BooleanUtils.booleanToValue(true))); } else if (LogState.SUCCESS.equals(state)) { boolQueryBuilder.must() - .add(QueryBuilders.termQuery(AbstractLogRecord.IS_ERROR, BooleanUtils.booleanToValue(false))); + .add(QueryBuilders.termQuery(AbstractLogRecord.IS_ERROR, + BooleanUtils.booleanToValue(false) + )); } sourceBuilder.size(limit); @@ -99,12 +102,14 @@ public class LogQueryEs7DAO extends EsDAO implements ILogQueryDAO { log.setServiceId(((Number) searchHit.getSourceAsMap().get(AbstractLogRecord.SERVICE_ID)).intValue()); log.setServiceInstanceId(((Number) searchHit.getSourceAsMap() .get(AbstractLogRecord.SERVICE_INSTANCE_ID)).intValue()); - log.setEndpointId(((Number) searchHit.getSourceAsMap().get(AbstractLogRecord.ENDPOINT_ID)).intValue()); + log.setEndpointId((String) searchHit.getSourceAsMap().get(AbstractLogRecord.ENDPOINT_ID)); + log.setEndpointName((String) searchHit.getSourceAsMap().get(AbstractLogRecord.ENDPOINT_NAME)); log.setError(BooleanUtils.valueToBoolean(((Number) searchHit.getSourceAsMap() .get(AbstractLogRecord.IS_ERROR)).intValue())); log.setStatusCode((String) searchHit.getSourceAsMap().get(AbstractLogRecord.STATUS_CODE)); log.setContentType(ContentType.instanceOf(((Number) searchHit.getSourceAsMap() - .get(AbstractLogRecord.CONTENT_TYPE)).intValue())); + .get( + AbstractLogRecord.CONTENT_TYPE)).intValue())); log.setContent((String) searchHit.getSourceAsMap().get(AbstractLogRecord.CONTENT)); logs.getLogs().add(log); diff --git a/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/query/MetadataQueryEs7DAO.java b/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/query/MetadataQueryEs7DAO.java index d421b69b20b7ea5575d57f73dba5f551ef453e13..29ab5e2b968d9e5258a686c0d1655d2bbaa4cbdd 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/query/MetadataQueryEs7DAO.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/query/MetadataQueryEs7DAO.java @@ -19,7 +19,7 @@ package org.apache.skywalking.oap.server.storage.plugin.elasticsearch7.query; import java.io.IOException; -import org.apache.skywalking.oap.server.core.register.EndpointInventory; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.register.NodeType; import org.apache.skywalking.oap.server.core.register.ServiceInventory; import org.apache.skywalking.oap.server.core.source.DetectPoint; @@ -54,6 +54,9 @@ public class MetadataQueryEs7DAO extends MetadataQueryEsDAO { return (int) response.getHits().getTotalHits().value; } + /** + * @since 7.0.0, as EndpointInventory has been replaced by EndpointTraffic. This is not an accurate number anymore. + */ @Override public int numOfEndpoint() throws IOException { SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); @@ -61,12 +64,12 @@ public class MetadataQueryEs7DAO extends MetadataQueryEsDAO { BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery(); boolQueryBuilder.must() - .add(QueryBuilders.termQuery(EndpointInventory.DETECT_POINT, DetectPoint.SERVER.ordinal())); + .add(QueryBuilders.termQuery(EndpointTraffic.DETECT_POINT, DetectPoint.SERVER.value())); sourceBuilder.query(boolQueryBuilder); sourceBuilder.size(0); - SearchResponse response = getClient().search(EndpointInventory.INDEX_NAME, sourceBuilder); + SearchResponse response = getClient().search(EndpointTraffic.INDEX_NAME, sourceBuilder); return (int) response.getHits().getTotalHits().value; } diff --git a/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/query/TraceQueryEs7DAO.java b/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/query/TraceQueryEs7DAO.java index ea89e6e3ff872b04463697e1f495556c88e466c9..862bf54f12ddd64e789ba33fe988cb9cf8365aed 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/query/TraceQueryEs7DAO.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch7-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch7/query/TraceQueryEs7DAO.java @@ -48,7 +48,7 @@ public class TraceQueryEs7DAO extends TraceQueryEsDAO { @Override public TraceBrief queryBasicTraces(long startSecondTB, long endSecondTB, long minDuration, long maxDuration, - String endpointName, int serviceId, int serviceInstanceId, int endpointId, String traceId, int limit, int from, + String endpointName, int serviceId, int serviceInstanceId, String endpointId, String traceId, int limit, int from, TraceState traceState, QueryOrder queryOrder) throws IOException { SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); @@ -80,7 +80,7 @@ public class TraceQueryEs7DAO extends TraceQueryEsDAO { if (serviceInstanceId != 0) { boolQueryBuilder.must().add(QueryBuilders.termQuery(SegmentRecord.SERVICE_INSTANCE_ID, serviceInstanceId)); } - if (endpointId != 0) { + if (!Strings.isNullOrEmpty(endpointId)) { boolQueryBuilder.must().add(QueryBuilders.termQuery(SegmentRecord.ENDPOINT_ID, endpointId)); } if (!Strings.isNullOrEmpty(traceId)) { diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxModelConstants.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxModelConstants.java index ec54fec83b0d11318669c7b91d4f9205f265f197..18dd47dc2816d36c63e8b2191bf4e0afa5a4beaf 100644 --- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxModelConstants.java +++ b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxModelConstants.java @@ -20,7 +20,7 @@ package org.apache.skywalking.oap.server.storage.plugin.influxdb; public interface InfluxModelConstants { /** - * Override column because the 'duration' is a identifier of InfluxDB. + * Override column because the 'duration' is the identifier of InfluxDB. */ String DURATION = "dur"; } diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxStorageProvider.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxStorageProvider.java index e294ccb104f3714b7c593ccf52c86cf8a250a526..38dfd00d9adf1d8aa6f59c658b3f09a8668f2841 100644 --- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxStorageProvider.java +++ b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/InfluxStorageProvider.java @@ -27,7 +27,6 @@ import org.apache.skywalking.oap.server.core.storage.IRegisterLockDAO; import org.apache.skywalking.oap.server.core.storage.StorageDAO; import org.apache.skywalking.oap.server.core.storage.StorageException; import org.apache.skywalking.oap.server.core.storage.StorageModule; -import org.apache.skywalking.oap.server.core.storage.cache.IEndpointInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.INetworkAddressInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.IServiceInstanceInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.IServiceInventoryCacheDAO; @@ -53,10 +52,11 @@ import org.apache.skywalking.oap.server.library.module.ServiceNotProvidedExcepti import org.apache.skywalking.oap.server.storage.plugin.influxdb.base.BatchDAO; import org.apache.skywalking.oap.server.storage.plugin.influxdb.base.HistoryDeleteDAO; import org.apache.skywalking.oap.server.storage.plugin.influxdb.base.InfluxStorageDAO; -import org.apache.skywalking.oap.server.storage.plugin.influxdb.installer.H2Installer; -import org.apache.skywalking.oap.server.storage.plugin.influxdb.installer.MySQLInstaller; +import org.apache.skywalking.oap.server.storage.plugin.influxdb.installer.InfluxDBH2MetaDBInstaller; +import org.apache.skywalking.oap.server.storage.plugin.influxdb.installer.InfluxDBMySQLMetaDBInstaller; import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.AggregationQuery; import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.AlarmQuery; +import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.InfluxMetadataQueryDAO; import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.LogQuery; import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.MetricsQuery; import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.ProfileTaskLogQuery; @@ -65,8 +65,6 @@ import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.ProfileThr import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.TopNRecordsQuery; import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.TopologyQuery; import org.apache.skywalking.oap.server.storage.plugin.influxdb.query.TraceQuery; -import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2EndpointInventoryCacheDAO; -import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2MetadataQueryDAO; import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2NetworkAddressInventoryCacheDAO; import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2RegisterLockDAO; import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2RegisterLockInstaller; @@ -119,11 +117,10 @@ public class InfluxStorageProvider extends ModuleProvider { this.registerServiceImplementation(IServiceInventoryCacheDAO.class, new H2ServiceInventoryCacheDAO(client)); this.registerServiceImplementation( IServiceInstanceInventoryCacheDAO.class, new H2ServiceInstanceInventoryCacheDAO(client)); - this.registerServiceImplementation(IEndpointInventoryCacheDAO.class, new H2EndpointInventoryCacheDAO(client)); this.registerServiceImplementation( INetworkAddressInventoryCacheDAO.class, new H2NetworkAddressInventoryCacheDAO(client)); this.registerServiceImplementation( - IMetadataQueryDAO.class, new H2MetadataQueryDAO(client, config.getMetadataQueryMaxSize())); + IMetadataQueryDAO.class, new InfluxMetadataQueryDAO(influxClient, client, config.getMetadataQueryMaxSize())); this.registerServiceImplementation(ITopologyQueryDAO.class, new TopologyQuery(influxClient)); this.registerServiceImplementation(IMetricsQueryDAO.class, new MetricsQuery(influxClient)); @@ -151,9 +148,9 @@ public class InfluxStorageProvider extends ModuleProvider { ModelInstaller installer; if (config.getMetabaseType().equalsIgnoreCase("h2")) { - installer = new H2Installer(getManager()); + installer = new InfluxDBH2MetaDBInstaller(getManager()); } else { - installer = new MySQLInstaller(getManager()); + installer = new InfluxDBMySQLMetaDBInstaller(getManager()); } installer.install(client); new H2RegisterLockInstaller().install(client, lockDAO); diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/MetricsDAO.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/MetricsDAO.java index b44638cb1159113f75da244d7cba5d6afea9d83c..98df2b303a59728fee6e05b00d62ca92de952a01 100644 --- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/MetricsDAO.java +++ b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/base/MetricsDAO.java @@ -27,6 +27,7 @@ import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; import org.apache.skywalking.oap.server.core.analysis.TimeBucket; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics; import org.apache.skywalking.oap.server.core.storage.IMetricsDAO; import org.apache.skywalking.oap.server.core.storage.StorageBuilder; @@ -45,6 +46,8 @@ import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select; public class MetricsDAO implements IMetricsDAO { public static final String TAG_ENTITY_ID = "_entity_id"; + public static final String TAG_ENDPOINT_OWNER_SERVICE = "_service_id"; + public static final String TAG_ENDPOINT_NAME = "_endpoint_name"; private final StorageBuilder storageBuilder; private final InfluxClient client; @@ -94,9 +97,19 @@ public class MetricsDAO implements IMetricsDAO { @Override public InsertRequest prepareBatchInsert(Model model, Metrics metrics) throws IOException { final long timestamp = TimeBucket.getTimestamp(metrics.getTimeBucket(), model.getDownsampling()); - return new InfluxInsertRequest(model, metrics, storageBuilder) - .time(timestamp, TimeUnit.MILLISECONDS) - .addFieldAsTag(Metrics.ENTITY_ID, TAG_ENTITY_ID); + if (metrics instanceof EndpointTraffic) { + /** + * @since 7.1.0 EndpointTraffic is a special manual metrics, to replace the old Endpoint Inventory. + */ + return new InfluxInsertRequest(model, metrics, storageBuilder) + .time(timestamp, TimeUnit.MILLISECONDS) + .addFieldAsTag(EndpointTraffic.SERVICE_ID, TAG_ENDPOINT_OWNER_SERVICE) + .addFieldAsTag(EndpointTraffic.NAME, TAG_ENDPOINT_NAME); + } else { + return new InfluxInsertRequest(model, metrics, storageBuilder) + .time(timestamp, TimeUnit.MILLISECONDS) + .addFieldAsTag(Metrics.ENTITY_ID, TAG_ENTITY_ID); + } } @Override diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/installer/H2Installer.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/installer/InfluxDBH2MetaDBInstaller.java similarity index 92% rename from oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/installer/H2Installer.java rename to oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/installer/InfluxDBH2MetaDBInstaller.java index 347f16bd71b668e8e3a3a85a183f4576d34e8079..a536f177009012a8f63b6c1f5f56d23147026b97 100644 --- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/installer/H2Installer.java +++ b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/installer/InfluxDBH2MetaDBInstaller.java @@ -26,9 +26,9 @@ import org.apache.skywalking.oap.server.library.module.ModuleManager; import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxModelConstants; import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2TableInstaller; -public class H2Installer extends H2TableInstaller { +public class InfluxDBH2MetaDBInstaller extends H2TableInstaller { - public H2Installer(ModuleManager moduleManager) { + public InfluxDBH2MetaDBInstaller(ModuleManager moduleManager) { super(moduleManager); overrideColumnName(ProfileTaskRecord.DURATION, InfluxModelConstants.DURATION); } diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/installer/MySQLInstaller.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/installer/InfluxDBMySQLMetaDBInstaller.java similarity index 92% rename from oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/installer/MySQLInstaller.java rename to oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/installer/InfluxDBMySQLMetaDBInstaller.java index 019d76949995f18c46e1b35080248adefbe528af..3ac7accfe4f28249d1040301114a94088f437846 100644 --- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/installer/MySQLInstaller.java +++ b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/installer/InfluxDBMySQLMetaDBInstaller.java @@ -26,9 +26,9 @@ import org.apache.skywalking.oap.server.library.module.ModuleManager; import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxModelConstants; import org.apache.skywalking.oap.server.storage.plugin.jdbc.mysql.MySQLTableInstaller; -public class MySQLInstaller extends MySQLTableInstaller { +public class InfluxDBMySQLMetaDBInstaller extends MySQLTableInstaller { - public MySQLInstaller(ModuleManager moduleManager) { + public InfluxDBMySQLMetaDBInstaller(ModuleManager moduleManager) { super(moduleManager); overrideColumnName(ProfileTaskRecord.DURATION, InfluxModelConstants.DURATION); } diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/AggregationQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/AggregationQuery.java index 36436bbf26381fc92b19c7211943779e7cc2929b..de8765c40003e8c461872c76da837d245d6c1610 100644 --- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/AggregationQuery.java +++ b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/AggregationQuery.java @@ -27,7 +27,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.skywalking.oap.server.core.analysis.Downsampling; import org.apache.skywalking.oap.server.core.query.entity.Order; import org.apache.skywalking.oap.server.core.query.entity.TopNEntity; -import org.apache.skywalking.oap.server.core.register.EndpointInventory; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.register.ServiceInstanceInventory; import org.apache.skywalking.oap.server.core.storage.model.ModelName; import org.apache.skywalking.oap.server.core.storage.query.IAggregationQueryDAO; @@ -85,7 +85,7 @@ public class AggregationQuery implements IAggregationQueryDAO { long startTB, long endTB, Order order) throws IOException { return getTopNEntity( downsampling, indName, - subQuery(EndpointInventory.SERVICE_ID, serviceId, indName, valueCName, startTB, endTB), order, topN + subQuery(EndpointTraffic.SERVICE_ID, serviceId, indName, valueCName, startTB, endTB), order, topN ); } diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/InfluxMetadataQueryDAO.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/InfluxMetadataQueryDAO.java new file mode 100644 index 0000000000000000000000000000000000000000..94611a6801777f18732af34cf24e8dca44f96069 --- /dev/null +++ b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/InfluxMetadataQueryDAO.java @@ -0,0 +1,112 @@ +/* + * 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 org.apache.skywalking.oap.server.storage.plugin.influxdb.query; + +import com.google.common.base.Strings; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; +import org.apache.skywalking.oap.server.core.query.entity.Endpoint; +import org.apache.skywalking.oap.server.core.source.DetectPoint; +import org.apache.skywalking.oap.server.library.client.jdbc.hikaricp.JDBCHikariCPClient; +import org.apache.skywalking.oap.server.storage.plugin.influxdb.InfluxClient; +import org.apache.skywalking.oap.server.storage.plugin.influxdb.base.MetricsDAO; +import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2MetadataQueryDAO; +import org.influxdb.dto.Query; +import org.influxdb.dto.QueryResult; +import org.influxdb.querybuilder.SelectQueryImpl; +import org.influxdb.querybuilder.WhereQueryImpl; + +import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.contains; +import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq; +import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select; + +/** + * InfluxMetadataQueryDAO is a hybrid dao implementation. + * + * @since 7.1.0 Endpoint data is save in the Endpoint Traffic, rather than endpoint inventory(deleted). The Endpoint + * Traffic is a time-series metrics data, so need the influxdb implementation. + */ +public class InfluxMetadataQueryDAO extends H2MetadataQueryDAO { + private InfluxClient client; + + public InfluxMetadataQueryDAO(final InfluxClient client, final JDBCHikariCPClient h2Client, + final int metadataQueryMaxSize) { + super(h2Client, metadataQueryMaxSize); + this.client = client; + } + + @Override + public int numOfEndpoint() throws IOException { + WhereQueryImpl countQuery = select() + .count(EndpointTraffic.ENTITY_ID) + .from(client.getDatabase(), EndpointTraffic.INDEX_NAME) + .where(); + countQuery.where(eq(EndpointTraffic.DETECT_POINT, DetectPoint.SERVER.value())); + + Query query = new Query(countQuery.getCommand()); + + final QueryResult.Series series = client.queryForSingleSeries(query); + if (series == null) { + return 0; + } + + return ((Number) series.getValues().get(0).get(1)).intValue(); + } + + @Override + public List searchEndpoint(final String keyword, + final int serviceId, + final int limit) throws IOException { + final String endpointName = '\"' + EndpointTraffic.NAME + '\"'; + + WhereQueryImpl endpointQuery = select() + .column(EndpointTraffic.SERVICE_ID) + .column(endpointName) + .column(EndpointTraffic.DETECT_POINT) + .from(client.getDatabase(), EndpointTraffic.INDEX_NAME) + .where(); + endpointQuery.where(eq(MetricsDAO.TAG_ENDPOINT_OWNER_SERVICE, String.valueOf(serviceId))); + if (!Strings.isNullOrEmpty(keyword)) { + endpointQuery.where(contains(MetricsDAO.TAG_ENDPOINT_NAME, keyword.replaceAll("/", "////"))); + } + endpointQuery.limit(limit); + + Query query = new Query(endpointQuery.getCommand()); + + final QueryResult.Series series = client.queryForSingleSeries(query); + + List list = new ArrayList<>(limit); + if (series != null) { + series.getValues().forEach(values -> { + EndpointTraffic endpointTraffic = new EndpointTraffic(); + endpointTraffic.setServiceId((int) values.get(1)); + endpointTraffic.setName((String) values.get(2)); + endpointTraffic.setDetectPoint((int) values.get(3)); + + Endpoint endpoint = new Endpoint(); + endpoint.setId(EndpointTraffic.buildId(endpointTraffic)); + endpoint.setName(endpointTraffic.getName()); + list.add(endpoint); + }); + } + return list; + } +} diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/LogQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/LogQuery.java index 6b155929fe5fe33baf5b29a2748ff0be7875bf8c..fdfaa909373d901486c48e8596c19cf1dcb7192a 100644 --- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/LogQuery.java +++ b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/LogQuery.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.util.List; import java.util.Map; import lombok.extern.slf4j.Slf4j; +import org.apache.skywalking.apm.util.StringUtil; import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord; import org.apache.skywalking.oap.server.core.query.entity.ContentType; @@ -43,6 +44,7 @@ import org.influxdb.querybuilder.clauses.ConjunctionClause; import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.CONTENT; import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.CONTENT_TYPE; import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.ENDPOINT_ID; +import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.ENDPOINT_NAME; import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.IS_ERROR; import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.SERVICE_ID; import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.SERVICE_INSTANCE_ID; @@ -63,19 +65,19 @@ public class LogQuery implements ILogQueryDAO { } @Override - public Logs queryLogs(String metricName, int serviceId, int serviceInstanceId, int endpointId, String traceId, + public Logs queryLogs(String metricName, int serviceId, int serviceInstanceId, String endpointId, String traceId, LogState state, String stateCode, Pagination paging, int from, int limit, long startTB, long endTB) throws IOException { WhereQueryImpl recallQuery = select().regex("*::field") - .from(client.getDatabase(), metricName) - .where(); + .from(client.getDatabase(), metricName) + .where(); if (serviceId != Const.NONE) { recallQuery.and(eq(RecordDAO.TAG_SERVICE_ID, String.valueOf(serviceId))); } if (serviceInstanceId != Const.NONE) { recallQuery.and(eq(SERVICE_INSTANCE_ID, serviceInstanceId)); } - if (endpointId != Const.NONE) { + if (StringUtil.isNotEmpty(endpointId)) { recallQuery.and(eq(ENDPOINT_ID, endpointId)); } if (!Strings.isNullOrEmpty(traceId)) { @@ -135,7 +137,8 @@ public class LogQuery implements ILogQueryDAO { log.setContent((String) data.get(CONTENT)); log.setContentType(ContentType.instanceOf((int) data.get(CONTENT_TYPE))); - log.setEndpointId((int) data.get(ENDPOINT_ID)); + log.setEndpointId((String) data.get(ENDPOINT_ID)); + log.setEndpointName((String) data.get(ENDPOINT_NAME)); log.setTraceId((String) data.get(TRACE_ID)); log.setTimestamp((String) data.get(TIMESTAMP)); diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TopologyQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TopologyQuery.java index 34b81c8fb759f34cbc8e18da3f1114ee6aac5fc2..c50de3b133c356c2cbbac592f99769076f61b693 100644 --- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TopologyQuery.java +++ b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TopologyQuery.java @@ -25,6 +25,7 @@ import java.util.List; import lombok.extern.slf4j.Slf4j; import org.apache.skywalking.oap.server.core.analysis.Downsampling; import org.apache.skywalking.oap.server.core.analysis.manual.RelationDefineUtil; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.analysis.manual.endpointrelation.EndpointRelationServerSideMetrics; import org.apache.skywalking.oap.server.core.analysis.manual.relation.instance.ServiceInstanceRelationClientSideMetrics; import org.apache.skywalking.oap.server.core.analysis.manual.relation.instance.ServiceInstanceRelationServerSideMetrics; @@ -153,31 +154,31 @@ public class TopologyQuery implements ITopologyQueryDAO { public List loadSpecifiedDestOfServerSideEndpointRelations(Downsampling downsampling, long startTB, long endTB, - int destEndpointId) throws IOException { + String destEndpointId) throws IOException { String measurement = ModelName.build(downsampling, EndpointRelationServerSideMetrics.INDEX_NAME); WhereQueryImpl query = buildServiceCallsQuery( measurement, startTB, endTB, - EndpointRelationServerSideMetrics.SOURCE_ENDPOINT_ID, - EndpointRelationServerSideMetrics.DEST_ENDPOINT_ID, + EndpointRelationServerSideMetrics.SOURCE_ENDPOINT, + EndpointRelationServerSideMetrics.DEST_ENDPOINT, Collections.emptyList() ); - query.and(eq(EndpointRelationServerSideMetrics.DEST_ENDPOINT_ID, destEndpointId)); + query.and(eq(EndpointRelationServerSideMetrics.DEST_ENDPOINT, destEndpointId)); WhereQueryImpl query2 = buildServiceCallsQuery( measurement, startTB, endTB, - EndpointRelationServerSideMetrics.SOURCE_ENDPOINT_ID, - EndpointRelationServerSideMetrics.DEST_ENDPOINT_ID, + EndpointRelationServerSideMetrics.SOURCE_ENDPOINT, + EndpointRelationServerSideMetrics.DEST_ENDPOINT, Collections.emptyList() ); - query2.and(eq(EndpointRelationServerSideMetrics.SOURCE_ENDPOINT_ID, destEndpointId)); + query2.and(eq(EndpointRelationServerSideMetrics.SOURCE_ENDPOINT, destEndpointId)); List calls = buildCalls(query, DetectPoint.SERVER); - calls.addAll(buildCalls(query2, DetectPoint.CLIENT)); + calls.addAll(buildEndpointCalls(query2, DetectPoint.CLIENT)); return calls; } @@ -229,7 +230,7 @@ public class TopologyQuery implements ITopologyQueryDAO { } private List buildCalls(WhereQueryImpl query, - DetectPoint detectPoint) throws IOException { + DetectPoint detectPoint) throws IOException { QueryResult.Series series = client.queryForSingleSeries(query); if (log.isDebugEnabled()) { @@ -245,8 +246,38 @@ public class TopologyQuery implements ITopologyQueryDAO { String entityId = (String) values.get(1); RelationDefineUtil.RelationDefine relationDefine = RelationDefineUtil.splitEntityId(entityId); - call.setSource(relationDefine.getSource()); - call.setTarget(relationDefine.getDest()); + call.setSource(String.valueOf(relationDefine.getSource())); + call.setTarget(String.valueOf(relationDefine.getDest())); + call.setComponentId(relationDefine.getComponentId()); + call.setDetectPoint(detectPoint); + call.generateID(); + calls.add(call); + }); + return calls; + } + + private List buildEndpointCalls(WhereQueryImpl query, + DetectPoint detectPoint) throws IOException { + QueryResult.Series series = client.queryForSingleSeries(query); + + if (log.isDebugEnabled()) { + log.debug("SQL: {} result set: {}", query.getCommand(), series); + } + if (series == null) { + return Collections.emptyList(); + } + + List calls = new ArrayList<>(); + series.getValues().forEach(values -> { + Call.CallDetail call = new Call.CallDetail(); + String entityId = (String) values.get(1); + RelationDefineUtil.EndpointRelationDefine relationDefine = RelationDefineUtil.splitEndpointRelationEntityId( + entityId); + + call.setSource( + EndpointTraffic.buildId(relationDefine.getSourceServiceId(), relationDefine.getSource(), detectPoint)); + call.setTarget( + EndpointTraffic.buildId(relationDefine.getDestServiceId(), relationDefine.getDest(), detectPoint)); call.setComponentId(relationDefine.getComponentId()); call.setDetectPoint(detectPoint); call.generateID(); diff --git a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TraceQuery.java b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TraceQuery.java index 6ad679edb0f18ad77021dce2153abc354a255996..1e27fb9fe601530e65e84e7a99965c6ffc7ea23b 100644 --- a/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TraceQuery.java +++ b/oap-server/server-storage-plugin/storage-influxdb-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/influxdb/query/TraceQuery.java @@ -41,10 +41,10 @@ import org.influxdb.querybuilder.SelectQueryImpl; import org.influxdb.querybuilder.WhereQueryImpl; import org.influxdb.querybuilder.clauses.Clause; +import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.contains; import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq; import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.gte; import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.lte; -import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.regex; import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.select; @Slf4j @@ -63,7 +63,7 @@ public class TraceQuery implements ITraceQueryDAO { String endpointName, int serviceId, int serviceInstanceId, - int endpointId, + String endpointId, String traceId, int limit, int from, @@ -98,7 +98,7 @@ public class TraceQuery implements ITraceQueryDAO { recallQuery.and(lte(SegmentRecord.LATENCY, maxDuration)); } if (!Strings.isNullOrEmpty(endpointName)) { - recallQuery.and(regex(SegmentRecord.ENDPOINT_NAME, "/" + endpointName.replaceAll("/", "\\\\/") + "/")); + recallQuery.and(contains(SegmentRecord.ENDPOINT_NAME, endpointName)); } if (serviceId != 0) { recallQuery.and(eq(RecordDAO.TAG_SERVICE_ID, String.valueOf(serviceId))); @@ -106,7 +106,7 @@ public class TraceQuery implements ITraceQueryDAO { if (serviceInstanceId != 0) { recallQuery.and(eq(SegmentRecord.SERVICE_INSTANCE_ID, serviceInstanceId)); } - if (endpointId != 0) { + if (!com.google.common.base.Strings.isNullOrEmpty(endpointId)) { recallQuery.and(eq(SegmentRecord.ENDPOINT_ID, endpointId)); } if (!Strings.isNullOrEmpty(traceId)) { diff --git a/oap-server/server-storage-plugin/storage-jaeger-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jaeger/JaegerSpan.java b/oap-server/server-storage-plugin/storage-jaeger-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jaeger/JaegerSpan.java index 9fbae2485e8181edf29b487384af56744deda861..ae1cf4a4b70bc56678885b0b013c2cb28a83134d 100644 --- a/oap-server/server-storage-plugin/storage-jaeger-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jaeger/JaegerSpan.java +++ b/oap-server/server-storage-plugin/storage-jaeger-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jaeger/JaegerSpan.java @@ -56,7 +56,7 @@ public class JaegerSpan extends Source { private String endpointName; @Setter @Getter - private int endpointId; + private String endpointId; @Setter @Getter private long startTime; diff --git a/oap-server/server-storage-plugin/storage-jaeger-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jaeger/JaegerSpanRecord.java b/oap-server/server-storage-plugin/storage-jaeger-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jaeger/JaegerSpanRecord.java index 28def8e82a28d6ae541543a7f54b0da49035d685..8b1a0dd7ae2ce2d079fb415a5fb04e4ada28ffba 100644 --- a/oap-server/server-storage-plugin/storage-jaeger-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jaeger/JaegerSpanRecord.java +++ b/oap-server/server-storage-plugin/storage-jaeger-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jaeger/JaegerSpanRecord.java @@ -79,7 +79,7 @@ public class JaegerSpanRecord extends Record { @Getter @Column(columnName = ENDPOINT_ID) @IDColumn - private int endpointId; + private String endpointId; @Setter @Getter @Column(columnName = START_TIME) @@ -149,7 +149,7 @@ public class JaegerSpanRecord extends Record { record.setServiceId(((Number) dbMap.get(SERVICE_ID)).intValue()); record.setServiceInstanceId(((Number) dbMap.get(SERVICE_INSTANCE_ID)).intValue()); record.setEndpointName((String) dbMap.get(ENDPOINT_NAME)); - record.setEndpointId(((Number) dbMap.get(ENDPOINT_ID)).intValue()); + record.setEndpointId((String) dbMap.get(ENDPOINT_ID)); record.setStartTime(((Number) dbMap.get(START_TIME)).longValue()); record.setEndTime(((Number) dbMap.get(END_TIME)).longValue()); record.setLatency(((Number) dbMap.get(LATENCY)).intValue()); diff --git a/oap-server/server-storage-plugin/storage-jaeger-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jaeger/elasticsearch/JaegerTraceQueryEsDAO.java b/oap-server/server-storage-plugin/storage-jaeger-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jaeger/elasticsearch/JaegerTraceQueryEsDAO.java index d292843346564fa71e0f8917c59b19223577fcc5..473a20a1889dedff69b4a6896f99de10b5632fc9 100644 --- a/oap-server/server-storage-plugin/storage-jaeger-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jaeger/elasticsearch/JaegerTraceQueryEsDAO.java +++ b/oap-server/server-storage-plugin/storage-jaeger-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jaeger/elasticsearch/JaegerTraceQueryEsDAO.java @@ -80,9 +80,19 @@ public class JaegerTraceQueryEsDAO extends EsDAO implements ITraceQueryDAO { } @Override - public TraceBrief queryBasicTraces(long startSecondTB, long endSecondTB, long minDuration, long maxDuration, - String endpointName, int serviceId, int serviceInstanceId, int endpointId, String traceId, int limit, int from, - TraceState traceState, QueryOrder queryOrder) throws IOException { + public TraceBrief queryBasicTraces(long startSecondTB, + long endSecondTB, + long minDuration, + long maxDuration, + String endpointName, + int serviceId, + int serviceInstanceId, + String endpointId, + String traceId, + int limit, + int from, + TraceState traceState, + QueryOrder queryOrder) throws IOException { SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); @@ -113,7 +123,7 @@ public class JaegerTraceQueryEsDAO extends EsDAO implements ITraceQueryDAO { if (serviceInstanceId != 0) { boolQueryBuilder.must().add(QueryBuilders.termQuery(SERVICE_INSTANCE_ID, serviceInstanceId)); } - if (endpointId != 0) { + if (!Strings.isNullOrEmpty(endpointId)) { boolQueryBuilder.must().add(QueryBuilders.termQuery(ENDPOINT_ID, endpointId)); } if (!Strings.isNullOrEmpty(traceId)) { diff --git a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/pom.xml b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/pom.xml index 66c8e8843257407fa19e92a4abe95a3a63f564da..2f798694ff200237be85c28e23e9ae5017baf38c 100644 --- a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/pom.xml +++ b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/pom.xml @@ -43,11 +43,11 @@ com.h2database h2 - - - - - + + + + + diff --git a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/H2StorageProvider.java b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/H2StorageProvider.java index 5b468ced6c926fb09e2e5ee456b99857fae1b1db..597748f431d12f619d045f26af3cfdf9ed3aaacc 100644 --- a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/H2StorageProvider.java +++ b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/H2StorageProvider.java @@ -26,7 +26,6 @@ import org.apache.skywalking.oap.server.core.storage.IRegisterLockDAO; import org.apache.skywalking.oap.server.core.storage.StorageDAO; import org.apache.skywalking.oap.server.core.storage.StorageException; import org.apache.skywalking.oap.server.core.storage.StorageModule; -import org.apache.skywalking.oap.server.core.storage.cache.IEndpointInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.INetworkAddressInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.IServiceInstanceInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.IServiceInventoryCacheDAO; @@ -51,7 +50,6 @@ import org.apache.skywalking.oap.server.library.module.ServiceNotProvidedExcepti import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2AggregationQueryDAO; import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2AlarmQueryDAO; import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2BatchDAO; -import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2EndpointInventoryCacheDAO; import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2HistoryDeleteDAO; import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2LogQueryDAO; import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2MetadataQueryDAO; @@ -121,23 +119,27 @@ public class H2StorageProvider extends ModuleProvider { this.registerServiceImplementation(IRegisterLockDAO.class, lockDAO); this.registerServiceImplementation(IServiceInventoryCacheDAO.class, new H2ServiceInventoryCacheDAO(h2Client)); - this.registerServiceImplementation(IServiceInstanceInventoryCacheDAO.class, new H2ServiceInstanceInventoryCacheDAO(h2Client)); - this.registerServiceImplementation(IEndpointInventoryCacheDAO.class, new H2EndpointInventoryCacheDAO(h2Client)); - this.registerServiceImplementation(INetworkAddressInventoryCacheDAO.class, new H2NetworkAddressInventoryCacheDAO(h2Client)); + this.registerServiceImplementation( + IServiceInstanceInventoryCacheDAO.class, new H2ServiceInstanceInventoryCacheDAO(h2Client)); + this.registerServiceImplementation( + INetworkAddressInventoryCacheDAO.class, new H2NetworkAddressInventoryCacheDAO(h2Client)); this.registerServiceImplementation(ITopologyQueryDAO.class, new H2TopologyQueryDAO(h2Client)); this.registerServiceImplementation(IMetricsQueryDAO.class, new H2MetricsQueryDAO(h2Client)); this.registerServiceImplementation(ITraceQueryDAO.class, new H2TraceQueryDAO(h2Client)); - this.registerServiceImplementation(IMetadataQueryDAO.class, new H2MetadataQueryDAO(h2Client, config.getMetadataQueryMaxSize())); + this.registerServiceImplementation( + IMetadataQueryDAO.class, new H2MetadataQueryDAO(h2Client, config.getMetadataQueryMaxSize())); this.registerServiceImplementation(IAggregationQueryDAO.class, new H2AggregationQueryDAO(h2Client)); this.registerServiceImplementation(IAlarmQueryDAO.class, new H2AlarmQueryDAO(h2Client)); - this.registerServiceImplementation(IHistoryDeleteDAO.class, new H2HistoryDeleteDAO(getManager(), h2Client, new GeneralStorageTTL())); + this.registerServiceImplementation( + IHistoryDeleteDAO.class, new H2HistoryDeleteDAO(getManager(), h2Client, new GeneralStorageTTL())); this.registerServiceImplementation(ITopNRecordsQueryDAO.class, new H2TopNRecordsQueryDAO(h2Client)); this.registerServiceImplementation(ILogQueryDAO.class, new H2LogQueryDAO(h2Client)); this.registerServiceImplementation(IProfileTaskQueryDAO.class, new H2ProfileTaskQueryDAO(h2Client)); this.registerServiceImplementation(IProfileTaskLogQueryDAO.class, new H2ProfileTaskLogQueryDAO(h2Client)); - this.registerServiceImplementation(IProfileThreadSnapshotQueryDAO.class, new H2ProfileThreadSnapshotQueryDAO(h2Client)); + this.registerServiceImplementation( + IProfileThreadSnapshotQueryDAO.class, new H2ProfileThreadSnapshotQueryDAO(h2Client)); } @Override diff --git a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2AggregationQueryDAO.java b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2AggregationQueryDAO.java index dea2b0b38db6c52e380ad19ffdfe7e68ebe2b9b4..4bab452c1a1274afe0455914fa80181ff858bf9f 100644 --- a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2AggregationQueryDAO.java +++ b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2AggregationQueryDAO.java @@ -24,7 +24,7 @@ import org.apache.skywalking.oap.server.core.analysis.Downsampling; import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics; import org.apache.skywalking.oap.server.core.query.entity.Order; import org.apache.skywalking.oap.server.core.query.entity.TopNEntity; -import org.apache.skywalking.oap.server.core.register.EndpointInventory; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.register.ServiceInstanceInventory; import org.apache.skywalking.oap.server.core.storage.model.ModelName; import org.apache.skywalking.oap.server.core.storage.query.IAggregationQueryDAO; @@ -77,7 +77,7 @@ public class H2AggregationQueryDAO implements IAggregationQueryDAO { public List getEndpointTopN(int serviceId, String indName, String valueCName, int topN, Downsampling downsampling, long startTB, long endTB, Order order) throws IOException { return topNQuery(indName, valueCName, topN, downsampling, startTB, endTB, order, (sql, conditions) -> { - sql.append(" and ").append(EndpointInventory.SERVICE_ID).append("=?"); + sql.append(" and ").append(EndpointTraffic.SERVICE_ID).append("=?"); conditions.add(serviceId); }); } diff --git a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2EndpointInventoryCacheDAO.java b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2EndpointInventoryCacheDAO.java deleted file mode 100644 index 9d865080208004d4875788c5153075120be76632..0000000000000000000000000000000000000000 --- a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2EndpointInventoryCacheDAO.java +++ /dev/null @@ -1,51 +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 org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao; - -import java.io.IOException; -import org.apache.skywalking.oap.server.core.register.EndpointInventory; -import org.apache.skywalking.oap.server.core.storage.cache.IEndpointInventoryCacheDAO; -import org.apache.skywalking.oap.server.library.client.jdbc.hikaricp.JDBCHikariCPClient; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class H2EndpointInventoryCacheDAO extends H2SQLExecutor implements IEndpointInventoryCacheDAO { - private static final Logger logger = LoggerFactory.getLogger(H2EndpointInventoryCacheDAO.class); - private JDBCHikariCPClient h2Client; - - public H2EndpointInventoryCacheDAO(JDBCHikariCPClient h2Client) { - this.h2Client = h2Client; - } - - @Override - public int getEndpointId(int serviceId, String endpointName, int detectPoint) { - String id = EndpointInventory.buildId(serviceId, endpointName, detectPoint); - return getEntityIDByID(h2Client, EndpointInventory.SEQUENCE, EndpointInventory.INDEX_NAME, id); - } - - @Override - public EndpointInventory get(int endpointId) { - try { - return (EndpointInventory) getByColumn(h2Client, EndpointInventory.INDEX_NAME, EndpointInventory.SEQUENCE, endpointId, new EndpointInventory.Builder()); - } catch (IOException e) { - logger.error(e.getMessage(), e); - return null; - } - } -} diff --git a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2LogQueryDAO.java b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2LogQueryDAO.java index 80b90335f0761aa2ce3d06301ac65c5b6e3d11f1..45cda2150b81d263be82e6d55b55d330c4b7ea4a 100644 --- a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2LogQueryDAO.java +++ b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2LogQueryDAO.java @@ -19,6 +19,13 @@ package org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao; import com.google.common.base.Strings; +import java.io.IOException; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; +import org.apache.skywalking.apm.util.StringUtil; import org.apache.skywalking.oap.server.core.Const; import org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord; import org.apache.skywalking.oap.server.core.query.entity.ContentType; @@ -30,16 +37,10 @@ import org.apache.skywalking.oap.server.core.storage.query.ILogQueryDAO; import org.apache.skywalking.oap.server.library.client.jdbc.hikaricp.JDBCHikariCPClient; import org.apache.skywalking.oap.server.library.util.BooleanUtils; -import java.io.IOException; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.CONTENT; import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.CONTENT_TYPE; import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.ENDPOINT_ID; +import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.ENDPOINT_NAME; import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.SERVICE_ID; import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.SERVICE_INSTANCE_ID; import static org.apache.skywalking.oap.server.core.analysis.manual.log.AbstractLogRecord.STATUS_CODE; @@ -54,9 +55,9 @@ public class H2LogQueryDAO implements ILogQueryDAO { } @Override - public Logs queryLogs(String metricName, int serviceId, int serviceInstanceId, int endpointId, String traceId, - LogState state, String stateCode, Pagination paging, int from, int limit, long startSecondTB, - long endSecondTB) throws IOException { + public Logs queryLogs(String metricName, int serviceId, int serviceInstanceId, String endpointId, String traceId, + LogState state, String stateCode, Pagination paging, int from, int limit, long startSecondTB, + long endSecondTB) throws IOException { StringBuilder sql = new StringBuilder(); List parameters = new ArrayList<>(10); @@ -77,7 +78,7 @@ public class H2LogQueryDAO implements ILogQueryDAO { sql.append(" and ").append(AbstractLogRecord.SERVICE_INSTANCE_ID).append(" = ?"); parameters.add(serviceInstanceId); } - if (endpointId != Const.NONE) { + if (StringUtil.isNotEmpty(endpointId)) { sql.append(" and ").append(AbstractLogRecord.ENDPOINT_ID).append(" = ?"); parameters.add(endpointId); } @@ -109,12 +110,14 @@ public class H2LogQueryDAO implements ILogQueryDAO { buildLimit(sql, from, limit); - try (ResultSet resultSet = h2Client.executeQuery(connection, "select * " + sql.toString(), parameters.toArray(new Object[0]))) { + try (ResultSet resultSet = h2Client.executeQuery( + connection, "select * " + sql.toString(), parameters.toArray(new Object[0]))) { while (resultSet.next()) { Log log = new Log(); log.setServiceId(resultSet.getInt(SERVICE_ID)); log.setServiceInstanceId(resultSet.getInt(SERVICE_INSTANCE_ID)); - log.setEndpointId(resultSet.getInt(ENDPOINT_ID)); + log.setEndpointId(resultSet.getString(ENDPOINT_ID)); + log.setEndpointName(resultSet.getString(ENDPOINT_NAME)); log.setTraceId(resultSet.getString(TRACE_ID)); log.setTimestamp(resultSet.getString(TIMESTAMP)); log.setStatusCode(resultSet.getString(STATUS_CODE)); diff --git a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2MetadataQueryDAO.java b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2MetadataQueryDAO.java index 1f3caf351a29432953745a8fa852680622f9afbb..a7609536b71f853f7382d951856a7bc07fa92d7b 100644 --- a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2MetadataQueryDAO.java +++ b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2MetadataQueryDAO.java @@ -29,13 +29,13 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Map; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.query.entity.Attribute; import org.apache.skywalking.oap.server.core.query.entity.Database; import org.apache.skywalking.oap.server.core.query.entity.Endpoint; import org.apache.skywalking.oap.server.core.query.entity.LanguageTrans; import org.apache.skywalking.oap.server.core.query.entity.Service; import org.apache.skywalking.oap.server.core.query.entity.ServiceInstance; -import org.apache.skywalking.oap.server.core.register.EndpointInventory; import org.apache.skywalking.oap.server.core.register.NodeType; import org.apache.skywalking.oap.server.core.register.RegisterSource; import org.apache.skywalking.oap.server.core.register.ServiceInstanceInventory; @@ -76,7 +76,8 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO { private Integer getNum(StringBuilder sql, List condition) throws IOException { try (Connection connection = h2Client.getConnection()) { - try (ResultSet resultSet = h2Client.executeQuery(connection, sql.toString(), condition.toArray(new Object[0]))) { + try (ResultSet resultSet = h2Client.executeQuery( + connection, sql.toString(), condition.toArray(new Object[0]))) { if (resultSet.next()) { return resultSet.getInt("num"); } @@ -91,8 +92,8 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO { public int numOfEndpoint() throws IOException { StringBuilder sql = new StringBuilder(); List condition = new ArrayList<>(5); - sql.append("select count(*) num from ").append(EndpointInventory.INDEX_NAME).append(" where "); - sql.append(EndpointInventory.DETECT_POINT).append("=").append(DetectPoint.SERVER.ordinal()); + sql.append("select count(*) num from ").append(EndpointTraffic.INDEX_NAME).append(" where "); + sql.append(EndpointTraffic.DETECT_POINT).append("=").append(DetectPoint.SERVER.value()); return getNum(sql, condition); } @@ -121,7 +122,8 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO { sql.append(" limit ").append(metadataQueryMaxSize); try (Connection connection = h2Client.getConnection()) { - try (ResultSet resultSet = h2Client.executeQuery(connection, sql.toString(), condition.toArray(new Object[0]))) { + try (ResultSet resultSet = h2Client.executeQuery( + connection, sql.toString(), condition.toArray(new Object[0]))) { return buildServices(resultSet); } } catch (SQLException e) { @@ -142,7 +144,8 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO { sql.append(" limit ").append(metadataQueryMaxSize); try (Connection connection = h2Client.getConnection()) { - try (ResultSet resultSet = h2Client.executeQuery(connection, sql.toString(), condition.toArray(new Object[0]))) { + try (ResultSet resultSet = h2Client.executeQuery( + connection, sql.toString(), condition.toArray(new Object[0]))) { return buildServices(resultSet); } } catch (SQLException e) { @@ -159,7 +162,8 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO { condition.add(NodeType.Database.value()); try (Connection connection = h2Client.getConnection()) { - try (ResultSet resultSet = h2Client.executeQuery(connection, sql.toString(), condition.toArray(new Object[0]))) { + try (ResultSet resultSet = h2Client.executeQuery( + connection, sql.toString(), condition.toArray(new Object[0]))) { List databases = new ArrayList<>(); while (resultSet.next()) { Database database = new Database(); @@ -199,7 +203,8 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO { sql.append(" limit ").append(metadataQueryMaxSize); try (Connection connection = h2Client.getConnection()) { - try (ResultSet resultSet = h2Client.executeQuery(connection, sql.toString(), condition.toArray(new Object[0]))) { + try (ResultSet resultSet = h2Client.executeQuery( + connection, sql.toString(), condition.toArray(new Object[0]))) { return buildServices(resultSet); } } catch (SQLException e) { @@ -218,7 +223,8 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO { condition.add(serviceCode); try (Connection connection = h2Client.getConnection()) { - try (ResultSet resultSet = h2Client.executeQuery(connection, sql.toString(), condition.toArray(new Object[0]))) { + try (ResultSet resultSet = h2Client.executeQuery( + connection, sql.toString(), condition.toArray(new Object[0]))) { while (resultSet.next()) { Service service = new Service(); @@ -235,27 +241,39 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO { } @Override - public List searchEndpoint(String keyword, String serviceId, int limit) throws IOException { + public List searchEndpoint(String keyword, int serviceId, int limit) throws IOException { StringBuilder sql = new StringBuilder(); List condition = new ArrayList<>(5); - sql.append("select * from ").append(EndpointInventory.INDEX_NAME).append(" where "); - sql.append(EndpointInventory.SERVICE_ID).append("=?"); + sql.append("select * from ").append(EndpointTraffic.INDEX_NAME).append(" where "); + sql.append(EndpointTraffic.SERVICE_ID).append("=?"); condition.add(serviceId); if (!Strings.isNullOrEmpty(keyword)) { - sql.append(" and ").append(EndpointInventory.NAME).append(" like '%").append(keyword).append("%' "); + sql.append(" and ").append(EndpointTraffic.NAME).append(" like '%").append(keyword).append("%' "); } - sql.append(" and ").append(EndpointInventory.DETECT_POINT).append(" = ?"); - condition.add(DetectPoint.SERVER.ordinal()); - sql.append(" limit ").append(limit); + sql.append(" and ").append(EndpointTraffic.DETECT_POINT).append(" = ?"); + condition.add(DetectPoint.SERVER.value()); + /** + * Query the dataset by a larger limit condition and distinct in the memory, + * in order to avoid the storage level distinct. + * This is a match query only, don't need 100% accurate. + */ + sql.append(" limit ").append(limit * 7); List endpoints = new ArrayList<>(); try (Connection connection = h2Client.getConnection()) { - try (ResultSet resultSet = h2Client.executeQuery(connection, sql.toString(), condition.toArray(new Object[0]))) { + try (ResultSet resultSet = h2Client.executeQuery( + connection, sql.toString(), condition.toArray(new Object[0]))) { while (resultSet.next()) { + EndpointTraffic endpointTraffic = new EndpointTraffic(); + endpointTraffic.setServiceId(resultSet.getInt(EndpointTraffic.SERVICE_ID)); + endpointTraffic.setName(resultSet.getString(EndpointTraffic.NAME)); + endpointTraffic.setDetectPoint(resultSet.getInt(EndpointTraffic.DETECT_POINT)); + endpointTraffic.setTimeBucket(resultSet.getLong(EndpointTraffic.TIME_BUCKET)); + Endpoint endpoint = new Endpoint(); - endpoint.setId(resultSet.getInt(EndpointInventory.SEQUENCE)); - endpoint.setName(resultSet.getString(EndpointInventory.NAME)); + endpoint.setId(EndpointTraffic.buildId(endpointTraffic)); + endpoint.setName(endpointTraffic.getName()); endpoints.add(endpoint); } } @@ -267,7 +285,7 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO { @Override public List getServiceInstances(long startTimestamp, long endTimestamp, - String serviceId) throws IOException { + String serviceId) throws IOException { StringBuilder sql = new StringBuilder(); List condition = new ArrayList<>(5); sql.append("select * from ").append(ServiceInstanceInventory.INDEX_NAME).append(" where "); @@ -277,7 +295,8 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO { List serviceInstances = new ArrayList<>(); try (Connection connection = h2Client.getConnection()) { - try (ResultSet resultSet = h2Client.executeQuery(connection, sql.toString(), condition.toArray(new Object[0]))) { + try (ResultSet resultSet = h2Client.executeQuery( + connection, sql.toString(), condition.toArray(new Object[0]))) { while (resultSet.next()) { ServiceInstance serviceInstance = new ServiceInstance(); @@ -300,11 +319,14 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO { } else if (key.equals(PROCESS_NO)) { serviceInstance.getAttributes().add(new Attribute(PROCESS_NO, value)); } else if (key.equals(IPV4S)) { - List ipv4s = ServiceInstanceInventory.PropertyUtil.ipv4sDeserialize(properties.get(IPV4S) - .getAsString()); + List ipv4s = ServiceInstanceInventory.PropertyUtil.ipv4sDeserialize( + properties.get(IPV4S) + .getAsString()); for (String ipv4 : ipv4s) { serviceInstance.getAttributes() - .add(new Attribute(ServiceInstanceInventory.PropertyUtil.IPV4S, ipv4)); + .add(new Attribute(ServiceInstanceInventory.PropertyUtil.IPV4S, + ipv4 + )); } } else { serviceInstance.getAttributes().add(new Attribute(key, value)); @@ -322,7 +344,7 @@ public class H2MetadataQueryDAO implements IMetadataQueryDAO { } private void setTimeRangeCondition(StringBuilder sql, List conditions, long startTimestamp, - long endTimestamp) { + long endTimestamp) { sql.append(" ( (") .append(RegisterSource.HEARTBEAT_TIME) .append(" >= ? and ") diff --git a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2TopologyQueryDAO.java b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2TopologyQueryDAO.java index ebf68e8240bd9dc5000b41198e452b5ab3f51df7..332ec542814f44f28946812a0a08a8b77686acad 100644 --- a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2TopologyQueryDAO.java +++ b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2TopologyQueryDAO.java @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.List; import org.apache.skywalking.oap.server.core.analysis.Downsampling; import org.apache.skywalking.oap.server.core.analysis.manual.RelationDefineUtil; +import org.apache.skywalking.oap.server.core.analysis.manual.endpoint.EndpointTraffic; import org.apache.skywalking.oap.server.core.analysis.manual.endpointrelation.EndpointRelationServerSideMetrics; import org.apache.skywalking.oap.server.core.analysis.manual.relation.instance.ServiceInstanceRelationClientSideMetrics; import org.apache.skywalking.oap.server.core.analysis.manual.relation.instance.ServiceInstanceRelationServerSideMetrics; @@ -46,59 +47,99 @@ public class H2TopologyQueryDAO implements ITopologyQueryDAO { } @Override - public List loadSpecifiedServerSideServiceRelations(Downsampling downsampling, long startTB, - long endTB, List serviceIds) throws IOException { + public List loadSpecifiedServerSideServiceRelations(Downsampling downsampling, + long startTB, + long endTB, + List serviceIds) throws IOException { String tableName = ModelName.build(downsampling, ServiceRelationServerSideMetrics.INDEX_NAME); - return loadServiceCalls(tableName, startTB, endTB, ServiceRelationServerSideMetrics.SOURCE_SERVICE_ID, ServiceRelationServerSideMetrics.DEST_SERVICE_ID, serviceIds, false); + return loadServiceCalls( + tableName, startTB, endTB, ServiceRelationServerSideMetrics.SOURCE_SERVICE_ID, + ServiceRelationServerSideMetrics.DEST_SERVICE_ID, serviceIds, false + ); } @Override - public List loadSpecifiedClientSideServiceRelations(Downsampling downsampling, long startTB, - long endTB, List serviceIds) throws IOException { + public List loadSpecifiedClientSideServiceRelations(Downsampling downsampling, + long startTB, + long endTB, + List serviceIds) throws IOException { String tableName = ModelName.build(downsampling, ServiceRelationClientSideMetrics.INDEX_NAME); - return loadServiceCalls(tableName, startTB, endTB, ServiceRelationClientSideMetrics.SOURCE_SERVICE_ID, ServiceRelationClientSideMetrics.DEST_SERVICE_ID, serviceIds, true); + return loadServiceCalls( + tableName, startTB, endTB, ServiceRelationClientSideMetrics.SOURCE_SERVICE_ID, + ServiceRelationClientSideMetrics.DEST_SERVICE_ID, serviceIds, true + ); } @Override public List loadServerSideServiceRelations(Downsampling downsampling, long startTB, - long endTB) throws IOException { + long endTB) throws IOException { String tableName = ModelName.build(downsampling, ServiceRelationServerSideMetrics.INDEX_NAME); - return loadServiceCalls(tableName, startTB, endTB, ServiceRelationServerSideMetrics.SOURCE_SERVICE_ID, ServiceRelationServerSideMetrics.DEST_SERVICE_ID, new ArrayList<>(0), false); + return loadServiceCalls( + tableName, startTB, endTB, ServiceRelationServerSideMetrics.SOURCE_SERVICE_ID, + ServiceRelationServerSideMetrics.DEST_SERVICE_ID, new ArrayList<>(0), false + ); } @Override public List loadClientSideServiceRelations(Downsampling downsampling, long startTB, - long endTB) throws IOException { + long endTB) throws IOException { String tableName = ModelName.build(downsampling, ServiceRelationClientSideMetrics.INDEX_NAME); - return loadServiceCalls(tableName, startTB, endTB, ServiceRelationClientSideMetrics.SOURCE_SERVICE_ID, ServiceRelationClientSideMetrics.DEST_SERVICE_ID, new ArrayList<>(0), true); + return loadServiceCalls( + tableName, startTB, endTB, ServiceRelationClientSideMetrics.SOURCE_SERVICE_ID, + ServiceRelationClientSideMetrics.DEST_SERVICE_ID, new ArrayList<>(0), true + ); } @Override - public List loadServerSideServiceInstanceRelations(int clientServiceId, int serverServiceId, - Downsampling downsampling, long startTB, long endTB) throws IOException { + public List loadServerSideServiceInstanceRelations(int clientServiceId, + int serverServiceId, + Downsampling downsampling, + long startTB, + long endTB) throws IOException { String tableName = ModelName.build(downsampling, ServiceInstanceRelationServerSideMetrics.INDEX_NAME); - return loadServiceInstanceCalls(tableName, startTB, endTB, ServiceInstanceRelationServerSideMetrics.SOURCE_SERVICE_ID, ServiceInstanceRelationServerSideMetrics.DEST_SERVICE_ID, clientServiceId, serverServiceId, false); + return loadServiceInstanceCalls( + tableName, startTB, endTB, ServiceInstanceRelationServerSideMetrics.SOURCE_SERVICE_ID, + ServiceInstanceRelationServerSideMetrics.DEST_SERVICE_ID, clientServiceId, serverServiceId, false + ); } @Override - public List loadClientSideServiceInstanceRelations(int clientServiceId, int serverServiceId, - Downsampling downsampling, long startTB, long endTB) throws IOException { + public List loadClientSideServiceInstanceRelations(int clientServiceId, + int serverServiceId, + Downsampling downsampling, + long startTB, + long endTB) throws IOException { String tableName = ModelName.build(downsampling, ServiceInstanceRelationClientSideMetrics.INDEX_NAME); - return loadServiceInstanceCalls(tableName, startTB, endTB, ServiceInstanceRelationClientSideMetrics.SOURCE_SERVICE_ID, ServiceInstanceRelationClientSideMetrics.DEST_SERVICE_ID, clientServiceId, serverServiceId, true); + return loadServiceInstanceCalls( + tableName, startTB, endTB, ServiceInstanceRelationClientSideMetrics.SOURCE_SERVICE_ID, + ServiceInstanceRelationClientSideMetrics.DEST_SERVICE_ID, clientServiceId, serverServiceId, true + ); } @Override - public List loadSpecifiedDestOfServerSideEndpointRelations(Downsampling downsampling, long startTB, - long endTB, int destEndpointId) throws IOException { + public List loadSpecifiedDestOfServerSideEndpointRelations(Downsampling downsampling, + long startTB, + long endTB, + String destEndpointId) throws IOException { String tableName = ModelName.build(downsampling, EndpointRelationServerSideMetrics.INDEX_NAME); - List calls = loadEndpointFromSide(tableName, startTB, endTB, EndpointRelationServerSideMetrics.SOURCE_ENDPOINT_ID, EndpointRelationServerSideMetrics.DEST_ENDPOINT_ID, destEndpointId, false); - calls.addAll(loadEndpointFromSide(tableName, startTB, endTB, EndpointRelationServerSideMetrics.SOURCE_ENDPOINT_ID, EndpointRelationServerSideMetrics.DEST_ENDPOINT_ID, destEndpointId, true)); + List calls = loadEndpointFromSide( + tableName, startTB, endTB, EndpointRelationServerSideMetrics.SOURCE_ENDPOINT, + EndpointRelationServerSideMetrics.DEST_ENDPOINT, destEndpointId, false + ); + calls.addAll(loadEndpointFromSide(tableName, startTB, endTB, EndpointRelationServerSideMetrics.SOURCE_ENDPOINT, + EndpointRelationServerSideMetrics.DEST_ENDPOINT, destEndpointId, true + )); return calls; } - private List loadServiceCalls(String tableName, long startTB, long endTB, String sourceCName, - String destCName, List serviceIds, boolean isClientSide) throws IOException { + private List loadServiceCalls(String tableName, + long startTB, + long endTB, + String sourceCName, + String destCName, + List serviceIds, + boolean isClientSide) throws IOException { Object[] conditions = new Object[serviceIds.size() * 2 + 2]; conditions[0] = startTB; conditions[1] = endTB; @@ -117,8 +158,11 @@ public class H2TopologyQueryDAO implements ITopologyQueryDAO { } List calls = new ArrayList<>(); try (Connection connection = h2Client.getConnection()) { - try (ResultSet resultSet = h2Client.executeQuery(connection, "select " + Metrics.ENTITY_ID + " from " + tableName + " where " + Metrics.TIME_BUCKET + ">= ? and " + Metrics.TIME_BUCKET + "<=? " + serviceIdMatchSql - .toString() + " group by " + Metrics.ENTITY_ID, conditions)) { + try (ResultSet resultSet = h2Client.executeQuery( + connection, + "select " + Metrics.ENTITY_ID + " from " + tableName + " where " + Metrics.TIME_BUCKET + ">= ? and " + Metrics.TIME_BUCKET + "<=? " + serviceIdMatchSql + .toString() + " group by " + Metrics.ENTITY_ID, conditions + )) { buildCalls(resultSet, calls, isClientSide); } } catch (SQLException e) { @@ -127,9 +171,14 @@ public class H2TopologyQueryDAO implements ITopologyQueryDAO { return calls; } - private List loadServiceInstanceCalls(String tableName, long startTB, long endTB, - String sourceCName, String descCName, int sourceServiceId, int destServiceId, - boolean isClientSide) throws IOException { + private List loadServiceInstanceCalls(String tableName, + long startTB, + long endTB, + String sourceCName, + String descCName, + int sourceServiceId, + int destServiceId, + boolean isClientSide) throws IOException { Object[] conditions = new Object[] { startTB, endTB, @@ -150,8 +199,11 @@ public class H2TopologyQueryDAO implements ITopologyQueryDAO { .append("))"); List calls = new ArrayList<>(); try (Connection connection = h2Client.getConnection()) { - try (ResultSet resultSet = h2Client.executeQuery(connection, "select " + Metrics.ENTITY_ID + " from " + tableName + " where " + Metrics.TIME_BUCKET + ">= ? and " + Metrics.TIME_BUCKET + "<=? " + serviceIdMatchSql - .toString() + " group by " + Metrics.ENTITY_ID, conditions)) { + try (ResultSet resultSet = h2Client.executeQuery( + connection, + "select " + Metrics.ENTITY_ID + " from " + tableName + " where " + Metrics.TIME_BUCKET + ">= ? and " + Metrics.TIME_BUCKET + "<=? " + serviceIdMatchSql + .toString() + " group by " + Metrics.ENTITY_ID, conditions + )) { buildCalls(resultSet, calls, isClientSide); } } catch (SQLException e) { @@ -160,16 +212,25 @@ public class H2TopologyQueryDAO implements ITopologyQueryDAO { return calls; } - private List loadEndpointFromSide(String tableName, long startTB, long endTB, String sourceCName, - String destCName, int id, boolean isSourceId) throws IOException { + private List loadEndpointFromSide(String tableName, + long startTB, + long endTB, + String sourceCName, + String destCName, + String id, + boolean isSourceId) throws IOException { Object[] conditions = new Object[3]; conditions[0] = startTB; conditions[1] = endTB; conditions[2] = id; List calls = new ArrayList<>(); try (Connection connection = h2Client.getConnection()) { - try (ResultSet resultSet = h2Client.executeQuery(connection, "select " + Metrics.ENTITY_ID + " from " + tableName + " where " + Metrics.TIME_BUCKET + ">= ? and " + Metrics.TIME_BUCKET + "<=? and " + (isSourceId ? sourceCName : destCName) + "=?" + " group by " + Metrics.ENTITY_ID, conditions)) { - buildCalls(resultSet, calls, isSourceId); + try (ResultSet resultSet = h2Client.executeQuery( + connection, + "select " + Metrics.ENTITY_ID + " from " + tableName + " where " + Metrics.TIME_BUCKET + ">= ? and " + Metrics.TIME_BUCKET + "<=? and " + (isSourceId ? sourceCName : destCName) + "=?" + " group by " + Metrics.ENTITY_ID, + conditions + )) { + buildEndpointCalls(resultSet, calls, isSourceId); } } catch (SQLException e) { throw new IOException(e); @@ -178,14 +239,14 @@ public class H2TopologyQueryDAO implements ITopologyQueryDAO { } private void buildCalls(ResultSet resultSet, List calls, - boolean isClientSide) throws SQLException { + boolean isClientSide) throws SQLException { while (resultSet.next()) { Call.CallDetail call = new Call.CallDetail(); String entityId = resultSet.getString(Metrics.ENTITY_ID); RelationDefineUtil.RelationDefine relationDefine = RelationDefineUtil.splitEntityId(entityId); - call.setSource(relationDefine.getSource()); - call.setTarget(relationDefine.getDest()); + call.setSource(String.valueOf(relationDefine.getSource())); + call.setTarget(String.valueOf(relationDefine.getDest())); call.setComponentId(relationDefine.getComponentId()); if (isClientSide) { call.setDetectPoint(DetectPoint.CLIENT); @@ -196,4 +257,30 @@ public class H2TopologyQueryDAO implements ITopologyQueryDAO { calls.add(call); } } + + private void buildEndpointCalls(ResultSet resultSet, List calls, + boolean isClientSide) throws SQLException { + while (resultSet.next()) { + Call.CallDetail call = new Call.CallDetail(); + String entityId = resultSet.getString(Metrics.ENTITY_ID); + RelationDefineUtil.EndpointRelationDefine relationDefine = RelationDefineUtil.splitEndpointRelationEntityId( + entityId); + + if (isClientSide) { + call.setDetectPoint(DetectPoint.CLIENT); + } else { + call.setDetectPoint(DetectPoint.SERVER); + } + call.setSource(EndpointTraffic.buildId(relationDefine.getSourceServiceId(), relationDefine.getSource(), + call.getDetectPoint() + )); + call.setTarget(EndpointTraffic.buildId(relationDefine.getDestServiceId(), relationDefine.getDest(), + call.getDetectPoint() + )); + call.setComponentId(relationDefine.getComponentId()); + + call.generateID(); + calls.add(call); + } + } } diff --git a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2TraceQueryDAO.java b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2TraceQueryDAO.java index 40f19325bc684687a4230933937dba370ed15d54..ff222ef466de20fce57abd9c453dbe691af6ca9a 100644 --- a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2TraceQueryDAO.java +++ b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2TraceQueryDAO.java @@ -48,7 +48,7 @@ public class H2TraceQueryDAO implements ITraceQueryDAO { @Override public TraceBrief queryBasicTraces(long startSecondTB, long endSecondTB, long minDuration, long maxDuration, - String endpointName, int serviceId, int serviceInstanceId, int endpointId, String traceId, int limit, int from, + String endpointName, int serviceId, int serviceInstanceId, String endpointId, String traceId, int limit, int from, TraceState traceState, QueryOrder queryOrder) throws IOException { StringBuilder sql = new StringBuilder(); List parameters = new ArrayList<>(10); @@ -82,7 +82,7 @@ public class H2TraceQueryDAO implements ITraceQueryDAO { sql.append(" and ").append(SegmentRecord.SERVICE_INSTANCE_ID).append(" = ?"); parameters.add(serviceInstanceId); } - if (endpointId != 0) { + if (!Strings.isNullOrEmpty(endpointId)) { sql.append(" and ").append(SegmentRecord.ENDPOINT_ID).append(" = ?"); parameters.add(endpointId); } diff --git a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/mysql/MySQLStorageProvider.java b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/mysql/MySQLStorageProvider.java index 09d302ef5bbaf90d951447c0ad3e15a8168b0dea..5fc2072a0baf42a9f756d98281721b5126cf8bba 100644 --- a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/mysql/MySQLStorageProvider.java +++ b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/mysql/MySQLStorageProvider.java @@ -25,7 +25,6 @@ import org.apache.skywalking.oap.server.core.storage.IRegisterLockDAO; import org.apache.skywalking.oap.server.core.storage.StorageDAO; import org.apache.skywalking.oap.server.core.storage.StorageException; import org.apache.skywalking.oap.server.core.storage.StorageModule; -import org.apache.skywalking.oap.server.core.storage.cache.IEndpointInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.INetworkAddressInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.IServiceInstanceInventoryCacheDAO; import org.apache.skywalking.oap.server.core.storage.cache.IServiceInventoryCacheDAO; @@ -48,7 +47,6 @@ import org.apache.skywalking.oap.server.library.module.ModuleProvider; import org.apache.skywalking.oap.server.library.module.ModuleStartException; import org.apache.skywalking.oap.server.library.module.ServiceNotProvidedException; import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2BatchDAO; -import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2EndpointInventoryCacheDAO; import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2HistoryDeleteDAO; import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2MetadataQueryDAO; import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2MetricsQueryDAO; @@ -110,24 +108,29 @@ public class MySQLStorageProvider extends ModuleProvider { lockDAO = new H2RegisterLockDAO(mysqlClient); this.registerServiceImplementation(IRegisterLockDAO.class, lockDAO); - this.registerServiceImplementation(IServiceInventoryCacheDAO.class, new H2ServiceInventoryCacheDAO(mysqlClient)); - this.registerServiceImplementation(IServiceInstanceInventoryCacheDAO.class, new H2ServiceInstanceInventoryCacheDAO(mysqlClient)); - this.registerServiceImplementation(IEndpointInventoryCacheDAO.class, new H2EndpointInventoryCacheDAO(mysqlClient)); - this.registerServiceImplementation(INetworkAddressInventoryCacheDAO.class, new H2NetworkAddressInventoryCacheDAO(mysqlClient)); + this.registerServiceImplementation( + IServiceInventoryCacheDAO.class, new H2ServiceInventoryCacheDAO(mysqlClient)); + this.registerServiceImplementation( + IServiceInstanceInventoryCacheDAO.class, new H2ServiceInstanceInventoryCacheDAO(mysqlClient)); + this.registerServiceImplementation( + INetworkAddressInventoryCacheDAO.class, new H2NetworkAddressInventoryCacheDAO(mysqlClient)); this.registerServiceImplementation(ITopologyQueryDAO.class, new H2TopologyQueryDAO(mysqlClient)); this.registerServiceImplementation(IMetricsQueryDAO.class, new H2MetricsQueryDAO(mysqlClient)); this.registerServiceImplementation(ITraceQueryDAO.class, new MySQLTraceQueryDAO(mysqlClient)); - this.registerServiceImplementation(IMetadataQueryDAO.class, new H2MetadataQueryDAO(mysqlClient, config.getMetadataQueryMaxSize())); + this.registerServiceImplementation( + IMetadataQueryDAO.class, new H2MetadataQueryDAO(mysqlClient, config.getMetadataQueryMaxSize())); this.registerServiceImplementation(IAggregationQueryDAO.class, new MySQLAggregationQueryDAO(mysqlClient)); this.registerServiceImplementation(IAlarmQueryDAO.class, new MySQLAlarmQueryDAO(mysqlClient)); - this.registerServiceImplementation(IHistoryDeleteDAO.class, new H2HistoryDeleteDAO(getManager(), mysqlClient, new GeneralStorageTTL())); + this.registerServiceImplementation( + IHistoryDeleteDAO.class, new H2HistoryDeleteDAO(getManager(), mysqlClient, new GeneralStorageTTL())); this.registerServiceImplementation(ITopNRecordsQueryDAO.class, new H2TopNRecordsQueryDAO(mysqlClient)); this.registerServiceImplementation(ILogQueryDAO.class, new MySQLLogQueryDAO(mysqlClient)); this.registerServiceImplementation(IProfileTaskQueryDAO.class, new H2ProfileTaskQueryDAO(mysqlClient)); this.registerServiceImplementation(IProfileTaskLogQueryDAO.class, new H2ProfileTaskLogQueryDAO(mysqlClient)); - this.registerServiceImplementation(IProfileThreadSnapshotQueryDAO.class, new H2ProfileThreadSnapshotQueryDAO(mysqlClient)); + this.registerServiceImplementation( + IProfileThreadSnapshotQueryDAO.class, new H2ProfileThreadSnapshotQueryDAO(mysqlClient)); } @Override diff --git a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/mysql/MySQLTableInstaller.java b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/mysql/MySQLTableInstaller.java index 21c2f8e3070ddcf134e69ee5d1ba05813706eed7..f0320c2129c0f588aac2e24477eb0763f425ddb2 100644 --- a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/mysql/MySQLTableInstaller.java +++ b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/mysql/MySQLTableInstaller.java @@ -21,8 +21,10 @@ package org.apache.skywalking.oap.server.storage.plugin.jdbc.mysql; import java.sql.Connection; import java.sql.SQLException; import lombok.extern.slf4j.Slf4j; +import org.apache.skywalking.oap.server.core.alarm.AlarmRecord; import org.apache.skywalking.oap.server.core.analysis.manual.segment.SegmentRecord; import org.apache.skywalking.oap.server.core.analysis.metrics.IntKeyLongValueHashMap; +import org.apache.skywalking.oap.server.core.analysis.metrics.Metrics; import org.apache.skywalking.oap.server.core.profile.ProfileTaskLogRecord; import org.apache.skywalking.oap.server.core.profile.ProfileThreadSnapshotRecord; import org.apache.skywalking.oap.server.core.register.RegisterSource; @@ -37,13 +39,12 @@ import org.apache.skywalking.oap.server.storage.plugin.jdbc.SQLBuilder; import org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao.H2TableInstaller; import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.ALARM; -import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.ENDPOINT_INVENTORY; import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.NETWORK_ADDRESS; +import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.PROFILE_TASK_LOG; +import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.PROFILE_TASK_SEGMENT_SNAPSHOT; import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SEGMENT; import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SERVICE_INSTANCE_INVENTORY; import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.SERVICE_INVENTORY; -import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.PROFILE_TASK_LOG; -import static org.apache.skywalking.oap.server.core.source.DefaultScopeDefine.PROFILE_TASK_SEGMENT_SNAPSHOT; /** * Extend H2TableInstaller but match MySQL SQL syntax. @@ -78,12 +79,15 @@ public class MySQLTableInstaller extends H2TableInstaller { } else if (Double.class.equals(type) || double.class.equals(type)) { return "DOUBLE"; } else if (String.class.equals(type)) { - if (SEGMENT == model.getScopeId() || PROFILE_TASK_SEGMENT_SNAPSHOT == model.getScopeId()) { - if (name.getName().equals(SegmentRecord.TRACE_ID) || name.getName().equals(SegmentRecord.SEGMENT_ID)) - return "VARCHAR(300)"; - if (name.getName().equals(SegmentRecord.DATA_BINARY)) { - return "MEDIUMTEXT"; - } + if (name.getName().equals(SegmentRecord.TRACE_ID) || name.getName().equals(SegmentRecord.SEGMENT_ID)) { + return "VARCHAR(150)"; + } + if (Metrics.ENTITY_ID.equals(name.getName())) { + return "VARCHAR(512)"; + } + if (SegmentRecord.ENDPOINT_NAME.equals(name.getName()) || SegmentRecord.ENDPOINT_ID.equals( + name.getName())) { + return "VARCHAR(200)"; } if (PROFILE_TASK_LOG == model.getScopeId() || PROFILE_TASK_SEGMENT_SNAPSHOT == model.getScopeId()) { if (name.getName().equals(ProfileTaskLogRecord.TASK_ID)) { @@ -111,7 +115,6 @@ public class MySQLTableInstaller extends H2TableInstaller { case SERVICE_INVENTORY: case SERVICE_INSTANCE_INVENTORY: case NETWORK_ADDRESS: - case ENDPOINT_INVENTORY: createInventoryIndexes(client, model); return; case SEGMENT: @@ -135,38 +138,38 @@ public class MySQLTableInstaller extends H2TableInstaller { try (Connection connection = client.getConnection()) { // query by task id, sequence SQLBuilder tableIndexSQL = new SQLBuilder("CREATE INDEX "); - tableIndexSQL.append(model.getName().toUpperCase()).append("_TASK_ID_SEQUENCE "); + tableIndexSQL.append(model.getName().toUpperCase()).append("_A "); tableIndexSQL.append("ON ") - .append(model.getName()) - .append("(") - .append(ProfileThreadSnapshotRecord.TASK_ID) - .append(", ") - .append(ProfileThreadSnapshotRecord.SEQUENCE) - .append(")"); + .append(model.getName()) + .append("(") + .append(ProfileThreadSnapshotRecord.TASK_ID) + .append(", ") + .append(ProfileThreadSnapshotRecord.SEQUENCE) + .append(")"); createIndex(client, connection, model, tableIndexSQL); // query by segment id, sequence tableIndexSQL = new SQLBuilder("CREATE INDEX "); tableIndexSQL.append(model.getName().toUpperCase()).append("_SEGMENT_ID_SEQUENCE "); tableIndexSQL.append("ON ") - .append(model.getName()) - .append("(") - .append(ProfileThreadSnapshotRecord.SEGMENT_ID) - .append(", ") - .append(ProfileThreadSnapshotRecord.SEQUENCE) - .append(")"); + .append(model.getName()) + .append("(") + .append(ProfileThreadSnapshotRecord.SEGMENT_ID) + .append(", ") + .append(ProfileThreadSnapshotRecord.SEQUENCE) + .append(")"); createIndex(client, connection, model, tableIndexSQL); // query by segment id, dump time tableIndexSQL = new SQLBuilder("CREATE INDEX "); tableIndexSQL.append(model.getName().toUpperCase()).append("_SEGMENT_ID_DUMP_TIME "); tableIndexSQL.append("ON ") - .append(model.getName()) - .append("(") - .append(ProfileThreadSnapshotRecord.SEGMENT_ID) - .append(", ") - .append(ProfileThreadSnapshotRecord.DUMP_TIME) - .append(")"); + .append(model.getName()) + .append("(") + .append(ProfileThreadSnapshotRecord.SEGMENT_ID) + .append(", ") + .append(ProfileThreadSnapshotRecord.DUMP_TIME) + .append(")"); createIndex(client, connection, model, tableIndexSQL); } catch (JDBCClientException | SQLException e) { throw new StorageException(e.getMessage(), e); @@ -179,10 +182,10 @@ public class MySQLTableInstaller extends H2TableInstaller { SQLBuilder tableIndexSQL = new SQLBuilder("CREATE INDEX "); tableIndexSQL.append(model.getName().toUpperCase()).append("_TASK_ID "); tableIndexSQL.append("ON ") - .append(model.getName()) - .append("(") - .append(ProfileTaskLogRecord.TASK_ID) - .append(")"); + .append(model.getName()) + .append("(") + .append(ProfileTaskLogRecord.TASK_ID) + .append(")"); createIndex(client, connection, model, tableIndexSQL); } catch (JDBCClientException | SQLException e) { throw new StorageException(e.getMessage(), e); @@ -196,7 +199,7 @@ public class MySQLTableInstaller extends H2TableInstaller { tableIndexSQL.append("ON ") .append(model.getName()) .append("(") - .append(SegmentRecord.TIME_BUCKET) + .append(Metrics.TIME_BUCKET) .append(")"); createIndex(client, connection, model, tableIndexSQL); } catch (JDBCClientException | SQLException e) { @@ -211,7 +214,7 @@ public class MySQLTableInstaller extends H2TableInstaller { tableIndexSQL.append("ON ") .append(model.getName()) .append("(") - .append(SegmentRecord.TIME_BUCKET) + .append(AlarmRecord.TIME_BUCKET) .append(")"); createIndex(client, connection, model, tableIndexSQL); } catch (JDBCClientException | SQLException e) { diff --git a/oap-server/server-storage-plugin/storage-zipkin-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/zipkin/ZipkinSpan.java b/oap-server/server-storage-plugin/storage-zipkin-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/zipkin/ZipkinSpan.java index ca657873857b5a629e3af7105ee2e798c4b69d27..539c7a2ba0c2371ef4c84f8e16673fa7edab777a 100644 --- a/oap-server/server-storage-plugin/storage-zipkin-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/zipkin/ZipkinSpan.java +++ b/oap-server/server-storage-plugin/storage-zipkin-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/zipkin/ZipkinSpan.java @@ -56,7 +56,7 @@ public class ZipkinSpan extends Source { private String endpointName; @Setter @Getter - private int endpointId; + private String endpointId; @Setter @Getter private long startTime; diff --git a/oap-server/server-storage-plugin/storage-zipkin-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/zipkin/ZipkinSpanRecord.java b/oap-server/server-storage-plugin/storage-zipkin-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/zipkin/ZipkinSpanRecord.java index 8b067221e8b4f8737a2443756df05ad9f14657d5..37b8921f93ae4d3a3714ecef3f7a26d38ab28d6b 100644 --- a/oap-server/server-storage-plugin/storage-zipkin-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/zipkin/ZipkinSpanRecord.java +++ b/oap-server/server-storage-plugin/storage-zipkin-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/zipkin/ZipkinSpanRecord.java @@ -79,7 +79,7 @@ public class ZipkinSpanRecord extends Record { @Getter @Column(columnName = ENDPOINT_ID) @IDColumn - private int endpointId; + private String endpointId; @Setter @Getter @Column(columnName = START_TIME) @@ -149,7 +149,7 @@ public class ZipkinSpanRecord extends Record { record.setServiceId(((Number) dbMap.get(SERVICE_ID)).intValue()); record.setServiceInstanceId(((Number) dbMap.get(SERVICE_INSTANCE_ID)).intValue()); record.setEndpointName((String) dbMap.get(ENDPOINT_NAME)); - record.setEndpointId(((Number) dbMap.get(ENDPOINT_ID)).intValue()); + record.setEndpointId((String) dbMap.get(ENDPOINT_ID)); record.setStartTime(((Number) dbMap.get(START_TIME)).longValue()); record.setEndTime(((Number) dbMap.get(END_TIME)).longValue()); record.setLatency(((Number) dbMap.get(LATENCY)).intValue()); diff --git a/oap-server/server-storage-plugin/storage-zipkin-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/zipkin/elasticsearch/ZipkinTraceQueryEsDAO.java b/oap-server/server-storage-plugin/storage-zipkin-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/zipkin/elasticsearch/ZipkinTraceQueryEsDAO.java index 94611429ba60b57d55c562447fb599f93bbb1e42..579993dfa3074b6c7faca3adec63a1dec41e1d8b 100644 --- a/oap-server/server-storage-plugin/storage-zipkin-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/zipkin/elasticsearch/ZipkinTraceQueryEsDAO.java +++ b/oap-server/server-storage-plugin/storage-zipkin-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/zipkin/elasticsearch/ZipkinTraceQueryEsDAO.java @@ -78,9 +78,19 @@ public class ZipkinTraceQueryEsDAO extends EsDAO implements ITraceQueryDAO { } @Override - public TraceBrief queryBasicTraces(long startSecondTB, long endSecondTB, long minDuration, long maxDuration, - String endpointName, int serviceId, int serviceInstanceId, int endpointId, String traceId, int limit, int from, - TraceState traceState, QueryOrder queryOrder) throws IOException { + public TraceBrief queryBasicTraces(long startSecondTB, + long endSecondTB, + long minDuration, + long maxDuration, + String endpointName, + int serviceId, + int serviceInstanceId, + String endpointId, + String traceId, + int limit, + int from, + TraceState traceState, + QueryOrder queryOrder) throws IOException { SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); @@ -111,7 +121,7 @@ public class ZipkinTraceQueryEsDAO extends EsDAO implements ITraceQueryDAO { if (serviceInstanceId != 0) { boolQueryBuilder.must().add(QueryBuilders.termQuery(SERVICE_INSTANCE_ID, serviceInstanceId)); } - if (endpointId != 0) { + if (!Strings.isNullOrEmpty(endpointId)) { boolQueryBuilder.must().add(QueryBuilders.termQuery(ENDPOINT_ID, endpointId)); } if (!Strings.isNullOrEmpty(traceId)) { diff --git a/oap-server/server-tools/profile-exporter/tool-profile-snapshot-bootstrap/src/test/java/org/apache/skywalking/oap/server/tool/profile/exporter/test/ProfileTraceDAO.java b/oap-server/server-tools/profile-exporter/tool-profile-snapshot-bootstrap/src/test/java/org/apache/skywalking/oap/server/tool/profile/exporter/test/ProfileTraceDAO.java index 4d26691a6ac2b10b73c7a2a904f4af170bd020aa..37112822a73523412b013c9c28d373e972956491 100644 --- a/oap-server/server-tools/profile-exporter/tool-profile-snapshot-bootstrap/src/test/java/org/apache/skywalking/oap/server/tool/profile/exporter/test/ProfileTraceDAO.java +++ b/oap-server/server-tools/profile-exporter/tool-profile-snapshot-bootstrap/src/test/java/org/apache/skywalking/oap/server/tool/profile/exporter/test/ProfileTraceDAO.java @@ -39,7 +39,7 @@ public class ProfileTraceDAO implements ITraceQueryDAO { } @Override - public TraceBrief queryBasicTraces(long startSecondTB, long endSecondTB, long minDuration, long maxDuration, String endpointName, int serviceId, int serviceInstanceId, int endpointId, String traceId, int limit, int from, TraceState traceState, QueryOrder queryOrder) throws IOException { + public TraceBrief queryBasicTraces(long startSecondTB, long endSecondTB, long minDuration, long maxDuration, String endpointName, int serviceId, int serviceInstanceId, String endpointId, String traceId, int limit, int from, TraceState traceState, QueryOrder queryOrder) throws IOException { return null; } diff --git a/oap-server/server-tools/profile-exporter/tool-profile-snapshot-server-mock/src/main/java/org/apache/skywalking/oap/server/tool/profile/core/MockCoreModuleProvider.java b/oap-server/server-tools/profile-exporter/tool-profile-snapshot-server-mock/src/main/java/org/apache/skywalking/oap/server/tool/profile/core/MockCoreModuleProvider.java index 6143f9d8994b029d3b6c2527120894a31f515fa0..54dda096e9bbe6d54423417693143155589eac9f 100755 --- a/oap-server/server-tools/profile-exporter/tool-profile-snapshot-server-mock/src/main/java/org/apache/skywalking/oap/server/tool/profile/core/MockCoreModuleProvider.java +++ b/oap-server/server-tools/profile-exporter/tool-profile-snapshot-server-mock/src/main/java/org/apache/skywalking/oap/server/tool/profile/core/MockCoreModuleProvider.java @@ -18,11 +18,12 @@ package org.apache.skywalking.oap.server.tool.profile.core; +import java.io.IOException; +import java.util.Collections; import org.apache.skywalking.oap.server.core.CoreModule; import org.apache.skywalking.oap.server.core.CoreModuleConfig; import org.apache.skywalking.oap.server.core.CoreModuleProvider; import org.apache.skywalking.oap.server.core.annotation.AnnotationScan; -import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; import org.apache.skywalking.oap.server.core.cache.NetworkAddressInventoryCache; import org.apache.skywalking.oap.server.core.cache.ProfileTaskCache; import org.apache.skywalking.oap.server.core.cache.ServiceInstanceInventoryCache; @@ -41,8 +42,6 @@ import org.apache.skywalking.oap.server.core.query.ProfileTaskQueryService; import org.apache.skywalking.oap.server.core.query.TopNRecordsQueryService; import org.apache.skywalking.oap.server.core.query.TopologyQueryService; import org.apache.skywalking.oap.server.core.query.TraceQueryService; -import org.apache.skywalking.oap.server.core.register.service.EndpointInventoryRegister; -import org.apache.skywalking.oap.server.core.register.service.IEndpointInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.INetworkAddressInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.IServiceInstanceInventoryRegister; import org.apache.skywalking.oap.server.core.register.service.IServiceInventoryRegister; @@ -74,9 +73,6 @@ import org.apache.skywalking.oap.server.tool.profile.core.mock.MockSourceReceive import org.apache.skywalking.oap.server.tool.profile.core.mock.MockStreamAnnotationListener; import org.apache.skywalking.oap.server.tool.profile.core.mock.MockWorkerInstancesService; -import java.io.IOException; -import java.util.Collections; - public class MockCoreModuleProvider extends CoreModuleProvider { private final StorageModels storageModels; @@ -117,12 +113,14 @@ public class MockCoreModuleProvider extends CoreModuleProvider { CoreModuleConfig moduleConfig = new CoreModuleConfig(); this.registerServiceImplementation(ConfigService.class, new ConfigService(moduleConfig)); - this.registerServiceImplementation(DownsamplingConfigService.class, new DownsamplingConfigService(Collections.emptyList())); + this.registerServiceImplementation( + DownsamplingConfigService.class, new DownsamplingConfigService(Collections.emptyList())); this.registerServiceImplementation(GRPCHandlerRegister.class, new MockGRPCHandlerRegister()); this.registerServiceImplementation(JettyHandlerRegister.class, new MockJettyHandlerRegister()); - this.registerServiceImplementation(IComponentLibraryCatalogService.class, new MockComponentLibraryCatalogService()); + this.registerServiceImplementation( + IComponentLibraryCatalogService.class, new MockComponentLibraryCatalogService()); this.registerServiceImplementation(SourceReceiver.class, new MockSourceReceiver()); @@ -135,17 +133,19 @@ public class MockCoreModuleProvider extends CoreModuleProvider { this.registerServiceImplementation(IModelGetter.class, storageModels); this.registerServiceImplementation(IModelOverride.class, storageModels); - this.registerServiceImplementation(ServiceInventoryCache.class, new ServiceInventoryCache(getManager(), moduleConfig)); + this.registerServiceImplementation( + ServiceInventoryCache.class, new ServiceInventoryCache(getManager(), moduleConfig)); this.registerServiceImplementation(IServiceInventoryRegister.class, new ServiceInventoryRegister(getManager())); - this.registerServiceImplementation(ServiceInstanceInventoryCache.class, new ServiceInstanceInventoryCache(getManager(), moduleConfig)); - this.registerServiceImplementation(IServiceInstanceInventoryRegister.class, new ServiceInstanceInventoryRegister(getManager())); - - this.registerServiceImplementation(EndpointInventoryCache.class, new EndpointInventoryCache(getManager(), moduleConfig)); - this.registerServiceImplementation(IEndpointInventoryRegister.class, new EndpointInventoryRegister(getManager())); + this.registerServiceImplementation( + ServiceInstanceInventoryCache.class, new ServiceInstanceInventoryCache(getManager(), moduleConfig)); + this.registerServiceImplementation( + IServiceInstanceInventoryRegister.class, new ServiceInstanceInventoryRegister(getManager())); - this.registerServiceImplementation(NetworkAddressInventoryCache.class, new NetworkAddressInventoryCache(getManager(), moduleConfig)); - this.registerServiceImplementation(INetworkAddressInventoryRegister.class, new NetworkAddressInventoryRegister(getManager())); + this.registerServiceImplementation( + NetworkAddressInventoryCache.class, new NetworkAddressInventoryCache(getManager(), moduleConfig)); + this.registerServiceImplementation( + INetworkAddressInventoryRegister.class, new NetworkAddressInventoryRegister(getManager())); this.registerServiceImplementation(TopologyQueryService.class, new TopologyQueryService(getManager())); this.registerServiceImplementation(MetricQueryService.class, new MetricQueryService(getManager())); @@ -184,7 +184,7 @@ public class MockCoreModuleProvider extends CoreModuleProvider { @Override public String[] requiredModules() { return new String[] { - TelemetryModule.NAME + TelemetryModule.NAME }; } } diff --git a/test/e2e/e2e-common/src/main/java/org/apache/skywalking/e2e/SkyWalkingAnnotations.java b/test/e2e/e2e-common/src/main/java/org/apache/skywalking/e2e/SkyWalkingAnnotations.java index 4121ecdba238bfc15bc911cc7194e0d74b35da02..ec35971a8183bf3bc0f1a46122f009f630f06091 100644 --- a/test/e2e/e2e-common/src/main/java/org/apache/skywalking/e2e/SkyWalkingAnnotations.java +++ b/test/e2e/e2e-common/src/main/java/org/apache/skywalking/e2e/SkyWalkingAnnotations.java @@ -208,7 +208,7 @@ public final class SkyWalkingAnnotations { compose.withPull(true) .withLocalCompose(true) - .withTailChildContainers(!IS_CI) + .withTailChildContainers(true) .withRemoveImages(DockerComposeContainer.RemoveImages.LOCAL); if (IS_CI) { diff --git a/test/plugin/scenarios/activemq-scenario/config/expectedData.yaml b/test/plugin/scenarios/activemq-scenario/config/expectedData.yaml index 13614f547c13873e1246effa5fd0a1a30cd58d3c..c61f2e9a0206bf1ba24ce17e56ee09e0c99786cb 100644 --- a/test/plugin/scenarios/activemq-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/activemq-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {activemq-scenario: nq 0} instances: - {activemq-scenario: nq 0} - operationNames: - - activemq-scenario: [ActiveMQ/Queue/test/Consumer, /activemq-scenario/case/activemq] heartbeat: [] segmentItems: - serviceName: activemq-scenario diff --git a/test/plugin/scenarios/apm-toolkit-trace-scenario/config/expectedData.yaml b/test/plugin/scenarios/apm-toolkit-trace-scenario/config/expectedData.yaml index 80800c7a3874b9981d127d29abcc7d8e014dc0d8..14fefb681300f1816810a8b0977d03b7e4f87df3 100644 --- a/test/plugin/scenarios/apm-toolkit-trace-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/apm-toolkit-trace-scenario/config/expectedData.yaml @@ -19,9 +19,6 @@ registryItems: - {apm-toolkit-trace-scenario: 2} instances: - {apm-toolkit-trace-scenario: 1} - operationNames: - - apm-toolkit-trace-scenario: [/case/asyncVisit/runnable, /case/asyncVisit/callable, - /case/tool-kit, /case/asyncVisit/supplier] heartbeat: [] segmentItems: - serviceName: apm-toolkit-trace-scenario @@ -196,7 +193,7 @@ segmentItems: - {key: http.method, value: GET} - {key: correlation, value: correlationValueTest} refs: - - {parentEndpointId: -1, parentEndpoint: '', + - {parentEndpointId: 0, parentEndpoint: Thread/org.apache.skywalking.apm.toolkit.trace.CallableWrapper/call, networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/tool-kit, entryServiceInstanceId: 1} @@ -292,7 +289,7 @@ segmentItems: - {key: http.method, value: GET} - {key: correlation, value: correlationValueTest} refs: - - {parentEndpointId: -1, parentEndpoint: '', + - {parentEndpointId: 0, parentEndpoint: Thread/org.apache.skywalking.apm.toolkit.trace.RunnableWrapper/run, networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/tool-kit, entryServiceInstanceId: 1} @@ -352,7 +349,7 @@ segmentItems: - {key: http.method, value: GET} - {key: correlation, value: correlationValueTest} refs: - - {parentEndpointId: -1, parentEndpoint: '', + - {parentEndpointId: 0, parentEndpoint: Thread/org.apache.skywalking.apm.toolkit.trace.SupplierWrapper/get, networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/tool-kit, entryServiceInstanceId: 1} \ No newline at end of file diff --git a/test/plugin/scenarios/armeria-0.96minus-scenario/config/expectedData.yaml b/test/plugin/scenarios/armeria-0.96minus-scenario/config/expectedData.yaml index 7038128a815bf0e92e6833e25f6a02f2c1232022..c4bfaf6f510aacd3134164ef22f959351fbb1cd1 100644 --- a/test/plugin/scenarios/armeria-0.96minus-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/armeria-0.96minus-scenario/config/expectedData.yaml @@ -20,8 +20,6 @@ registryItems: - {'armeria-0.96minus-scenario': 2} instances: - {'armeria-0.96minus-scenario': 1} - operationNames: - - 'armeria-0.96minus-scenario': [/greet/skywalking] heartbeat: [] segmentItems: - serviceName: armeria-0.96minus-scenario diff --git a/test/plugin/scenarios/armeria-0.96plus-scenario/config/expectedData.yaml b/test/plugin/scenarios/armeria-0.96plus-scenario/config/expectedData.yaml index 44e8a10f1342bbe855d546616b5931cd1420fb17..19125260d43152a729ec5cabd6e413c47969eb57 100644 --- a/test/plugin/scenarios/armeria-0.96plus-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/armeria-0.96plus-scenario/config/expectedData.yaml @@ -20,8 +20,6 @@ registryItems: - {'armeria-0.96plus-scenario': 2} instances: - {'armeria-0.96plus-scenario': 1} - operationNames: - - 'armeria-0.96plus-scenario': [/greet/skywalking] heartbeat: [] segmentItems: - serviceName: armeria-0.96plus-scenario diff --git a/test/plugin/scenarios/avro-scenario/config/expectedData.yaml b/test/plugin/scenarios/avro-scenario/config/expectedData.yaml index 4890674171ac0947f551fe0245ac6085a664ddca..b259bd5446230c65da4dee3dea0f61a0091441d1 100644 --- a/test/plugin/scenarios/avro-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/avro-scenario/config/expectedData.yaml @@ -20,9 +20,6 @@ registryItems: instances: - {avro-server: 1} - {avro-client: 1} - operationNames: - - avro-server: [example.proto.Greeter.hello] - - avro-client: [/avro-scenario/case/healthCheck, /avro-scenario/case/avro-scenario] heartbeat: [] segmentItems: - serviceName: avro-server diff --git a/test/plugin/scenarios/canal-scenario/config/expectedData.yaml b/test/plugin/scenarios/canal-scenario/config/expectedData.yaml index 020f6a544a1c82eb47cf5200ef80478b7a921afa..d3d4b20e4e9cb723425b4249b1a15fca01496e56 100644 --- a/test/plugin/scenarios/canal-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/canal-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {canal-scenario: 2} instances: - {canal-scenario: 1} - operationNames: - - canal-scenario: [/canal-scenario/case/canal-case] heartbeat: [] segmentItems: - serviceName: canal-scenario diff --git a/test/plugin/scenarios/cassandra-java-driver-3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/cassandra-java-driver-3.x-scenario/config/expectedData.yaml index 45dcc1bb675dfd15a91300acd2c4f2481a025430..c603ca787e4a0e5d404bfebff7d9524faebb5353 100644 --- a/test/plugin/scenarios/cassandra-java-driver-3.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/cassandra-java-driver-3.x-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {cassandra-java-driver-3.x-scenario: 2} instances: - {cassandra-java-driver-3.x-scenario: 1} - operationNames: - - cassandra-java-driver-3.x-scenario: [/cassandra-java-driver-3.x-scenario/case/cassandra] heartbeat: [] segmentItems: - serviceName: cassandra-java-driver-3.x-scenario diff --git a/test/plugin/scenarios/customize-scenario/config/expectedData.yaml b/test/plugin/scenarios/customize-scenario/config/expectedData.yaml index 34f1eddc42a72ebd8e50c149bf661da1fd45435c..98884cbbddb3ed3246f43bf8ed4c3b1d66c9040f 100644 --- a/test/plugin/scenarios/customize-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/customize-scenario/config/expectedData.yaml @@ -19,8 +19,6 @@ registryItems: - {customize-scenario: nq 0} instances: - {customize-scenario: 1} - operationNames: - - customize-scenario: [/case/customize] segmentItems: - serviceName: customize-scenario segmentSize: gt 1 diff --git a/test/plugin/scenarios/dubbo-2.5.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/dubbo-2.5.x-scenario/config/expectedData.yaml index 6c4d00912ce23f077c81fdd8008c3d6a76629d83..0f23f9fd1a76cf924dc86a7ba48c62969464a548 100644 --- a/test/plugin/scenarios/dubbo-2.5.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/dubbo-2.5.x-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {dubbo-2.5.x-scenario: 2} instances: - {dubbo-2.5.x-scenario: 1} - operationNames: - - dubbo-2.5.x-scenario: [/dubbo-2.5.x-scenario/case/dubbo, org.apache.skywalking.apm.testcase.dubbo.services.GreetService.doBusiness()] heartbeat: [] segmentItems: - serviceName: dubbo-2.5.x-scenario diff --git a/test/plugin/scenarios/dubbo-2.7.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/dubbo-2.7.x-scenario/config/expectedData.yaml index 62548c5c5fcb1c8d8f328fae0cce52a14d5afd41..e497b7591f007abe4e6317fbed29f8f731ac73c9 100644 --- a/test/plugin/scenarios/dubbo-2.7.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/dubbo-2.7.x-scenario/config/expectedData.yaml @@ -18,9 +18,6 @@ registryItems: - {dubbo-2.7.x-scenario: 2} instances: - {dubbo-2.7.x-scenario: 1} - operationNames: - - dubbo-2.7.x-scenario: [/dubbo-2.7.x-scenario/case/dubbo, - org.apache.skywalking.apm.testcase.dubbo.services.GreetService.doBusiness()] heartbeat: [] segmentItems: - serviceName: dubbo-2.7.x-scenario diff --git a/test/plugin/scenarios/ehcache-2.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/ehcache-2.x-scenario/config/expectedData.yaml index 02e22562e568f56c4599851b3d26f45505876fd0..54591d177fa3d47c6de6c6568273599cd68d8604 100644 --- a/test/plugin/scenarios/ehcache-2.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/ehcache-2.x-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {ehcache-2.x-scenario: 2} instances: - {ehcache-2.x-scenario: 1} - operationNames: - - ehcache-2.x-scenario: [/ehcache-2.x-scenario/case/ehcache] heartbeat: [] segmentItems: - serviceName: ehcache-2.x-scenario diff --git a/test/plugin/scenarios/elasticsearch-5.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/elasticsearch-5.x-scenario/config/expectedData.yaml index dbe2c45d15593bc4c64270fa681984196e340a6e..14310ad8c66fa3daeba4bfef35090d3df6f60b36 100644 --- a/test/plugin/scenarios/elasticsearch-5.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/elasticsearch-5.x-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {elasticsearch-5.x-scenario: nq 0} instances: - {elasticsearch-5.x-scenario: 1} - operationNames: - - elasticsearch-5.x-scenario: [/case/elasticsearch] heartbeat: [] segmentItems: - serviceName: elasticsearch-5.x-scenario diff --git a/test/plugin/scenarios/elasticsearch-6.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/elasticsearch-6.x-scenario/config/expectedData.yaml index 745377f5a1e9ff6e99192e7a9d395ace0dd8a252..ea0c5a7921609f175ac80f2800b5fa8b31fa4cb5 100644 --- a/test/plugin/scenarios/elasticsearch-6.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/elasticsearch-6.x-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {elasticsearch-6.x-scenario: nq 0} instances: - {elasticsearch-6.x-scenario: 1} - operationNames: - - elasticsearch-6.x-scenario: [/elasticsearch-case/case/elasticsearch] heartbeat: [] segmentItems: - serviceName: elasticsearch-6.x-scenario diff --git a/test/plugin/scenarios/elasticsearch-7.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/elasticsearch-7.x-scenario/config/expectedData.yaml index c45972fb1eb379d7a25bb750bebfc17242d102b5..0afa00d5a99eeea80aab3b37a41d678865ded256 100644 --- a/test/plugin/scenarios/elasticsearch-7.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/elasticsearch-7.x-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {elasticsearch-7.x-scenario: nq 0} instances: - {elasticsearch-7.x-scenario: 1} - operationNames: - - elasticsearch-7.x-scenario: [/elasticsearch-case/case/elasticsearch] heartbeat: [] segmentItems: - serviceName: elasticsearch-7.x-scenario diff --git a/test/plugin/scenarios/feign-scenario/config/expectedData.yaml b/test/plugin/scenarios/feign-scenario/config/expectedData.yaml index f2a411802ce8a488fdc8dbe7795e67c1d99a0285..3ef2b62cc9131c5fc8870b3d08e543483c674049 100644 --- a/test/plugin/scenarios/feign-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/feign-scenario/config/expectedData.yaml @@ -18,9 +18,6 @@ registryItems: - {feign-scenario: nq 0} instances: - {feign-scenario: 1} - operationNames: - - feign-scenario: [/feign-scenario/update/1, /feign-scenario/get/1, /feign-scenario/create/, - /feign-scenario/case/feign-scenario, /feign-scenario/delete/1] heartbeat: [] segmentItems: - serviceName: feign-scenario diff --git a/test/plugin/scenarios/finagle-17.10.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/finagle-17.10.x-scenario/config/expectedData.yaml index 13e28ea81819d1a65209162449ad8a6c94a7a906..b386a29db4e9b1262b39482eff3167ff45921a1e 100644 --- a/test/plugin/scenarios/finagle-17.10.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/finagle-17.10.x-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {finagle-17.10.x-scenario: 2} instances: - {finagle-17.10.x-scenario: 1} - operationNames: - - finagle-17.10.x-scenario: [hello, /finagle-17.10.x-scenario/case/finagle] heartbeat: [] segmentItems: - serviceName: finagle-17.10.x-scenario diff --git a/test/plugin/scenarios/finagle-6.25.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/finagle-6.25.x-scenario/config/expectedData.yaml index 6f49af51ee7c68acddac4228b36650aa8846db45..6141f30c5f8786189d885ad3351a799100553b96 100644 --- a/test/plugin/scenarios/finagle-6.25.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/finagle-6.25.x-scenario/config/expectedData.yaml @@ -19,8 +19,6 @@ registryItems: - {finagle-6.25.x-scenario: 2} instances: - {finagle-6.25.x-scenario: 1} - operationNames: - - finagle-6.25.x-scenario: [hello, /finagle-6.25.x-scenario/case/finagle] heartbeat: [] segmentItems: - serviceName: finagle-6.25.x-scenario diff --git a/test/plugin/scenarios/finagle-6.44.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/finagle-6.44.x-scenario/config/expectedData.yaml index 05ba675b19e13deae4cc709a0a527361753bf68c..b4bf231b510d713c429ad7b35074f6663296cfca 100644 --- a/test/plugin/scenarios/finagle-6.44.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/finagle-6.44.x-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {finagle-6.44.x-scenario: 2} instances: - {finagle-6.44.x-scenario: 1} - operationNames: - - finagle-6.44.x-scenario: [hello, /finagle-6.44.x-scenario/case/finagle] heartbeat: [] segmentItems: - serviceName: finagle-6.44.x-scenario diff --git a/test/plugin/scenarios/gateway-scenario/config/expectedData.yaml b/test/plugin/scenarios/gateway-scenario/config/expectedData.yaml index b48b2f1300742ca18ce21d46eff44380236f214b..124385d3f05adeacfb1217297d55ed9657162abf 100644 --- a/test/plugin/scenarios/gateway-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/gateway-scenario/config/expectedData.yaml @@ -21,9 +21,6 @@ registryItems: instances: - {gateway-projectB-scenario: 1} - {gateway-projectA-scenario: 1} - operationNames: - - gateway-projectB-scenario: [/provider/b/testcase] - - gateway-projectA-scenario: [WEBFLUX.handle] heartbeat: [] segmentItems: - serviceName: gateway-projectB-scenario @@ -48,7 +45,7 @@ segmentItems: - {key: url, value: not null} - {key: http.method, value: GET} refs: - - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, + - {parentEndpointId: 0, parentEndpoint: GATEWAY/provider_route, networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstanceId: not null, networkAddress: 'localhost:18070', entryEndpoint: WEBFLUX.handle, entryServiceInstanceId: not null} diff --git a/test/plugin/scenarios/grpc-scenario/config/expectedData.yaml b/test/plugin/scenarios/grpc-scenario/config/expectedData.yaml index dbbec60411c27dd7e95b52bbb5424d76475a6508..e4e13fe543e4d7973c14a4db31af754005142137 100644 --- a/test/plugin/scenarios/grpc-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/grpc-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - { grpc-scenario: 2 } instances: - { grpc-scenario: 1 } - operationNames: - - grpc-scenario: [Greeter.sayHello, GreeterBlocking.sayHello, GreeterBlockingError.sayHello, /grpc-scenario/case/grpc-scenario] heartbeat: [] segmentItems: - serviceName: grpc-scenario diff --git a/test/plugin/scenarios/gson-scenario/config/expectedData.yaml b/test/plugin/scenarios/gson-scenario/config/expectedData.yaml index 95ea037db2bdb816471424549e627d3c9f614eb6..618da09c517ddcc049999b20524327d3fb2b9319 100644 --- a/test/plugin/scenarios/gson-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/gson-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {gson-scenario: nq 0} instances: - {gson-scenario: nq 0} - operationNames: - - gson-scenario: [/gson-scenario/case/gson-scenario] segmentItems: - serviceName: gson-scenario segmentSize: ge 2 diff --git a/test/plugin/scenarios/h2-scenario/config/expectedData.yaml b/test/plugin/scenarios/h2-scenario/config/expectedData.yaml index bd9da8aa169afd101665a8788fb4412751aeac14..733f817b0d9bff1409fe4fed4b155798bb1ddb99 100644 --- a/test/plugin/scenarios/h2-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/h2-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {h2-scenario: 2} instances: - {h2-scenario: 1} - operationNames: - - h2-scenario: [/h2-scenario/case/h2-scenario] heartbeat: [] segmentItems: - serviceName: h2-scenario diff --git a/test/plugin/scenarios/httpasyncclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/httpasyncclient-scenario/config/expectedData.yaml index a5ecd33956bad48a0795c18435c8709ed3628df7..41f62b85269016403b0d81c08a0efae7249dde19 100644 --- a/test/plugin/scenarios/httpasyncclient-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/httpasyncclient-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {httpasyncclient-scenario: nq 0} instances: - {httpasyncclient-scenario: 1} - operationNames: - - httpasyncclient-scenario: [/httpasyncclient/case/httpasyncclient, /httpasyncclient/back] segmentItems: - serviceName: httpasyncclient-scenario segmentSize: ge 4 diff --git a/test/plugin/scenarios/httpclient-3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/httpclient-3.x-scenario/config/expectedData.yaml index c0e154f3105e46804df973f6f5a0a383b0877da5..300eff841a2718303b116a169ee0486142ada95e 100644 --- a/test/plugin/scenarios/httpclient-3.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/httpclient-3.x-scenario/config/expectedData.yaml @@ -18,9 +18,6 @@ registryItems: - {httpclient-3.x-scenario: 2} instances: - {httpclient-3.x-scenario: 1} - operationNames: - - httpclient-3.x-scenario: [/httpclient-3.x-scenario/case/httpclient, - /httpclient-3.x-scenario/case/context-propagate] heartbeat: [] segmentItems: - serviceName: httpclient-3.x-scenario diff --git a/test/plugin/scenarios/httpclient-4.3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/httpclient-4.3.x-scenario/config/expectedData.yaml index af156bcb570de9383e32c04173bce1cd86cd3ec2..02087bff36c7026a289d1e76d323703d8b7624e7 100644 --- a/test/plugin/scenarios/httpclient-4.3.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/httpclient-4.3.x-scenario/config/expectedData.yaml @@ -18,10 +18,6 @@ registryItems: - {httpclient-4.3.x-scenario: 2} instances: - {httpclient-4.3.x-scenario: 1} - operationNames: - - httpclient-4.3.x-scenario: [/httpclient-4.3.x-scenario/case/httpclient, - /httpclient-4.3.x-scenario/healthCheck, - /httpclient-4.3.x-scenario/case/context-propagate] heartbeat: [] segmentItems: - serviceName: httpclient-4.3.x-scenario diff --git a/test/plugin/scenarios/hystrix-scenario/config/expectedData.yaml b/test/plugin/scenarios/hystrix-scenario/config/expectedData.yaml index f02c033b8d5b36329f5fafc2ec3a80ae84f716ab..e2f81884935bb45e115c8924334056d9bac99f28 100644 --- a/test/plugin/scenarios/hystrix-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/hystrix-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {hystrix-scenario: 2} instances: - {hystrix-scenario: 1} - operationNames: - - hystrix-scenario: [/case/hystrix-scenario] heartbeat: [] segmentItems: - serviceName: hystrix-scenario @@ -65,7 +63,7 @@ segmentItems: peer: '' peerId: 0 refs: - - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, entryEndpointId: 0, refType: CrossThread, parentSpanId: 0, + - {parentEndpointId: 0, parentEndpoint: Hystrix/TestACommand/Execution, networkAddressId: 0, entryEndpointId: 0, refType: CrossThread, parentSpanId: 0, parentTraceSegmentId: '${hystrix-scenario[0]}', parentServiceInstanceId: nq 0, networkAddress: '', entryEndpoint: /case/hystrix-scenario, entryServiceInstanceId: nq 0} - segmentId: not null spans: diff --git a/test/plugin/scenarios/jdk-http-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-http-scenario/config/expectedData.yaml index a2202292403ad3d12f611e6d1a6b9b9e8442fc09..23ab4f90efd639ae18d620beb0f12350d8d28a21 100644 --- a/test/plugin/scenarios/jdk-http-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-http-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {jdk-http-scenario: 2} instances: - {jdk-http-scenario: 1} - operationNames: - - jdk-http-scenario: [/jdk-http-scenario/case/receiveContext-0, /jdk-http-scenario/case/jdk-http-scenario] heartbeat: [] segmentItems: - serviceName: jdk-http-scenario diff --git a/test/plugin/scenarios/jdk-threading-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk-threading-scenario/config/expectedData.yaml index e5be08ef75c23a9a49c254e7c991ec6e2f4abc29..18245a9aeaa210c5f197112bbc60cd69bc8669e8 100644 --- a/test/plugin/scenarios/jdk-threading-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jdk-threading-scenario/config/expectedData.yaml @@ -19,8 +19,6 @@ registryItems: - {jdk-threading-scenario: 2} instances: - {jdk-threading-scenario: 1} - operationNames: - - jdk-threading-scenario: ['/greet/{username}'] heartbeat: [] segmentItems: diff --git a/test/plugin/scenarios/jedis-scenario/config/expectedData.yaml b/test/plugin/scenarios/jedis-scenario/config/expectedData.yaml index aacdf80f659536b5fb17692e029d6b63f32f741c..72118d295a3d3042ddf9bca9b8fc2340c8d763d8 100644 --- a/test/plugin/scenarios/jedis-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jedis-scenario/config/expectedData.yaml @@ -19,8 +19,6 @@ registryItems: - {jedis-scenario: 2} instances: - {jedis-scenario: 1} - operationNames: - - jedis-scenario: [/jedis-scenario/case/jedis-scenario] heartbeat: [] segmentItems: - serviceName: jedis-scenario diff --git a/test/plugin/scenarios/jetty-scenario/config/expectedData.yaml b/test/plugin/scenarios/jetty-scenario/config/expectedData.yaml index b4bcafed6c52e7379cdcded5cc4df679ac147aa3..d56289f5e7c83804fb85c303d80da668ef530ba0 100644 --- a/test/plugin/scenarios/jetty-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/jetty-scenario/config/expectedData.yaml @@ -20,10 +20,6 @@ registryItems: instances: - {jettyserver-scenario: 1} - {jettyclient-scenario: 1} - operationNames: - - jettyserver-scenario: [/jettyserver-case/case/receiveContext-0] - - jettyclient-scenario: [/jettyclient-case/case/jettyclient-case, - /jettyclient-case/case/healthCheck] segmentItems: - serviceName: jettyserver-scenario segmentSize: 1 diff --git a/test/plugin/scenarios/kafka-scenario/config/expectedData.yaml b/test/plugin/scenarios/kafka-scenario/config/expectedData.yaml index eb2b7dafa860e3fa53e9b5a1307712116b70a739..2f2e5fa4e44e39638646818684bf16c91a9c9711 100644 --- a/test/plugin/scenarios/kafka-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/kafka-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {kafka-scenario: 2} instances: - {kafka-scenario: 1} - operationNames: - - kafka-scenario: [Kafka/test/Consumer/testGroup, /case/kafka-case] heartbeat: [] segmentItems: - serviceName: kafka-scenario diff --git a/test/plugin/scenarios/kotlin-coroutine-scenario/config/expectedData.yaml b/test/plugin/scenarios/kotlin-coroutine-scenario/config/expectedData.yaml index 6a882e97f8bd239f960cc3bf5c41898e8b5aa0de..c1e891cebbbb14c6db11d7f63834d0cb50e0539e 100644 --- a/test/plugin/scenarios/kotlin-coroutine-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/kotlin-coroutine-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {kotlin-coroutine-scenario: 2} instances: - {kotlin-coroutine-scenario: 1} - operationNames: - - kotlin-coroutine-scenario: [/kotlin-coroutine-scenario/case/h2] heartbeat: [] segmentItems: - serviceName: kotlin-coroutine-scenario diff --git a/test/plugin/scenarios/lettuce-scenario/config/expectedData.yaml b/test/plugin/scenarios/lettuce-scenario/config/expectedData.yaml index df6fe7ee1fa9b9ea9de00fc64c4b6312fa8f611e..d78728c20fd9de055c0c4abe39bd3f08b1d9ef26 100644 --- a/test/plugin/scenarios/lettuce-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/lettuce-scenario/config/expectedData.yaml @@ -19,8 +19,6 @@ registryItems: - {lettuce-scenario: 2} instances: - {lettuce-scenario: 1} - operationNames: - - lettuce-scenario: [/lettuce-scenario/case/lettuce-case, /lettuce-scenario/case/healthCheck] heartbeat: [] segmentItems: - serviceName: lettuce-scenario diff --git a/test/plugin/scenarios/mongodb-3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/mongodb-3.x-scenario/config/expectedData.yaml index 1ddcd60c09bf5a64c733db020badc30e6b4d04f0..01f851b1b2975e94e2979aeba3fd776f0e4dfa82 100644 --- a/test/plugin/scenarios/mongodb-3.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/mongodb-3.x-scenario/config/expectedData.yaml @@ -19,8 +19,6 @@ registryItems: - {mongodb-3.x-scenario: nq 0} instances: - {mongodb-3.x-scenario: 1} - operationNames: - - mongodb-3.x-scenario: [/mongodb-case/case/mongodb] heartbeat: [] segmentItems: diff --git a/test/plugin/scenarios/mysql-scenario/config/expectedData.yaml b/test/plugin/scenarios/mysql-scenario/config/expectedData.yaml index 929b7ef07c40cfc9610f30e01dcdaf1ad3a07928..9c678687e58c7a086cfe7f7f16fe20a06e59c874 100644 --- a/test/plugin/scenarios/mysql-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/mysql-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {mysql-scenario: nq 0} instances: - {mysql-scenario: 1} - operationNames: - - mysql-scenario: [/mysql-scenario/case/healthCheck, /mysql-scenario/case/mysql-scenario] segmentItems: - serviceName: mysql-scenario segmentSize: ge 2 diff --git a/test/plugin/scenarios/netty-socketio-scenario/config/expectedData.yaml b/test/plugin/scenarios/netty-socketio-scenario/config/expectedData.yaml index 233fb3d50ba7405bc06f3d749c663901dd84eecc..079e990e1137342ffcd1487dfd73f4d00099fd58 100644 --- a/test/plugin/scenarios/netty-socketio-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/netty-socketio-scenario/config/expectedData.yaml @@ -19,9 +19,6 @@ registryItems: - {netty-socketio-scenario: 2} instances: - {netty-socketio-scenario: 1} - operationNames: - - netty-socketio-scenario: [/netty-socketio-scenario/case/netty-socketio, - /netty-socketio-scenario/healthCheck, SocketIO/onConnect, SocketIO/send_data/receive] heartbeat: [] segmentItems: - serviceName: netty-socketio-scenario diff --git a/test/plugin/scenarios/okhttp-scenario/config/expectedData.yaml b/test/plugin/scenarios/okhttp-scenario/config/expectedData.yaml index 8b5f782f1dfe715fcb803ef834176d7c57ba6a91..00c1a1ddb77339bb01b1ef9071154d111b55697a 100644 --- a/test/plugin/scenarios/okhttp-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/okhttp-scenario/config/expectedData.yaml @@ -19,8 +19,6 @@ registryItems: - {okhttp-scenario: nq 0} instances: - {okhttp-scenario: 1} - operationNames: - - okhttp-scenario: [/case/receiveContext-0, /case/healthCheck, /case/okhttp-case, /case/receiveContext-1] heartbeat: [] segmentItems: - serviceName: okhttp-scenario @@ -76,7 +74,7 @@ segmentItems: - {key: url, value: 'http://127.0.0.1:8080/okhttp-case/case/receiveContext-0'} - {key: http.method, value: GET} refs: - - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, entryEndpointId: 0, + - {parentEndpointId: 0, parentEndpoint: /okhttp-case/case/receiveContext-0, networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: nq 0, parentServiceInstanceId: nq 0, networkAddress: '127.0.0.1:8080', entryEndpoint: /case/okhttp-case, entryServiceInstanceId: nq 0} - segmentId: not null @@ -98,7 +96,7 @@ segmentItems: - {key: url, value: 'http://127.0.0.1:8080/okhttp-case/case/receiveContext-1'} - {key: http.method, value: GET} refs: - - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 0, + - {parentEndpointId: 0, parentEndpoint: /okhttp-case/case/receiveContext-0, networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: nq 0, parentServiceInstanceId: nq 0, networkAddress: '127.0.0.1:8080', entryEndpoint: /case/okhttp-case, entryServiceInstanceId: nq 0} - segmentId: not null spans: diff --git a/test/plugin/scenarios/oracle-scenario/config/expectedData.yaml b/test/plugin/scenarios/oracle-scenario/config/expectedData.yaml index 1a209b45753bad96d6662f5f63fc032e8bb9344b..df1168063b6d53850ad9da8173ea082edfae3c80 100644 --- a/test/plugin/scenarios/oracle-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/oracle-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {oracle-scenario: nq 0} instances: - {oracle-scenario: 1} - operationNames: - - oracle-scenario: [/oracle-scenario/case/oracle] segmentItems: - serviceName: oracle-scenario segmentSize: ge 1 diff --git a/test/plugin/scenarios/play-scenario/config/expectedData.yaml b/test/plugin/scenarios/play-scenario/config/expectedData.yaml index e9c7668c9ab81e7dc17c8e6d0b17a142c769effc..b2f5337dbe09497d5a83d1140e9ce19daf22ca03 100644 --- a/test/plugin/scenarios/play-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/play-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {play-scenario: 2} instances: - {play-scenario: 1} - operationNames: - - play-scenario: ["/play-scenario/case/play-scenario/projects/{projectId}"] segmentItems: - serviceName: play-scenario segmentSize: gt 1 diff --git a/test/plugin/scenarios/postgresql-above9.4.1207-scenario/config/expectedData.yaml b/test/plugin/scenarios/postgresql-above9.4.1207-scenario/config/expectedData.yaml index a374546a6ba9c7ead64be7de4b9f840399408a77..b6b0269eb440207b6bf41e323fbb86cf3a818aca 100644 --- a/test/plugin/scenarios/postgresql-above9.4.1207-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/postgresql-above9.4.1207-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {postgresql-above9.4.1207-scenario: nq 0} instances: - {postgresql-above9.4.1207-scenario: 1} - operationNames: - - postgresql-above9.4.1207-scenario: [/postgresql-scenario/case/postgres] segmentItems: - serviceName: postgresql-above9.4.1207-scenario segmentSize: ge 1 diff --git a/test/plugin/scenarios/postgresql-scenario/config/expectedData.yaml b/test/plugin/scenarios/postgresql-scenario/config/expectedData.yaml index 44493b73170cf8258c1b2ccae166d40d96ea8de9..b9b666d54fb8ae07f8f57a64047b0cf126f0da57 100644 --- a/test/plugin/scenarios/postgresql-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/postgresql-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {postgresql-scenario: nq 0} instances: - {postgresql-scenario: 1} - operationNames: - - postgresql-scenario: [/postgresql-scenario/case/postgres] heartbeat: [] segmentItems: - serviceName: postgresql-scenario diff --git a/test/plugin/scenarios/pulsar-scenario/config/expectedData.yaml b/test/plugin/scenarios/pulsar-scenario/config/expectedData.yaml index a7316759d4dd134aa003a990caa8681ab14d08d6..0d9f84a9c3c45d022579c83c8beb8d96e59d0680 100644 --- a/test/plugin/scenarios/pulsar-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/pulsar-scenario/config/expectedData.yaml @@ -19,8 +19,6 @@ registryItems: - {pulsar-scenario: nq 0} instances: - {pulsar-scenario: nq 0} - operationNames: - - pulsar-scenario: [/case/pulsar-case, Pulsar/test/Consumer/test] segmentItems: - serviceName: pulsar-scenario segmentSize: ge 3 diff --git a/test/plugin/scenarios/rabbitmq-scenario/config/expectedData.yaml b/test/plugin/scenarios/rabbitmq-scenario/config/expectedData.yaml index a1d9a8959554ea88c3e491cdeaf5d6c81c3c441b..a12cfc806b3a8ccb66fdc3d64a4ae95fb30d944f 100644 --- a/test/plugin/scenarios/rabbitmq-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/rabbitmq-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {rabbitmq-scenario: nq 0} instances: - {rabbitmq-scenario: 1} - operationNames: - - rabbitmq-scenario: [/rabbitmq-scenario/case/rabbitmq, RabbitMQ/Topic/Queue/test/Consumer] segmentItems: - serviceName: rabbitmq-scenario segmentSize: gt 2 diff --git a/test/plugin/scenarios/redisson-scenario/config/expectedData.yaml b/test/plugin/scenarios/redisson-scenario/config/expectedData.yaml index d1c33a9bed57707f4d08b43e89caf387db7915cd..eb2bf267fd9d72574fbd0c497ed3f03c71f83025 100644 --- a/test/plugin/scenarios/redisson-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/redisson-scenario/config/expectedData.yaml @@ -19,8 +19,6 @@ registryItems: - {redisson-scenario: 2} instances: - {redisson-scenario: 1} - operationNames: - - redisson-scenario: [/case/healthCheck, /case/redisson-case] heartbeat: [] segmentItems: - serviceName: redisson-scenario diff --git a/test/plugin/scenarios/resttemplate-4.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/resttemplate-4.x-scenario/config/expectedData.yaml index 43d57d39c98344cab741bf5d0ce7024a9f63772c..03966f2f9e402757407ba1a0529ca8c515ca9ce8 100644 --- a/test/plugin/scenarios/resttemplate-4.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/resttemplate-4.x-scenario/config/expectedData.yaml @@ -18,9 +18,6 @@ registryItems: - {resttemplate-4.x-scenario: nq 0} instances: - {resttemplate-4.x-scenario: 1} - operationNames: - - resttemplate-4.x-scenario: [/resttemplate-4.x-scenario/resttemplate/asyncback, /resttemplate-4.x-scenario/resttemplate/case/resttemplate, - /resttemplate-4.x-scenario/resttemplate/syncback] heartbeat: [] segmentItems: - serviceName: resttemplate-4.x-scenario diff --git a/test/plugin/scenarios/servicecomb-0.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/servicecomb-0.x-scenario/config/expectedData.yaml index 6b6dae5820569a61f0c16ca0af4ecbe2160ca1a4..62cea6aa8c50e3d2bff4a9479ee34de9fddf1be7 100644 --- a/test/plugin/scenarios/servicecomb-0.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/servicecomb-0.x-scenario/config/expectedData.yaml @@ -19,8 +19,6 @@ registryItems: - {servicecomb-0.x-scenario: 2} instances: - {servicecomb-0.x-scenario: 1} - operationNames: - - servicecomb-0.x-scenario: [codefirst.codeFirstSpringmvcHelloClient.say, codefirst.codeFirstHello.sayHi] heartbeat: [] segmentItems: - serviceName: servicecomb-0.x-scenario diff --git a/test/plugin/scenarios/servicecomb-1.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/servicecomb-1.x-scenario/config/expectedData.yaml index 21816a9c7e758842e4a3f32bb020e1179a64ccac..fa579a4178f233d296cf8b382fde0ac3984879a0 100644 --- a/test/plugin/scenarios/servicecomb-1.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/servicecomb-1.x-scenario/config/expectedData.yaml @@ -19,8 +19,6 @@ registryItems: - {servicecomb-1.x-scenario: 2} instances: - {servicecomb-1.x-scenario: 1} - operationNames: - - servicecomb-1.x-scenario: [codefirst.codeFirstSpringmvcHelloClient.say, codefirst.codeFirstHello.sayHi] heartbeat: [] segmentItems: - serviceName: servicecomb-1.x-scenario diff --git a/test/plugin/scenarios/shardingsphere-3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/shardingsphere-3.x-scenario/config/expectedData.yaml index f02c68bd71c1946b7428b5ac7aaf452bb67f924d..c1fda50f9923542886259a807bfe9a11618cf730 100644 --- a/test/plugin/scenarios/shardingsphere-3.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/shardingsphere-3.x-scenario/config/expectedData.yaml @@ -19,8 +19,6 @@ registryItems: - {shardingsphere-3.x-scenario: nq 0} instances: - {shardingsphere-3.x-scenario: 1} - operationNames: - - shardingsphere-3.x-scenario: [/shardingsphere-3.x-scenario/case/execute] heartbeat: [] segmentItems: - serviceName: shardingsphere-3.x-scenario diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/config/expectedData.yaml b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/config/expectedData.yaml index b45895a0d11f64d50467c9032adb035215bc1ace..bd4913f6f6685c0db72a3c9217d98c3c3589729c 100644 --- a/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/shardingsphere-4.x-RC1-RC2-scenario/config/expectedData.yaml @@ -19,8 +19,6 @@ registryItems: - {shardingsphere-4.x-RC1-RC2-scenario: nq 0} instances: - {shardingsphere-4.x-RC1-RC2-scenario: 1} - operationNames: - - shardingsphere-4.x-RC1-RC2-scenario: [/shardingsphere-4.x-RC1-RC2-scenario/case/execute] heartbeat: [] segmentItems: - serviceName: shardingsphere-4.x-RC1-RC2-scenario diff --git a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/config/expectedData.yaml b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/config/expectedData.yaml index a4990cb6a79a7ef56d65db7ad2c11051d0848776..f2d3e4fe7dfa6c9d9411515d0f0dcb0ed3375be0 100644 --- a/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/shardingsphere-4.x-RC3-scenario/config/expectedData.yaml @@ -19,8 +19,6 @@ registryItems: - {shardingsphere-4.x-RC3-scenario: nq 0} instances: - {shardingsphere-4.x-RC3-scenario: 1} - operationNames: - - shardingsphere-4.x-RC3-scenario: [/shardingsphere-4.x-RC3-scenario/case/execute] heartbeat: [] segmentItems: - serviceName: shardingsphere-4.x-RC3-scenario diff --git a/test/plugin/scenarios/sofarpc-scenario/config/expectedData.yaml b/test/plugin/scenarios/sofarpc-scenario/config/expectedData.yaml index d48c5b1fdb391ce1bbe5aae60624900cfa9552b6..1d9fd765f1e6fab62cf76e186c34c1411bb574a0 100644 --- a/test/plugin/scenarios/sofarpc-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/sofarpc-scenario/config/expectedData.yaml @@ -19,9 +19,6 @@ registryItems: - {sofarpc-scenario: 2} instances: - {sofarpc-scenario: 1} - operationNames: - - sofarpc-scenario: [org.apache.skywalking.apm.testcase.sofarpc.interfaces.SofaRpcDemoService.hello(java.lang.String), - /sofarpc-scenario/case/sofarpc] heartbeat: [] segmentItems: - serviceName: sofarpc-scenario diff --git a/test/plugin/scenarios/solrj-7.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/solrj-7.x-scenario/config/expectedData.yaml index b9781b473e61f07c4b9d1cc65706a688366c6651..e2355659c548932c6e602deb80041967e1cf4d7a 100644 --- a/test/plugin/scenarios/solrj-7.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/solrj-7.x-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {solrj-7.x-scenario: nq 0} instances: - {solrj-7.x-scenario: nq 0} - operationNames: - - solrj-7.x-scenario: [/solrj-scenario/case/solrj] heartbeat: [] segmentItems: - serviceName: solrj-7.x-scenario diff --git a/test/plugin/scenarios/spring-3.0.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-3.0.x-scenario/config/expectedData.yaml index 322a191689574e253b0881f2967aaf8f05012478..380c2a563dc2de853f0e4c7a845e28b8ec342875 100644 --- a/test/plugin/scenarios/spring-3.0.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-3.0.x-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {spring-3.0.x-scenario: 2} instances: - {spring-3.0.x-scenario: 1} - operationNames: - - spring-3.0.x-scenario: [/healthCheck, /case/spring3] heartbeat: [] segmentItems: - serviceName: spring-3.0.x-scenario diff --git a/test/plugin/scenarios/spring-3.1.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-3.1.x-scenario/config/expectedData.yaml index 3e3bedbd3223186cae3a8e9ab21f61decc7769df..d68689625db92ac800a1421917278131c075c5bc 100644 --- a/test/plugin/scenarios/spring-3.1.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-3.1.x-scenario/config/expectedData.yaml @@ -18,10 +18,6 @@ registryItems: - {spring-3.1.x-scenario: 2} instances: - {spring-3.1.x-scenario: 1} - operationNames: - - spring-3.1.x-scenario: ['{DELETE}/delete/{id}', /case/resttemplate, '{GET}/get/{id}', - '{POST}/create/', /healthCheck, /case/spring3, - '{PUT}/update/{id}'] heartbeat: [] segmentItems: - serviceName: spring-3.1.x-scenario diff --git a/test/plugin/scenarios/spring-4.1.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-4.1.x-scenario/config/expectedData.yaml index 14cfa9ae35758826b5653f8b4e8191322b710302..79fb337fe46609c772a3d5aba2cff21bb9ed8616 100644 --- a/test/plugin/scenarios/spring-4.1.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-4.1.x-scenario/config/expectedData.yaml @@ -18,9 +18,6 @@ registryItems: - {spring-4.1.x-scenario: 2} instances: - {spring-4.1.x-scenario: 1} - operationNames: - - spring-4.1.x-scenario: ['{DELETE}/delete/{id}', /case/resttemplate, '{GET}/get/{id}', - '{POST}/create/', /healthCheck, /case/spring3, '{PUT}/update/{id}'] heartbeat: [] segmentItems: - serviceName: spring-4.1.x-scenario diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-4.3.x-scenario/config/expectedData.yaml index 2d7776deba2a24652789dc82d10b033ec8f4b081..72cd02aa2eac4153f5bb36cfcc96d14d27bae8c0 100644 --- a/test/plugin/scenarios/spring-4.3.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-4.3.x-scenario/config/expectedData.yaml @@ -18,10 +18,6 @@ registryItems: - {spring-4.3.x-scenario: 2} instances: - {spring-4.3.x-scenario: 1} - operationNames: - - spring-4.3.x-scenario: [/create/, '/delete/{id}', /inherit/child/test, /healthCheck, - '/get/{id}', '/update/{id}', /case/resttemplate, - /case/spring3, /impl/requestmapping, /impl/restmapping] heartbeat: [] segmentItems: - serviceName: spring-4.3.x-scenario diff --git a/test/plugin/scenarios/spring-async-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-async-scenario/config/expectedData.yaml index ea4056c0c6a32ec5ed8eefee8fc14b6e490f252d..026dc2751d21e7d3ade42885f3eb5ebf862938d3 100644 --- a/test/plugin/scenarios/spring-async-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-async-scenario/config/expectedData.yaml @@ -19,8 +19,6 @@ registryItems: - {spring-async-scenario: 2} instances: - {spring-async-scenario: 1} - operationNames: - - spring-async-scenario: [/spring-async-scenario/case/asyncVisit, /spring-async-scenario/case/spring-async] heartbeat: [] segmentItems: - serviceName: spring-async-scenario @@ -63,7 +61,7 @@ segmentItems: - {key: url, value: 'http://localhost:8080/spring-async-scenario/case/asyncVisit'} - {key: http.method, value: GET} refs: - - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, entryEndpointId: 0, + - {parentEndpointId: 0, parentEndpoint: SpringAsync, networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /spring-async-scenario/case/spring-async, entryServiceInstanceId: 1} @@ -86,7 +84,7 @@ segmentItems: - {key: url, value: 'http://localhost:8080/spring-async-scenario/case/asyncVisit'} - {key: http.method, value: GET} refs: - - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, entryEndpointId: 0, + - {parentEndpointId: 0, parentEndpoint: SpringAsync, networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /spring-async-scenario/case/spring-async, entryServiceInstanceId: 1} diff --git a/test/plugin/scenarios/spring-cloud-feign-1.1.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-cloud-feign-1.1.x-scenario/config/expectedData.yaml index 381a880a0b70900f41d159ee102ad4fc5b632336..512f03c3442cd5af6ee862ece7ac22d3775e4f7c 100644 --- a/test/plugin/scenarios/spring-cloud-feign-1.1.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-cloud-feign-1.1.x-scenario/config/expectedData.yaml @@ -18,9 +18,6 @@ registryItems: - {spring-cloud-feign-1.1.x-scenario: nq 0} instances: - {spring-cloud-feign-1.1.x-scenario: 1} - operationNames: - - spring-cloud-feign-1.1.x-scenario: [/spring-cloud-feign-1.1.x-scenario/case/spring-cloud-feign-1.1.x-scenario, - /spring-cloud-feign-1.1.x-scenario/get] heartbeat: [] segmentItems: - serviceName: spring-cloud-feign-1.1.x-scenario diff --git a/test/plugin/scenarios/spring-cloud-feign-1.2.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-cloud-feign-1.2.x-scenario/config/expectedData.yaml index 9f8e496f8a5bab688d0f76247c68f64623ff6778..0cba2b146c69e362e7c7a9038d413a19326c67b3 100644 --- a/test/plugin/scenarios/spring-cloud-feign-1.2.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-cloud-feign-1.2.x-scenario/config/expectedData.yaml @@ -18,9 +18,6 @@ registryItems: - {spring-cloud-feign-1.2.x-scenario: nq 0} instances: - {spring-cloud-feign-1.2.x-scenario: 1} - operationNames: - - spring-cloud-feign-1.2.x-scenario: [/spring-cloud-feign-1.2.x-scenario/case/spring-cloud-feign-1.2.x-scenario, - /spring-cloud-feign-1.2.x-scenario/get] heartbeat: [] segmentItems: - serviceName: spring-cloud-feign-1.2.x-scenario diff --git a/test/plugin/scenarios/spring-cloud-feign-2.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-cloud-feign-2.x-scenario/config/expectedData.yaml index edce0ed9f58dce7c57c5965ca56730d61f22297a..0982e69fbfb747ff1c2ed81df9ed57c43ea36709 100644 --- a/test/plugin/scenarios/spring-cloud-feign-2.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-cloud-feign-2.x-scenario/config/expectedData.yaml @@ -18,10 +18,6 @@ registryItems: - {spring-cloud-feign-2.x-scenario: nq 0} instances: - {spring-cloud-feign-2.x-scenario: 1} - operationNames: - - spring-cloud-feign-2.x-scenario: [/spring-cloud-feign-2.x-scenario/update/1, /spring-cloud-feign-2.x-scenario/create/, - /spring-cloud-feign-2.x-scenario/case/spring-cloud-feign-2.x-scenario, - /spring-cloud-feign-2.x-scenario/delete/1, /spring-cloud-feign-2.x-scenario/get/1] heartbeat: [] segmentItems: - serviceName: spring-cloud-feign-2.x-scenario diff --git a/test/plugin/scenarios/spring-tx-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-tx-scenario/config/expectedData.yaml index 3f7a4f227925aca614f7f2dcf348ae3dc8635e15..043a27fe9fa4e6a93e8177fa06a2acfa7d773bfe 100644 --- a/test/plugin/scenarios/spring-tx-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/spring-tx-scenario/config/expectedData.yaml @@ -19,8 +19,6 @@ registryItems: - {spring-tx-scenario: 2} instances: - {spring-tx-scenario: 1} - operationNames: - - spring-tx-scenario: [/case/spring-tx-case, /case/healthCheck] heartbeat: [] segmentItems: - serviceName: spring-tx-scenario diff --git a/test/plugin/scenarios/struts2.3-scenario/config/expectedData.yaml b/test/plugin/scenarios/struts2.3-scenario/config/expectedData.yaml index 5d400a0a1e1d76e6cdf906587516c42b7d9110fc..a6fc9d6ac3adc842648b76d0e48c6bc34b768313 100644 --- a/test/plugin/scenarios/struts2.3-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/struts2.3-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {struts2.3-scenario: 2} instances: - {struts2.3-scenario: 1} - operationNames: - - struts2.3-scenario: [/struts2.3-scenario/struts-scenario/case1.action, /struts2.3-scenario/struts-scenario/case.action] heartbeat: [] segmentItems: - serviceName: struts2.3-scenario diff --git a/test/plugin/scenarios/struts2.5-scenario/config/expectedData.yaml b/test/plugin/scenarios/struts2.5-scenario/config/expectedData.yaml index bf3c2c63bcdf47df265b4f697a2dfa4d41ef6395..b14ab6e8e244f075aee8543e2401d9fe78529e67 100644 --- a/test/plugin/scenarios/struts2.5-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/struts2.5-scenario/config/expectedData.yaml @@ -18,8 +18,6 @@ registryItems: - {struts2.5-scenario: 2} instances: - {struts2.5-scenario: 1} - operationNames: - - struts2.5-scenario: [/struts2.5-scenario/struts-scenario/case1.action, /struts2.5-scenario/struts-scenario/case.action] heartbeat: [] segmentItems: - serviceName: struts2.5-scenario diff --git a/test/plugin/scenarios/undertow-scenario/config/expectedData.yaml b/test/plugin/scenarios/undertow-scenario/config/expectedData.yaml index 4f811c245af4d76d8f27ede2f61c93ec7d8769e0..f53e423ff805035571458b9a9ac55cda4b511a59 100644 --- a/test/plugin/scenarios/undertow-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/undertow-scenario/config/expectedData.yaml @@ -19,9 +19,6 @@ registryItems: - {undertow-scenario: 2} instances: - {undertow-scenario: 1} - operationNames: - - undertow-scenario: [/undertow-scenario/case/undertow1, /undertow-scenario/case/undertow, - '/undertow-routing-scenario/case/{context}'] heartbeat: [] segmentItems: - serviceName: undertow-scenario @@ -64,7 +61,7 @@ segmentItems: - {key: url, value: 'http://localhost:8081/undertow-routing-scenario/case/undertow'} - {key: http.method, value: GET} refs: - - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, + - {parentEndpointId: 0, parentEndpoint: UndertowDispatch, networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstanceId: 1, networkAddress: 'localhost:8081', entryEndpoint: /undertow-scenario/case/undertow, entryServiceInstanceId: 1} @@ -87,7 +84,7 @@ segmentItems: - {key: url, value: 'http://localhost:8080/undertow-scenario/case/undertow1'} - {key: http.method, value: GET} refs: - - {parentEndpointId: -1, parentEndpoint: '', networkAddressId: 0, + - {parentEndpointId: 0, parentEndpoint: UndertowDispatch, networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /undertow-scenario/case/undertow, entryServiceInstanceId: 1} diff --git a/test/plugin/scenarios/webflux-scenario/config/expectedData.yaml b/test/plugin/scenarios/webflux-scenario/config/expectedData.yaml index 91b194feeaf90c53c4641cec1543e01872b488b2..f8ca4d1bd86f1272ca2bdc4f5ed5b2284f3d26f0 100644 --- a/test/plugin/scenarios/webflux-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/webflux-scenario/config/expectedData.yaml @@ -21,9 +21,6 @@ registryItems: instances: - {webflux-projectB-scenario: 1} - {webflux-projectA-scenario: 1} - operationNames: - - webflux-projectB-scenario: [WEBFLUX.handle] - - webflux-projectA-scenario: [/projectA/testcase] heartbeat: [] segmentItems: - serviceName: webflux-projectB-scenario diff --git a/test/plugin/scenarios/zookeeper-scenario/config/expectedData.yaml b/test/plugin/scenarios/zookeeper-scenario/config/expectedData.yaml index 6ed7304f20d5d185c95d8c3ae3465fca20f976df..c6137e9df5748be526bfe231bbb18592924b8ba2 100644 --- a/test/plugin/scenarios/zookeeper-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/zookeeper-scenario/config/expectedData.yaml @@ -19,9 +19,6 @@ registryItems: - {zookeeper-scenario: 2} instances: - {zookeeper-scenario: 1} - operationNames: - - zookeeper-scenario: [Zookeeper/WatchedEvent/NodeDeleted, /zookeeper-scenario/case/zookeeper-case, - /zookeeper-scenario/case/healthCheck] heartbeat: [] segmentItems: - serviceName: zookeeper-scenario