Skip to content

Commit

Permalink
Generate fields for APM package (#4432)
Browse files Browse the repository at this point in the history
Adds an APM package for Fleet, with a script to generate fields.yml files and docs
  • Loading branch information
jalvz committed Nov 25, 2020
1 parent 4727a8b commit 576186d
Show file tree
Hide file tree
Showing 34 changed files with 4,497 additions and 57 deletions.
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
2 changes: 2 additions & 0 deletions apmpackage/apm/0.1.0/agent/input/template.yml.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
apm-server:
rum.enabled: {{enable_rum}}
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

0 comments on commit 576186d

Please sign in to comment.