Skip to content

Conversation

@oleiade
Copy link
Contributor

@oleiade oleiade commented Sep 23, 2025

What?

This pull request adds comprehensive documentation for the new k6/x/dns extension module, which enables DNS resolution testing in k6. The documentation introduces the module, details its API, provides usage examples, explains error handling, and describes the metrics generated. The changes are organized into three new documentation pages: an overview, and detailed pages for the resolve and lookup functions.

New documentation for the DNS extension:

Overview and Introduction

  • Adds docs/sources/k6/next/javascript-api/k6-x-dns/_index.md with an overview of the k6/x/dns module, its key features, use cases, API summary, available metrics, and practical code examples for DNS testing scenarios.

API Reference and Usage Details

  • Adds docs/sources/k6/next/javascript-api/k6-x-dns/resolve.md with detailed documentation for the dns.resolve() function, including parameters, return values, usage examples (A and AAAA record resolution, multiple DNS servers, performance comparison), error handling, metrics, and important notes on usage.
  • Adds docs/sources/k6/next/javascript-api/k6-x-dns/lookup.md with detailed documentation for the dns.lookup() function, including parameters, return values, usage examples (basic lookup, comparison with custom DNS, load testing, configuration validation), error handling, metrics, and usage notes.

Checklist

  • I have used a meaningful title for the PR.
  • I have described the changes I've made in the "What?" section above.
  • I have performed a self-review of my changes.
  • I have run the npm start command locally and verified that the changes look good.
  • I have made my changes in the docs/sources/k6/next folder of the documentation.

Related PR(s)/Issue(s)

@github-actions
Copy link
Contributor

@github-actions
Copy link
Contributor

github-actions bot commented Oct 20, 2025

💻 Deploy preview available (docs: add comprehensive k6/x/dns extension documentation):

- Add complete documentation for k6/x/dns module with _index.md overview
- Create resolve.md documenting dns.resolve() function with parameters, examples, and error handling
- Create lookup.md documenting dns.lookup() function for system DNS resolution
- Include installation instructions, API reference, and metrics documentation
- Add comprehensive examples for IPv4/IPv6 resolution, performance testing, and validation
- Use IPv6 DNS server (2606:4700:4700::1111) in IPv6 examples for consistency
- Replace check() usage with k6-jslib-testing expect() assertions throughout examples
- Follow k6 documentation conventions matching existing API documentation structure
@oleiade oleiade self-assigned this Oct 20, 2025
@oleiade oleiade marked this pull request as ready for review October 20, 2025 13:18
@oleiade oleiade requested review from a team and heitortsergent as code owners October 20, 2025 13:18
@oleiade oleiade requested review from ankur22, codebien and joanlopez and removed request for a team and ankur22 October 20, 2025 13:18
Copy link
Collaborator

@heitortsergent heitortsergent left a comment

Choose a reason for hiding this comment

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

Thanks for creating these docs @oleiade 🙇 .

A lot of my comments are just removing the code shortcode, we only need them for tabbed code samples.

You can also replace some of the <!-- md-k6:skip --> statements and just add a <!-- md-k6:skipall --> at the top of the page. I'm happy to make that change if you want to, just let me know. 🙇

@@ -0,0 +1,30 @@
# Repository Guidelines
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is really helpful @oleiade! I just added the AGENTS.md file with the instructions we have for general technical writing guidance in a previous PR, but maybe we can merge them together?

weight: 11
---

# DNS
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# DNS
# k6/x/dns

We usually keep the title and the H1 heading the same.


{{< docs/shared source="k6" lookup="extension.md" version="<K6_VERSION>" >}}

The `k6/x/dns` modul enables DNS resolution testing in k6, allowing you to resolve DNS names to IP addresses using custom DNS servers or the system's default DNS configuration. This module is particularly useful for testing DNS server performance, validating DNS configurations, and incorporating DNS resolution into your load testing scenarios.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The `k6/x/dns` modul enables DNS resolution testing in k6, allowing you to resolve DNS names to IP addresses using custom DNS servers or the system's default DNS configuration. This module is particularly useful for testing DNS server performance, validating DNS configurations, and incorporating DNS resolution into your load testing scenarios.
The `k6/x/dns` module enables DNS resolution testing in k6, allowing you to resolve DNS names to IP addresses using custom DNS servers or the system's default DNS configuration. This module is useful for testing DNS server performance, validating DNS configurations, and incorporating DNS resolution into your load testing scenarios.


### Basic DNS resolution with custom server

{{< code >}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
{{< code >}}

}
```

{{< /code >}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
{{< /code >}}

- DNS server unreachable or timeout
- DNS server returns an error response

{{< code >}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
{{< code >}}

}
```

{{< /code >}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
{{< /code >}}


These metrics help you monitor DNS performance and identify potential bottlenecks in your testing scenarios.

## Notes on Usage
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
## Notes on Usage
## Best practices

Comment on lines +178 to +181
- **Nameserver format**: Always specify the port number (typically 53 for DNS) in the nameserver parameter
- **Record type support**: Currently supports "A" and "AAAA" record types; additional types may be added in future versions
- **Timeout behavior**: DNS queries have built-in timeouts; consider this when designing load tests
- **Load testing**: Use multiple VUs and iterations to properly test DNS server performance under load
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- **Nameserver format**: Always specify the port number (typically 53 for DNS) in the nameserver parameter
- **Record type support**: Currently supports "A" and "AAAA" record types; additional types may be added in future versions
- **Timeout behavior**: DNS queries have built-in timeouts; consider this when designing load tests
- **Load testing**: Use multiple VUs and iterations to properly test DNS server performance under load
- **Nameserver format**: Always specify the port number, typically 53 for DNS, in the nameserver parameter.
- **Timeout behavior**: DNS queries have built-in timeouts; consider this when designing load tests.
- **Load testing**: Use multiple VUs and iterations to properly test DNS server performance under load.

The supported record types are already listed in the table above, so I think we can remove it from here.


{{< admonition type="note">}}

This module is implemented as an official extension and is available natively in k6, requiring no additional installation or build steps thanks to native extensions support. See the [extensions documentation](/docs/k6/<K6_VERSION>/extensions/explore) for available extensions and details.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
This module is implemented as an official extension and is available natively in k6, requiring no additional installation or build steps thanks to native extensions support. See the [extensions documentation](/docs/k6/<K6_VERSION>/extensions/explore) for available extensions and details.
This module is implemented as an official extension and is available natively in k6, requiring no additional installation or build steps. Refer to the [extensions documentation](/docs/k6/<K6_VERSION>/extensions/explore) for available extensions and details.

@heitortsergent heitortsergent self-assigned this Oct 27, 2025
@heitortsergent heitortsergent added the Area:extensions Issues about the extension ecosystem label Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area:extensions Issues about the extension ecosystem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants