Giter VIP home page Giter VIP logo

opencensus-csharp's People

Contributors

aabmass avatar dnduffy avatar dtillman avatar ebbz avatar fhalim avatar marklonquist avatar meastp avatar miknoj avatar mirzamerdovic avatar ndrwrbgs avatar sandeshp avatar sergeykanzhelev avatar tags07 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

opencensus-csharp's Issues

Discuss: public API surface and interface usage

C# and .NET programming styles do not typically involve interface-for-everything approach.

We should have a discussion about it in opencensus and during separation of API and Impl (#8) ensure that interfaces are not overused

Should the concrete classes be hidden?

In the java source version, the concrete classes are created by AutoValue which, from my limited understanding, does not expose the concrete types. If we want to preserve that intention, then I'd propose our concrete classes (like BucketBoundaries, should not be sealed, but rather be static with just the Create method, and have private sealed implementation classes.

If the intention is to expose these concrete types (which may result in folks programming to those rather than the intended interfaces) then that's fine too - but at that point we may want to consider if we want to expose interfaces at all.

Counter type conversion inconsistency in Prometheus exporter

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'

Question about the spec statement on Context implementation

The spec statement about implementing the Context concept is

Languages that already have this support, like Go (context.Context) or C# (ExecutionContext), MUST use the language supported generic context instead of building their own.

Is there more info about a planned design in this direction? ExecutionContext doesn't seem great for extension, but I might be missing something.

https://docs.microsoft.com/en-us/dotnet/api/system.threading.executioncontext?view=netcore-2.0

Performance and benchmarking

  1. we should understand the performance of OC and fix bottlenecks if any
  2. we should make it easy to run and experiment (e.g. opencensus-java allows to run benchmarking as unit tests) - can we do it?

Configure the list of domains to not track

Eliminate this hardcode in auto-collector:

// TODO: this needs to be generalized
if (request.RequestUri.ToString().Contains("zipkin.azurewebsites.net"))
{
return;
}

I suggest as an initial implementation just have a custom sampler that will work per-request object before the main sampler like suggested here: https://github.com/rakyll/opencensus-specs/blob/7ae3810847d951ae79d0576afc3fd2cf0e020862/trace/HTTP.md#sampling

Add user-agent header in Stackdriver metrics and trace exporters

@simonz130

  1. In SD trace exporter in all the exported spans add an extra attribute:
    String AGENT_LABEL_KEY = "g.co/agent";
    String AGENT_LABEL_VALUE_STRING =
    "opencensus-csharp %LIB_VERSION%; stackdriver-exporter %EXPORTER_VERSION%"
  2. In SD monitoring exporter add the user-agent with the request:
    String USER_AGENT =
    "opencensus-csharp/%LIB_VERSION%"

Finalize prometheus exporter

There are only a few aggregation types currently supported by Prometheus exporter. Need to finalize all of them.

See

public PrometheusMetricValueBuilder WithValue(IAggregationData metric)
{
// TODO: review conversions
// counter, gauge, histogram, summary, or untyped
if (metric is ISumDataDouble doubleSum)
{
this.Value = doubleSum.Sum;
}
else if (metric is ISumDataLong longSum)
{
this.Value = longSum.Sum;
}
else if (metric is ICountData count)
{
this.Value = count.Count;
}
else if (metric is IMeanData mean)
{
// TODO: do more with this
this.Value = mean.Mean;
}
else if (metric is IDistributionData dist)
{
// TODO: do more with this
this.Value = dist.Mean;
}
else if (metric is ILastValueDataDouble lastDoubleValue)
{
this.Value = lastDoubleValue.LastValue;
}
else if (metric is ILastValueDataLong lastLongValue)
{
this.Value = lastLongValue.LastValue;
}
else if (metric is IAggregationData aggregationData)
{
// TODO: report an error
}
return this;
}
for list of TODOs

Timestamp, Clocks, TimestampConverter: are they needed

Clean up time-related contracts. Most of them came as a port from Java SDK. After reviewing it I think we need the following:

  • Timestamp class with nanosecond resolution. Make it struct. It should only used in SpanData as this resolution it only needed to be able to represent high-resolution clock - when you are importing data for instance, not to actually measure time in C# application. It may also be needed for stats Views, need more investigations.
  • IClock should be removed as it is only used to abstract away getNanos system call in Java. The only promise of IClock is to give the start time of a span and DateTimeOffset.Now can do it well.
  • TimesampConverter is needed as it is used to calculate latency with high precision using StopWatch from the startTime of the outermost span. All children spans and time events should the same instance of TimestampConverter to ensure the durations and position of time events is monotonic and precise. Theoretically we can use Stopwatch class instead of using this wrapper. The only benefit of a wrapper is that it will encapsulate both - start time and stopwatch to generate high-precision start time.

Remove or implement CurrentStatsState.set_Value

Motivation: Exposed API
User impact: Confusion

The Value property on an instance of CurrentStatsState exposes an empty set method. Either

  1. That property setter should call Set(StatsCollectionState state)
  2. That property setter should be removed
  3. That property setter should have modified visibility to hide it from consumers

Discuss releases schedule

This is the issue to collect feedback on releases schedule for this repository. Current thinking is to schedule releases like one beta every month and stable version twice a year. Basically calendar-based, not feature based.

We will also align marking SDK 1.0 with other repositories.

Allow spans from the past

As described in #92 - there are cases when you might need to report a span from the past. In that PR Redis library calls are recorded asynchronously. My guess why this API was chosen to expose Redis calls is extreme care of those calls latency.

Current API is quite limiting in this sense.

  1. ISpan doesn't allow to set start and end timestamps explicitly. Same for time events like annotations. Expanding ISpan interface may create some confusions.
  2. Alternative is to report SpanData directly. This approach can be problematic as a lot of logic like calling start/stop handler and sampling needs to be replicated manually.
  3. Another alternative is to either create custom Redis implementation of ISpan or make ISpan constructible from SpanData. I like this last approach. Not sure what may be the problems here.

Code clean up

  • Namespaces should not contain vendor name and should be aligned with Java OC
  • unused usings
  • commented code
  • remove AsyncLocal OnChange subscription
  • code style checks
  • latest C# features: expression-bodied props, etc...
  • empty lines
  • sln project
  • gitignore
  • readme
  • making the enums pascal cased

Add .net 4.5 target for abstractions and implementation

Currently opencensus targets 4.6 and netstandard 2.0.
.NET 4.5 is not officially supported by Microsoft, but still is very popular.

Caveat: AsyncLocal is not available on .NET 4.5.

Here is the code that System.Diagnostics.Activity uses instead. Note what it does to avoid cross AppDomain calls issues.

Prometheus exporter: allow to work via the application's port

In some environments opening separate port for Prometheus exporter will not work. Especially for sandboxed environments like Azure Web Apps. Re-using app's port and allow Prometheus to work as a middleware will help to enable those environments.

Prometheus exporter not listening on all addresses

I am assuming this should work but it doesnt listen on anything related to port 9184 then, if I change it to localhost instead of 0.0.0.0 then it works. Is it a bug or intentional?

var exporter = new PrometheusExporter(
new PrometheusExporterOptions()
{
    Url = new Uri("http://0.0.0.0:9184/metrics/")
},
Stats.ViewManager);

exporter.Start();

EF Core support

Hi, is there a timeline for support for EF core and psql/mysql/mssql?

Improve performance of CurrentStatsState

Motivation: Performance
User impact: None/Hypothetical

Oops, that wasn't meant to make it in as-is, mostly just to demonstrate the problem with the test :)

RE: #29, a lock is being taken for every read. We should investigate alternative methods as the type has the concurrency properties of being unlikely to be written to frequently (in fact, it's disallowed) and being likely to be read more than it is written. Perhaps ReaderWriterLock would be sufficient here.

Change span.Kind API to make sure it set early

Span.Kind should be set early to allow correct metrics calculation. This should be reflected in API design - getter/setter pattern may not be ideal here. Consider requiring span Kind in constructor or Create method.

One of ApplicationInsights tests blocks CI

Hi,

Thank you for working on this project. I tried to get latest beta build from MyGet today (i am particularly interested in #109) and realized that CI is red from the end of January.

Failing test is OpenCensus.Exporter.ApplicationInsights.Tests.OpenCensusTelemetryConverterTests.OpenCensusTelemetryConverterTests_TracksRequestWithAnnotations which fails on Assert.NonEqual. I do not have enough knowledge to understand why it fails.

Thanks.

Proper pattern matching implementation for AttributeValue

This repository uses pattern matching with some errors:

The purpose of Match method is to avoid if/else checks by supplying set of callbacks to call. And each implementation calls respective callback. Something like a virtual methods in generic class, but strongly typed for pre-defined types.

Issues:

  1. AttributeValue uses if/else instead of having separate classes with the hardcoded implementation of a Match method which will call the proper callback:

    public override TReturn Match<TReturn>(
    Func<string, TReturn> stringFunction,
    Func<bool, TReturn> booleanFunction,
    Func<long, TReturn> longFunction,
    Func<double, TReturn> doubleFunction,
    Func<object, TReturn> defaultFunction)
    {
    if (typeof(T) == typeof(string))
    {
    string value = this.Value as string;
    return stringFunction(value);
    }
    else if (typeof(T) == typeof(long))
    {
    long val = (long)(object)this.Value;
    return longFunction(val);
    }
    else if (typeof(T) == typeof(bool))
    {
    bool val = (bool)(object)this.Value;
    return booleanFunction(val);
    }
    else if (typeof(T) == typeof(double))
    {
    double val = (double)(object)this.Value;
    return doubleFunction(val);
    }
    return defaultFunction(this.Value);
    }

  2. There is no need to expose type-specific results in factory methods AttributeValue.StringAttributeValue. Simply returning IAttributeValue should suffice. So generic IAttributeValue<T> interface is not needed.

  3. Implementation of IAttributeValue is trivial and there is no need to have interface and implementation separately - simple implementation class will suffice.

Configure CI

Let's try to start with CircleCI to align with other repos.

Setup via DependencyInjection

Can impl package depend on Ms.Extensions.DependencyInjection? It should be just fine for .NET Core apps.

In this case TraceComponent could be removed completely

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.