-
Notifications
You must be signed in to change notification settings - Fork 75
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 support for aggregate_metric_double field type #500
Conversation
🌐 Coverage report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
`field 1: default_metric is required`, | ||
`field 2.metrics.2: 2.metrics.2 must be one of the following: "min", "max", "sum", "value_count", "avg"`, | ||
`field 3: Must not be present`, | ||
`field 3: Must not be present`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shame we don't report the field name with this error, but I remember that wasn't trivial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I tried some things, but I didn't manage to do it. Maybe we can do it directly in the underlying library, we already have it forked in https://github.com/elastic/gojsonschema.
type: | ||
const: aggregate_metric_double | ||
required: | ||
- type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this add?
required:
- type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It avoids the condition to match when the type
is not defined, what happens with external fields. Like this one:
- name: "@timestamp"
external: ecs
required: | ||
- default_metric | ||
properties: | ||
default_metric: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type: string
is not needed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type: string
is defined in the referenced definition.
test/packages/bad_aggregate_metric_double/data_stream/foo/fields/fields.yml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
## Summary Add support for fields of type `aggregate_metric_double` in EPM. Change in package spec introduced in elastic/package-spec#500. Fixes #154867 Closes elastic/package-spec#457 ### Checklist Delete any items that are not applicable to this PR. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios. ### How to test * Modify a package to include a field with type `aggregate_metric_double`, for example like this: ``` - name: some_metric type: aggregate_metric_double metrics: [ "min", "max", "sum", "value_count" ] default_metric: "max" ``` * Install elastic package with this branch of the package-spec included: elastic/package-spec#500, for this, from an elastic-package working directory: * `go mod edit -replace github.com/elastic/package-spec/v2=github.com/elastic/package-spec@main` * `go mod tidy` * `make install` * Build the package with `elastic-package build -v`. * Install the package with `elastic-package install -v`. * Check that the template contains the expected field. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
What does this PR do?
It adds support for the
aggregate_metric_double
field type.Why is it important?
This field type is used in TSDB use cases.
Checklist
test/packages
that prove my change is effective.spec/changelog.yml
.Related issues