From d00551ab94001b227a3e8e5178cd827c4f63165e Mon Sep 17 00:00:00 2001 From: Wu Sheng Date: Mon, 19 Nov 2018 11:09:30 +0800 Subject: [PATCH] Provide v2 trace protocol, with no new feature, but make sure concept consistent. --- common/JVM.proto | 71 ++++++++++++++++++++++ common/trace-common.proto | 46 ++++++++++++++ language-agent-v2/JVMMetric.proto | 36 +++++++++++ language-agent-v2/trace.proto | 76 ++++++++++++++++++++++++ language-agent/JVMMetricsService.proto | 54 +---------------- language-agent/TraceSegmentService.proto | 24 +------- register/InstancePing.proto | 2 +- register/Register.proto | 2 +- 8 files changed, 233 insertions(+), 78 deletions(-) create mode 100644 common/JVM.proto create mode 100644 common/trace-common.proto create mode 100644 language-agent-v2/JVMMetric.proto create mode 100644 language-agent-v2/trace.proto diff --git a/common/JVM.proto b/common/JVM.proto new file mode 100644 index 0000000..e3a82c1 --- /dev/null +++ b/common/JVM.proto @@ -0,0 +1,71 @@ +/* + * 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. + * + */ + +syntax = "proto3"; + +option java_multiple_files = true; +option java_package = "org.apache.skywalking.apm.network.language.agent"; +option csharp_namespace = "SkyWalking.NetworkProtocol"; + +message JVMMetric { + int64 time = 1; + CPU cpu = 2; + repeated Memory memory = 3; + repeated MemoryPool memoryPool = 4; + repeated GC gc = 5; +} + +message CPU { + double usagePercent = 2; +} + +message Memory { + bool isHeap = 1; + int64 init = 2; + int64 max = 3; + int64 used = 4; + int64 committed = 5; +} + +message MemoryPool { + PoolType type = 1; + int64 init = 2; + int64 max = 3; + int64 used = 4; + int64 commited = 5; +} + +enum PoolType { + CODE_CACHE_USAGE = 0; + NEWGEN_USAGE = 1; + OLDGEN_USAGE = 2; + SURVIVOR_USAGE = 3; + PERMGEN_USAGE = 4; + METASPACE_USAGE = 5; +} + +message GC { + GCPhrase phrase = 1; + int64 count = 2; + int64 time = 3; +} + +enum GCPhrase { + NEW = 0; + OLD = 1; +} diff --git a/common/trace-common.proto b/common/trace-common.proto new file mode 100644 index 0000000..b9bdb78 --- /dev/null +++ b/common/trace-common.proto @@ -0,0 +1,46 @@ +/* + * 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. + * + */ + +syntax = "proto3"; + +option java_multiple_files = true; +option java_package = "org.apache.skywalking.apm.network.language.agent"; +option csharp_namespace = "SkyWalking.NetworkProtocol"; + +message UpstreamSegment { + repeated UniqueId globalTraceIds = 1; + bytes segment = 2; // the byte array of TraceSegmentObject +} + +message UniqueId { + repeated int64 idParts = 1; +} + +enum RefType { + CrossProcess = 0; + CrossThread = 1; +} + +enum SpanLayer { + Unknown = 0; + Database = 1; + RPCFramework = 2; + Http = 3; + MQ = 4; + Cache = 5; +} diff --git a/language-agent-v2/JVMMetric.proto b/language-agent-v2/JVMMetric.proto new file mode 100644 index 0000000..e6353d8 --- /dev/null +++ b/language-agent-v2/JVMMetric.proto @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +syntax = "proto3"; + +option java_multiple_files = true; +option java_package = "org.apache.skywalking.apm.network.language.agent.v2"; +option csharp_namespace = "SkyWalking.NetworkProtocol"; + +import "common/common.proto"; +import "common/JVM.proto"; + +service JVMMetricReportService { + rpc collect (JVMMetrics) returns (Downstream) { + } +} + +message JVMMetricCollection { + repeated JVMMetric metrics = 1; + int32 serviceInstanceId = 2; +} diff --git a/language-agent-v2/trace.proto b/language-agent-v2/trace.proto new file mode 100644 index 0000000..37f607e --- /dev/null +++ b/language-agent-v2/trace.proto @@ -0,0 +1,76 @@ +/* + * 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. + * + */ + +syntax = "proto3"; + +option java_multiple_files = true; +option java_package = "org.apache.skywalking.apm.network.language.agent.v2"; +option csharp_namespace = "SkyWalking.NetworkProtocol"; + +import "common/common.proto"; + +service TraceSegmentReportService { + rpc collect (stream UpstreamSegment) returns (Downstream) { + } +} + +message TraceSegmentObject { + UniqueId traceSegmentId = 1; + repeated SpanObject spans = 2; + int32 serviceId = 3; + int32 serviceInstanceId = 4; + bool isSizeLimited = 5; +} + +message TraceSegmentReference { + RefType refType = 1; + UniqueId parentTraceSegmentId = 2; + int32 parentSpanId = 3; + int32 parentServiceInstanceId = 4; + string networkAddress = 5; + int32 networkAddressId = 6; + int32 entryServiceInstanceId = 7; + string entryEndpoint = 8; + int32 entryEndpointId = 9; + string parentEndpoint = 10; + int32 parentEndopintId = 11; +} + +message SpanObject { + int32 spanId = 1; + int32 parentSpanId = 2; + int64 startTime = 3; + int64 endTime = 4; + repeated TraceSegmentReference refs = 5; + int32 operationNameId = 6; + string operationName = 7; + int32 peerId = 8; + string peer = 9; + SpanType spanType = 10; + SpanLayer spanLayer = 11; + int32 componentId = 12; + string component = 13; + bool isError = 14; + repeated KeyWithStringValue tags = 15; + repeated LogMessage logs = 16; +} + +message Log { + int64 time = 1; + repeated KeyStringValuePair data = 2; +} diff --git a/language-agent/JVMMetricsService.proto b/language-agent/JVMMetricsService.proto index 4c50aaf..dfc62e9 100644 --- a/language-agent/JVMMetricsService.proto +++ b/language-agent/JVMMetricsService.proto @@ -23,61 +23,9 @@ option java_package = "org.apache.skywalking.apm.network.language.agent"; option csharp_namespace = "SkyWalking.NetworkProtocol"; import "language-agent/Downstream.proto"; +import "common/JVM.proto"; service JVMMetricsService { rpc collect (JVMMetrics) returns (Downstream) { } } - -message JVMMetrics { - repeated JVMMetric metrics = 1; - int32 applicationInstanceId = 2; -} - -message JVMMetric { - int64 time = 1; - CPU cpu = 2; - repeated Memory memory = 3; - repeated MemoryPool memoryPool = 4; - repeated GC gc = 5; -} - -message CPU { - double usagePercent = 2; -} - -message Memory { - bool isHeap = 1; - int64 init = 2; - int64 max = 3; - int64 used = 4; - int64 committed = 5; -} - -message MemoryPool { - PoolType type = 1; - int64 init = 2; - int64 max = 3; - int64 used = 4; - int64 commited = 5; -} - -enum PoolType { - CODE_CACHE_USAGE = 0; - NEWGEN_USAGE = 1; - OLDGEN_USAGE = 2; - SURVIVOR_USAGE = 3; - PERMGEN_USAGE = 4; - METASPACE_USAGE = 5; -} - -message GC { - GCPhrase phrase = 1; - int64 count = 2; - int64 time = 3; -} - -enum GCPhrase { - NEW = 0; - OLD = 1; -} diff --git a/language-agent/TraceSegmentService.proto b/language-agent/TraceSegmentService.proto index 283526c..fc17cb8 100644 --- a/language-agent/TraceSegmentService.proto +++ b/language-agent/TraceSegmentService.proto @@ -25,21 +25,13 @@ option csharp_namespace = "SkyWalking.NetworkProtocol"; import "language-agent/Common.proto"; import "language-agent/Downstream.proto"; import "language-agent/KeyWithStringValue.proto"; +import "common/trace-common.proto" service TraceSegmentService { rpc collect (stream UpstreamSegment) returns (Downstream) { } } -message UpstreamSegment { - repeated UniqueId globalTraceIds = 1; - bytes segment = 2; // the byte array of TraceSegmentObject -} - -message UniqueId { - repeated int64 idParts = 1; -} - message TraceSegmentObject { UniqueId traceSegmentId = 1; repeated SpanObject spans = 2; @@ -81,20 +73,6 @@ message SpanObject { repeated LogMessage logs = 16; } -enum RefType { - CrossProcess = 0; - CrossThread = 1; -} - -enum SpanLayer { - Unknown = 0; - Database = 1; - RPCFramework = 2; - Http = 3; - MQ = 4; - Cache = 5; -} - message LogMessage { int64 time = 1; repeated KeyWithStringValue data = 2; diff --git a/register/InstancePing.proto b/register/InstancePing.proto index 3a332a6..3a8ffe1 100644 --- a/register/InstancePing.proto +++ b/register/InstancePing.proto @@ -19,7 +19,7 @@ syntax = "proto3"; option java_multiple_files = true; -option java_package = "org.apache.skywalking.apm.network.register"; +option java_package = "org.apache.skywalking.apm.network.register.v2"; option csharp_namespace = "SkyWalking.NetworkProtocol"; import "common/common.proto"; diff --git a/register/Register.proto b/register/Register.proto index 24c83d1..13a20fc 100644 --- a/register/Register.proto +++ b/register/Register.proto @@ -19,7 +19,7 @@ syntax = "proto3"; option java_multiple_files = true; -option java_package = "org.apache.skywalking.apm.network.register"; +option java_package = "org.apache.skywalking.apm.network.register.v2"; option csharp_namespace = "SkyWalking.NetworkProtocol"; import "common/common.proto"; -- GitLab