Register.proto 3.4 KB
Newer Older
wu-sheng's avatar
wu-sheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*
 * 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.
 *
 */

19 20 21
syntax = "proto3";

option java_multiple_files = true;
22
option java_package = "org.apache.skywalking.apm.network.register.v2";
23 24 25 26 27 28 29 30 31 32 33 34
option csharp_namespace = "SkyWalking.NetworkProtocol";

import "common/common.proto";

//register service for ApplicationCode, this service is called when service starts.
service Register {
    rpc doServiceRegister (Services) returns (ServiceRegisterMapping) {
    }

    rpc doServiceInstanceRegister (ServiceInstances) returns (ServiceInstanceRegisterMapping) {
    }

35
    rpc doEndpointRegister (Endpoints) returns (EndpointMapping) {
36 37 38 39
    }

    rpc doNetworkAddressRegister (NetAddresses) returns (NetAddressMapping) {
    }
wu-sheng's avatar
wu-sheng 已提交
40

wu-sheng's avatar
wu-sheng 已提交
41
    rpc doServiceAndNetworkAddressMappingRegister (ServiceAndNetworkAddressMappings) returns(Commands) {
wu-sheng's avatar
wu-sheng 已提交
42
    }
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
}

// Service register
message Services {
    repeated Service services = 1;
}

message Service {
    string serviceName = 1;
    repeated KeyStringValuePair tags = 3;
    repeated KeyStringValuePair properties = 4;
}

message ServiceRegisterMapping {
    repeated KeyIntValuePair services = 1;
}

// Service Instance register
message ServiceInstances {
    repeated ServiceInstance instances = 1;
}

message ServiceInstance {
    int32 serviceId = 1;
    string instanceUUID = 2;
wu-sheng's avatar
wu-sheng 已提交
68 69 70
    int64 time = 3;
    repeated KeyStringValuePair tags = 4;
    repeated KeyStringValuePair properties = 5;
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
}

message ServiceInstanceRegisterMapping {
    repeated KeyIntValuePair serviceInstances = 1;
}

// Network address register

// Only known use case is the language agent.
// Network address represents the ip/hostname:port, which is usually used at client side of RPC.
message NetAddresses {
    repeated string addresses = 1;
}

message NetAddressMapping {
    repeated KeyIntValuePair addressIds = 1;
}

89 90
// Endpoints register
message Endpoints {
91 92 93 94 95 96 97 98 99 100 101 102 103 104
    repeated Endpoint endpoints = 1;
}

message Endpoint {
    int32 serviceId = 1;
    string endpointName = 2;
    repeated KeyStringValuePair tags = 3;
    repeated KeyStringValuePair properties = 4;
    // For endpoint
    // from DetectPoint is either `client` or `server`. No chance to be `proxy`.
    DetectPoint from = 5;
}

message EndpointMapping {
wu-sheng's avatar
wu-sheng 已提交
105 106 107 108
    repeated EndpointMappingElement elements = 1;
}

message EndpointMappingElement {
wu-sheng's avatar
wu-sheng 已提交
109 110 111 112
    int32 serviceId = 1;
    string endpointName = 2;
    int32 endpointId = 3;
    DetectPoint from = 4;
113
}
wu-sheng's avatar
wu-sheng 已提交
114

wu-sheng's avatar
wu-sheng 已提交
115 116 117 118
message ServiceAndNetworkAddressMappings {
    repeated ServiceAndNetworkAddressMapping mappings = 1;
}

wu-sheng's avatar
wu-sheng 已提交
119
message ServiceAndNetworkAddressMapping {
wu-sheng's avatar
wu-sheng 已提交
120 121
    int32 serviceId = 1;
    int32 serviceInstanceId = 2;
wu-sheng's avatar
wu-sheng 已提交
122
    string networkAddress = 3;
wu-sheng's avatar
wu-sheng 已提交
123
    int32 networkAddressId = 4;
wu-sheng's avatar
wu-sheng 已提交
124
}