Git Product home page Git Product logo

open-telemetry / opentelemetry-dotnet Goto Github PK

View Code? Open in Web Editor NEW
3.0K 64.0 718.0 15.24 MB

The OpenTelemetry .NET Client

Home Page: https://opentelemetry.io

License: Apache License 2.0

C# 99.56% Batchfile 0.01% Python 0.13% PowerShell 0.18% Dockerfile 0.06% Shell 0.04% HTML 0.01% JavaScript 0.01%
telemetry distributed-tracing asp-net-core metrics asp-net opentelemetry netcore instrumentation-libraries ilogger iloggerprovider

opentelemetry-dotnet's Introduction

OpenTelemetry .NET

Slack codecov.io Nuget NuGet Build

The .NET OpenTelemetry client.

Supported .NET Versions

Packages shipped from this repository generally support all the officially supported versions of .NET and .NET Framework (an older Windows-based .NET implementation), except .NET Framework 3.5. Any exceptions to this are noted in the individual README.md files.

Project Status

Stable across all 3 signals i.e. Logs, Metrics, and Traces.

See Spec Compliance Matrix to understand which portions of the specification has been implemented in this repo.

Getting Started

If you are new here, please read the getting started docs:

This repository includes multiple installable components, available on NuGet. Each component has its individual README.md file, which covers the instruction on how to install and how to get started. To find all the available components, please take a look at the src folder.

Here are the most commonly used components:

Here are the instrumentation libraries:

Here are the exporter libraries:

See the OpenTelemetry registry and OpenTelemetry .NET Contrib repo for more components.

Troubleshooting

See Troubleshooting. Additionally check readme file for the individual components for any additional troubleshooting information.

Extensibility

OpenTelemetry .NET is designed to be extensible. Here are the most common extension scenarios:

Contributing

See CONTRIBUTING.md

We meet weekly on Tuesdays, and the time of the meeting alternates between 9AM PT and 4PM PT. The meeting is subject to change depending on contributors' availability. Check the OpenTelemetry community calendar for specific dates and for Zoom meeting links.

Meeting notes are available as a public Google doc. If you have trouble accessing the doc, please get in touch on Slack.

The meeting is open for all to join. We invite everyone to join our meeting, regardless of your experience level. Whether you're a seasoned OpenTelemetry developer, just starting your journey, or simply curious about the work we do, you're more than welcome to participate!

Maintainers (@open-telemetry/dotnet-maintainers):

Approvers (@open-telemetry/dotnet-approvers):

Triagers (@open-telemetry/dotnet-triagers):

Emeritus Maintainer/Approver/Triager:

Thanks to all the people who have contributed

contributors

Release Schedule

See the project milestones for details on upcoming releases. The dates and features described in issues and milestones are estimates, and subject to change.

See the release notes for existing releases.

Caution

Certain components, marked as pre-release, are still work in progress and can undergo breaking changes before stable release. Check the individual README.md file for each component to understand its current state.

Daily builds from this repo are published to MyGet, and can be installed from this source.

opentelemetry-dotnet's People

Contributors

alanwest avatar austin-tan avatar bruno-garcia avatar cijothomas avatar codeblanch avatar dependabot[bot] avatar eddynaka avatar jarosal avatar joaopgrassi avatar kielek avatar mbakalov avatar mfogliatto avatar mic-max avatar mikegoldsmith avatar ngruson avatar pcwiese avatar pellared avatar pjanotti avatar rajkumar-rangaraj avatar reyang avatar sergeykanzhelev avatar thomsontan avatar tillig avatar timothymothra avatar trwegner avatar utpilla avatar vishweshbankwar avatar xiang17 avatar yun-ting avatar z1c0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opentelemetry-dotnet's Issues

Namespaces

I think it'd make sense to agree on what namespaces the project should use.

#1 seems to be the way to go, and if #3 gets merged we'll end up with OpenCensus in the repo.

Suggestion 1:

  • We just rename every OpenCencus namespace to OpenTelemetry.

Any other ideas?

Make list of support generic diagnostc listeners configurable

DependencyCollector now has a hardcoded list of supported dependencies (http only for now):

namespace OpenCensus.Collector.Dependencies{
       // ...
       public DependenciesCollector(DependenciesCollectorOptions options, ITracer tracer, ISampler sampler, IPropagationComponent propagationComponent)
        {
            this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber(
                new Dictionary<string, Func<ITracer, Func<HttpRequestMessage, ISampler>, ListenerHandler>>()
                {
                    { "HttpHandlerDiagnosticListener", (t, s) => new HttpHandlerDiagnosticListener(t, s, propagationComponent) } ,
                   // e.g. how do I add { "Microsoft.Azure.Sdk", (t, s) => new AzureSdkListener(t, sampler) }
                },
                tracer,
                x =>  {... });
            this.diagnosticSourceSubscriber.Subscribe();
        }

We should allow configuring generic sources by name and allowing to provide custom handlers.
This could be done via DependenciesCollectorOptions.

This is also useful when users need to remove default collectors.

API: Use TraceId and SpanId from System.Diagnostics.DiagnosticSource

Use ActivityTraceId and ActivitySpanId instead of the library-own definition of TraceId and SpanId. https://github.com/dotnet/corefx/blob/5f9f2e57e668fccbc68e8f9c77852b2befef7712/src/System.Diagnostics.DiagnosticSource/src/System/Diagnostics/Activity.cs#L881-L1197

The only complication will be the need to take dependeny on DiagnosticsSource package that will only become stable in September. But it is aligned reasonably well with our schedule

Allow to implement specific component listeners leveraging ListenerHandler

From: census-instrumentation/opencensus-csharp#129

When someone wants to implement a new listener for the component we don't support out of the box, they should be able to leverage DiagnosticListener subscription, and perhaps property fetching.

The first step could be making OpenCensus.Collector.Dependencies.Common.ListenerHandler public.

One scenario for this feature: I'm implementing DiagnosticSource instrumentation for my component and want to test out how it will work with OpenCensus.

Counter type conversion inconsistency in Prometheus exporter

Original: census-instrumentation/opencensus-csharp#59

hi, there.
I'm trying to use your library. Thank you for it.

So, I found some inconsistency in the implementation of exporters.
Namely, 'Sum' aggregation in case of Prometheus converted to 'gauge', in case of StackDriver to CUMULATIVE, which is 'counter'.

The fun is that neither of both is totally right.
'Sum' can represent either 'counter' or 'gauge'. For instance, when we count peers or users currently online it is very convenient to use 'Sum' and, in this case, it should be converted to 'gauge' by all exporters because value can go up and down
The second case, when we count the amount of data sent. When we have just buffer length it is very convenient to use 'Sum', but in this case, a value will only grow and measure should be converted to 'counter'

So, I would propose to add a second type for 'Sum' aggregation. first will be converted to 'gauge' second to 'counter'

Revisit naming of API and SDK packages

We discussed naming in #5. We may need to revisit it:

  1. Abstraction package have only a subset of classes and interfaces used in SDK. So not really an abstraction. Perhaps rename it to Api instead for consistency with Java?
  2. Should we rename OpenTelemetry to OpenTelemetry.Sdk? It will be consistent with Java. But harder for end user to follow the success path of "import OpenTelemetry" and you all set.

Let's discuss naming here

API: Use Activity as a context propagation mechanism

Activity from DiagnosticsSource package is already used to propagate a context. Activity is being set and restore by the framework so OpenTelemetry can rely on it.

It will be great to switch OpenTelemetry to use Activity as a way to propagate state (current Span, SpanContext and tags) instead of simply relying on AsyncLocal

Capture custom request/response properties

Original: census-instrumentation/opencensus-csharp#130

The scenario:

Azure APIs return server request is in HTTP response headers and we want to put it on the span created to trace this http call.
We may argue the validity of this scenario and this might change in the future with W3C adoption, current support processes rely on this.

Also, this scenario of enhancing telemetry based on arbitrary request properties is popular among ApplicationInsights users.

While HttpClient instrumentation with DiagnosticSource allows it easily (you have the whole response object), Http listener in opencensus does not capture anything custom and does not provide extensibility points.

We have several options here

  1. Keep it as is. Ask users/library owners to implement Http listeners on their own which just enhance current span. This approach requires deep knowledge of DiagnosticSource, error-prone and extremely inefficient. It also requires special configurations done by users.
    This is a viable workaround for now.

  2. Provide hooks through DependenciesCollectorOptions like

class DependenciesCollectorOptions
{
  //...
 public  Action<HttpRequestMessage request, HttpResponseMessage response, Span span> EnhanceSpan;
}
  1. Provide a way to disable automatic instrumentation for certain calls that require special treatment and ask users/libraries to implement instrumentation themselves with OpenCensus or DiagnosticSource.
  • Provide configuration (e.g. for certain HTTP Url do not instrument). The problem of this approach is that by default 2 spans are collected and headers are injected twice. Only when a proper configuration is applied, we have something working. It's also quite inefficient and hard to configure
  • It might be possible to auto-detect the presence of another instrumentation, but it would require setting some additional tags on the Activity OR attributes on Span OR both because so far we can have any of them :( So we'll need to implement another AsyncLocal which first instrumentation will lock and the next one would not run is detects this 'lock'.

Any of above requires someone to reimplement the whole HTTP instrumentation to do something as simple as reading one custom header. And custom instrumentations would be error prone and likely would not produce high-quality data.

So I believe
(1) is workaround
(2) is a possible solution, but we might want to spend time designing better API

Prometheus exporter outputs values of invalid format under certain culture settings

Original: census-instrumentation/opencensus-csharp#143

When running the sample for Prometheus (TestPrometheus.cs) Prometheus server reports invalid data format in:

# HELP my_org_views_video_sizeprocessed video size over time
my_org_views_video_size{my_org_keys_frontend="mobile-ios9.3.5"} 173189802,666667 1555493470457

Culture setting for my machine is pl-PL. Apparently there's a problem with a comma which separates decimal places of the value. The source of the problem is writing a double value by StreamWriter.Write(double) in PrometheusMetricBuilder.Write, which applies national settings. I suppose this should be replaced by something like:

writer.Write(m.Value.ToString("G", CultureInfo.InvariantCulture));

Closing spans in diagnostic listeners

Hi,

I'm recently implementing OpenCensus in the CMS-type application our company is developing. Beside using listeners for incoming and outgoing HTTP connections, provided in OpenCensus.Collector.AspNetCore and OpenCensus.Collector.Dependencies packages, I've reused the same pattern for DiagnosticSources our code is instrumented with.

I have some doubts with regards to my understanding of the way in which collectors/listeners plug into span hierarchy. In these two files:

https://github.com/census-instrumentation/opencensus-csharp/blob/develop/src/OpenCensus.Collector.AspNetCore/Implementation/HttpInListener.cs
https://githhub.com/census-instrumentation/opencensus-csharp/blob/develop/src/OpenCensus.Collector.Dependencies/Implementation/HttpHandlerDiagnosticListener.cs

OnStopActivity handler closes active span by calling its End method. This however does not change Tracer.CurrentSpan, and therefore next started span becomes a child span of the closed one, instead of a following. Current span is correctly reset when IScope instance produced by SpanBuilder.StartScopedSpan is disposed (which I did in my own listener, adding an async local stack of scopes).

Is here some thought I don't understand or mechanism I don't see? I can understand that for incoming HTTP requests resetting Tracer.CurrentSpan may be not important, because they are top level in a (local) trace, but for outgoing connections correct setting of CurrentSpan seems to me important.

Cheers,
Jacek

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.