-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include process information in metadata stanza when emiting events to…
… apm-server (#2272) * Include process information in metadata stanza when emiting events to apm-server * fix missing space * ensure process is available on mock apm server too * move ProcessInformation to API and implement a ToString() * add max length validation to process.title
- Loading branch information
Showing
4 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Licensed to Elasticsearch B.V under | ||
// one or more agreements. | ||
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information | ||
|
||
using System.Diagnostics; | ||
using Elastic.Apm.Api.Constraints; | ||
using Elastic.Apm.Helpers; | ||
|
||
namespace Elastic.Apm.Api; | ||
|
||
internal class ProcessInformation | ||
{ | ||
public int Pid { get; set; } | ||
|
||
[MaxLength] | ||
public string Title { get; set; } | ||
|
||
public static ProcessInformation Create() | ||
{ | ||
var p = Process.GetCurrentProcess(); | ||
return new ProcessInformation { Pid = p.Id, Title = p.ProcessName }; | ||
} | ||
|
||
public override string ToString() => new ToStringBuilder(nameof(Service)) | ||
{ | ||
{ nameof(Pid), Pid }, | ||
{ nameof(Title), Title } | ||
}.ToString(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters