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

Add basic configuration for the APM tracer #18861

Merged
merged 16 commits into from
Jun 17, 2020
Merged

Conversation

jalvz
Copy link
Contributor

@jalvz jalvz commented May 29, 2020

What does this PR do?

This adds configuration for the APM tracer, and sets it on the Beat object so that every Beat can use it.
Libbeat is responsible for correct initialization and closing.

A top level instrumentation config option is added to libbeat.yml / reference.yml to set it up, disabled by default.

Why is it important?

Dogfooding!

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

Run any beat with configuration enabled and disabled, alongside with APM Server, Elasticsearch and Kibana. Observe output transactions (or lack thereof when disabled) in the Kibana APM tab, coming from the libbeat publisher.

Related issues

Closes #18360

An APM Server PR showing how to use the tracer from the Beat is coming up soon.

@jalvz jalvz added enhancement Team:Integrations Label for the Integrations team Team:apm APM Server team issues/PRs labels May 29, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels May 29, 2020
@elasticmachine
Copy link
Collaborator

elasticmachine commented May 29, 2020

💔 Tests Failed

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Started by user Juan Álvarez, Replayed #16]

  • Start Time: 2020-06-16T09:04:48.526+0000

  • Duration: 80 min 43 sec

Test stats 🧪

Test Results
Failed 7
Passed 9434
Skipped 1574
Total 11015

Test errors

Expand to view the tests failures

  • Name: Build and Test / Filebeat Windows / test_close_renamed – test_harvester.Test

    • Age: 1
    • Duration: 0.561
    • Error Details: [Errno 13] Permission denied: 'C:\Users\jenkins\workspace\Beats_beats-beats-mbp_PR-18861\src\github.com\elastic\beats\filebeat\build\system-tests\run\test_harvester.Test.test_close_renamed\registry/filebeat/data.json'
  • Name: Build and Test / Filebeat Mac OS X / test_file_disappear – test_crawler.Test

    • Age: 1
    • Duration: 2.626
    • Error Details:
  • Name: Build and Test / Filebeat Mac OS X / test_clean_removed_with_clean_inactive – test_registrar.Test

    • Age: 1
    • Duration: 2.187
    • Error Details:
      -------------------- >> begin captured stdout << ---------------------
      registry size: 2
      registry size after remove: 2

--------------------- >> end captured stdout << ----------------------

  • Name: Build and Test / Filebeat Mac OS X / test_rotating_file_with_restart – test_registrar.Test

    • Age: 1
    • Duration: 5.989
    • Error Details:
  • Name: Build and Test / Filebeat Mac OS X / test_upgrade_from_6_3_1 – test_registrar_upgrade.Test

    • Age: 1
    • Duration: 1.778
    • Error Details:
  • Name: Build and Test / Filebeat Mac OS X / test_upgrade_from_faulty_6_3_1 – test_registrar_upgrade.Test

    • Age: 1
    • Duration: 1.909
    • Error Details:
  • Name: Build and Test / Filebeat Mac OS X / test_upgrade_from_latest – test_registrar_upgrade.Test

    • Age: 1
    • Duration: 1.811
    • Error Details:

Steps errors

Expand to view the steps failures

  • Name: Mage build unitTest

    • Description: mage build unitTest

    • Duration: 20 min 8 sec

    • Start Time: 2020-06-16T09:31:53.385+0000

    • log

  • Name: Recursively delete the current directory from the workspace

    • Description: script returned exit code 1

    • Duration: 1 min 21 sec

    • Start Time: 2020-06-16T09:52:22.852+0000

    • log

  • Name: Mage build unitTest

    • Description: mage build unitTest

    • Duration: 10 min 12 sec

    • Start Time: 2020-06-16T09:32:54.421+0000

    • log

  • Name: Make -C generator/_templates/metricbeat test

    • Description: make -C generator/_templates/metricbeat test

    • Duration: 8 min 38 sec

    • Start Time: 2020-06-16T10:09:58.362+0000

    • log

Log output

Expand to view the last 100 lines of log output

[2020-06-16T10:23:47.327Z]  OS/Arch:           darwin/amd64
[2020-06-16T10:23:47.327Z]  Experimental:      false
[2020-06-16T10:23:47.327Z] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[2020-06-16T10:23:47.327Z] It requires Docker daemon to be installed and running
[2020-06-16T10:24:03.257Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats
[2020-06-16T10:24:03.565Z] + find . -type f -name TEST*.xml -path */build/* -delete
[2020-06-16T10:24:03.577Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Lint
[2020-06-16T10:24:03.684Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Winlogbeat-oss
[2020-06-16T10:24:03.768Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Elastic-Agent-Mac-OS-X
[2020-06-16T10:24:03.848Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Elastic-Agent-x-pack
[2020-06-16T10:24:03.935Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Auditbeat-oss-Mac-OS-X
[2020-06-16T10:24:04.019Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Auditbeat-x-pack-Mac-OS-X
[2020-06-16T10:24:04.107Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Dockerlogbeat
[2020-06-16T10:24:04.216Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Auditbeat-crosscompile
[2020-06-16T10:24:04.317Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Filebeat-x-pack-Mac-OS-X
[2020-06-16T10:24:04.416Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Journalbeat-oss
[2020-06-16T10:24:04.513Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Generators-Metricbeat-Linux
[2020-06-16T10:24:04.603Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Metricbeat-Mac-OS-X
[2020-06-16T10:24:04.690Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Functionbeat-x-pack
[2020-06-16T10:24:04.774Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Elastic-Agent-x-pack-Windows
[2020-06-16T10:24:04.858Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Heartbeat-oss
[2020-06-16T10:24:04.938Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Metricbeat-OSS-Unit-tests
[2020-06-16T10:24:05.029Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Metricbeat-crosscompile
[2020-06-16T10:24:05.112Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Auditbeat-x-pack
[2020-06-16T10:24:05.199Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Auditbeat-oss-Windows
[2020-06-16T10:24:05.284Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Libbeat-x-pack
[2020-06-16T10:24:05.377Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Functionbeat-Mac-OS-X-x-pack
[2020-06-16T10:24:05.461Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Auditbeat-x-pack-Windows
[2020-06-16T10:24:05.548Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Filebeat-x-pack-Windows
[2020-06-16T10:24:05.639Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Filebeat-Windows
[2020-06-16T10:24:05.724Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Heartbeat-Mac-OS-X
[2020-06-16T10:24:05.808Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Packetbeat-oss
[2020-06-16T10:24:05.899Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Winlogbeat-Windows-x-pack
[2020-06-16T10:24:05.991Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Auditbeat-oss-Linux
[2020-06-16T10:24:06.101Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Metricbeat-x-pack-Mac-OS-X
[2020-06-16T10:24:06.196Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Winlogbeat-Windows
[2020-06-16T10:24:06.280Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Metricbeat-Windows
[2020-06-16T10:24:06.364Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Metricbeat-x-pack-Windows
[2020-06-16T10:24:06.451Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Filebeat-x-pack
[2020-06-16T10:24:06.536Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Generators-Beat-Linux
[2020-06-16T10:24:06.622Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Filebeat-Mac-OS-X
[2020-06-16T10:24:06.706Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Heartbeat-Windows
[2020-06-16T10:24:06.800Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Filebeat-oss
[2020-06-16T10:24:06.883Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests
[2020-06-16T10:24:06.966Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Functionbeat-Windows
[2020-06-16T10:24:07.051Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Metricbeat-Python-integration-tests
[2020-06-16T10:24:07.134Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Libbeat-oss
[2020-06-16T10:24:07.220Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Metricbeat-x-pack
[2020-06-16T10:24:07.320Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Libbeat-crosscompile
[2020-06-16T10:24:07.411Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Libbeat-stress-tests
[2020-06-16T10:24:07.498Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Generators-Metricbeat-Mac-OS-X
[2020-06-16T10:24:07.589Z] Running in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Generators-Beat-Mac-OS-X
[2020-06-16T10:24:07.951Z] + cat
[2020-06-16T10:24:07.951Z] + /usr/local/bin/runbld ./runbld-script
[2020-06-16T10:24:07.951Z] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
[2020-06-16T10:24:14.570Z] runbld>>> runbld started
[2020-06-16T10:24:14.570Z] runbld>>> 1.6.11/a66728ff8f4356963772e6e6d2069392fa06acbe
[2020-06-16T10:24:15.509Z] runbld>>> The following profiles matched the job 'Beats/beats-beats-mbp/PR-18861' in order of occurrence in the config (last value wins).
[2020-06-16T10:24:16.890Z] runbld>>> Debug logging enabled.
[2020-06-16T10:24:16.890Z] runbld>>> Storing result
[2020-06-16T10:24:17.149Z] runbld>>> Store result: created {:total 2, :successful 2, :failed 0} 1
[2020-06-16T10:24:17.149Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200616102416-577AEAAA
[2020-06-16T10:24:17.149Z] runbld>>> Adding system facts.
[2020-06-16T10:24:18.090Z] runbld>>> Adding vcs info for the latest commit:  091f6212c35b24b4e35c2726058640d1be65341f
[2020-06-16T10:24:18.090Z] runbld>>> >>>>>>>>>>>> SCRIPT EXECUTION BEGIN >>>>>>>>>>>>
[2020-06-16T10:24:18.090Z] runbld>>> Adding /usr/lib/jvm/java-8-openjdk-amd64/bin to the path.
[2020-06-16T10:24:18.090Z] Processing JUnit reports with runbld...
[2020-06-16T10:24:18.090Z] + echo 'Processing JUnit reports with runbld...'
[2020-06-16T10:24:18.659Z] runbld>>> <<<<<<<<<<<< SCRIPT EXECUTION END <<<<<<<<<<<<
[2020-06-16T10:24:18.659Z] runbld>>> DURATION: 22ms
[2020-06-16T10:24:18.659Z] runbld>>> STDOUT: 40 bytes
[2020-06-16T10:24:18.659Z] runbld>>> STDERR: 49 bytes
[2020-06-16T10:24:18.659Z] runbld>>> WRAPPED PROCESS: SUCCESS (0)
[2020-06-16T10:24:18.659Z] runbld>>> Searching for build metadata in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats
[2020-06-16T10:24:20.041Z] runbld>>> Storing build metadata: 
[2020-06-16T10:24:20.041Z] runbld>>> Adding test report.
[2020-06-16T10:24:20.041Z] runbld>>> Searching for junit test output files with the pattern: TEST-.*\.xml$ in: /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats
[2020-06-16T10:24:20.980Z] runbld>>> Found 115 test output files
[2020-06-16T10:24:21.921Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-tomcat.xml
[2020-06-16T10:24:21.922Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-istio.xml
[2020-06-16T10:24:21.922Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-openmetrics.xml
[2020-06-16T10:24:21.922Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-cloudfoundry.xml
[2020-06-16T10:24:21.922Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-activemq.xml
[2020-06-16T10:24:21.922Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Metricbeat-x-pack/x-pack/metricbeat/build/TEST-go-integration-iis.xml
[2020-06-16T10:24:22.861Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests/metricbeat/build/TEST-go-integration-windows.xml
[2020-06-16T10:24:22.861Z] runbld>>> No testsuite node found in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861/src/github.com/elastic/beats/Metricbeat-OSS-Integration-tests/metricbeat/build/TEST-go-integration-graphite.xml
[2020-06-16T10:24:23.431Z] runbld>>> Test output logs contained: Errors: 1 Failures: 6 Tests: 10865 Skipped: 1335
[2020-06-16T10:24:23.431Z] runbld>>> Storing result
[2020-06-16T10:24:23.431Z] runbld>>> FAILURES: 7
[2020-06-16T10:24:24.810Z] runbld>>> Store result: updated {:total 2, :successful 2, :failed 0} 2
[2020-06-16T10:24:24.810Z] runbld>>> BUILD: https://c150076387b5421f9154dfbf536e5c60.us-west1.gcp.cloud.es.io:9243/build-1587637540455/t/20200616102416-577AEAAA
[2020-06-16T10:24:24.810Z] runbld>>> Email notification disabled by environment variable.
[2020-06-16T10:24:24.810Z] runbld>>> Slack notification disabled by environment variable.
[2020-06-16T10:24:30.387Z] Running on Jenkins in /var/lib/jenkins/workspace/Beats_beats-beats-mbp_PR-18861
[2020-06-16T10:24:30.521Z] [INFO] getVaultSecret: Getting secrets
[2020-06-16T10:24:30.606Z] Masking supported pattern matches of $VAULT_ADDR or $VAULT_ROLE_ID or $VAULT_SECRET_ID
[2020-06-16T10:24:31.487Z] + chmod 755 generate-build-data.sh
[2020-06-16T10:24:31.487Z] + ./generate-build-data.sh https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18861/ https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18861/runs/17 FAILURE 4782702
[2020-06-16T10:24:31.487Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18861/runs/17/steps/?limit=10000 -o steps-info.json
[2020-06-16T10:24:33.970Z] INFO: curl https://beats-ci.elastic.co/blue/rest/organizations/jenkins/pipelines/Beats/beats-beats-mbp/PR-18861/runs/17/tests/?status=FAILED -o tests-errors.json

@jalvz jalvz requested review from a team as code owners June 2, 2020 08:02
@jalvz jalvz removed request for a team June 2, 2020 08:03
@jalvz jalvz mentioned this pull request Jun 2, 2020
10 tasks
@jalvz jalvz requested a review from a team June 3, 2020 11:37
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Much more straightforward than the approach I had in mind originally.

libbeat/_meta/config/instrumentation.yml.tmpl Outdated Show resolved Hide resolved
libbeat/beat/instrumentation.go Outdated Show resolved Hide resolved
libbeat/beat/instrumentation.go Outdated Show resolved Hide resolved
libbeat/beat/instrumentation.go Outdated Show resolved Hide resolved
libbeat/beat/instrumentation.go Outdated Show resolved Hide resolved
libbeat/beat/instrumentation.go Outdated Show resolved Hide resolved
libbeat/pipe/listener.go Outdated Show resolved Hide resolved
Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once the config files are updated to render conditionally on apm-server.

libbeat/beat/instrumentation.go Outdated Show resolved Hide resolved
@jalvz
Copy link
Contributor Author

jalvz commented Jun 8, 2020

@urso / @ycombinator can any of you have a look at this, or assign it to someone else?

Thanks.

@urso urso self-requested a review June 10, 2020 12:22
Copy link

@urso urso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add docs about enabling instrumentation in beats? Please add the needs_docs label if you plan to add docs later.

// Listener is only relevant for APM Server sending tracing data to itself
// APM Server needs this Listener to create an ad-hoc tracing server
Listener net.Listener
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'libbeat/beat' package should be the minimal package with public API that is required to implement a custom Beat. It should provide mostly interfaces only. Can we move this functionality into a separate package and turn 'Instrumentation' into an interface? Do we even need Instrumentation or would it be enough to have a Tracer within the Beat structure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Just the Tracer is not enough, thou - we need the Listener

libbeat/beat/instrumentation.go Outdated Show resolved Hide resolved
libbeat/pipe/listener_test.go Outdated Show resolved Hide resolved
Logging *common.Config `config:"logging"`
MetricLogging *common.Config `config:"logging.metrics"`
Keystore *common.Config `config:"keystore"`
Instrumentation *common.Config `config:"instrumentation"`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know there are no clear rules, but I'd prefer to use concrete types and only use common.Config if we really need it (e.g. capture a configuration without interpreting it yet). You might consider to change this line to Instrumentation instrumentation.Config).

// Instrumentation is an interface that can return an APM tracer a net.listener
type Instrumentation interface {
Tracer() *apm.Tracer
Listener() net.Listener
Copy link

@urso urso Jun 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious, but why do we need the Listener here? Is it still for apm-server itself, or is it some general requirement? I didn't see the listener used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is for apm-server: we need to create an adhoc tracing server so it doesn't send traces to itself infinitely. Possibly this can be useful for the Elastic Agent too.

@jalvz jalvz merged commit b9e49ea into elastic:master Jun 17, 2020
jalvz added a commit to jalvz/beats that referenced this pull request Jun 25, 2020
This includes an instrumentation namespace at the top of all beat config files. The tracer is exposed trough the Beat object.
melchiormoulin pushed a commit to melchiormoulin/beats that referenced this pull request Oct 14, 2020
This includes an instrumentation namespace at the top of all beat config files. The tracer is exposed trough the Beat object.
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
This includes an instrumentation namespace at the top of all beat config files. The tracer is exposed trough the Beat object.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement needs_docs Team:apm APM Server team issues/PRs Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[APM] Make APM tracer configurable
5 participants