Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple processes metrics #7200

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

piotrkryger
Copy link

Summary

This PR covers functionality requested in #2761 :

  • AllowMultipleProcessesMetrics configuration flag was added; it allows to return metrics from multiple processes via /metrics endpoint. By default its value is false and /metrics endpoint behaves as currently: when multiple processes match default process filters, no data is returned. When set to true, /metrics endpoint can return metrics of multiple processes, and:
    • all metrics returned by /metrics endpoint will contain additional labels: process_name and process_id. Those labels identify process which is the source of given metric
    • process_name label returns name of app pool for IIS processes (that is, when system process name is w3wp) and "regular" system process name for other processes
Release Notes Entry

Added option to track metrics of multiple processes via /metrics endpoint

@piotrkryger
Copy link
Author

@dotnet-policy-service agree

try
{
DiagProcessFilter filter = DiagProcessFilter.FromConfiguration(_processFilterMonitor.CurrentValue);
IEnumerable<IProcessInfo> processes = await _services.GetProcessesAsync(filter, stoppingToken);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll need a separate filter for processes we monitor vs. processes we collect metrics for.


foreach (var completed in allCompleted)
{
_store.RemoveMetricsForPid(completed.ProcessId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than keeping a list of tasks and checking their results, you could create continuations to StartMetricsPipelineForProcess that remove the pid from a set and remove the metrics from the store.

{
return new Dictionary<string, string>()
{
{ "process_id", process.EndpointInfo.ProcessId.ToString() },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These will likely need to be configurable

@wiktork
Copy link
Member

wiktork commented Aug 27, 2024

Thank you for your contribution. I put some initial feedback in the PR, but please hold off on additional changes until we figure out some of these design points:

  • Should we support multiple metrics on connect mode
  • Configuration options: allow the same level of configurability but across N processes or keep all options the same.
  • How do we extract a meaningful process name? Ideally we don't need specific understanding of w3wp or dotnet.

@piotrkryger
Copy link
Author

Thank you for your feedback. I'll wait for your decisions.

(...)

  • How do we extract a meaningful process name? Ideally we don't need specific understanding of w3wp or dotnet.

I suppose some extensibility for "process label factory" could be introduced, similarly to egress extensibility model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants