Skip to content
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

Generate fields for APM package #4432

Merged
merged 21 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export GO111MODULE=on

GOOSBUILD=./build/$(shell go env GOOS)
APPROVALS=$(GOOSBUILD)/approvals
GENPACKAGE=$(GOOSBUILD)/genpackage
GOIMPORTS=$(GOOSBUILD)/goimports
GOLICENSER=$(GOOSBUILD)/go-licenser
GOLINT=$(GOOSBUILD)/golint
Expand Down Expand Up @@ -75,6 +76,10 @@ check-approvals: $(APPROVALS)
check: $(MAGE) check-headers
@$(MAGE) check

.PHONY: gen-package
gen-package: $(GENPACKAGE)
@$(GENPACKAGE)

.PHONY: bench
bench:
@go test -benchmem -run=XXX -benchtime=100ms -bench='.*' ./...
Expand Down Expand Up @@ -105,7 +110,7 @@ docker-compose.override.yml:
# Rules for updating config files, fields.yml, etc.
##############################################################################

update: fields go-generate add-headers copy-docs notice $(MAGE)
update: fields go-generate add-headers copy-docs gen-package notice $(MAGE)
@$(MAGE) update

fields_sources=\
Expand Down Expand Up @@ -247,6 +252,11 @@ $(MAGE): magefile.go $(BIN_MAGE)
$(STATICCHECK): go.mod
go build -o $@ honnef.co/go/tools/cmd/staticcheck

.PHONY: $(GENPACKAGE)
$(GENPACKAGE):
@go build -o $@ github.com/elastic/apm-server/apmpackage/cmd/gen-package


$(GOLINT): go.mod
go build -o $@ golang.org/x/lint/golint

Expand Down
3 changes: 2 additions & 1 deletion NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,8 @@ License type (autodetected): Apache-2.0

--------------------------------------------------------------------
Dependency: github.com/elastic/go-ucfg
Version: v0.8.3
Version: v0.8.4
Revision: 1232bd4774a6
License type (autodetected): Apache-2.0

--------------------------------------------------------------------
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,21 @@ To generate required configuration files and templates run:
make update
```

### Generate package

APM-Server includes a script to generate an integration package to run with Fleet.
To Generate a package run:

```
make fields gen-package
```

That command takes the existing `fields.yml` files and split them into `ecs.yml` and `fields.yml` files for each data stream type.
It also generates a `README.md` with a field reference that will be shown in the integration package.

After generating a package, `apmpackage/apm` should be manually copied to `elastic/integrations`.
Then follow instructions in https://github.com/elastic/integrations/blob/master/CONTRIBUTING.md.

### Cleanup

To clean APM Server source code, run the following commands:
Expand Down
12 changes: 12 additions & 0 deletions apmpackage/apm/0.1.0/data_stream/logs/fields/base-fields.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- name: '@timestamp'
type: date
description: Event timestamp.
- name: data_stream.type
type: constant_keyword
description: Data stream type.
- name: data_stream.dataset
type: constant_keyword
description: Data stream dataset.
- name: data_stream.namespace
type: constant_keyword
description: Data stream namespace.
Loading