Long process notification

Hi!

There are processes in a console application we log spans. How can I create an alert to get a notification if a process takes too long to complete?

I have the following example code.

        private static void Example(string label, int ms)
        {
            var trans = Agent.Tracer.StartTransaction(
                label,
                Elastic.Apm.Api.ApiConstants.TypeRequest);

            trans.CaptureSpan("Span", Elastic.Apm.Api.ApiConstants.ActionExec, () =>
            {
                Thread.Sleep(TimeSpan.FromMilliseconds(ms));  // do something
            });

            trans.End();
        }

The chart looks like this.

I want to catch a running process if it doesn't finish in 2 minutes or exceeds duration of 95 percent of executions by more than 2 times, for instance.

I appreciate if someone help me.

Hello Alex, thanks for logging in to ask - let me see if I can help.

Are you familiar with Kibana Alerting? See the docs here:

The Alerting Rules can send you notifications based on different types of thresholds and evaluations from the data ingested into your cluster.

The nuance being the data must be written into Elasticsearch to query against it... If you are capturing the process duration time metric, you can query against that field in the index. Perhaps, you could use the Metric Threshold Alert? See docs below:

Let us know if this doesn't meet your needs, please!

Hello, thanks for fast response!

I checked the links you sent. There is general info.

I created the following alerts with an email connector: Latency anomaly and Latency threshold. Seems, these alerts aren't designed for my case. I also don't understand alerts with queries using field names. I'm not sure which field I should use in this case. Would be great to see examples.

Could you please provide how-to tips of creating an alert for a long process duration?

Thanks in advance

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.