Skip to content
This repository was archived by the owner on Dec 18, 2023. It is now read-only.

Commit f6a31ca

Browse files
Simon ZeltserSergeyKanzhelev
authored andcommitted
Updated readme.md to include link to stackdriver exporter package (#72)
* Introducing Stackdriver Exporter for Opencensus C# library - Current implementation can only store string values - Added the exporter and trace handler only - The exporter relies on newest Trace API from Stackdriver. * Updating translation from ISpan to Stackdriver's Span to cover more fields * Fixing the issue that prevented Stackdriver API call to succeed: now construction of Span resource is taken care of by SpanName class that is part of Stackdriver Trace V2 API. * - Added support for capturing all types of trace spans (long/bool/string) - Fixed csproj, so it produces both .NET Core and .NET versions. It also means signing the assembly using the same mechanism as other assemblies in the solution * - Added support for storing links - Minor fixes to proto<->opencensus translation methods * Fixing merge issue * Added command line support for the Samples project. This will make it easier to script testing multiple exporters as well as prevent commenting and uncommenting different test procedures for different exporters. Finally, it will making test code cleaner for showing samples embedded in documentation website. In order to test the exporter, you can either execute it from the command line: samples.dll prometheus or to debug using Visual Studio: Debug => Sample Properties => Debug. Now create a profile for your testing execution and fill application arguments if needed. Now choose your profile in running configuration of Visual Studio. Running settings are local to the machine and are ignored in PRs. * Adding sceleton of metrics support in Stackdriver Exporter. Currently we can't detect all types of monitoring resources but we can ship the batches of metrics with time series to Stackdriver. Thorough testing TBD * Fixing a few bugs in Stackdriver metrics exporter - Small refactoring - Assinging default values for time intervals * - Fixing a few bugs around metric creation and labels - Refactoring MetricsConversions - Fixing stackdriver stats configuration - population of default resource and projects * First working version of Stackdriver Stats Exporter. 1) Fixed bugs related to Stackdriver Metrics Descriptor creation 2) Renamed Metrics Exporter to Stats Exporter to follow Opencensus terminology 3) Cache Stackdriver Metrics Descriptors locally so it's easy which descriptor holds the time series to upload 4) Fixed test code that was producing the metrics using Opencensus and uploading it to Stackdriver 5) Minor refactoring Current limitations: 1) Supporting only string labels 2) We support only "Global" monitored resource. We need to detect dynamically where the code is running and attach corresponding labels to the monitored resource, so metrics are stored correctly 3) More Tests * Removing commented lines * Fixed Stackdriver export interval propagation Added Opencensus headers into every call into Stackdriver APIs Added consts for resources that Stackdriver Exporter should auto-detect when running on GCP * - Added test project for Stackdriver Exporter - Added tests for StackdriverStatsConfiguration * Trying to fix the tests that fail on CI as a result of wrong signing key for InternalVisibleTo * Updating Travis build definition to latest .netcore sdk and running all tests * Adding an option to set google cloud projectId in environment variable for testing purposes(Stackdriver exporter). * Temporarily commenting out lines that read from a friend assembly as it doesn't work on a build server * Added AssemblyInfo.cs into Stackdriver Exporter, so it's visible to tests on both signed and unsigned builds * Introducing Stackdriver Exporter for Opencensus C# library - Current implementation can only store string values - Added the exporter and trace handler only - The exporter relies on newest Trace API from Stackdriver. * Updating translation from ISpan to Stackdriver's Span to cover more fields * Fixing the issue that prevented Stackdriver API call to succeed: now construction of Span resource is taken care of by SpanName class that is part of Stackdriver Trace V2 API. * - Added support for storing links - Minor fixes to proto<->opencensus translation methods * Added command line support for the Samples project. This will make it easier to script testing multiple exporters as well as prevent commenting and uncommenting different test procedures for different exporters. Finally, it will making test code cleaner for showing samples embedded in documentation website. In order to test the exporter, you can either execute it from the command line: samples.dll prometheus or to debug using Visual Studio: Debug => Sample Properties => Debug. Now create a profile for your testing execution and fill application arguments if needed. Now choose your profile in running configuration of Visual Studio. Running settings are local to the machine and are ignored in PRs. * Adding sceleton of metrics support in Stackdriver Exporter. Currently we can't detect all types of monitoring resources but we can ship the batches of metrics with time series to Stackdriver. Thorough testing TBD * Fixing a few bugs in Stackdriver metrics exporter - Small refactoring - Assinging default values for time intervals * - Fixing a few bugs around metric creation and labels - Refactoring MetricsConversions - Fixing stackdriver stats configuration - population of default resource and projects * First working version of Stackdriver Stats Exporter. 1) Fixed bugs related to Stackdriver Metrics Descriptor creation 2) Renamed Metrics Exporter to Stats Exporter to follow Opencensus terminology 3) Cache Stackdriver Metrics Descriptors locally so it's easy which descriptor holds the time series to upload 4) Fixed test code that was producing the metrics using Opencensus and uploading it to Stackdriver 5) Minor refactoring Current limitations: 1) Supporting only string labels 2) We support only "Global" monitored resource. We need to detect dynamically where the code is running and attach corresponding labels to the monitored resource, so metrics are stored correctly 3) More Tests * Removing commented lines * Fixed Stackdriver export interval propagation Added Opencensus headers into every call into Stackdriver APIs Added consts for resources that Stackdriver Exporter should auto-detect when running on GCP * - Added test project for Stackdriver Exporter - Added tests for StackdriverStatsConfiguration * Trying to fix the tests that fail on CI as a result of wrong signing key for InternalVisibleTo * Adding an option to set google cloud projectId in environment variable for testing purposes(Stackdriver exporter). * Temporarily commenting out lines that read from a friend assembly as it doesn't work on a build server * Added AssemblyInfo.cs into Stackdriver Exporter, so it's visible to tests on both signed and unsigned builds * Rebasing origin to upstream * Updated readme to include a link to Stackdriver package
1 parent 38976dd commit f6a31ca

File tree

9 files changed

+17
-16
lines changed

9 files changed

+17
-16
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
[![Gitter chat][gitter-image]][gitter-url]
44
[![Build Status](https://opencensus.visualstudio.com/continuous-integration/_apis/build/status/ci-myget-update.yml)](https://opencensus.visualstudio.com/continuous-integration/_build/latest?definitionId=3)
55

6-
| Source | OpenCensus | Zipkin Exporter | Application Insights exporter |
7-
|--------|------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|
6+
| Source | OpenCensus | Zipkin Exporter | Application Insights exporter | Stackdriver |
7+
|--------|------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|------------------------------------------------------------------|
88
| MyGet | [![MyGet Nightly][opencensus-myget-image]][opencensus-myget-url] | [![MyGet Nightly][opencensus-exporter-zipkin-myget-image]][opencensus-exporter-zipkin-myget-url] | [![MyGet Nightly][opencensus-exporter-ai-myget-image]][opencensus-exporter-ai-myget-url] |
9-
9+
[![MyGet Nightly][opencensus-exporter-stackdriver-myget-image]][opencensus-exporter-stackdriver-myget-url]
1010

1111
OpenCensus is a toolkit for collecting application performance and behavior
1212
data. It currently includes 3 APIs: stats, tracing and tags.
@@ -134,6 +134,8 @@ deprecate it for 18 months before removing it, if possible.
134134
[opencensus-exporter-zipkin-myget-url]: https://www.myget.org/feed/opencensus/package/nuget/OpenCensus.Exporter.Zipkin
135135
[opencensus-exporter-ai-myget-image]:https://img.shields.io/myget/opencensus/vpre/OpenCensus.Exporter.ApplicationInsights.svg
136136
[opencensus-exporter-ai-myget-url]: https://www.myget.org/feed/opencensus/package/nuget/OpenCensus.Exporter.ApplicationInsights
137+
[opencensus-exporter-stackdriver-myget-image]:https://img.shields.io/myget/opencensus/vpre/OpenCensus.Exporter.Stackdriver.svg
138+
[opencensus-exporter-stackdriver-myget-url]: https://www.myget.org/feed/opencensus/package/nuget/OpenCensus.Exporter.Stackdriver
137139
[up-for-grabs-issues]: https://github.com/census-instrumentation/opencensus-csharp/issues?q=is%3Aissue+is%3Aopen+label%3Aup-for-grabs
138140
[good-first-issues]: https://github.com/census-instrumentation/opencensus-csharp/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22
139141
[zipkin-get-started]: https://zipkin.io/pages/quickstart.html

src/OpenCensus.Exporter.Stackdriver/Implementation/Constants.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ internal class Constants
3030
public const string GLOBAL = "global";
3131

3232
public const string PROJECT_ID_LABEL_KEY = "project_id";
33-
public static readonly string OPENCENSUS_TASK_VALUE_DEFAULT = generateDefaultTaskValue();
33+
public static readonly string OPENCENSUS_TASK_VALUE_DEFAULT = GenerateDefaultTaskValue();
3434

3535
public const string GCP_GCE_INSTANCE_TYPE = "cloud.google.com/gce/instance";
3636
public const string GCP_INSTANCE_ID_KEY = "cloud.google.com/gce/instance_id";
@@ -43,10 +43,10 @@ internal class Constants
4343
public const string K8S_NAMESPACE_NAME_KEY = "k8s.io/namespace/name";
4444
public const string K8S_POD_NAME_KEY = "k8s.io/pod/name";
4545

46-
private static string generateDefaultTaskValue()
46+
private static string GenerateDefaultTaskValue()
4747
{
4848
// Something like '<pid>@<hostname>'
4949
return $"dotnet-{System.Diagnostics.Process.GetCurrentProcess().Id}@{Environment.MachineName}";
5050
}
5151
}
52-
}
52+
}

src/OpenCensus.Exporter.Stackdriver/Implementation/GoogleCloudResourceUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ public static MonitoredResource GetDefaultResource(string projectId)
7474
return resource;
7575
}
7676
}
77-
}
77+
}

src/OpenCensus.Exporter.Stackdriver/Implementation/MetricsConversions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,4 +334,4 @@ internal static string GetStackdriverLabelKey(string label)
334334
return label.Replace('/', '_');
335335
}
336336
}
337-
}
337+
}

src/OpenCensus.Exporter.Stackdriver/Implementation/StackdriverStatsConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ public static StackdriverStatsConfiguration Default
6868
}
6969
}
7070
}
71-
}
71+
}

src/OpenCensus.Exporter.Stackdriver/Implementation/StackdriverTraceExporter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ public static Span.Types.Link ToLink(this ILink link)
8686
var ret = new Span.Types.Link();
8787
ret.SpanId = link.SpanId.ToLowerBase16();
8888
ret.TraceId = link.TraceId.ToLowerBase16();
89-
89+
9090
if (link.Attributes != null)
9191
{
9292
ret.Attributes = new Span.Types.Attributes
9393
{
94-
94+
9595
DroppedAttributesCount = OpenCensus.Trace.Config.TraceParams.Default.MaxNumberOfAttributes - link.Attributes.Count,
9696

9797
AttributeMap = { link.Attributes.ToDictionary(
@@ -144,7 +144,7 @@ internal class StackdriverTraceExporter : IHandler
144144
public StackdriverTraceExporter(string projectId)
145145
{
146146
googleCloudProjectId = new Google.Api.Gax.ResourceNames.ProjectName(projectId);
147-
147+
148148
}
149149

150150
public void Export(IList<ISpanData> spanDataList)
@@ -159,4 +159,4 @@ public void Export(IList<ISpanData> spanDataList)
159159
traceWriter.BatchWriteSpans(batchSpansRequest);
160160
}
161161
}
162-
}
162+
}

src/OpenCensus.Exporter.Stackdriver/StackdriverExporter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,4 @@ public void Stop()
116116
}
117117
}
118118
}
119-
}
119+
}

src/Samples/TestZipkin.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ internal class TestZipkin
1010
{
1111
private static ITracer tracer = Tracing.Tracer;
1212

13-
1413
internal static object Run()
1514
{
1615
Console.WriteLine("Hello World!");

test/OpenCensus.Exporter.Stackdriver.Tests/Impl/StackdriverStatsConfigurationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ public void StatsConfiguration_ByDefault_MonitoredResourceIsGlobal()
6565
StackdriverStatsConfiguration.Default.MonitoredResource.Labels[Constants.PROJECT_ID_LABEL_KEY]);
6666
}
6767
}
68-
}
68+
}

0 commit comments

Comments
 (0)