Skip to content

Commit

Permalink
Generate fields for APM package (#4432) (#4532)
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 authored Dec 15, 2020
1 parent 2b0e658 commit 73d40c6
Show file tree
Hide file tree
Showing 34 changed files with 4,519 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 @@ -975,7 +975,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 73d40c6

Please sign in to comment.