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

Support benchmarking an unreleased locally built APM Server #7986

Closed
marclop opened this issue Apr 28, 2022 · 4 comments
Closed

Support benchmarking an unreleased locally built APM Server #7986

marclop opened this issue Apr 28, 2022 · 4 comments
Assignees
Milestone

Comments

@marclop
Copy link
Contributor

marclop commented Apr 28, 2022

Description

We should document or automate (if it proves easy enough) how to package and run a locally built version of APM Server with some changes in ESS / ECE.

@marclop marclop added this to the 8.3 milestone Apr 28, 2022
@marclop marclop self-assigned this Apr 29, 2022
@simitt simitt removed this from the 8.3 milestone May 24, 2022
@simitt
Copy link
Contributor

simitt commented May 24, 2022

@marclop could you summarize the road bumps you hit here please.

@simitt simitt added this to the 8.3 milestone May 24, 2022
@marclop
Copy link
Contributor Author

marclop commented May 25, 2022

My approach for this issue has been to reuse and extend some of the code that we use to build the APM Server for the system tests and re-use the same packaging to produce a Docker Image that would be able to run in ESS or ECE.

For that purpose I introduced a new buildapm binary (link) that builds a docker image from the fleet-server service as specified in our docker-compose.yml (docker.elastic.co/beats/elastic-agent).

I also introduced a new -cloud flag in that binary which instead of using the upstream elastic-agent standard image, uses the docker image that would be used in ESS (docker.elastic.co/cloud-release/elastic-agent-cloud).

As documented in the Observability-dev documentation PR, the packaging should work and it's a fairly easy experience to do build, package and build a docker image which is then uploaded to a repository which is allowed to run in ESS / ECE.

When using buildapm and running the image manually (or just using runapm which uses a very similar code path) to run the image locally, the injected apm-server runs without any problems and testing changes locally is pretty easy. The same is not applicable for the apm-server in the cloud-release image. It seems that something is missing or the packaging doesn't work exactly right. Although the APM Server binary is executed by the Elastic Agent in the built container, some libbeat code (before any of the APM Server code is run) returns with an error:

Exiting: error initializing publisher: missing field accessing 'output.elasticsearch.hosts.0'

The code that returns that error is: https://github.com/elastic/beats/blob/ff1041fc099ec69caea11c5c9c83d6ca59170ee7/libbeat/cmd/instance/beat.go#L387

Which is run before the APM Server's Creator func.

It's unclear to me how to debug this further and make headway since debugging is not straightforward.

@axw
Copy link
Member

axw commented May 26, 2022

I haven't gotten to the bottom of why, but commenting out

apm-server/cmd/root.go

Lines 57 to 67 in e960ca3

{
Check: func(_ *agentconfig.C) bool {
return os.Getenv(cloudEnv) != ""
},
Config: func() *agentconfig.C {
return agentconfig.MustNewConfigFrom(map[string]interface{}{
// default to medium compression on cloud
"output.elasticsearch.compression_level": 5,
})
}(),
},
allows things to proceed. IIANM we should get rid of that override anyway, since we set the default for modelindexer in
CompressionLevel: 5,

@simitt simitt modified the milestones: 8.3, 8.4 Jun 3, 2022
@marclop
Copy link
Contributor Author

marclop commented Jun 6, 2022

Verified that the internal docs work while testing the automaxprocs change (#8278). Since @axw removed the problematic code snipped in 8.3.0, I am going to close off this issue.

I am unsure how to best point APM Server developers to the internal docs, since we aren't referencing those anywhere in this repository. I am open to suggestions as to how to best do that. https://github.com/elastic/apm-server/blob/main/TESTING.md#manual-testing asks readers to consult the internal docs, but no references as to how to find these.

@marclop marclop closed this as completed Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants