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

Add new TCP metrics for Network integration on Windows #18294

Merged
merged 16 commits into from
Aug 23, 2024

Conversation

JakeYankovich
Copy link
Contributor

@JakeYankovich JakeYankovich commented Aug 9, 2024

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

Copy link

codecov bot commented Aug 9, 2024

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
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
Contributor 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
Copy link
Contributor

@iglendd iglendd left a comment

Choose a reason for hiding this comment

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

Looks good

Copy link
Contributor

@clarkb7 clarkb7 left a comment

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

@clarkb7 clarkb7 merged commit 5798c98 into master Aug 23, 2024
39 checks passed
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