Skip to content

Conversation

@marclop
Copy link
Contributor

@marclop marclop commented Nov 19, 2021

What is the problem this PR solves?

Adds support to enable instrumentation via the APM Go agent. New config
options have been added to the Server input which could be set up in
the fleet-server integration configuration.

The added instrumentation covers the fleet-server http server and the
go-elasticsearch client.

A sample of the configuration that's been added (instrumentation):

inputs:
  - type: fleet-server
    server:
      host: localhost
      port: 8220
      instrumentation:
        enabled: true
        hosts: ["localhost:8200"]
        environment: production
        secret_token: token
        api_key: apikey

How does this PR solve the problem?

By using the go.elastic.co/apm client.

How to test this PR locally

  1. Build elastic-agent and patch it with a locally built version of fleet-server.
  2. Run fleet server in agent mode.
  3. Go to Kibana and install the APM Integration
  4. Modify fleet server and add these custom settings:
server.instrumentation:
  enabled: true
  environment: test

image

  1. Navigate to the APM App and verify that traces are shown and have the following metadata set:

Screen Shot 2021-11-19 at 7 22 38 PM

image

  1. Verify elasticsearch shows up as a dependency in the APM Service map

image

Checklist

  • 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.

Related issues

Closes #850

Adds support to enable instrumentation via the APM Go agent. New config
options have been added to the `Server` input which could be set up in
the `fleet-server` integration configuration.

The added instrumentation covers the `fleet-server` http server and the
`go-elasticsearch` client.

Signed-off-by: Marc Lopez Rubio <[email protected]>
@elasticmachine
Copy link
Contributor

elasticmachine commented Nov 19, 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 preview

Expand to view the summary

Build stats

  • Duration: 9 min 32 sec

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@mergify
Copy link
Contributor

mergify bot commented Nov 19, 2021

This pull request does not have a backport label. Could you fix it @marclop? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v/d./d./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Nov 19, 2021
@marclop marclop marked this pull request as ready for review November 19, 2021 11:34
@aleksmaus aleksmaus added backport-v8.0.0 Automated backport with mergify v8.0.0 labels Nov 19, 2021
@mergify mergify bot removed the backport-skip Skip notification from the automated backport with mergify label Nov 19, 2021
Signed-off-by: Marc Lopez Rubio <[email protected]>
@scunningham
Copy link

This seems like the right level of integration.

Copy link
Contributor

@aleksmaus aleksmaus left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Marc Lopez Rubio <[email protected]>
@marclop marclop requested review from aleksmaus and axw November 22, 2021 01:49
Signed-off-by: Marc Lopez Rubio <[email protected]>
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 good!

Signed-off-by: Marc Lopez Rubio <[email protected]>
Copy link
Contributor

@aleksmaus aleksmaus left a comment

Choose a reason for hiding this comment

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

LGTM

@marclop marclop merged commit ade74c7 into elastic:master Nov 23, 2021
mergify bot pushed a commit that referenced this pull request Nov 23, 2021
Adds support to enable instrumentation via the APM Go agent. New config
options have been added to the `Server` input which could be set up in
the `fleet-server` integration configuration.

The added instrumentation covers the `fleet-server` http server and the
Adds support to enable instrumentation via the APM Go agent. New config
options have been added to the `Server` input which could be set up in
the `fleet-server` integration configuration.

The added instrumentation covers the `fleet-server` http server and the
`go-elasticsearch` client.

A sample of the configuration that's been added (`instrumentation`):

```yaml
inputs:
  - type: fleet-server
    server:
      instrumentation:
        enabled: true
        hosts: ["localhost:8200"]
        environment: production
        secret_token: token
        api_key: apikey
```

Signed-off-by: Marc Lopez Rubio <[email protected]>
(cherry picked from commit ade74c7)
mergify bot added a commit that referenced this pull request Nov 23, 2021
Adds support to enable instrumentation via the APM Go agent. New config
options have been added to the `Server` input which could be set up in
the `fleet-server` integration configuration.

The added instrumentation covers the `fleet-server` http server and the
Adds support to enable instrumentation via the APM Go agent. New config
options have been added to the `Server` input which could be set up in
the `fleet-server` integration configuration.

The added instrumentation covers the `fleet-server` http server and the
`go-elasticsearch` client.

A sample of the configuration that's been added (`instrumentation`):

```yaml
inputs:
  - type: fleet-server
    server:
      instrumentation:
        enabled: true
        hosts: ["localhost:8200"]
        environment: production
        secret_token: token
        api_key: apikey
```

Signed-off-by: Marc Lopez Rubio <[email protected]>
(cherry picked from commit ade74c7)

Co-authored-by: Marc Lopez Rubio <[email protected]>
stuartnelson3 added a commit to stuartnelson3/beats that referenced this pull request Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-v8.0.0 Automated backport with mergify v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add APM instrumentation to Fleet Server

5 participants