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 APM instrumentation #702

Merged
merged 10 commits into from
Jul 27, 2021
Merged

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Jul 20, 2021

In #670 we are planning to introduce some refactors, in part motivated by performance issues. Introduce some instrumentation to evaluate what parts of the service require more performance tunning. And in the future to be able to compare the impact of the applied changes.

With this instrumentation we can collect traces such as this one:
Captura de pantalla de 2021-07-20 19-36-32

Checklist:

  • Fix /categories, tests failing.
  • Add docs.

@jsoriano jsoriano added the Team:Integrations Label for the Integrations team label Jul 20, 2021
@jsoriano jsoriano self-assigned this Jul 20, 2021
@elasticmachine
Copy link

elasticmachine commented Jul 20, 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

  • Start Time: 2021-07-27T11:18:12.747+0000

  • Duration: 5 min 51 sec

  • Commit: 4e219ec

Test stats 🧪

Test Results
Failed 0
Passed 89
Skipped 0
Total 89

Trends 🧪

Image of Build Times

Image of Tests

@jsoriano jsoriano force-pushed the apm-instrumentation branch from 079049f to b2de498 Compare July 27, 2021 09:14
@jsoriano jsoriano marked this pull request as ready for review July 27, 2021 09:17
@jsoriano jsoriano requested a review from mtojek July 27, 2021 09:17
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 from the Go Agent usage angle, just a couple of minor comments.

util/packages.go Outdated Show resolved Hide resolved
categories.go Outdated
}

func (filter categoriesFilter) Filter(ctx context.Context, packages util.Packages) map[string]util.Package {
span, _ := apm.StartSpan(ctx, "FilterPackages", "custom")
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest changing all the span types from "custom" to "app". This should work better with the "time spent by span type" chart in APM:

image

Transaction time is countered under "app", and if you add spans with type "app" then they will add to this. i.e. it's best practice (probably not written down anywhere) to use "app" for spans related to application code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed 👍

Btw, when initializing the service (here), I am using "backend.init" as transaction type, is this ok?
Are there some guidelines or list of recommended values for transaction and span types?

Copy link
Member

Choose a reason for hiding this comment

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

That is okay, and I don't think it particularly matters. HTTP requests will be given the transaction type "request". I'm not aware of any guidance for transaction types for this kind of program initialisation.

Copy link
Contributor

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

LGTM as long as CI is happy. Do we need to modify Dockerfiles in Package Storage too?

@jsoriano
Copy link
Member Author

Do we need to modify Dockerfiles in Package Storage too?

Yes, next step would be to see where we send the data, and configure the registries used in production.

@jsoriano jsoriano merged commit ce683f8 into elastic:master Jul 27, 2021
@jsoriano jsoriano deleted the apm-instrumentation branch July 27, 2021 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Integrations Label for the Integrations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants