-
Notifications
You must be signed in to change notification settings - Fork 7
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
API: support ECS major version number #3
API: support ECS major version number #3
Conversation
explicitly discourage use of `@ecs_compatibility` instance variable, since it is not clear how Logstash Core will implement its ECS-Compatibility mode
EDIT: upon further consideration, using v-prefixed integers greatly increases the clarity of intent, so I have modified this PR to incorporate these alternatives |
Modifies API to make the ECS Schema major version the primary unit to target, in order to provide a path to support the ECS Schema v2 that is targeted to release along-side Elastic Stack 8.0 Plugin implementors are now supplied with `LegacyAdapter#ecs_compatibility` that produces a `Symbol` representing the desired ECS-Compatibility mode (either `:disabled` or a v-prefixed integer e.g., `:v1`). Plugin configuration in a pipeline definition now can specify `disabled` or a v-prefixed integer (e.g., `v1`).
7b213d8
to
ad8a05c
Compare
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.
👍 very much on where this is going, and that we're forward thinking about ECS ❤️
There's a fly 🪲 in my head regarding the 'previous' way of doing configuration, let me explain:
I do like ecs_compatibility => false
or ecs_compatibility => 1.0
since it's kind of 'consistent' with an on/off flag and also with ECS versioning. No need to have to think much about what are the supported options.
For users trying to configure a plugin, given current ECS is 1.5
what do they put here: v1
looks like it should do but might feel confusing.
I know minor versions are out-of-scope atm but how will this look if at some point a plugin would need to handle ECS minor level changes (just-in-case) ?
I mean, there's going to be v1
but than the format slightly changes to v1.5
.
Haven't put as much thought into this but naively seems like parsing numbers and using ranges we might be able to accomplish the same and allow for later flexibility, if needed? e.g.
def register
case ecs_compatibility
when :disabled, :false
# legacy behaviour
when 1...1.5 # >= 1.0 (<1.5)
# previous ECS 1.0 behaviour
when 1.5...2, :true # >= 1.5 (< 2.0)
# default ECS (>= 1.5) behavior
else
fail(NotImplementedError, "ECS #{ecs_compatibility} is not supported by this plugin.")
end
end
I'll expound on this a bit. Supporting minor declarations and minor implementations at worst requires lock-step releases of all ECS-supporting plugins with the ECS schema, and at best provides little benefit. Consider:
Since ECS is Semantically Versioned, requesting a specific major or implementing a specific major should be sufficient. The added benefit of being able to optionally warn someone that a plugin doesn't support the exact version they are requesting is counter-balanced by the fact that the warning will be lost in the flood of other plugins's similar warnings when most minor releases won't affect most plugins. |
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.
Thanks for explaining these thoroughly.
Makes sense to really not care about minors.
Prior to this change, ECS Compatibility had two modes:
false
andtrue
. As ECS is expecting to ship breaking changes to its schema along-side Elastic Stack 8.0 (elastic/ecs#839), it is becoming clear that plugins may stand to benefit from knowing the desired major schema version.As this is an API support adapter, there are two usage perspectives to consider:
Plugin Implementation
This change-set allows plugin maintainers to supply implementations for specific ECS major versions (which may be shared), while still allowing the pre-ECS behaviour to be selected. It does so by publicly implementing an
ecs_compatibility
method that returns aSymbol
containing either:disabled
or a v-prefixed integer representing a major ECS version (e.g.,:v1
).Generally, plugins will implement something like the following in their
register
method:The API uses a
Symbol
to represent the current mode to accomplish several goals:case
statement to define behaviour, improving usability (e.g., when the 1.x -> 2.x schema change does not break a specific implementation, the plugin can usewhen :v1, :v2
to capture both major versions 1 and 2).Plugin Usage in Logstash Pipelines
To explicitly configure a plugin using this adapter to disable ECS:
Or, to explicitly request version 1 of ECS:
Notes: