﻿using System.Net;
using Criteo.Profiling.Tracing.Annotation;

namespace Criteo.Profiling.Tracing
{

    /// <summary>
    /// Factory for annotations
    /// </summary>
    public static class Annotations
    {

        public static IAnnotation ClientRecv()
        {
            return new ClientRecv();
        }

        public static IAnnotation ClientSend()
        {
            return new ClientSend();
        }

        public static IAnnotation ServerRecv()
        {
            return new ServerRecv();
        }

        public static IAnnotation ServerSend()
        {
            return new ServerSend();
        }

        public static IAnnotation Rpc(string name)
        {
            return new Rpc(name);
        }

        public static IAnnotation ServiceName(string name)
        {
            return new ServiceName(name);
        }

        public static IAnnotation LocalAddr(IPEndPoint endPoint)
        {
            return new LocalAddr(endPoint);
        }

        public static IAnnotation Binary(string key, object value)
        {
            return new BinaryAnnotation(key, value);
        }

        public static IAnnotation Event(string name)
        {
            return new Event(name);
        }

    }
}

﻿using System.Net;
using Criteo.Profiling.Tracing.Annotation;

namespace Criteo.Profiling.Tracing
{

    /// <summary>
    /// Factory for annotations
    /// </summary>
    public static class Annotations
    {
        private static readonly IAnnotation AnnClientReceive = new ClientRecv();
        private static readonly IAnnotation AnnClientSend = new ClientSend();
        private static readonly IAnnotation AnnServerReceive = new ServerRecv();
        private static readonly IAnnotation AnnServerSend = new ServerSend();

        public static IAnnotation ClientRecv()
        {
            return AnnClientReceive;
        }

        public static IAnnotation ClientSend()
        {
            return AnnClientSend;
        }

        public static IAnnotation ServerRecv()
        {
            return AnnServerReceive;
        }

        public static IAnnotation ServerSend()
        {
            return AnnServerSend;
        }

        public static IAnnotation Rpc(string name)
        {
            return new Rpc(name);
        }

        public static IAnnotation ServiceName(string name)
        {
            return new ServiceName(name);
        }

        public static IAnnotation LocalAddr(IPEndPoint endPoint)
        {
            return new LocalAddr(endPoint);
        }

        public static IAnnotation Binary(string key, object value)
        {
            return new BinaryAnnotation(key, value);
        }

        public static IAnnotation Event(string name)
        {
            return new Event(name);
        }

    }
}

Remove unnecessary object creation of IAnnotation
Remove unnecessary object creation of IAnnotation

Change-Id: Iac7a22031d737acb1fef3c86b0297a65e06ec002
JIRA: CSI-1181
