Skip to content

Add new TCP metrics for Network integration on Windows#18294

Merged
clarkb7 merged 16 commits into
masterfrom
jake.yankovich/win-tcp-metrics
Aug 23, 2024
Merged

Add new TCP metrics for Network integration on Windows#18294
clarkb7 merged 16 commits into
masterfrom
jake.yankovich/win-tcp-metrics

Conversation

@JakeYankovich

@JakeYankovich JakeYankovich commented Aug 9, 2024

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds new system.net.tcp4.*, system.net.tcp6.*, and system.net.tcp.* metrics using Microsoft's "GetTcpStatisticsEx":
https://learn.microsoft.com/en-us/windows/win32/api/tcpmib/ns-tcpmib-mib_tcpstats2#members

Motivation

https://datadoghq.atlassian.net/browse/FRAGENT-2770
https://datadoghq.atlassian.net/browse/FRAGENT-2953

Additional Notes

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Changelog entries must be created for modifications to shipped code
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

@codecov

codecov Bot commented Aug 9, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 95.31250% with 3 lines in your changes missing coverage. Please review.

Project coverage is 88.76%. Comparing base (0cf0d84) to head (eb41515).
Report is 4 commits behind head on master.

Additional details and impacted files
Flag Coverage Δ
activemq ?
cassandra ?
gearmand ?
hive ?
hivemq ?
hudi ?
ignite ?
jboss_wildfly ?
kafka ?
network 93.64% <93.75%> (+1.07%) ⬆️
presto ?
solr ?

Flags with carried forward coverage won't be shown. Click here to find out more.

@JakeYankovich
JakeYankovich marked this pull request as ready for review August 12, 2024 22:53
@JakeYankovich
JakeYankovich requested review from a team as code owners August 12, 2024 22:53
Comment on lines +145 to 157
if 'tcp4' in proto_dict and 'tcp6' in proto_dict:
for fieldname, _ in tcpAllstats._fields_:
tcp_sum = getattr(proto_dict['tcp4'], fieldname) + getattr(proto_dict['tcp6'], fieldname)
setattr(tcpAllstats, fieldname, tcp_sum)
proto_dict["tcp"] = tcpAllstats

for proto, stats in proto_dict.items():
for fieldname in tcpstats_dict:
fieldvalue = getattr(stats, fieldname)
metric_name = "system.net." + str(proto) + tcpstats_dict[fieldname]
self.submit_netmetric(metric_name, fieldvalue, tags)

def _parse_protocol_psutil(self, conn):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this what Linux implementation has. Metrics for tcp4, tcp6 and just tcp?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The linux implementation only submits the combined value for these metrics. The tcp4 and tcp6 metrics added by this change are not available on the linux implementation

@shanelhuang
shanelhuang requested a review from iglendd August 22, 2024 13:14
iglendd
iglendd previously approved these changes Aug 22, 2024

@iglendd iglendd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good

@clarkb7 clarkb7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

for consistency with other metrics
TCP4 -> TCP IPv4
TCP6 -> TCP IPv6

Comment thread network/metadata.csv Outdated
Comment thread network/metadata.csv Outdated
Comment thread network/metadata.csv Outdated
@clarkb7
clarkb7 merged commit 5798c98 into master Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants