ve-global / ve-metrics-statsdclient-csharp

Wrappers and utilities for VE statsd infrastructure
MIT License
2 stars 7 forks source link

add attribute formatting for better stats #9

Closed turowicz closed 8 years ago

turowicz commented 8 years ago

Enables to write code like this:

public class FooService : IFooService
{
    [StatsDCounting("dependencies.{type}.{method}")]
    [StatsDTiming("dependencies.{type}.{method}")]
    public void TrackedFormattedMethod()
    {
    }

    [StatsDCounting("dependencies.{generic}")]
    [StatsDTiming("dependencies.{generic}")]
    public T TrackedGenericMethod<T>()
    {
        return default(T);
    }
}
turowicz commented 8 years ago

@andyroyle tell me what you think

turowicz commented 8 years ago

I only really need the generic part, so if you think performance is at risk, we can remove the type and method bits.

andyroyle commented 8 years ago

it's not really a huge performance hit. Yes it's reflection, but we're already doing some reflection to get the method attributes, so it's not a huge extra hit.

Looks good to me dude!

👍