Skip to content

stats: support default tags with fixed value - #416

Merged
mattklein123 merged 9 commits into
envoyproxy:masterfrom
taiki45:default-stats-tag
Jan 16, 2018
Merged

mattklein123 merged 9 commits into
envoyproxy:masterfrom
taiki45:default-stats-tag

Conversation

@taiki45

@taiki45 taiki45 commented Jan 12, 2018 •

Copy link
Copy Markdown
Member

For envoyproxy/envoy#1975.

Adding extra fields to TagSpecifier to allow users set default tags
which have a fixed value.

Envoy side PR: envoyproxy/envoy#2357.

Adding extra fields to TagSpecifier to allow users set default tags
which have a fixed value.

Signed-off-by: Taiki Ono <[email protected]>
Comment thread api/stats.proto

// Add a default tag which have a fixed value and they will be added to all stats.
// Typical use case is identifying Envoy instances with the tag.
string fixed_value = 3;

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.

Just use value should be fine.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think the notation like "fixed" helps users to distinguish this field from the regex field because this field is placed on the same level as regexp is on. In addition, since this field is in the TagSpecifier message not Tag message, indicating the characteristic of this field would help. WDYT?

Comment thread api/stats.proto Outdated
// .. note::
//
// If any default tags are specified twice, the config will be considered
// If any tag names are specified twice, the config will be considered

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.

The comment can be simplified as

// It is invalid to specify the same tag name twice in a config.

Comment thread api/stats.proto Outdated
string regex = 2;

// Add a default tag which have a fixed value and they will be added to all stats.
// Typical use case is identifying Envoy instances with the tag.

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.

The comment can be simplified as.

// Specifies a default tag value for the tag_name.

We don't need to care how the value is used, which can be controlled or stripped in different places.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just to add to that, can we remove the term default from the language since that implies it's a fallback value? I think fixed, as you used below, is clearer.

@taiki45 taiki45 Jan 13, 2018 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed. Simplified the description and removed the term. Also I will remove the default term from Envoy side documents. ff78ff3

Comment thread api/stats.proto Outdated
// group is provided, the first will also be used to set the value of the tag.
// All other capture groups will be ignored.
//
// Take for example, with a stat name ``cluster.foo_cluster.upstream_rq_timeout``

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.

How about format like this:

Example 1: xxx

description

code

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

+1. The structured example format will help readers.

I think the code is placed there as a example condition description, we need to keep the code above the description. So changed like 8631e4f.

@htuch htuch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM modulo comments. @mrice32 can you also take a pass? Thanks.

Comment thread api/stats.proto Outdated
// tag value for all statistics. This will only occur if any part of the name
// matches the regex provided with one or more capture groups.
// Configuration for tagged metrics. Setting default tags which have fixed tag
// value and will be added to all metrics. Or settting dynamic tag extractions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here's how I would reword for maximum clarity:

Designates a tag name and value pair. The value may be either a fixed value or a regex providing the value via capture groups. The specified tag will be unconditionally set if a fixed value, otherwise it will only be set if one or more capture groups in the regex match.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

@mrice32 mrice32 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great work! Just a few nits.

Comment thread api/stats.proto Outdated
string regex = 2;

// Add a default tag which have a fixed value and they will be added to all stats.
// Typical use case is identifying Envoy instances with the tag.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just to add to that, can we remove the term default from the language since that implies it's a fallback value? I think fixed, as you used below, is clearer.

Comment thread api/stats.proto Outdated
// <envoy_api_field_TagSpecifier.tag_name>` is provided in the config with an
// empty regex, Envoy will attempt to find that name in its set of defaults
// and use the accompanying regex.
// <envoy_api_field_TagSpecifier.tag_name>` is provided in the config and none of

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: none of -> neither

Comment thread api/stats.proto Outdated
// empty regex, Envoy will attempt to find that name in its set of defaults
// and use the accompanying regex.
// <envoy_api_field_TagSpecifier.tag_name>` is provided in the config and none of
// :ref:`regex <envoy_api_field_TagSpecifier.regex>` and

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: and -> or

Comment thread api/stats.proto Outdated
// tag value for all statistics. This will only occur if any part of the name
// matches the regex provided with one or more capture groups.
// Configuration for tagged metrics. Setting default tags which have fixed tag
// value and will be added to all metrics. Or settting dynamic tag extractions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

@mattklein123
mattklein123 merged commit 0811371 into envoyproxy:master Jan 16, 2018
@taiki45
taiki45 deleted the default-stats-tag branch January 16, 2018 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants