Skip to content

Serverless instrumentation - #716

Closed
basepi wants to merge 34 commits into
elastic:masterfrom
basepi:serverless
Closed

Serverless instrumentation#716
basepi wants to merge 34 commits into
elastic:masterfrom
basepi:serverless

Conversation

@basepi

@basepi basepi commented Feb 13, 2020

Copy link
Copy Markdown
Contributor

What does this pull request do?

Adds support for instrumenting serverless functions. Logs to CloudWatch so that those logs can be collected and sent to the APM Server later. Disables all background threads.

Note: This "works", but isn't useful without the connecting lambda from CloudWatch to the APM Server. Thus the lack of docs or references to this code.

Related issues

Ref #428

This function appears to have been replaced by Client.queue()
anywhere that it actually matters. I can't find any code paths
that actually use this function, which further makes DummyClient
useless.
The http transport has wandered from the parent Transport class
I also let black restructure this file. I don't see anything
semantically different with black's version and it does look nicer.
We're going to need context helpers and the like, makes sense
for it to live in its own area
Comment thread elasticapm/contrib/serverless/__init__.py Outdated
@basepi
basepi marked this pull request as ready for review February 20, 2020 23:28
@basepi
basepi requested a review from beniwohli February 20, 2020 23:28
Comment thread elasticapm/contrib/serverless/__init__.py Outdated

@beniwohli beniwohli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great stuff!

Comment thread elasticapm/__init__.py
from elasticapm.conf import setup_logging # noqa: F401
from elasticapm.contrib.serverless import capture_serverless # noqa: F401
from elasticapm.instrumentation.control import instrument, uninstrument # noqa: F401
from elasticapm.traces import ( # noqa: F401

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IIRC, last time I did this, all our linters got into a kerfuffle. I think it was black and flake8 duking it out

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As far as I can tell, both are running on that file in my IDE and both are happy. Took some experimentation as to the location of the # noqa: F401 line (which is why I know both were running).

Could you try checking it out and see if your IDE gives you problems?

Comment thread elasticapm/base.py
Comment thread elasticapm/contrib/serverless/__init__.py
Comment thread elasticapm/contrib/serverless/__init__.py Outdated
Comment thread elasticapm/contrib/serverless/__init__.py Outdated
Comment thread elasticapm/contrib/serverless/__init__.py Outdated
Comment thread elasticapm/contrib/serverless/__init__.py Outdated
@basepi

basepi commented Jan 7, 2021

Copy link
Copy Markdown
Contributor Author

Closing for now. We will probably go a different direction (via Lambda extensions)

@basepi basepi closed this Jan 7, 2021
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.

2 participants