diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 000000000000..35492b7f3de0
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "grpc/grpc-idl"]
+ path = grpc/grpc-idl
+ url = https://github.com/pinpoint-apm/pinpoint-grpc-idl
diff --git a/grpc/grpc-idl b/grpc/grpc-idl
new file mode 160000
index 000000000000..4c2966b1b6aa
--- /dev/null
+++ b/grpc/grpc-idl
@@ -0,0 +1 @@
+Subproject commit 4c2966b1b6aa03da5ec35bb7ff3f2342905f1e13
diff --git a/grpc/pom.xml b/grpc/pom.xml
index ac94ccde7cdd..76112aea48d6 100644
--- a/grpc/pom.xml
+++ b/grpc/pom.xml
@@ -177,6 +177,7 @@
protobuf-maven-plugin
0.6.1
+ ${basedir}/grpc-idl/proto
com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}
grpc-java
io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
diff --git a/grpc/src/main/proto/Annotation.proto b/grpc/src/main/proto/Annotation.proto
deleted file mode 100644
index 55167c6dac41..000000000000
--- a/grpc/src/main/proto/Annotation.proto
+++ /dev/null
@@ -1,66 +0,0 @@
-syntax = "proto3";
-
-import "google/protobuf/wrappers.proto";
-
-
-option java_multiple_files = true;
-option java_package = "com.navercorp.pinpoint.grpc.trace";
-option java_outer_classname = "AnnotationProto";
-//option objc_class_prefix = "PIN";
-
-message PIntStringValue {
- int32 intValue = 1;
- google.protobuf.StringValue stringValue = 2;
-}
-
-message PIntStringStringValue {
- int32 intValue = 1;
- google.protobuf.StringValue stringValue1 = 2;
- google.protobuf.StringValue stringValue2 = 3;
-}
-
-message PLongIntIntByteByteStringValue {
- int64 longValue = 1;
- int32 intValue1 = 2;
- int32 intValue2 = 3;
- sint32 byteValue1 = 4;
- sint32 byteValue2 = 5;
- google.protobuf.StringValue stringValue = 6;
-}
-
-message PIntBooleanIntBooleanValue {
- int32 intValue1 = 1;
- bool boolValue1 = 2;
- int32 intValue2 = 3;
- bool boolValue2 = 4;
-}
-
-message PStringStringValue {
- google.protobuf.StringValue stringValue1 = 1;
- google.protobuf.StringValue stringValue2 = 2;
-}
-
-message PAnnotationValue {
- oneof field {
- string stringValue = 1;
- bool boolValue = 2;
- int32 intValue = 3;
- int64 longValue = 4;
- // for compatibility
- sint32 shortValue = 5;
- double doubleValue = 6;
- bytes binaryValue = 7;
- // for compatibility
- sint32 byteValue = 8;
- PIntStringValue intStringValue = 9;
- PStringStringValue stringStringValue = 10;
- PIntStringStringValue intStringStringValue = 11;
- PLongIntIntByteByteStringValue longIntIntByteByteStringValue = 12;
- PIntBooleanIntBooleanValue intBooleanIntBooleanValue = 13;
- }
-}
-
-message PAnnotation {
- int32 key = 1;
- PAnnotationValue value = 2;
-}
\ No newline at end of file
diff --git a/grpc/src/main/proto/Cmd.proto b/grpc/src/main/proto/Cmd.proto
deleted file mode 100644
index 38ad44ac532e..000000000000
--- a/grpc/src/main/proto/Cmd.proto
+++ /dev/null
@@ -1,106 +0,0 @@
-syntax = "proto3";
-
-import "google/protobuf/wrappers.proto";
-import "ThreadDump.proto";
-
-option java_multiple_files = true;
-option java_package = "com.navercorp.pinpoint.grpc.trace";
-option java_outer_classname = "CmdProto";
-//option objc_class_prefix = "PIN";
-
-package v1;
-
-enum PCommandType {
- NONE = 0;
-
- PING = 100;
- PONG = 101;
-
- ECHO = 710;
-
- ACTIVE_THREAD_COUNT = 730;
- ACTIVE_THREAD_DUMP = 740;
- ACTIVE_THREAD_LIGHT_DUMP = 750;
-}
-
-message PCmdMessage {
- oneof message {
- PCmdServiceHandshake handshakeMessage = 1;
- PCmdResponse failMessage = 2;
- }
-}
-
-message PCmdServiceHandshake {
- // initial message
- repeated int32 supportCommandServiceKey = 1;
-}
-
-message PCmdResponse {
- int32 responseId = 1;
- int32 status = 2;
- google.protobuf.StringValue message = 3;
-}
-
-message PCmdStreamResponse {
- int32 responseId = 1;
- int32 sequenceId = 2;
- google.protobuf.StringValue message = 3;
-}
-
-message PCmdRequest {
- int32 requestId = 1;
-
- oneof command {
- PCmdEcho commandEcho = 710;
- PCmdActiveThreadCount commandActiveThreadCount = 730;
- PCmdActiveThreadDump commandActiveThreadDump = 740;
- PCmdActiveThreadLightDump commandActiveThreadLightDump = 750;
- }
-}
-
-message PCmdEcho {
- string message = 1;
-}
-
-message PCmdEchoResponse {
- PCmdResponse commonResponse = 1;
- string message = 2;
-}
-
-message PCmdActiveThreadDump {
- int32 limit = 1;
- repeated string threadName = 2;
- repeated int64 localTraceId = 3;
-}
-
-message PCmdActiveThreadDumpRes {
- PCmdResponse commonResponse = 1;
- repeated PActiveThreadDump threadDump = 2;
- string type = 3;
- string subType = 4;
- string version = 5;
-}
-
-message PCmdActiveThreadLightDump {
- int32 limit = 1;
- repeated string threadName = 2;
- repeated int64 localTraceId = 3;
-}
-
-message PCmdActiveThreadLightDumpRes {
- PCmdResponse commonResponse = 1;
- repeated PActiveThreadLightDump threadDump = 2;
- string type = 3;
- string subType = 4;
- string version = 5;
-}
-
-message PCmdActiveThreadCount {
-}
-
-message PCmdActiveThreadCountRes {
- PCmdStreamResponse commonStreamResponse = 1;
- int32 histogramSchemaType = 2;
- repeated int32 activeThreadCount = 3;
- int64 timeStamp = 4;
-}
\ No newline at end of file
diff --git a/grpc/src/main/proto/CustomMetric.proto b/grpc/src/main/proto/CustomMetric.proto
deleted file mode 100644
index 755350af6112..000000000000
--- a/grpc/src/main/proto/CustomMetric.proto
+++ /dev/null
@@ -1,63 +0,0 @@
-syntax = "proto3";
-
-option java_multiple_files = true;
-option java_package = "com.navercorp.pinpoint.grpc.trace";
-option java_outer_classname = "CustomMetricProto";
-option objc_class_prefix = "PIN";
-
-package v1;
-
-message PCustomMetricMessage {
- repeated int64 timestamp = 1;
- repeated int64 collectInterval = 2;
- repeated PCustomMetric customMetrics = 3;
-}
-
-message PCustomMetric {
- oneof field {
- PIntCountMetric intCountMetric = 1;
- PLongCountMetric longCountMetric = 2;
- PIntGaugeMetric intGaugeMetric = 3;
- PLongGaugeMetric longGaugeMetric = 4;
- PDouleGaugeMetric doubleGaugeMetric = 5;
- }
-}
-
-message PIntCountMetric {
- string name = 1;
- repeated PIntValue values = 2;
-}
-message PLongCountMetric {
- string name = 1;
- repeated PLongValue values = 2;
-}
-
-message PIntGaugeMetric {
- string name = 1;
- repeated PIntValue values = 2;
-}
-
-message PLongGaugeMetric {
- string name = 1;
- repeated PLongValue values = 2;
-}
-
-message PDouleGaugeMetric {
- string name = 1;
- repeated PDoubleValue values = 2;
-}
-
-message PIntValue {
- int32 value = 1;
- bool isNotSet = 2;
-}
-
-message PLongValue {
- int64 value = 1;
- bool isNotSet = 2;
-}
-
-message PDoubleValue {
- double value = 1;
- bool isNotSet = 2;
-}
diff --git a/grpc/src/main/proto/Service.proto b/grpc/src/main/proto/Service.proto
deleted file mode 100644
index 706cb8606cdd..000000000000
--- a/grpc/src/main/proto/Service.proto
+++ /dev/null
@@ -1,61 +0,0 @@
-syntax = "proto3";
-
-import "google/protobuf/empty.proto";
-import "Span.proto";
-import "Stat.proto";
-import "Cmd.proto";
-
-option java_multiple_files = true;
-option java_package = "com.navercorp.pinpoint.grpc.trace";
-option java_outer_classname = "ServiceProto";
-//option objc_class_prefix = "PIN";
-
-package v1;
-
-service Span {
- rpc SendSpan (stream PSpanMessage) returns (google.protobuf.Empty) {
- }
-}
-
-service Agent {
- rpc RequestAgentInfo (PAgentInfo) returns (PResult) {
- }
- rpc PingSession (stream PPing) returns (stream PPing) {
- }
-}
-
-service Metadata {
- rpc RequestSqlMetaData (PSqlMetaData) returns (PResult) {
- }
- rpc RequestApiMetaData (PApiMetaData) returns (PResult) {
- }
- rpc RequestStringMetaData (PStringMetaData) returns (PResult) {
- }
-}
-
-service Stat {
- rpc SendAgentStat (stream PStatMessage) returns (google.protobuf.Empty) {
- }
-}
-
-service ProfilerCommandService {
- // deprecated api
- rpc HandleCommand (stream PCmdMessage) returns (stream PCmdRequest) {
- option deprecated = true;
- }
-
- rpc HandleCommandV2 (stream PCmdMessage) returns (stream PCmdRequest) {
- }
-
- rpc CommandEcho (PCmdEchoResponse) returns (google.protobuf.Empty) {
- }
-
- rpc CommandStreamActiveThreadCount (stream PCmdActiveThreadCountRes) returns (google.protobuf.Empty) {
- }
-
- rpc CommandActiveThreadDump (PCmdActiveThreadDumpRes) returns (google.protobuf.Empty) {
- }
-
- rpc CommandActiveThreadLightDump (PCmdActiveThreadLightDumpRes) returns (google.protobuf.Empty) {
- }
-}
\ No newline at end of file
diff --git a/grpc/src/main/proto/Span.proto b/grpc/src/main/proto/Span.proto
deleted file mode 100644
index 900b5df7b9a0..000000000000
--- a/grpc/src/main/proto/Span.proto
+++ /dev/null
@@ -1,152 +0,0 @@
-syntax = "proto3";
-
-import "Annotation.proto";
-
-
-option java_multiple_files = true;
-option java_package = "com.navercorp.pinpoint.grpc.trace";
-option java_outer_classname = "SpanProto";
-//option objc_class_prefix = "PIN";
-
-package v1;
-
-message PSpanMessage {
- oneof field {
- PSpan span = 1;
- PSpanChunk spanChunk =2;
- }
-}
-
-message PSpan {
- int32 version = 1;
-
- PTransactionId transactionId = 2;
-
- sfixed64 spanId = 3;
- sfixed64 parentSpanId = 4;
-
- // span event's startTimestamp
- int64 startTime = 5;
- int32 elapsed = 6;
- int32 apiId = 7;
-
- int32 serviceType = 8;
-
- PAcceptEvent acceptEvent = 9;
-
- repeated PAnnotation annotation = 10;
-
- int32 flag = 11;
- sint32 err = 12;
-
- repeated PSpanEvent spanEvent = 13;
-
- PIntStringValue exceptionInfo = 14;
-
- int32 applicationServiceType = 15;
- int32 loggingTransactionInfo = 16;
-}
-
-message PTransactionId {
- // identical to agentId if null
- string agentId = 1; //nullable
- int64 agentStartTime = 2;
- int64 sequence = 3;
-}
-
-message PAcceptEvent {
- string rpc = 1;
- string endPoint = 2;
- string remoteAddr = 3;
- PParentInfo parentInfo = 4;
-}
-
-message PParentInfo {
- string parentApplicationName = 1;
- int32 parentApplicationType = 2;
- string acceptorHost = 3;
-}
-
-message PLocalAsyncId {
- int32 asyncId = 1;
- int32 sequence = 2;
-}
-
-
-message PSpanEvent {
- int32 sequence = 1;
- int32 depth = 2;
-
- int32 startElapsed = 3;
- int32 endElapsed = 4;
-
- sint32 serviceType = 5;
-
- repeated PAnnotation annotation = 6;
-
- sint32 apiId = 10;
- PIntStringValue exceptionInfo = 11;
-
- PNextEvent nextEvent = 12;
- int32 asyncEvent = 13;
-}
-
-message PNextEvent {
- oneof field {
- PMessageEvent messageEvent = 1;
- }
-}
-
-message PMessageEvent {
- sfixed64 nextSpanId = 1;
- string endPoint = 2;
- string destinationId = 3;
-}
-
-message PSpanChunk {
- int32 version = 1;
-
- PTransactionId transactionId = 2;
-
- sfixed64 spanId = 3;
-
- string endPoint = 4;
-
- repeated PSpanEvent spanEvent = 5;
-
- int32 applicationServiceType = 6;
-
- int64 keyTime = 7;
-
- PLocalAsyncId localAsyncId = 8;
-
-}
-
-// 1.6.x- : version = 0;
-// 1.7.x+ : version = 1;
-//const i8 TRACE_V1 = 0;
-//const i8 TRACE_V2 = 1;
-//
-
-
-message PResult {
- bool success = 1;
- string message = 2;
-}
-
-message PSqlMetaData {
- int32 sqlId = 1;
- string sql = 2;
-}
-
-message PApiMetaData {
- int32 apiId = 1;
- string apiInfo = 2;
- int32 line = 3;
- int32 type = 4;
-}
-
-message PStringMetaData {
- int32 stringId = 1;
- string stringValue = 2;
-}
\ No newline at end of file
diff --git a/grpc/src/main/proto/Stat.proto b/grpc/src/main/proto/Stat.proto
deleted file mode 100644
index c3476ad88926..000000000000
--- a/grpc/src/main/proto/Stat.proto
+++ /dev/null
@@ -1,190 +0,0 @@
-syntax = "proto3";
-
-import "ThreadDump.proto";
-
-option java_multiple_files = true;
-option java_package = "com.navercorp.pinpoint.grpc.trace";
-option java_outer_classname = "StatProto";
-option objc_class_prefix = "PIN";
-
-package v1;
-
-message PPing {
-}
-
-message PStatMessage {
- oneof field {
- PAgentStat agentStat = 1;
- PAgentStatBatch agentStatBatch = 2;
- PAgentUriStat agentUriStat = 3;
- }
-}
-
-message PAgentInfo {
- string hostname = 1;
- string ip = 2;
- string ports = 3;
- int32 serviceType = 4;
- int32 pid = 5;
- string agentVersion = 6;
- string vmVersion = 7;
- int64 endTimestamp = 8;
- int32 endStatus = 9;
- PServerMetaData serverMetaData = 10;
- PJvmInfo jvmInfo = 11;
- bool container = 12;
-}
-
-message PServerMetaData {
- string serverInfo = 1;
- repeated string vmArg = 2;
- repeated PServiceInfo serviceInfo = 3;
-}
-
-message PServiceInfo {
- string serviceName = 1;
- repeated string serviceLib = 2;
-}
-
-message PJvmInfo {
- int32 version = 1;
- string vmVersion = 2;
- PJvmGcType gcType = 3;
-}
-
-enum PJvmGcType {
- JVM_GC_TYPE_UNKNOWN = 0;
- JVM_GC_TYPE_SERIAL = 1;
- JVM_GC_TYPE_PARALLEL = 2;
- JVM_GC_TYPE_CMS = 3;
- JVM_GC_TYPE_G1 = 4;
-}
-
-message PAgentStat {
- int64 timestamp = 1;
- int64 collectInterval =2;
- PJvmGc gc = 3;
- PCpuLoad cpuLoad = 4;
- PTransaction transaction = 5;
- PActiveTrace activeTrace = 6;
- PDataSourceList dataSourceList = 7;
- PResponseTime responseTime = 8;
- PDeadlock deadlock = 9;
- PFileDescriptor fileDescriptor = 10;
- PDirectBuffer directBuffer = 11;
- string metadata = 12;
- PTotalThread totalThread = 13;
- PLoadedClass loadedClass = 14;
-}
-
-message PAgentStatBatch {
- repeated PAgentStat agentStat = 1;
-}
-
-message PDataSource {
- int32 id = 1;
- int32 serviceTypeCode = 2;
- string databaseName = 3;
- string url = 4;
- int32 activeConnectionSize = 5;
- int32 maxConnectionSize = 6;
-}
-
-message PDataSourceList {
- repeated PDataSource dataSource = 1;
-}
-
-message PFileDescriptor {
- int64 openFileDescriptorCount = 1;
-}
-
-message PJvmGc {
- PJvmGcType type = 1;
- int64 jvmMemoryHeapUsed = 2;
- int64 jvmMemoryHeapMax = 3;
- int64 jvmMemoryNonHeapUsed = 4;
- int64 jvmMemoryNonHeapMax = 5;
- int64 jvmGcOldCount = 6;
- int64 jvmGcOldTime = 7;
- PJvmGcDetailed jvmGcDetailed = 8;
-}
-
-message PJvmGcDetailed {
- int64 jvmGcNewCount = 1;
- int64 jvmGcNewTime = 2;
- double jvmPoolCodeCacheUsed = 3;
- double jvmPoolNewGenUsed = 4;
- double jvmPoolOldGenUsed = 5;
- double jvmPoolSurvivorSpaceUsed = 6;
- double jvmPoolPermGenUsed = 7;
- double jvmPoolMetaspaceUsed = 8;
-}
-
-message PCpuLoad {
- double jvmCpuLoad = 1;
- double systemCpuLoad = 2;
-}
-
-message PTransaction {
- int64 sampledNewCount = 2;
- int64 sampledContinuationCount = 3;
- int64 unsampledNewCount = 4;
- int64 unsampledContinuationCount = 5;
- int64 skippedNewCount = 6;
- int64 skippedContinuationCount = 7;
-}
-
-message PActiveTraceHistogram {
- int32 version = 1;
- int32 histogramSchemaType = 2;
- repeated int32 activeTraceCount = 3;
-}
-
-message PActiveTrace {
- PActiveTraceHistogram histogram = 1;
-}
-
-message PResponseTime {
- int64 avg = 1;
- int64 max = 2;
-}
-
-message PDeadlock {
- int32 count = 1;
- repeated PThreadDump threadDump = 2;
-}
-
-message PDirectBuffer {
- int64 directCount = 1;
- int64 directMemoryUsed = 2;
- int64 mappedCount = 3;
- int64 mappedMemoryUsed = 4;
-}
-
-message PTotalThread {
- int64 totalThreadCount = 1;
-}
-
-message PLoadedClass {
- int64 loadedClassCount = 1;
- int64 unloadedClassCount = 2;
-}
-
-message PAgentUriStat {
- int64 timestamp = 1;
- int32 bucketVersion = 2;
- repeated PEachUriStat eachUriStat = 3;
-}
-
-message PEachUriStat {
- string uri = 1;
- PUriHistogram totalHistogram = 2;
- PUriHistogram failedHistogram = 3;
-}
-
-message PUriHistogram {
- int32 count = 1;
- double avg = 2;
- int64 max = 3;
- repeated int32 histogram = 4;
-}
\ No newline at end of file
diff --git a/grpc/src/main/proto/ThreadDump.proto b/grpc/src/main/proto/ThreadDump.proto
deleted file mode 100644
index f76992246ce4..000000000000
--- a/grpc/src/main/proto/ThreadDump.proto
+++ /dev/null
@@ -1,72 +0,0 @@
-syntax = "proto3";
-
-option java_multiple_files = true;
-option java_package = "com.navercorp.pinpoint.grpc.trace";
-option java_outer_classname = "ThreadDumpProto";
-//option objc_class_prefix = "PIN";
-
-package v1;
-
-enum PThreadState {
- THREAD_STATE_NEW = 0;
- THREAD_STATE_RUNNABLE = 1;
- THREAD_STATE_BLOCKED = 2;
- THREAD_STATE_WAITING = 3;
- THREAD_STATE_TIMED_WAITING = 4;
- THREAD_STATE_TERMINATED = 5;
- THREAD_STATE_UNKNOWN = 6;
-}
-
-message PMonitorInfo {
- int32 stackDepth = 1;
- string stackFrame = 2;
-}
-
-message PThreadDump {
- string threadName = 1;
- int64 threadId = 2;
- int64 blockedTime = 3;
- int64 blockedCount = 4;
- int64 waitedTime = 5;
- int64 waitedCount = 6;
- string lockName = 7;
- int64 lockOwnerId = 8;
- string lockOwnerName = 9;
- bool inNative = 10;
- bool suspended = 11;
- PThreadState threadState = 12;
- repeated string stackTrace = 13;
- repeated PMonitorInfo lockedMonitor = 14;
- repeated string lockedSynchronizer = 15;
-}
-
-message PThreadLightDump {
- string threadName = 1;
- int64 threadId = 2;
- PThreadState threadState = 3;
-}
-
-enum PThreadDumpType {
- TARGET = 0;
- PENDING = 1;
-}
-
-message PActiveThreadDump {
- int64 startTime = 1;
- int64 localTraceId = 2;
- PThreadDump threadDump = 3;
- bool sampled = 4;
- string transactionId = 5;
- string entryPoint = 6;
-}
-
-message PActiveThreadLightDump {
- int64 startTime = 1;
- int64 localTraceId = 2;
- PThreadLightDump threadDump = 3;
- bool sampled = 4;
- string transactionId = 5;
- string entryPoint = 6;
-}
-
-