Skip to content

Use the apm-server version everywhere*#4725

Merged
axw merged 3 commits intoelastic:masterfrom
axw:test-update-beats
Feb 15, 2021
Merged

Use the apm-server version everywhere*#4725
axw merged 3 commits intoelastic:masterfrom
axw:test-update-beats

Conversation

@axw
Copy link
Copy Markdown
Member

@axw axw commented Feb 11, 2021

Motivation/summary

We have been using the libbeat version in the root handler,
which may not be the same as the apm-server version since
we maintain our own version now. This PR injects the apm-server
version into the root handler so it can be returned.

In the publisher code, we had hard-coded the major version
number. Less problematic, but I have changed this to parse the
full version to extract the major version number.

In the Elasticsearch client we still use the libbeat version for
determining the major version number. I think this is OK because
we should never have different major version of libbeat in
APM Server, for the time being at least.

Finally: instead of using the libbeat version in integration tests,
use a hard-coded version of "1.2.3" so we don't have to change
approval files each time we bump the version. This should enable
us to automate the version bump.

Checklist

- [ ] Update CHANGELOG.asciidoc should have no visible impact on users, as we have kept libbeat up to date.
- [ ] Documentation has been updated

How to test these changes

  1. Run apm-server
  2. Query http://localhost:8200/
  3. Check that it responds with the apm-server version

Related issues

Fixes #4420

Instead of hardcoding the major version, parse the full version.
@ghost
Copy link
Copy Markdown

ghost commented Feb 11, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #4725 updated

  • Start Time: 2021-02-15T07:43:41.590+0000

  • Duration: 43 min 1 sec

  • Commit: eb3effb

Test stats 🧪

Test Results
Failed 0
Passed 4727
Skipped 124
Total 4851

Trends 🧪

Image of Build Times

Image of Tests

Steps errors 4

Expand to view the steps failures

Run Window tests
  • Took 10 min 6 sec . View more details on here
Compress
  • Took 0 min 0 sec . View more details on here
  • Description: tar --exclude=coverage-files.tgz -czf coverage-files.tgz coverage
Compress
  • Took 0 min 0 sec . View more details on here
  • Description: tar --exclude=system-tests-linux-files.tgz -czf system-tests-linux-files.tgz system-tests
Test Sync
  • Took 4 min 50 sec . View more details on here
  • Description: ./.ci/scripts/sync.sh

Rather than returning the libbeat version from the
root/healthcheck handler, inject the apm-server version
so it can be returned.

Also, in the integration tests use a hard-coded version
"1.2.3", so we don't have to change approval files each
time we bump the version. This should enable us to
automate the version bump.
@axw axw force-pushed the test-update-beats branch from b2be4bb to 7e9243f Compare February 12, 2021 01:09
@axw
Copy link
Copy Markdown
Member Author

axw commented Feb 13, 2021

In the Elasticsearch client we still use the libbeat version for determining the major version number. I think this is OK because we should never have different major version of libbeat in APM Server, for the time being at least.

Having said that, it would be better if we passed the version in. That way we could better unit test the behaviour.

@axw axw marked this pull request as ready for review February 13, 2021 03:10
@axw axw requested a review from a team February 13, 2021 03:11
@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #4725 (eb3effb) into master (8507904) will decrease coverage by 0.00%.
The diff coverage is 95.91%.

@@            Coverage Diff             @@
##           master    #4725      +/-   ##
==========================================
- Coverage   76.43%   76.43%   -0.01%     
==========================================
  Files         165      165              
  Lines       10076    10083       +7     
==========================================
+ Hits         7702     7707       +5     
- Misses       2374     2376       +2     
Impacted Files Coverage Δ
publish/pub.go 72.15% <77.77%> (-2.85%) ⬇️
beater/api/mux.go 91.66% <100.00%> (+0.75%) ⬆️
beater/api/root/handler.go 87.50% <100.00%> (ø)
beater/http.go 66.66% <100.00%> (ø)
beater/server.go 63.33% <100.00%> (ø)
beater/tracing.go 78.37% <100.00%> (ø)
...ack/apm-server/aggregation/txmetrics/aggregator.go 93.36% <0.00%> (ø)

@axw axw merged commit 9ad7072 into elastic:master Feb 15, 2021
@axw axw deleted the test-update-beats branch February 15, 2021 09:17
axw added a commit to axw/apm-server that referenced this pull request Feb 19, 2021
* publish: parse version to set version_major

Instead of hardcoding the major version, parse the full version.

* beater: pass apm-server version into root handler

Rather than returning the libbeat version from the
root/healthcheck handler, inject the apm-server version
so it can be returned.

Also, in the integration tests use a hard-coded version
"1.2.3", so we don't have to change approval files each
time we bump the version. This should enable us to
automate the version bump.
# Conflicts:
#	beater/api/mux.go
#	beater/api/root/test_approved/integration/TestRootHandler_AuthorizationMiddleware/Authorized.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationErrors.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationEvents.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationMetricsets.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationMinimalEvents.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationProfileCPUProfile.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationProfileCPUProfileMetadata.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationProfileHeapProfile.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationSpans.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationTransactions.approved.json
#	publish/pub.go
axw added a commit to axw/apm-server that referenced this pull request Feb 19, 2021
* publish: parse version to set version_major

Instead of hardcoding the major version, parse the full version.

* beater: pass apm-server version into root handler

Rather than returning the libbeat version from the
root/healthcheck handler, inject the apm-server version
so it can be returned.

Also, in the integration tests use a hard-coded version
"1.2.3", so we don't have to change approval files each
time we bump the version. This should enable us to
automate the version bump.
# Conflicts:
#	beater/api/mux.go
#	beater/api/root/test_approved/integration/TestRootHandler_AuthorizationMiddleware/Authorized.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationErrors.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationEvents.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationMetricsets.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationMinimalEvents.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationProfileCPUProfile.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationProfileCPUProfileMetadata.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationProfileHeapProfile.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationSpans.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationTransactions.approved.json
#	publish/pub.go
axw added a commit that referenced this pull request Feb 19, 2021
* publish: parse version to set version_major

Instead of hardcoding the major version, parse the full version.

* beater: pass apm-server version into root handler

Rather than returning the libbeat version from the
root/healthcheck handler, inject the apm-server version
so it can be returned.

Also, in the integration tests use a hard-coded version
"1.2.3", so we don't have to change approval files each
time we bump the version. This should enable us to
automate the version bump.
# Conflicts:
#	beater/api/mux.go
#	beater/api/root/test_approved/integration/TestRootHandler_AuthorizationMiddleware/Authorized.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationErrors.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationEvents.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationMetricsets.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationMinimalEvents.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationProfileCPUProfile.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationProfileCPUProfileMetadata.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationProfileHeapProfile.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationSpans.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationTransactions.approved.json
#	publish/pub.go
axw added a commit that referenced this pull request Feb 19, 2021
* publish: parse version to set version_major

Instead of hardcoding the major version, parse the full version.

* beater: pass apm-server version into root handler

Rather than returning the libbeat version from the
root/healthcheck handler, inject the apm-server version
so it can be returned.

Also, in the integration tests use a hard-coded version
"1.2.3", so we don't have to change approval files each
time we bump the version. This should enable us to
automate the version bump.
# Conflicts:
#	beater/api/mux.go
#	beater/api/root/test_approved/integration/TestRootHandler_AuthorizationMiddleware/Authorized.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationErrors.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationEvents.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationMetricsets.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationMinimalEvents.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationProfileCPUProfile.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationProfileCPUProfileMetadata.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationProfileHeapProfile.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationSpans.approved.json
#	beater/test_approved_es_documents/TestPublishIntegrationTransactions.approved.json
#	publish/pub.go
v1v added a commit to v1v/apm-server that referenced this pull request Feb 22, 2021
…chemas-to-agents

* upstream/master: (111 commits)
  Introduce metricset.name (elastic#4857)
  processor/otel: test service.version handling (elastic#4853)
  docs: Add PHP agent information to shared docs (elastic#4740)
  Script for faster development workflow (elastic#4731)
  Update to elastic/beats@1b31c26 (elastic#4763)
  backport: add 7.12 to .backportrc.json (elastic#4807)
  backport: enable auto-merge on backport PRs (elastic#4777)
  Support for Node.js profiles (elastic#4728)
  docs: readds .NET link (elastic#4764)
  [DOCS] Fixes URLs on Secure communication with APM Agents page (elastic#4746)
  ci: set proper parameters for the tar step (elastic#4696)
  docs: add 7.11.1 release notes (elastic#4727)
  Disable sourcemap upload endpoint when data streams enabled (elastic#4735)
  Add service name to dataset field (elastic#4674)
  Update to elastic/beats@ba423212a660 (elastic#4733)
  sampling: require a default policy (elastic#4729)
  processor/otel: add unit test for span status (elastic#4734)
  Add support for consuming OTLP/gRPC metrics (elastic#4722)
  [apmpackage] Add config options supported in ESS (elastic#4690)
  Use the apm-server version everywhere* (elastic#4725)
  ...
v1v added a commit to v1v/apm-server that referenced this pull request Feb 22, 2021
…te-schema-json-1

* upstream/master: (111 commits)
  Introduce metricset.name (elastic#4857)
  processor/otel: test service.version handling (elastic#4853)
  docs: Add PHP agent information to shared docs (elastic#4740)
  Script for faster development workflow (elastic#4731)
  Update to elastic/beats@1b31c26 (elastic#4763)
  backport: add 7.12 to .backportrc.json (elastic#4807)
  backport: enable auto-merge on backport PRs (elastic#4777)
  Support for Node.js profiles (elastic#4728)
  docs: readds .NET link (elastic#4764)
  [DOCS] Fixes URLs on Secure communication with APM Agents page (elastic#4746)
  ci: set proper parameters for the tar step (elastic#4696)
  docs: add 7.11.1 release notes (elastic#4727)
  Disable sourcemap upload endpoint when data streams enabled (elastic#4735)
  Add service name to dataset field (elastic#4674)
  Update to elastic/beats@ba423212a660 (elastic#4733)
  sampling: require a default policy (elastic#4729)
  processor/otel: add unit test for span status (elastic#4734)
  Add support for consuming OTLP/gRPC metrics (elastic#4722)
  [apmpackage] Add config options supported in ESS (elastic#4690)
  Use the apm-server version everywhere* (elastic#4725)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

APM Server version not hooked properly

3 participants