diff --git a/.appveyor.yml b/.appveyor.yml index d9a8a5c..8daebc9 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,7 +1,7 @@ # AppVeyor Build number is incremental and not related to actual version number of the product version: '{build}' -image: Visual Studio 2017 +image: Visual Studio 2019 init: - cmd: git config --global core.autocrlf true diff --git a/OpenTracing.Contrib.sln b/OpenTracing.Contrib.sln index ac7141d..c0ec8db 100644 --- a/OpenTracing.Contrib.sln +++ b/OpenTracing.Contrib.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2020 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29411.108 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B72DE217-C3BF-4F75-9741-2B74E3847443}" ProjectSection(SolutionItems) = preProject @@ -21,6 +21,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject Directory.Build.props = Directory.Build.props README.md = README.md + version.props = version.props EndProjectSection EndProject Global diff --git a/src/Directory.Build.props b/src/Directory.Build.props index b4af8a4..cb11d97 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -14,9 +14,9 @@ - - - + + + diff --git a/src/OpenTracing.Contrib.Grpc/OpenTracing.Contrib.Grpc.csproj b/src/OpenTracing.Contrib.Grpc/OpenTracing.Contrib.Grpc.csproj index dfb4c1b..8e25099 100644 --- a/src/OpenTracing.Contrib.Grpc/OpenTracing.Contrib.Grpc.csproj +++ b/src/OpenTracing.Contrib.Grpc/OpenTracing.Contrib.Grpc.csproj @@ -1,7 +1,7 @@  - netstandard1.5 + net45;netstandard1.5;netstandard2.0 true Adds OpenTracing instrumentation for .NET Standard apps that use GRPC. opentracing;distributed-tracing;tracing;grpc;netstandard @@ -9,8 +9,8 @@ - - + + diff --git a/src/OpenTracing.Contrib.Grpc/Streaming/TracingAsyncStreamReader.cs b/src/OpenTracing.Contrib.Grpc/Streaming/TracingAsyncStreamReader.cs index 360663a..46d4e1c 100644 --- a/src/OpenTracing.Contrib.Grpc/Streaming/TracingAsyncStreamReader.cs +++ b/src/OpenTracing.Contrib.Grpc/Streaming/TracingAsyncStreamReader.cs @@ -20,7 +20,6 @@ public TracingAsyncStreamReader(IAsyncStreamReader reader, Action onMessag _onException = onException; } - public void Dispose() => _reader.Dispose(); public T Current => _reader.Current; public async Task MoveNext(CancellationToken cancellationToken) diff --git a/test/OpenTracing.Contrib.Grpc.Test/AddressbookGrpc.cs b/test/OpenTracing.Contrib.Grpc.Test/AddressbookGrpc.cs deleted file mode 100644 index 27d723f..0000000 --- a/test/OpenTracing.Contrib.Grpc.Test/AddressbookGrpc.cs +++ /dev/null @@ -1,244 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: addressbook.proto -#pragma warning disable 1591 -#region Designer generated code - -using System; -using System.Threading; -using System.Threading.Tasks; -using grpc = global::Grpc.Core; - -namespace Tutorial { - public static partial class Phone - { - static readonly string __ServiceName = "tutorial.Phone"; - - static readonly grpc::Marshaller __Marshaller_Person = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Tutorial.Person.Parser.ParseFrom); - - static readonly grpc::Method __Method_GetName = new grpc::Method( - grpc::MethodType.Unary, - __ServiceName, - "GetName", - __Marshaller_Person, - __Marshaller_Person); - - static readonly grpc::Method __Method_GetNameRequestStream = new grpc::Method( - grpc::MethodType.ClientStreaming, - __ServiceName, - "GetNameRequestStream", - __Marshaller_Person, - __Marshaller_Person); - - static readonly grpc::Method __Method_GetNameResponseStream = new grpc::Method( - grpc::MethodType.ServerStreaming, - __ServiceName, - "GetNameResponseStream", - __Marshaller_Person, - __Marshaller_Person); - - static readonly grpc::Method __Method_GetNameBiDiStream = new grpc::Method( - grpc::MethodType.DuplexStreaming, - __ServiceName, - "GetNameBiDiStream", - __Marshaller_Person, - __Marshaller_Person); - - /// Service descriptor - public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor - { - get { return global::Tutorial.AddressbookReflection.Descriptor.Services[0]; } - } - - /// Base class for server-side implementations of Phone - public abstract partial class PhoneBase - { - public virtual global::System.Threading.Tasks.Task GetName(global::Tutorial.Person request, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - public virtual global::System.Threading.Tasks.Task GetNameRequestStream(grpc::IAsyncStreamReader requestStream, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - public virtual global::System.Threading.Tasks.Task GetNameResponseStream(global::Tutorial.Person request, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - public virtual global::System.Threading.Tasks.Task GetNameBiDiStream(grpc::IAsyncStreamReader requestStream, grpc::IServerStreamWriter responseStream, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - } - - /// Client for Phone - public partial class PhoneClient : grpc::ClientBase - { - /// Creates a new client for Phone - /// The channel to use to make remote calls. - public PhoneClient(grpc::Channel channel) : base(channel) - { - } - /// Creates a new client for Phone that uses a custom CallInvoker. - /// The callInvoker to use to make remote calls. - public PhoneClient(grpc::CallInvoker callInvoker) : base(callInvoker) - { - } - /// Protected parameterless constructor to allow creation of test doubles. - protected PhoneClient() : base() - { - } - /// Protected constructor to allow creation of configured clients. - /// The client configuration. - protected PhoneClient(ClientBaseConfiguration configuration) : base(configuration) - { - } - - public virtual global::Tutorial.Person GetName(global::Tutorial.Person request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) - { - return GetName(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - public virtual global::Tutorial.Person GetName(global::Tutorial.Person request, grpc::CallOptions options) - { - return CallInvoker.BlockingUnaryCall(__Method_GetName, null, options, request); - } - public virtual grpc::AsyncUnaryCall GetNameAsync(global::Tutorial.Person request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) - { - return GetNameAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - public virtual grpc::AsyncUnaryCall GetNameAsync(global::Tutorial.Person request, grpc::CallOptions options) - { - return CallInvoker.AsyncUnaryCall(__Method_GetName, null, options, request); - } - public virtual grpc::AsyncClientStreamingCall GetNameRequestStream(grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) - { - return GetNameRequestStream(new grpc::CallOptions(headers, deadline, cancellationToken)); - } - public virtual grpc::AsyncClientStreamingCall GetNameRequestStream(grpc::CallOptions options) - { - return CallInvoker.AsyncClientStreamingCall(__Method_GetNameRequestStream, null, options); - } - public virtual grpc::AsyncServerStreamingCall GetNameResponseStream(global::Tutorial.Person request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) - { - return GetNameResponseStream(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - public virtual grpc::AsyncServerStreamingCall GetNameResponseStream(global::Tutorial.Person request, grpc::CallOptions options) - { - return CallInvoker.AsyncServerStreamingCall(__Method_GetNameResponseStream, null, options, request); - } - public virtual grpc::AsyncDuplexStreamingCall GetNameBiDiStream(grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) - { - return GetNameBiDiStream(new grpc::CallOptions(headers, deadline, cancellationToken)); - } - public virtual grpc::AsyncDuplexStreamingCall GetNameBiDiStream(grpc::CallOptions options) - { - return CallInvoker.AsyncDuplexStreamingCall(__Method_GetNameBiDiStream, null, options); - } - /// Creates a new instance of client from given ClientBaseConfiguration. - protected override PhoneClient NewInstance(ClientBaseConfiguration configuration) - { - return new PhoneClient(configuration); - } - } - - /// Creates service definition that can be registered with a server - /// An object implementing the server-side handling logic. - public static grpc::ServerServiceDefinition BindService(PhoneBase serviceImpl) - { - return grpc::ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_GetName, serviceImpl.GetName) - .AddMethod(__Method_GetNameRequestStream, serviceImpl.GetNameRequestStream) - .AddMethod(__Method_GetNameResponseStream, serviceImpl.GetNameResponseStream) - .AddMethod(__Method_GetNameBiDiStream, serviceImpl.GetNameBiDiStream).Build(); - } - - } - public static partial class PhoneRelay - { - static readonly string __ServiceName = "tutorial.PhoneRelay"; - - static readonly grpc::Marshaller __Marshaller_Person = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Tutorial.Person.Parser.ParseFrom); - - static readonly grpc::Method __Method_GetName = new grpc::Method( - grpc::MethodType.Unary, - __ServiceName, - "GetName", - __Marshaller_Person, - __Marshaller_Person); - - /// Service descriptor - public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor - { - get { return global::Tutorial.AddressbookReflection.Descriptor.Services[1]; } - } - - /// Base class for server-side implementations of PhoneRelay - public abstract partial class PhoneRelayBase - { - public virtual global::System.Threading.Tasks.Task GetName(global::Tutorial.Person request, grpc::ServerCallContext context) - { - throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); - } - - } - - /// Client for PhoneRelay - public partial class PhoneRelayClient : grpc::ClientBase - { - /// Creates a new client for PhoneRelay - /// The channel to use to make remote calls. - public PhoneRelayClient(grpc::Channel channel) : base(channel) - { - } - /// Creates a new client for PhoneRelay that uses a custom CallInvoker. - /// The callInvoker to use to make remote calls. - public PhoneRelayClient(grpc::CallInvoker callInvoker) : base(callInvoker) - { - } - /// Protected parameterless constructor to allow creation of test doubles. - protected PhoneRelayClient() : base() - { - } - /// Protected constructor to allow creation of configured clients. - /// The client configuration. - protected PhoneRelayClient(ClientBaseConfiguration configuration) : base(configuration) - { - } - - public virtual global::Tutorial.Person GetName(global::Tutorial.Person request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) - { - return GetName(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - public virtual global::Tutorial.Person GetName(global::Tutorial.Person request, grpc::CallOptions options) - { - return CallInvoker.BlockingUnaryCall(__Method_GetName, null, options, request); - } - public virtual grpc::AsyncUnaryCall GetNameAsync(global::Tutorial.Person request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) - { - return GetNameAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); - } - public virtual grpc::AsyncUnaryCall GetNameAsync(global::Tutorial.Person request, grpc::CallOptions options) - { - return CallInvoker.AsyncUnaryCall(__Method_GetName, null, options, request); - } - /// Creates a new instance of client from given ClientBaseConfiguration. - protected override PhoneRelayClient NewInstance(ClientBaseConfiguration configuration) - { - return new PhoneRelayClient(configuration); - } - } - - /// Creates service definition that can be registered with a server - /// An object implementing the server-side handling logic. - public static grpc::ServerServiceDefinition BindService(PhoneRelayBase serviceImpl) - { - return grpc::ServerServiceDefinition.CreateBuilder() - .AddMethod(__Method_GetName, serviceImpl.GetName).Build(); - } - - } -} -#endregion diff --git a/test/OpenTracing.Contrib.Grpc.Test/OpenTracing.Contrib.Grpc.Test.csproj b/test/OpenTracing.Contrib.Grpc.Test/OpenTracing.Contrib.Grpc.Test.csproj index 44d3542..237283f 100644 --- a/test/OpenTracing.Contrib.Grpc.Test/OpenTracing.Contrib.Grpc.Test.csproj +++ b/test/OpenTracing.Contrib.Grpc.Test/OpenTracing.Contrib.Grpc.Test.csproj @@ -2,15 +2,20 @@ Exe - netcoreapp2.0 + net45;netcoreapp2.1;netcoreapp3.1 OpenTracing.Contrib.Grpc.Test OpenTracing.Contrib.Grpc.Test 7.3 - - + + + + + + + diff --git a/test/OpenTracing.Contrib.Grpc.Test/Program.cs b/test/OpenTracing.Contrib.Grpc.Test/Program.cs index bd4b91c..36a2e8b 100644 --- a/test/OpenTracing.Contrib.Grpc.Test/Program.cs +++ b/test/OpenTracing.Contrib.Grpc.Test/Program.cs @@ -53,7 +53,7 @@ private static async Task MainAsync() var client = new Phone.PhoneClient(new Channel("localhost:8011", ChannelCredentials.Insecure).Intercept(tracingInterceptor)); var request = new Person { Name = "Karl Heinz" }; - var response1 = await client.GetNameAsync(request); + var _ = await client.GetNameAsync(request); var response2 = client.GetNameRequestStream(); await response2.RequestStream.WriteAsync(request); diff --git a/test/OpenTracing.Contrib.Grpc.Test/Tutorial/Addressbook.cs b/test/OpenTracing.Contrib.Grpc.Test/Tutorial/Addressbook.cs deleted file mode 100644 index 2d74931..0000000 --- a/test/OpenTracing.Contrib.Grpc.Test/Tutorial/Addressbook.cs +++ /dev/null @@ -1,520 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: addressbook.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Tutorial { - - /// Holder for reflection information generated from addressbook.proto - public static partial class AddressbookReflection { - - #region Descriptor - /// File descriptor for addressbook.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static AddressbookReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "ChFhZGRyZXNzYm9vay5wcm90bxIIdHV0b3JpYWwi1QEKBlBlcnNvbhIMCgRu", - "YW1lGAEgASgJEgoKAmlkGAIgASgFEg0KBWVtYWlsGAMgASgJEiwKBnBob25l", - "cxgEIAMoCzIcLnR1dG9yaWFsLlBlcnNvbi5QaG9uZU51bWJlchpHCgtQaG9u", - "ZU51bWJlchIOCgZudW1iZXIYASABKAkSKAoEdHlwZRgCIAEoDjIaLnR1dG9y", - "aWFsLlBlcnNvbi5QaG9uZVR5cGUiKwoJUGhvbmVUeXBlEgoKBk1PQklMRRAA", - "EggKBEhPTUUQARIICgRXT1JLEAIiLwoLQWRkcmVzc0Jvb2sSIAoGcGVvcGxl", - "GAEgAygLMhAudHV0b3JpYWwuUGVyc29uMvgBCgVQaG9uZRIvCgdHZXROYW1l", - "EhAudHV0b3JpYWwuUGVyc29uGhAudHV0b3JpYWwuUGVyc29uIgASPgoUR2V0", - "TmFtZVJlcXVlc3RTdHJlYW0SEC50dXRvcmlhbC5QZXJzb24aEC50dXRvcmlh", - "bC5QZXJzb24iACgBEj8KFUdldE5hbWVSZXNwb25zZVN0cmVhbRIQLnR1dG9y", - "aWFsLlBlcnNvbhoQLnR1dG9yaWFsLlBlcnNvbiIAMAESPQoRR2V0TmFtZUJp", - "RGlTdHJlYW0SEC50dXRvcmlhbC5QZXJzb24aEC50dXRvcmlhbC5QZXJzb24i", - "ACgBMAEyPQoKUGhvbmVSZWxheRIvCgdHZXROYW1lEhAudHV0b3JpYWwuUGVy", - "c29uGhAudHV0b3JpYWwuUGVyc29uIgBiBnByb3RvMw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tutorial.Person), global::Tutorial.Person.Parser, new[]{ "Name", "Id", "Email", "Phones" }, null, new[]{ typeof(global::Tutorial.Person.Types.PhoneType) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Tutorial.Person.Types.PhoneNumber), global::Tutorial.Person.Types.PhoneNumber.Parser, new[]{ "Number", "Type" }, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Tutorial.AddressBook), global::Tutorial.AddressBook.Parser, new[]{ "People" }, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class Person : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Person()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Tutorial.AddressbookReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Person() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Person(Person other) : this() { - name_ = other.name_; - id_ = other.id_; - email_ = other.email_; - phones_ = other.phones_.Clone(); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Person Clone() { - return new Person(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private string name_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "id" field. - public const int IdFieldNumber = 2; - private int id_; - /// - /// Unique ID number for this person. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int Id { - get { return id_; } - set { - id_ = value; - } - } - - /// Field number for the "email" field. - public const int EmailFieldNumber = 3; - private string email_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Email { - get { return email_; } - set { - email_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "phones" field. - public const int PhonesFieldNumber = 4; - private static readonly pb::FieldCodec _repeated_phones_codec - = pb::FieldCodec.ForMessage(34, global::Tutorial.Person.Types.PhoneNumber.Parser); - private readonly pbc::RepeatedField phones_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Phones { - get { return phones_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Person); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Person other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (Id != other.Id) return false; - if (Email != other.Email) return false; - if(!phones_.Equals(other.phones_)) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (Id != 0) hash ^= Id.GetHashCode(); - if (Email.Length != 0) hash ^= Email.GetHashCode(); - hash ^= phones_.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (Id != 0) { - output.WriteRawTag(16); - output.WriteInt32(Id); - } - if (Email.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Email); - } - phones_.WriteTo(output, _repeated_phones_codec); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (Id != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(Id); - } - if (Email.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Email); - } - size += phones_.CalculateSize(_repeated_phones_codec); - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Person other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.Id != 0) { - Id = other.Id; - } - if (other.Email.Length != 0) { - Email = other.Email; - } - phones_.Add(other.phones_); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 16: { - Id = input.ReadInt32(); - break; - } - case 26: { - Email = input.ReadString(); - break; - } - case 34: { - phones_.AddEntriesFrom(input, _repeated_phones_codec); - break; - } - } - } - } - - #region Nested types - /// Container for nested types declared in the Person message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - public enum PhoneType { - [pbr::OriginalName("MOBILE")] Mobile = 0, - [pbr::OriginalName("HOME")] Home = 1, - [pbr::OriginalName("WORK")] Work = 2, - } - - public sealed partial class PhoneNumber : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new PhoneNumber()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Tutorial.Person.Descriptor.NestedTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public PhoneNumber() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public PhoneNumber(PhoneNumber other) : this() { - number_ = other.number_; - type_ = other.type_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public PhoneNumber Clone() { - return new PhoneNumber(this); - } - - /// Field number for the "number" field. - public const int NumberFieldNumber = 1; - private string number_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Number { - get { return number_; } - set { - number_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "type" field. - public const int TypeFieldNumber = 2; - private global::Tutorial.Person.Types.PhoneType type_ = 0; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Tutorial.Person.Types.PhoneType Type { - get { return type_; } - set { - type_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as PhoneNumber); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(PhoneNumber other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Number != other.Number) return false; - if (Type != other.Type) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Number.Length != 0) hash ^= Number.GetHashCode(); - if (Type != 0) hash ^= Type.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Number.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Number); - } - if (Type != 0) { - output.WriteRawTag(16); - output.WriteEnum((int) Type); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Number.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Number); - } - if (Type != 0) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(PhoneNumber other) { - if (other == null) { - return; - } - if (other.Number.Length != 0) { - Number = other.Number; - } - if (other.Type != 0) { - Type = other.Type; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - Number = input.ReadString(); - break; - } - case 16: { - type_ = (global::Tutorial.Person.Types.PhoneType) input.ReadEnum(); - break; - } - } - } - } - - } - - } - #endregion - - } - - /// - /// Our address book file is just one of these. - /// - public sealed partial class AddressBook : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AddressBook()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Tutorial.AddressbookReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddressBook() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddressBook(AddressBook other) : this() { - people_ = other.people_.Clone(); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AddressBook Clone() { - return new AddressBook(this); - } - - /// Field number for the "people" field. - public const int PeopleFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_people_codec - = pb::FieldCodec.ForMessage(10, global::Tutorial.Person.Parser); - private readonly pbc::RepeatedField people_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField People { - get { return people_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as AddressBook); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(AddressBook other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!people_.Equals(other.people_)) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= people_.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - people_.WriteTo(output, _repeated_people_codec); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += people_.CalculateSize(_repeated_people_codec); - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(AddressBook other) { - if (other == null) { - return; - } - people_.Add(other.people_); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - people_.AddEntriesFrom(input, _repeated_people_codec); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/test/OpenTracing.Contrib.Grpc.Test/protos/addressbook.proto b/test/OpenTracing.Contrib.Grpc.Test/protos/addressbook.proto new file mode 100644 index 0000000..a6a944e --- /dev/null +++ b/test/OpenTracing.Contrib.Grpc.Test/protos/addressbook.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; + +package tutorial; + +message Person { + string name = 1; + int32 id = 2; // Unique ID number for this person. + string email = 3; + + enum PhoneType { + MOBILE = 0; + HOME = 1; + WORK = 2; + } + + message PhoneNumber { + string number = 1; + PhoneType type = 2; + } + + repeated PhoneNumber phones = 4; +} + +// Our address book file is just one of these. +message AddressBook { + repeated Person people = 1; +} + +service Phone { + rpc GetName(Person) returns (Person) {} + rpc GetNameRequestStream(stream Person) returns (Person) {} + rpc GetNameResponseStream(Person) returns (stream Person) {} + rpc GetNameBiDiStream(stream Person) returns (stream Person) {} +} \ No newline at end of file