Skip to content

Commit 7a9b6b4

Browse files
authored
Make ecs.version a constant_keyword field (#9208)
Instead of adding `ecs.version` as a field in every document written by APM Server, make it a constant_keyword field and set its version in the data stream mappings. The data stream's ingest pipeline is responsible for upgrading documents to the expected format, so it follows that the integration package (ingest pipeline, mappings) should define the ECS version. We're currently pinning to a recent commit of ECS due to our reliance on the unreleased `device.*` fields. When they are released, we should update to the released version.
1 parent 35f2cca commit 7a9b6b4

File tree

62 files changed

+184
-586
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+184
-586
lines changed

Makefile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ GOTESTFLAGS?=-v
1212
# Prevent unintended modifications of go.[mod|sum]
1313
GOMODFLAG?=-mod=readonly
1414

15+
# Define the github.com/elastic/ecs ref used for the integration package for
16+
# resolving ECS fields. The top-level "value" file in the repo will be used
17+
# for populating the `ecs.version` field added to documents.
18+
#
19+
# TODO(axw) when the device.* fields we're using have been added to a release,
20+
# we should pin to a release tag here.
21+
ECS_REF?=266cf6aa62e46bff1965342a61191ce5ffe1b0d7
22+
1523
PYTHON_ENV?=.
1624
PYTHON_VENV_DIR:=$(PYTHON_ENV)/build/ve/$(shell $(GO) env GOOS)
1725
PYTHON_BIN:=$(PYTHON_VENV_DIR)/bin
@@ -149,6 +157,11 @@ get-version:
149157
# Integration package generation.
150158
##############################################################################
151159

160+
ECS_REF_FILE:=build/ecs/$(ECS_REF).txt
161+
$(ECS_REF_FILE):
162+
@mkdir -p $(@D)
163+
@curl --fail --silent -o $@ https://raw.githubusercontent.com/elastic/ecs/$(ECS_REF)/version
164+
152165
build-package: build/packages/apm-$(APM_SERVER_VERSION).zip
153166
build-package-snapshot: build/packages/apm-$(APM_SERVER_VERSION)-preview-$(GITCOMMITTIMESTAMPUNIX).zip
154167
build/packages/apm-$(APM_SERVER_VERSION).zip: build/apmpackage
@@ -159,9 +172,9 @@ build/packages/apm-%.zip: $(ELASTICPACKAGE)
159172
.PHONY: build/apmpackage build/apmpackage-snapshot
160173
build/apmpackage: PACKAGE_VERSION=$(APM_SERVER_VERSION)
161174
build/apmpackage-snapshot: PACKAGE_VERSION=$(APM_SERVER_VERSION)-preview-$(GITCOMMITTIMESTAMPUNIX)
162-
build/apmpackage build/apmpackage-snapshot:
175+
build/apmpackage build/apmpackage-snapshot: $(ECS_REF_FILE)
163176
@mkdir -p $(@D) && rm -fr $@
164-
@$(GO) run ./apmpackage/cmd/genpackage -o $@ -version=$(PACKAGE_VERSION)
177+
@$(GO) run ./apmpackage/cmd/genpackage -o $@ -version=$(PACKAGE_VERSION) -ecs=$$(cat $(ECS_REF_FILE)) -ecsref=git@$(ECS_REF)
165178

166179
##############################################################################
167180
# Documentation.

NOTICE.txt

Lines changed: 0 additions & 212 deletions
Original file line numberDiff line numberDiff line change
@@ -281,218 +281,6 @@ binaries that contain `-oss` in the artifact name are licensed under the Apache
281281
License Version 2.0.
282282

283283

284-
--------------------------------------------------------------------------------
285-
Dependency : github.com/elastic/ecs
286-
Version: v1.12.0
287-
Licence type (autodetected): Apache-2.0
288-
--------------------------------------------------------------------------------
289-
290-
Contents of probable licence file $GOMODCACHE/github.com/elastic/ecs@v1.12.0/LICENSE.txt:
291-
292-
293-
Apache License
294-
Version 2.0, January 2004
295-
http://www.apache.org/licenses/
296-
297-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
298-
299-
1. Definitions.
300-
301-
"License" shall mean the terms and conditions for use, reproduction,
302-
and distribution as defined by Sections 1 through 9 of this document.
303-
304-
"Licensor" shall mean the copyright owner or entity authorized by
305-
the copyright owner that is granting the License.
306-
307-
"Legal Entity" shall mean the union of the acting entity and all
308-
other entities that control, are controlled by, or are under common
309-
control with that entity. For the purposes of this definition,
310-
"control" means (i) the power, direct or indirect, to cause the
311-
direction or management of such entity, whether by contract or
312-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
313-
outstanding shares, or (iii) beneficial ownership of such entity.
314-
315-
"You" (or "Your") shall mean an individual or Legal Entity
316-
exercising permissions granted by this License.
317-
318-
"Source" form shall mean the preferred form for making modifications,
319-
including but not limited to software source code, documentation
320-
source, and configuration files.
321-
322-
"Object" form shall mean any form resulting from mechanical
323-
transformation or translation of a Source form, including but
324-
not limited to compiled object code, generated documentation,
325-
and conversions to other media types.
326-
327-
"Work" shall mean the work of authorship, whether in Source or
328-
Object form, made available under the License, as indicated by a
329-
copyright notice that is included in or attached to the work
330-
(an example is provided in the Appendix below).
331-
332-
"Derivative Works" shall mean any work, whether in Source or Object
333-
form, that is based on (or derived from) the Work and for which the
334-
editorial revisions, annotations, elaborations, or other modifications
335-
represent, as a whole, an original work of authorship. For the purposes
336-
of this License, Derivative Works shall not include works that remain
337-
separable from, or merely link (or bind by name) to the interfaces of,
338-
the Work and Derivative Works thereof.
339-
340-
"Contribution" shall mean any work of authorship, including
341-
the original version of the Work and any modifications or additions
342-
to that Work or Derivative Works thereof, that is intentionally
343-
submitted to Licensor for inclusion in the Work by the copyright owner
344-
or by an individual or Legal Entity authorized to submit on behalf of
345-
the copyright owner. For the purposes of this definition, "submitted"
346-
means any form of electronic, verbal, or written communication sent
347-
to the Licensor or its representatives, including but not limited to
348-
communication on electronic mailing lists, source code control systems,
349-
and issue tracking systems that are managed by, or on behalf of, the
350-
Licensor for the purpose of discussing and improving the Work, but
351-
excluding communication that is conspicuously marked or otherwise
352-
designated in writing by the copyright owner as "Not a Contribution."
353-
354-
"Contributor" shall mean Licensor and any individual or Legal Entity
355-
on behalf of whom a Contribution has been received by Licensor and
356-
subsequently incorporated within the Work.
357-
358-
2. Grant of Copyright License. Subject to the terms and conditions of
359-
this License, each Contributor hereby grants to You a perpetual,
360-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
361-
copyright license to reproduce, prepare Derivative Works of,
362-
publicly display, publicly perform, sublicense, and distribute the
363-
Work and such Derivative Works in Source or Object form.
364-
365-
3. Grant of Patent License. Subject to the terms and conditions of
366-
this License, each Contributor hereby grants to You a perpetual,
367-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
368-
(except as stated in this section) patent license to make, have made,
369-
use, offer to sell, sell, import, and otherwise transfer the Work,
370-
where such license applies only to those patent claims licensable
371-
by such Contributor that are necessarily infringed by their
372-
Contribution(s) alone or by combination of their Contribution(s)
373-
with the Work to which such Contribution(s) was submitted. If You
374-
institute patent litigation against any entity (including a
375-
cross-claim or counterclaim in a lawsuit) alleging that the Work
376-
or a Contribution incorporated within the Work constitutes direct
377-
or contributory patent infringement, then any patent licenses
378-
granted to You under this License for that Work shall terminate
379-
as of the date such litigation is filed.
380-
381-
4. Redistribution. You may reproduce and distribute copies of the
382-
Work or Derivative Works thereof in any medium, with or without
383-
modifications, and in Source or Object form, provided that You
384-
meet the following conditions:
385-
386-
(a) You must give any other recipients of the Work or
387-
Derivative Works a copy of this License; and
388-
389-
(b) You must cause any modified files to carry prominent notices
390-
stating that You changed the files; and
391-
392-
(c) You must retain, in the Source form of any Derivative Works
393-
that You distribute, all copyright, patent, trademark, and
394-
attribution notices from the Source form of the Work,
395-
excluding those notices that do not pertain to any part of
396-
the Derivative Works; and
397-
398-
(d) If the Work includes a "NOTICE" text file as part of its
399-
distribution, then any Derivative Works that You distribute must
400-
include a readable copy of the attribution notices contained
401-
within such NOTICE file, excluding those notices that do not
402-
pertain to any part of the Derivative Works, in at least one
403-
of the following places: within a NOTICE text file distributed
404-
as part of the Derivative Works; within the Source form or
405-
documentation, if provided along with the Derivative Works; or,
406-
within a display generated by the Derivative Works, if and
407-
wherever such third-party notices normally appear. The contents
408-
of the NOTICE file are for informational purposes only and
409-
do not modify the License. You may add Your own attribution
410-
notices within Derivative Works that You distribute, alongside
411-
or as an addendum to the NOTICE text from the Work, provided
412-
that such additional attribution notices cannot be construed
413-
as modifying the License.
414-
415-
You may add Your own copyright statement to Your modifications and
416-
may provide additional or different license terms and conditions
417-
for use, reproduction, or distribution of Your modifications, or
418-
for any such Derivative Works as a whole, provided Your use,
419-
reproduction, and distribution of the Work otherwise complies with
420-
the conditions stated in this License.
421-
422-
5. Submission of Contributions. Unless You explicitly state otherwise,
423-
any Contribution intentionally submitted for inclusion in the Work
424-
by You to the Licensor shall be under the terms and conditions of
425-
this License, without any additional terms or conditions.
426-
Notwithstanding the above, nothing herein shall supersede or modify
427-
the terms of any separate license agreement you may have executed
428-
with Licensor regarding such Contributions.
429-
430-
6. Trademarks. This License does not grant permission to use the trade
431-
names, trademarks, service marks, or product names of the Licensor,
432-
except as required for reasonable and customary use in describing the
433-
origin of the Work and reproducing the content of the NOTICE file.
434-
435-
7. Disclaimer of Warranty. Unless required by applicable law or
436-
agreed to in writing, Licensor provides the Work (and each
437-
Contributor provides its Contributions) on an "AS IS" BASIS,
438-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
439-
implied, including, without limitation, any warranties or conditions
440-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
441-
PARTICULAR PURPOSE. You are solely responsible for determining the
442-
appropriateness of using or redistributing the Work and assume any
443-
risks associated with Your exercise of permissions under this License.
444-
445-
8. Limitation of Liability. In no event and under no legal theory,
446-
whether in tort (including negligence), contract, or otherwise,
447-
unless required by applicable law (such as deliberate and grossly
448-
negligent acts) or agreed to in writing, shall any Contributor be
449-
liable to You for damages, including any direct, indirect, special,
450-
incidental, or consequential damages of any character arising as a
451-
result of this License or out of the use or inability to use the
452-
Work (including but not limited to damages for loss of goodwill,
453-
work stoppage, computer failure or malfunction, or any and all
454-
other commercial damages or losses), even if such Contributor
455-
has been advised of the possibility of such damages.
456-
457-
9. Accepting Warranty or Additional Liability. While redistributing
458-
the Work or Derivative Works thereof, You may choose to offer,
459-
and charge a fee for, acceptance of support, warranty, indemnity,
460-
or other liability obligations and/or rights consistent with this
461-
License. However, in accepting such obligations, You may act only
462-
on Your own behalf and on Your sole responsibility, not on behalf
463-
of any other Contributor, and only if You agree to indemnify,
464-
defend, and hold each Contributor harmless for any liability
465-
incurred by, or claims asserted against, such Contributor by reason
466-
of your accepting any such warranty or additional liability.
467-
468-
END OF TERMS AND CONDITIONS
469-
470-
APPENDIX: How to apply the Apache License to your work.
471-
472-
To apply the Apache License to your work, attach the following
473-
boilerplate notice, with the fields enclosed by brackets "[]"
474-
replaced with your own identifying information. (Don't include
475-
the brackets!) The text should be enclosed in the appropriate
476-
comment syntax for the file format. We also recommend that a
477-
file or class name and description of purpose be included on the
478-
same "printed page" as the copyright notice for easier
479-
identification within third-party archives.
480-
481-
Copyright [yyyy] [name of copyright owner]
482-
483-
Licensed under the Apache License, Version 2.0 (the "License");
484-
you may not use this file except in compliance with the License.
485-
You may obtain a copy of the License at
486-
487-
http://www.apache.org/licenses/LICENSE-2.0
488-
489-
Unless required by applicable law or agreed to in writing, software
490-
distributed under the License is distributed on an "AS IS" BASIS,
491-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
492-
See the License for the specific language governing permissions and
493-
limitations under the License.
494-
495-
496284
--------------------------------------------------------------------------------
497285
Dependency : github.com/elastic/elastic-agent-libs
498286
Version: v0.2.11
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
dependencies:
22
ecs:
3-
# TODO(axw) make sure this is kept in sync with the ECS version used in libbeat.
4-
reference: git@main
3+
reference: generated

apmpackage/apm/changelog.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# change type can be one of: enhancement, bugfix, breaking-change
44
- version: "generated"
55
changes:
6-
- description: Placeholder
6+
- description: Change `ecs.version` to a `constant_keyword` field
77
type: enhancement
8-
link: https://github.com/elastic/apm-server/pull/123
8+
link: https://github.com/elastic/apm-server/pull/9208
99
- version: "8.5.0"
1010
changes:
1111
- description: Add package settings to enable the experimental collection of service metrics

apmpackage/apm/data_stream/app_logs/elasticsearch/ingest_pipeline/default.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ processors:
55
name: process_ppid
66
- pipeline:
77
name: observer_version
8+
- pipeline:
9+
name: ecs_version

apmpackage/apm/data_stream/app_metrics/elasticsearch/ingest_pipeline/default.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ description: Pipeline for ingesting APM application metrics.
33
processors:
44
- pipeline:
55
name: observer_version
6+
- pipeline:
7+
name: ecs_version
68
- pipeline:
79
name: user_agent
810
- pipeline:

apmpackage/apm/data_stream/error_logs/elasticsearch/ingest_pipeline/default.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ description: Pipeline for ingesting APM error events.
33
processors:
44
- pipeline:
55
name: observer_version
6+
- pipeline:
7+
name: ecs_version
68
- pipeline:
79
name: user_agent
810
- pipeline:

apmpackage/apm/data_stream/internal_metrics/elasticsearch/ingest_pipeline/default.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ description: Pipeline for ingesting APM internal metrics.
33
processors:
44
- pipeline:
55
name: observer_version
6+
- pipeline:
7+
name: ecs_version
68
- pipeline:
79
name: user_agent
810
- pipeline:

apmpackage/apm/data_stream/rum_traces/elasticsearch/ingest_pipeline/default.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ description: Pipeline for ingesting APM RUM trace events.
33
processors:
44
- pipeline:
55
name: observer_version
6+
- pipeline:
7+
name: ecs_version
68
- pipeline:
79
name: user_agent
810
- pipeline:

apmpackage/apm/data_stream/traces/elasticsearch/ingest_pipeline/apm_data_stream_migration.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ description: |
66
processors:
77
- pipeline:
88
name: observer_version
9+
- pipeline:
10+
name: ecs_version
911
- pipeline:
1012
name: process_ppid
1113
- script:

0 commit comments

Comments
 (0)