Skip to content

Add metric filtering capability#1728

Merged
heyams merged 3 commits into
mainfrom
trask/add-metric-filtering-capability
Jun 7, 2021
Merged

Add metric filtering capability#1728
heyams merged 3 commits into
mainfrom
trask/add-metric-filtering-capability

Conversation

@trask

@trask trask commented Jun 7, 2021

Copy link
Copy Markdown
Member

Resolves #1665

case SPAN:
validateSpanProcessorIncludeExclude(includeExclude);
break;
case METRIC_FILTER:

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.

Can we rename it to METRIC?

public static class ProcessorIncludeExclude {
public MatchType matchType;
public List<String> spanNames = new ArrayList<>();
public List<String> metricNames = new ArrayList<>();

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.

if not renaming to METRIC, can you rename this to metricFilterNames for consistency.

}

validateSectionIsEmpty(spanNames, ProcessorType.LOG, includeExclude, "spanNames");
validateSectionIsEmpty(metricNames, ProcessorType.LOG, includeExclude, "metricNames");

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.

metricFilterNames? or rename the processor type to METRIC?

"type": "metric-filter",
"exclude": {
"matchType": "strict",
"metricNames": [

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.

i see why metricNames makes sense now. please ignore renaming comments.

// Moshi JSON builder do not allow case insensitive mapping
strict, regexp
@Json(name = "strict")
STRICT {

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.

it's not clear to me why you need to define MatchType in both places.. one here and calling MetricFilter's constants.. why not just keep one enum here?

}
}

public enum MatchType {

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.

I wonder why not just define this in configuration.java?

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.

because core doesn't depend on agent (where configuration is)

I left a couple of comments in Configuration about this:

        // TODO (trask) this could be revisited in the future once core goes away
        // need a different MetricFilter in this case because it lives in core

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.

i saw that.. didn't quite get it.. ok, now it makes sense.

@heyams heyams merged commit 49cc5d6 into main Jun 7, 2021
@heyams heyams deleted the trask/add-metric-filtering-capability branch June 7, 2021 23:41
trask added a commit that referenced this pull request Jun 18, 2021
* Add metric filtering capability

* Change enums to uppercase

* Spotbugs
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.

Using the Sampling Override preview feature to change metrics sampling rate

3 participants