Beispiel #1
0
        public void ShouldPublishGateTimingMetricForAllOperations()
        {
            var  gateName      = "Gate";
            var  operationName = "Operation";
            long milliseconds  = 15;
            var  clock         = MockClock(milliseconds);
            var  StatsdClient  = MockRepository.GenerateStub <IStatsd>();
            var  payload       = new InstrumentationPayload {
                GateName  = gateName,
                Operation = operationName,
            };

            var Instrumenter = new StatsdInstrumenter(StatsdClient, clock);
            var token        = Instrumenter.InstrumentGate(payload);

            token.Dispose();

            StatsdClient.AssertWasCalled(x => x.LogTiming(string.Format("flipper.gate_operation.{0}.{1}", gateName, operationName), milliseconds));
        }
Beispiel #2
0
        public void ShouldPublishGateCountMetricForIsOpenOperation(bool isEnabled, string status)
        {
            var featureName   = "Feature";
            var gateName      = "Gate";
            var operationName = "open?";
            var StatsdClient  = MockRepository.GenerateStub <IStatsd>();
            var payload       = new InstrumentationPayload {
                FeatureName = featureName,
                GateName    = gateName,
                Operation   = operationName,
                Result      = isEnabled,
            };

            var Instrumenter = new StatsdInstrumenter(StatsdClient);
            var token        = Instrumenter.InstrumentGate(payload);

            token.Dispose();

            StatsdClient.AssertWasCalled(x => x.LogCount(string.Format("flipper.feature.{0}.gate.{1}.{2}", featureName, gateName, status)));
        }