@treelab/skywalking-backend-js
Version:
The NodeJS agent for Apache SkyWalking
95 lines (84 loc) • 4.07 kB
JavaScript
// GENERATED CODE -- DO NOT EDIT!
// Original file comments:
//
// 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.
//
//
;
var grpc = require('@grpc/grpc-js');
var language$agent_Tracing_pb = require('../language-agent/Tracing_pb.js');
var common_Common_pb = require('../common/Common_pb.js');
function serialize_skywalking_v3_Commands(arg) {
if (!(arg instanceof common_Common_pb.Commands)) {
throw new Error('Expected argument of type skywalking.v3.Commands');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_skywalking_v3_Commands(buffer_arg) {
return common_Common_pb.Commands.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_skywalking_v3_SegmentCollection(arg) {
if (!(arg instanceof language$agent_Tracing_pb.SegmentCollection)) {
throw new Error('Expected argument of type skywalking.v3.SegmentCollection');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_skywalking_v3_SegmentCollection(buffer_arg) {
return language$agent_Tracing_pb.SegmentCollection.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_skywalking_v3_SegmentObject(arg) {
if (!(arg instanceof language$agent_Tracing_pb.SegmentObject)) {
throw new Error('Expected argument of type skywalking.v3.SegmentObject');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_skywalking_v3_SegmentObject(buffer_arg) {
return language$agent_Tracing_pb.SegmentObject.deserializeBinary(new Uint8Array(buffer_arg));
}
// Define a trace segment report service.
// All language agents or any trace collecting component, could use this service to send span collection to the SkyWalking OAP backend.
var TraceSegmentReportServiceService = exports.TraceSegmentReportServiceService = {
// Recommended trace segment report channel.
// gRPC streaming provides better performance.
// All language agents should choose this.
collect: {
path: '/skywalking.v3.TraceSegmentReportService/collect',
requestStream: true,
responseStream: false,
requestType: language$agent_Tracing_pb.SegmentObject,
responseType: common_Common_pb.Commands,
requestSerialize: serialize_skywalking_v3_SegmentObject,
requestDeserialize: deserialize_skywalking_v3_SegmentObject,
responseSerialize: serialize_skywalking_v3_Commands,
responseDeserialize: deserialize_skywalking_v3_Commands,
},
// An alternative for trace report by using gRPC unary
// This is provided for some 3rd-party integration, if and only if they prefer the unary mode somehow.
// The performance of SkyWalking OAP server would be very similar with streaming report,
// the performance of the network and client side are affected
collectInSync: {
path: '/skywalking.v3.TraceSegmentReportService/collectInSync',
requestStream: false,
responseStream: false,
requestType: language$agent_Tracing_pb.SegmentCollection,
responseType: common_Common_pb.Commands,
requestSerialize: serialize_skywalking_v3_SegmentCollection,
requestDeserialize: deserialize_skywalking_v3_SegmentCollection,
responseSerialize: serialize_skywalking_v3_Commands,
responseDeserialize: deserialize_skywalking_v3_Commands,
},
};
exports.TraceSegmentReportServiceClient = grpc.makeGenericClientConstructor(TraceSegmentReportServiceService);