public VostokApplicationMetrics(IMetricContext root, IVostokApplicationIdentity identity)
 {
     Root       = root;
     Project    = Root.WithTag(WellKnownApplicationIdentityProperties.Project, identity.Project);
     Subproject = identity.Subproject == null
         ? Project
         : Project.WithTag(WellKnownApplicationIdentityProperties.Subproject, identity.Subproject);
     Environment = Subproject.WithTag(WellKnownApplicationIdentityProperties.Environment, identity.Environment);
     Application = Environment.WithTag(WellKnownApplicationIdentityProperties.Application, identity.Application);
     Instance    = Application.WithTag(WellKnownApplicationIdentityProperties.Instance, identity.Instance);
 }
示例#2
0
        public VostokApplicationMetrics(IMetricContext root, IVostokApplicationIdentity identity)
        {
            Root       = root;
            Project    = Root.WithTag(WellKnownApplicationIdentityProperties.Project, identity.Project);
            Subproject = identity.Subproject == null
                ? Project
                : Project.WithTag(WellKnownApplicationIdentityProperties.Subproject, identity.Subproject);
            Environment = Subproject.WithTag(WellKnownApplicationIdentityProperties.Environment, identity.Environment);
            Application = Environment.WithTag(WellKnownApplicationIdentityProperties.Application, identity.Application);

            var instance = identity.Instance;

            if (string.Equals(instance, EnvironmentInfo.Host, StringComparison.InvariantCultureIgnoreCase))
            {
                instance = instance.ToLowerInvariant();
            }
            Instance = Application.WithTag(WellKnownApplicationIdentityProperties.Instance, instance);
        }