Skip to content

Conversation

oschaaf
Copy link
Member

@oschaaf oschaaf commented Mar 2, 2021

This captures something I used and for which I had to dig a bit in
the codebase to get it set up. Stashing it here may help others and
lower the bar for consumption.

I anticipate there may be more examples like this that we could
add over time. So ideally this PR will be assessed both on structure
of the initiative (/examples) and contents (MULTIPLE_ENDPOINTS.md)

Signed-off-by: Otto van der Schaaf ovanders@redhat.com

This captures something I used and for which I had to dig a bit in
the codebase to get it set up. Stashing it here may help others and
lower the bar for consumption.

I anticipate there may be more examples like this that we could
add over time. So ideally this PR will be assessed both on structure
of the initiative (/examples) and contents (MULTIPLE_ENDPOINTS.md)

Signed-off-by: Otto van der Schaaf <ovanders@redhat.com>
@oschaaf oschaaf added the waiting-for-review A PR waiting for a review. label Mar 2, 2021

## Configuring the CLI

Below is a CLI examples which will consume the traffic profile created above, and send it to multiple endpoints.
Copy link
Contributor

Choose a reason for hiding this comment

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

example - shouldn't be plural here


## Description

Below is an example which will send requests to two endpoints `127.0.0.1:80` and `127.0.0.2:80`, while alternating over two request headers, which contain different paths and hosts.
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend making explicit references to what features are being illustrated here. Examples of features being illustrated: multi-target, request source, etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

actually, importantly this isn't using request source generally, it's using the file based request source specifically


Below is an example which will send requests to two endpoints `127.0.0.1:80` and `127.0.0.2:80`, while alternating over two request headers, which contain different paths and hosts.

## Define a traffic profile
Copy link
Contributor

Choose a reason for hiding this comment

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

Unless I'm mistaken you've created this term traffic profile here, and it is not used elsewhere. The way you've structured this makes it look like traffic profile is a broader nighthawk term in a way that I think is misleading.

Could we instead discuss it like:

Place a file called traffic-profile.yaml in your current working directory. This will act as your configuration for the file-based request source.

@dubious90 dubious90 added waiting-for-changes A PR waiting for comments to be resolved and changes to be applied. and removed waiting-for-review A PR waiting for a review. labels Mar 2, 2021
@oschaaf
Copy link
Member Author

oschaaf commented Mar 2, 2021

@dubious90 thanks for the review, you raise some good points. Also, looking at this again, I wonder if it would be better to move examples/ into docs/.. thoughts?

@dubious90
Copy link
Contributor

@dubious90 thanks for the review, you raise some good points. Also, looking at this again, I wonder if it would be better to move examples/ into docs/.. thoughts?

This change sounds good to me. docs/examples/ seems like the right landing location.

Signed-off-by: Otto van der Schaaf <ovanders@redhat.com>
@oschaaf
Copy link
Member Author

oschaaf commented Mar 3, 2021

I addressed feedback in e83f615, added a little more polish & moved examples/ into doc/root/. Ready for another round.

@oschaaf oschaaf added waiting-for-review A PR waiting for a review. and removed waiting-for-changes A PR waiting for comments to be resolved and changes to be applied. labels Mar 3, 2021
dubious90
dubious90 previously approved these changes Mar 5, 2021
Copy link
Contributor

@dubious90 dubious90 left a comment

Choose a reason for hiding this comment

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

Oof, sorry for my delay on this. For some reason, I thought I had already replied to this.

This looks good modulo one typo

This example illustrates the following features:

- [Request Source](https://github.com/envoyproxy/nighthawk/blob/261abb62c40afbdebb317f320fe67f1a1da1838f/api/request_source/request_source_plugin.proto#L15) (specifically the file-based implementation).
- [Multi-targetting](https://github.com/envoyproxy/nighthawk/blob/261abb62c40afbdebb317f320fe67f1a1da1838f/api/client/options.proto#L84)
Copy link
Contributor

Choose a reason for hiding this comment

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

sp: targeting

Copy link
Member Author

Choose a reason for hiding this comment

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

Amended in baf7a5e

Signed-off-by: Otto van der Schaaf <ovanders@redhat.com>
@dubious90 dubious90 merged commit cee358d into envoyproxy:main Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-for-review A PR waiting for a review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants