Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jaeger exporter implementation #132

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
639cd23
Fix visual studio dotnet core build task
EGHornbostel Jul 3, 2019
6d37ed2
Added CNCF Jaeger exporter support
EGHornbostel Jul 3, 2019
8e45715
possible fix for win32 build issue.
EGHornbostel Jul 3, 2019
86db023
Fix windows build by adding Thrift source
EGHornbostel Jul 3, 2019
dd4492b
Fix yet more windows build issues.
EGHornbostel Jul 3, 2019
0d872b4
fix another style issue.
EGHornbostel Jul 3, 2019
6fd13b8
fix reference to System.Net.Http
EGHornbostel Jul 8, 2019
ac5561a
remove unnecessary conditional framework reference.
EGHornbostel Jul 8, 2019
7b82349
Update lib/Thrift/Transports/Client/TStreamClientTransport.cs
EGHornbostel Jul 8, 2019
5ec204c
Update lib/Thrift/Transports/Client/TStreamClientTransport.cs
EGHornbostel Jul 8, 2019
01f4283
Added the conditional for netstandard2.0
EGHornbostel Jul 8, 2019
41c8151
remove IDisposable TODO comments.
EGHornbostel Jul 8, 2019
82eddea
Update src/OpenTelemetry.Exporter.Jaeger/Implimentation/EmitBatchArgs.cs
EGHornbostel Jul 9, 2019
1098705
Add readme with thrift fork info.
EGHornbostel Jul 9, 2019
fcab9be
Merge branch 'master' into jaeger-exporter
EGHornbostel Jul 9, 2019
ba897aa
cleanup after merge.
EGHornbostel Jul 9, 2019
bbbcf47
WIP remove thrift code
EGHornbostel Jul 10, 2019
fa5fbd8
Use prepackaged Apache Thrift assembly
EGHornbostel Jul 11, 2019
9aaa138
wrap EmitBatch
EGHornbostel Jul 11, 2019
ac65edf
Revert "wrap EmitBatch "
EGHornbostel Jul 11, 2019
645d444
Revert "Use prepackaged Apache Thrift assembly"
EGHornbostel Jul 11, 2019
c368e2e
Revert "Use prepackaged Apache Thrift assembly"
EGHornbostel Jul 11, 2019
93c845e
Revert "WIP remove thrift code"
EGHornbostel Jul 10, 2019
89840a2
Add missing ConfigureAwait(false) to Thrift async calls.
EGHornbostel Jul 11, 2019
c22d3db
Added Thrift fork differences to README.md
EGHornbostel Jul 11, 2019
010dd08
WIP Jaeger Unit tests
EGHornbostel Jul 12, 2019
3a47d48
Merge remote-tracking branch 'upstream/master' into jaeger-exporter
EGHornbostel Jul 12, 2019
2d8401e
Fix build after merge.
EGHornbostel Jul 12, 2019
b831f6e
Merge branch 'master' into jaeger-exporter
SergeyKanzhelev Jul 12, 2019
b6e3720
WIP Jaeger Unit tests - Span conversion to Jaeger Thrift format
EGHornbostel Jul 12, 2019
3b06692
WIP Jaeger Unit tests - Span conversion to Jaeger Thrift format - cle…
EGHornbostel Jul 12, 2019
3188066
Merge remote-tracking branch 'upstream/master' into jaeger-exporter
EGHornbostel Jul 12, 2019
f56e7e4
Clean up merge issues
EGHornbostel Jul 12, 2019
916f223
WIP
EGHornbostel Jul 12, 2019
5f98892
WIP cleanup
EGHornbostel Jul 12, 2019
1cc3e83
more testing WIP
EGHornbostel Jul 13, 2019
aff702e
use pattern matching for attribute conversion
EGHornbostel Jul 15, 2019
e4f9b12
Merge remote-tracking branch 'upstream/master' into jaeger-exporter
EGHornbostel Jul 15, 2019
b4c5f5b
WIP cleanup after timestamp removal.
EGHornbostel Jul 16, 2019
6ded7ba
Merge remote-tracking branch 'upstream/master' into jaeger-exporter
EGHornbostel Jul 17, 2019
8620491
WIP
EGHornbostel Jul 20, 2019
b18f778
WIP UDP integration test
EGHornbostel Jul 20, 2019
604e747
Update src/OpenTelemetry.Exporter.Jaeger/Implimentation/Batch.cs
EGHornbostel Jul 20, 2019
d4bd960
remove solution-explorer
EGHornbostel Jul 20, 2019
c8a706a
add to gitignore
EGHornbostel Jul 20, 2019
011cd04
refactored List<T> to IEnumerable<T>
EGHornbostel Jul 20, 2019
4a4a592
Fix unit test bug
EGHornbostel Jul 20, 2019
0341811
Add integration test
EGHornbostel Jul 20, 2019
e2030e7
cleanup
EGHornbostel Jul 20, 2019
940fce7
fix unix epoch conversion
EGHornbostel Jul 21, 2019
7a98559
Update Thrift expected payload in unit test.
EGHornbostel Jul 21, 2019
9fa75eb
fix build issues
EGHornbostel Jul 21, 2019
eb1b880
fix typo
EGHornbostel Jul 23, 2019
4408d98
Merge remote-tracking branch 'upstream/master' into jaeger-exporter
EGHornbostel Jul 23, 2019
4d27578
fix solution
EGHornbostel Jul 23, 2019
c333fb6
Merge branch 'master' into jaeger-exporter
austinlparker Jul 24, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
"tasks": [
{
"label": "build",
"command": "dotnet build",
"command": "dotnet",
"type": "shell",
"group": "build",
"presentation": {
"reveal": "silent"
},
"args": [
"build",
"/property:GenerateFullPaths=true"
],
"problemMatcher": "$msCompile"
}
]
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ the release.
1. Modified the content of PrometheusExporterOptions from `Uri()` to `string`.
2. `HttpListener()` can support "+" as: hostname which listens on all ports.
3. Modified samples/TestPrometheus.cs to safely use the new implementation.
4. Jaeger exporter implemented

- Copy from
[OpenCensus](http://github.com/census-instrumentation/opencensus-csharp) at
Expand Down
15 changes: 15 additions & 0 deletions OpenTelemetry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{E359
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Exporters", "samples\Exporters\Exporters.csproj", "{6EC9DEC9-086F-4F29-BF3F-5FC7253829D5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelemetry.Exporter.Jaeger", "src\OpenTelemetry.Exporter.Jaeger\OpenTelemetry.Exporter.Jaeger.csproj", "{ECC1F0A2-F880-46FA-8D7D-1AC909829E17}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lib", "lib", "{328E9300-9DA5-11E9-B531-E75873C46FCA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Thrift", "lib\Thrift\Thrift.csproj", "{2B0A9573-CC51-4BE2-86EA-8DEA3D7213FF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -147,6 +153,14 @@ Global
{6EC9DEC9-086F-4F29-BF3F-5FC7253829D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6EC9DEC9-086F-4F29-BF3F-5FC7253829D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6EC9DEC9-086F-4F29-BF3F-5FC7253829D5}.Release|Any CPU.Build.0 = Release|Any CPU
{ECC1F0A2-F880-46FA-8D7D-1AC909829E17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ECC1F0A2-F880-46FA-8D7D-1AC909829E17}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ECC1F0A2-F880-46FA-8D7D-1AC909829E17}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ECC1F0A2-F880-46FA-8D7D-1AC909829E17}.Release|Any CPU.Build.0 = Release|Any CPU
{2B0A9573-CC51-4BE2-86EA-8DEA3D7213FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2B0A9573-CC51-4BE2-86EA-8DEA3D7213FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2B0A9573-CC51-4BE2-86EA-8DEA3D7213FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2B0A9573-CC51-4BE2-86EA-8DEA3D7213FF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -155,6 +169,7 @@ Global
{7CB2F02E-03FA-4FFF-89A5-C51F107623FD} = {61188153-47FB-4567-AC9B-79B2435853EB}
{F2F81E76-6A0E-466B-B673-EBBF1A9ED075} = {77C7929A-2EED-4AA6-8705-B5C443C8AA0F}
{6EC9DEC9-086F-4F29-BF3F-5FC7253829D5} = {E359BB2B-9AEC-497D-B321-7DF2450C3B8E}
{2B0A9573-CC51-4BE2-86EA-8DEA3D7213FF} = {328E9300-9DA5-11E9-B531-E75873C46FCA}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {55639B5C-0770-4A22-AB56-859604650521}
Expand Down
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,42 @@ Outgoing http calls to Redis made usign StackExchange.Redis library can be autom

## OpenTelemetry QuickStart: exporting data

### Using the Jaeger exporter

The Jaeger exporter communicates to a Jaeger Agent through the compact thrift protocol on
the Compact Thrift API port. You can configure the Jaeger exporter by following the directions below:

1. [Get Jaeger][jaeger-get-started].
2. Configure the `JaegerExporter`
- `ServiceName`: The name of your application or service.
- `AgengHost`: Usually `localhost` since an agent should
usually be running on the same machine as your application or service.
- `AgentPort`: The compact thrift protocol port of the Jaeger Agent (default `6831`)
- `MaxPacketSize`: The maximum size of each UDP packet that gets sent to the agent. (default `65000`)
3. See the [sample][jaeger-sample] for an example of how to use the exporter.

``` csharp
var exporter = new JaegerExporter(
new JaegerExporterOptions
{
ServiceName = "tracing-to-jaeger-service",
AgentHost = host,
AgentPort = port,
},
Tracing.ExportComponent);

exporter.Start();

var span = tracer
.SpanBuilder("incoming request")
.SetSampler(Samplers.AlwaysSample)
.StartSpan();

Thread.Sleep(TimeSpan.FromSeconds(1));
span.End();
```


### Using Zipkin exporter

Configure Zipkin exporter to see traces in Zipkin UI.
Expand Down Expand Up @@ -316,6 +352,7 @@ deprecate it for 18 months before removing it, if possible.
[up-for-grabs-issues]: https://github.com/open-telemetry/OpenTelemetry-dotnet/issues?q=is%3Aissue+is%3Aopen+label%3Aup-for-grabs
[good-first-issues]: https://github.com/open-telemetry/OpenTelemetry-dotnet/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22
[zipkin-get-started]: https://zipkin.io/pages/quickstart.html
[jaeger-get-started]: https://www.jaegertracing.io/docs/1.13/getting-started/
[ai-get-started]: https://docs.microsoft.com/azure/application-insights
[stackdriver-trace-setup]: https://cloud.google.com/trace/docs/setup/
[stackdriver-monitoring-setup]: https://cloud.google.com/monitoring/api/enable-api
Expand All @@ -326,6 +363,7 @@ deprecate it for 18 months before removing it, if possible.
[ai-sample]: https://github.com/open-telemetry/opentelemetry-dotnet/blob/master/samples/Exporters/TestApplicationInsights.cs
[stackdriver-sample]: https://github.com/open-telemetry/opentelemetry-dotnet/blob/master/samples/Exporters/TestStackdriver.cs
[zipkin-sample]: https://github.com/open-telemetry/opentelemetry-dotnet/blob/master/samples/Exporters/TestZipkin.cs
[jaeger-sample]: https://github.com/open-telemetry/opentelemetry-dotnet/blob/master/samples/Exporters/TestJaeger.cs
[prometheus-get-started]: https://prometheus.io/docs/introduction/first_steps/
[prometheus-sample]: https://github.com/open-telemetry/opentelemetry-dotnet/blob/master/samples/Exporters/TestPrometheus.cs

101 changes: 101 additions & 0 deletions lib/Thrift/Collections/TCollections.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// 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.

using System.Collections;

namespace Thrift.Collections
{
// ReSharper disable once InconsistentNaming
public class TCollections
{
/// <summary>
/// This will return true if the two collections are value-wise the same.
/// If the collection contains a collection, the collections will be compared using this method.
/// </summary>
public static bool Equals(IEnumerable first, IEnumerable second)
{
if (first == null && second == null)
{
return true;
}

if (first == null || second == null)
{
return false;
}

var fiter = first.GetEnumerator();
var siter = second.GetEnumerator();

var fnext = fiter.MoveNext();
var snext = siter.MoveNext();

while (fnext && snext)
{
var fenum = fiter.Current as IEnumerable;
var senum = siter.Current as IEnumerable;

if (fenum != null && senum != null)
{
if (!Equals(fenum, senum))
{
return false;
}
}
else if (fenum == null ^ senum == null)
{
return false;
}
else if (!Equals(fiter.Current, siter.Current))
{
return false;
}

fnext = fiter.MoveNext();
snext = siter.MoveNext();
}

return fnext == snext;
}

/// <summary>
/// This returns a hashcode based on the value of the enumerable.
/// </summary>
public static int GetHashCode(IEnumerable enumerable)
{
if (enumerable == null)
{
return 0;
}

var hashcode = 0;

foreach (var obj in enumerable)
{
var enum2 = obj as IEnumerable;
var objHash = enum2 == null ? obj.GetHashCode() : GetHashCode(enum2);

unchecked
{
hashcode = (hashcode*397) ^ (objHash);
}
}

return hashcode;
}
}
}
67 changes: 67 additions & 0 deletions lib/Thrift/Collections/THashSet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// 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.

using System.Collections;
using System.Collections.Generic;

namespace Thrift.Collections
{
// ReSharper disable once InconsistentNaming
public class THashSet<T> : ICollection<T>
{
private readonly HashSet<T> _set = new HashSet<T>();

public int Count => _set.Count;

public bool IsReadOnly => false;

public void Add(T item)
{
_set.Add(item);
}

public void Clear()
{
_set.Clear();
}

public bool Contains(T item)
{
return _set.Contains(item);
}

public void CopyTo(T[] array, int arrayIndex)
{
_set.CopyTo(array, arrayIndex);
}

public IEnumerator GetEnumerator()
{
return _set.GetEnumerator();
}

IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return ((IEnumerable<T>) _set).GetEnumerator();
}

public bool Remove(T item)
{
return _set.Remove(item);
}
}
}
29 changes: 29 additions & 0 deletions lib/Thrift/ITAsyncProcessor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// 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.

using System.Threading;
using System.Threading.Tasks;
using Thrift.Protocols;

namespace Thrift
{
public interface ITAsyncProcessor
{
Task<bool> ProcessAsync(TProtocol iprot, TProtocol oprot);
Task<bool> ProcessAsync(TProtocol iprot, TProtocol oprot, CancellationToken cancellationToken);
}
}
28 changes: 28 additions & 0 deletions lib/Thrift/ITProcessorFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// 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.

using Thrift.Server;
using Thrift.Transports;

namespace Thrift
{
// ReSharper disable once InconsistentNaming
public interface ITProcessorFactory
{
ITAsyncProcessor GetAsyncProcessor(TClientTransport trans, TBaseServer baseServer = null);
}
}
37 changes: 37 additions & 0 deletions lib/Thrift/Protocols/Entities/TField.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// 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.

namespace Thrift.Protocols.Entities
{
// ReSharper disable once InconsistentNaming
public struct TField
{
public TField(string name, TType type, short id)
{
Name = name;
Type = type;
ID = id;
}

public string Name { get; set; }

public TType Type { get; set; }

// ReSharper disable once InconsistentNaming - do not rename - it used for generation
public short ID { get; set; }
}
}
Loading