Exemplo n.º 1
0
        /// <summary>
        /// Generates the phase metrics result for inclusion in the output json.
        /// </summary>
        /// <param name="entry">The entry.</param>
        /// <returns>System.Object.</returns>
        private IResponseItem GeneratePhaseResult(ApolloMetricsEntry entry)
        {
            var dictionary = new ResponseFieldSet();

            dictionary.AddSingleValue("startOffset", entry.StartOffsetNanoseconds);
            dictionary.AddSingleValue("duration", entry.DurationNanoSeconds);
            return(dictionary);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Marks the start of the given phase. THe metrics package should make note of this to determine
        /// total duration of the phase if desired.
        /// </summary>
        /// <param name="phase">The phase to begin.</param>
        public virtual void StartPhase(string phase)
        {
            var phaseEntry = new ApolloMetricsEntry();

            phaseEntry.StartOffsetTicks = _watch.ElapsedTicks;

            _phaseEntries.TryAdd(phase, phaseEntry);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Marks the start of a single resolver attempting to generate data according to its own specifications.
        /// </summary>
        /// <param name="context">The context outlining the resolution that is taking place.</param>
        public virtual void BeginFieldResolution(GraphFieldExecutionContext context)
        {
            var startTime = _watch.ElapsedTicks;
            var entry     = new ApolloMetricsEntry()
            {
                StartOffsetTicks = startTime,
            };

            _resolverEntries.TryAdd(context, entry);
        }