{ "info": { "author": "SignalFx, Inc", "author_email": "info@signalfx.com", "bugtrack_url": null, "classifiers": [ "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "SignalFx Python Lambda Wrapper\n==============================\n\nSignalFx Python Lambda Wrapper.\n\nUsage\n-----\n\nThe SignalFx Python Lambda Wrapper is a wrapper around an AWS Lambda\nPython function handler, used to instrument execution of the function\nand send metrics and traces to SignalFx.\n\nInstallation\n~~~~~~~~~~~~\n\nTo install from PyPi\n\n::\n\n $ pip install signalfx_lambda\n\nConfiguring the ingest endpoint\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nBy default, this function wrapper will send to the `us0` realm. If you are\nnot in this realm you will need to set the `SIGNALFX_INGEST_ENDPOINT` environment\nvariable to the correct realm ingest endpoint (https://ingest.{REALM}.signalfx.com).\nTo determine what realm you are in, check your profile page in the SignalFx\nweb application (click the avatar in the upper right and click My Profile).\n\n\nEnvironment Variables\n~~~~~~~~~~~~~~~~~~~~~\n\n**Note: the environment variables SIGNALFX_INGEST_ENDPOINT and SIGNALFX_AUTH_TOKEN are being deprecated and will not be supported in future releases.**\n\n::\n\n SIGNALFX_ACCESS_TOKEN=access token\n\n # endpoint for both metrics and tracer. Overridden by SIGNALFX_METRICS_URL\n # and SIGNALFX_TRACING_URL if set\n SIGNALFX_ENDPOINT_URL=http://:8080\n\n # optional metrics and tracing configuration\n\n SIGNALFX_METRICS_URL=ingest endpoint [ default: https://pops.signalfx.com ]\n SIGNALFX_SEND_TIMEOUT=timeout in seconds for sending datapoint [ default: 0.3 ]\n\n SIGNALFX_TRACING_URL=tracing endpoint [ default: https://ingest.signalfx.com/v1/trace ]\n\nSIGNALFX_ENDPOINT_URL can be used to configure a common endpoint for metrics and\ntraces, as is the case when forwarding with the Smart Gateway. The path :code:`/v1/traces`\nwill automatically be added to the endpoint for traces.\n\nIf either SIGNALFX_TRACING_URL or SIGNALFX_METRICS_URL are set, they will take\nprecendence over SIGNALFX_ENDPOINT_URL for their respective components.\n\nFor example, if only SIGNALFX_ENDPOINT_URL is set:\n\n::\n\n SIGNALFX_ENDPOINT_URL=http://:8080\n\nboth metrics and traces will be sent to the gateway address.\n\nIf SIGNALFX_ENDPOINT_URL and SIGNALFX_METRICS_URL are set:\n\n::\n\n SIGNALFX_METRICS_URL=https://pops.signalfx.com\n\n SIGNALFX_ENDPOINT_URL=http://:8080\n\nTraces will be sent to the gateway and metrics will go through POPS.\n\nWrapping a function\n~~~~~~~~~~~~~~~~~~~\n\nThere are two wrappers provided.\n\nFor metrics, decorate your handler with @signalfx_lambda.emits_metrics\n\n::\n\n import signalfx_lambda\n\n @signalfx_lambda.emits_metrics\n def handler(event, context):\n # your code\n\nFor tracing, use the @signalfx_lambda.is_traced decorator\n\n::\n\n import signalfx_lambda\n\n @signalfx_lambda.is_traced\n def handler(event, context):\n # your code\n\nThe decorators can be used individually or together.\n\nMetrics and dimensions sent by the metrics wrapper\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe Lambda wrapper sends the following metrics to SignalFx:\n\n+-----------------------+-----------------------+-----------------------+\n| Metric Name | Type | Description |\n+=======================+=======================+=======================+\n| function.invocations | Counter | Count number of |\n| | | Lambda invocations |\n+-----------------------+-----------------------+-----------------------+\n| function.cold_starts | Counter | Count number of cold |\n| | | starts |\n+-----------------------+-----------------------+-----------------------+\n| function.errors | Counter | Count number of |\n| | | errors from |\n| | | underlying Lambda |\n| | | handler |\n+-----------------------+-----------------------+-----------------------+\n| function.duration | Gauge | Milliseconds in |\n| | | execution time of |\n| | | underlying Lambda |\n| | | handler |\n+-----------------------+-----------------------+-----------------------+\n\nThe Lambda wrapper adds the following dimensions to all data points sent\nto SignalFx:\n\n+----------------------------------+----------------------------------+\n| Dimension | Description |\n+==================================+==================================+\n| lambda_arn | ARN of the Lambda function |\n| | instance |\n+----------------------------------+----------------------------------+\n| aws_region | AWS Region |\n+----------------------------------+----------------------------------+\n| aws_account_id | AWS Account ID |\n+----------------------------------+----------------------------------+\n| aws_function_name | AWS Function Name |\n+----------------------------------+----------------------------------+\n| aws_function_version | AWS Function Version |\n+----------------------------------+----------------------------------+\n| aws_function_qualifier | AWS Function Version Qualifier |\n| | (version or version alias if it |\n| | is not an event source mapping |\n| | Lambda invocation) |\n+----------------------------------+----------------------------------+\n| event_source_mappings | AWS Function Name (if it is an |\n| | event source mapping Lambda |\n| | invocation) |\n+----------------------------------+----------------------------------+\n| aws_execution_env | AWS execution environment |\n| | (e.g.\u00a0AWS_Lambda_python3.6) |\n+----------------------------------+----------------------------------+\n| function_wrapper_version | SignalFx function wrapper |\n| | qualifier |\n| | (e.g.\u00a0signalfx_lambda_0.0.2) |\n+----------------------------------+----------------------------------+\n| metric_source | The literal value of |\n| | \u2018lambda_wrapper\u2019 |\n+----------------------------------+----------------------------------+\n\nTraces and tags sent by the Tracing wrapper\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe tracing wrapper creates a span for the wrapper handler. This span has the following tags:\n\n+----------------------------------+----------------------------------+\n| Tag | Description |\n+==================================+==================================+\n| aws_request_id | AWS Request ID |\n+----------------------------------+----------------------------------+\n| lambda_arn | ARN of the Lambda function |\n| | instance |\n+----------------------------------+----------------------------------+\n| aws_region | AWS Region |\n+----------------------------------+----------------------------------+\n| aws_account_id | AWS Account ID |\n+----------------------------------+----------------------------------+\n| aws_function_name | AWS Function Name |\n+----------------------------------+----------------------------------+\n| aws_function_version | AWS Function Version |\n+----------------------------------+----------------------------------+\n| aws_function_qualifier | AWS Function Version Qualifier |\n| | (version or version alias if it |\n| | is not an event source mapping |\n| | Lambda invocation) |\n+----------------------------------+----------------------------------+\n| event_source_mappings | AWS Function Name (if it is an |\n| | event source mapping Lambda |\n| | invocation) |\n+----------------------------------+----------------------------------+\n| aws_execution_env | AWS execution environment |\n| | (e.g.\u00a0AWS_Lambda_python3.6) |\n+----------------------------------+----------------------------------+\n| function_wrapper_version | SignalFx function wrapper |\n| | qualifier |\n| | (e.g.\u00a0signalfx_lambda_0.0.2) |\n+----------------------------------+----------------------------------+\n| component | The literal value of |\n| | \u2018python-lambda-wrapper\u2019 |\n+----------------------------------+----------------------------------+\n\nSending custom metric from the Lambda function\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n import signalfx_lambda\n\n # sending application_performance metric with value 100 and dimension abc:def\n signalfx_lambda.send_gauge('application_performance', 100, {'abc':'def'})\n\n # sending counter metric with no dimension\n signalfx_lambda.send_counter('database_calls', 1)\n\nAdding manual tracing to the Lambda function\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nManual instrumentation can be added to trace critical parts of your handler\nfunction.\n\n::\n\n import opentracing\n\n tracer = opentracing.tracer\n\n def some_function():\n with tracer.start_active_span(\"span_name\", tags=tags) as scope:\n\n # do some work\n\n span = scope.span\n span.set_tag(\"example_tag\", \"example_value\")\n\nMore examples and usage information can be found in the Jaeger Python Tracer\n`documentation `_.\n\nTesting it out locally\n~~~~~~~~~~~~~~~~~~~~~~\n\nUse python-lambda-local\n\n::\n\n pip install python-lambda-local\n\n::\n\n python-lambda-local tests/test.py tests/event.json -a 'arn:aws:lambda:us-east-1:accountId:function:functionNamePython:$LATEST'\n\nPackaging\n~~~~~~~~~\n\n::\n\n python setup.py bdist_wheel --universal\n\nLicense\n~~~~~~~\n\nApache Software License v2. Copyright \u00a9 2014-2019 SignalFx\n\n\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/signalfx/lambda-python", "keywords": "", "license": "Apache Software License v2", "maintainer": "", "maintainer_email": "", "name": "signalfx-lambda", "package_url": "https://pypi.org/project/signalfx-lambda/", "platform": "", "project_url": "https://pypi.org/project/signalfx-lambda/", "project_urls": { "Homepage": "https://github.com/signalfx/lambda-python" }, "release_url": "https://pypi.org/project/signalfx-lambda/0.1.5/", "requires_dist": [ "signalfx (>=1.0.16)", "sfx-jaeger-client (>=3.13.1.dev0)", "six (>=1.4.0)" ], "requires_python": "", "summary": "SignalFx Lambda Python Wrapper", "version": "0.1.5" }, "last_serial": 5651431, "releases": { "0.0.4": [ { "comment_text": "", "digests": { "md5": "8a42f2c99fbeb4b431b1c4d2bdcc1e7a", "sha256": "8149ab5b26090022a468259f93c171950e419bfd983d7d5b25ca3c5efaf7b9f0" }, "downloads": -1, "filename": "signalfx_lambda-0.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8a42f2c99fbeb4b431b1c4d2bdcc1e7a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6388, "upload_time": "2017-11-15T05:01:54", "url": "https://files.pythonhosted.org/packages/56/39/d11b0b8be0780ae5508778084803d7aa269ca430c99ada4040552e80d32b/signalfx_lambda-0.0.4-py2.py3-none-any.whl" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "2fe6f5eba35064a4469c0066d59bb5cf", "sha256": "fedb8cc2cd56399a51e7ecc7b60a4409f209c932adf910ab03b9940243d92dce" }, "downloads": -1, "filename": "signalfx_lambda-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2fe6f5eba35064a4469c0066d59bb5cf", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15131, "upload_time": "2019-03-11T15:08:25", "url": "https://files.pythonhosted.org/packages/8c/38/80356e23e252779526fd194d7ede928f344f8a68fe21043b66e0efe4b8eb/signalfx_lambda-0.1.0-py2.py3-none-any.whl" } ], "0.1.0.1": [ { "comment_text": "", "digests": { "md5": "6d2de069db62f4476ab40882686080d9", "sha256": "0717dbcf26985e1202f59277764b6009a9c8eb89bb90d927dbcfc04abdf22b73" }, "downloads": -1, "filename": "signalfx_lambda-0.1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6d2de069db62f4476ab40882686080d9", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15161, "upload_time": "2019-03-11T20:21:34", "url": "https://files.pythonhosted.org/packages/11/22/229dc9245d35e6644b9c3ff857c6aed70e527a011185f3b3f38c6df77640/signalfx_lambda-0.1.0.1-py2.py3-none-any.whl" } ], "0.1.1.1": [ { "comment_text": "", "digests": { "md5": "82ab8e3907d9fa5f766948d72bec32ff", "sha256": "0db3aaecec7a7851bffaa293c402eed727d5041f3069d1f69c629640c6311640" }, "downloads": -1, "filename": "signalfx_lambda-0.1.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "82ab8e3907d9fa5f766948d72bec32ff", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15336, "upload_time": "2019-03-19T17:39:16", "url": "https://files.pythonhosted.org/packages/93/ea/64ab798e0beb08ea3dbe3f89b2a17d474c18df1564f2fb55f98eda613181/signalfx_lambda-0.1.1.1-py2.py3-none-any.whl" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "d81ed47b68af36bbc87234c3ca39ce97", "sha256": "78e1e9bba5e43ed0a6adca36a46ac834445ce83501e6c2b6ff369fae7277daaa" }, "downloads": -1, "filename": "signalfx_lambda-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d81ed47b68af36bbc87234c3ca39ce97", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15347, "upload_time": "2019-04-02T11:47:16", "url": "https://files.pythonhosted.org/packages/67/b3/61b9f633bbec83c997ff403cace908e204f058fa04d9e229ddb9a5089b78/signalfx_lambda-0.1.2-py2.py3-none-any.whl" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "27c86c7a0e138228fe5ca51676375c8b", "sha256": "72b2045d4a14023f386bab12a2904ad273baa927467f06cc018784ac384ef1a3" }, "downloads": -1, "filename": "signalfx_lambda-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "27c86c7a0e138228fe5ca51676375c8b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15324, "upload_time": "2019-06-11T18:18:53", "url": "https://files.pythonhosted.org/packages/ae/41/497a63229fb4223b4b6cefa860018eb808888ce514972432a747e7d860f7/signalfx_lambda-0.1.3-py2.py3-none-any.whl" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "a66ab524909bb23a39ed54fa0eaf87b3", "sha256": "37f030cfa462f15d3bdf6e3e4ec1afd5ee91974fd8b9ca5d91f6acabb5117cb4" }, "downloads": -1, "filename": "signalfx_lambda-0.1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a66ab524909bb23a39ed54fa0eaf87b3", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11807, "upload_time": "2019-07-26T15:42:40", "url": "https://files.pythonhosted.org/packages/cc/9d/1a12b40cde5688955f5e6e36d966f0f49fe18fb1635de6c2614847afbae5/signalfx_lambda-0.1.4-py2.py3-none-any.whl" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "c9b960dbbf61cd7ba162a3caec5cfff1", "sha256": "4ba8b7f27fbffb3a90f4073243a5d39927f5037f43bd9b3a34ba404e105a6a65" }, "downloads": -1, "filename": "signalfx_lambda-0.1.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c9b960dbbf61cd7ba162a3caec5cfff1", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11793, "upload_time": "2019-08-08T17:33:11", "url": "https://files.pythonhosted.org/packages/9e/b6/84adff6fffbe30b61abc12c348d5de3e9e298434ad3ea31d2b8da12cb8e3/signalfx_lambda-0.1.5-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c9b960dbbf61cd7ba162a3caec5cfff1", "sha256": "4ba8b7f27fbffb3a90f4073243a5d39927f5037f43bd9b3a34ba404e105a6a65" }, "downloads": -1, "filename": "signalfx_lambda-0.1.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c9b960dbbf61cd7ba162a3caec5cfff1", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11793, "upload_time": "2019-08-08T17:33:11", "url": "https://files.pythonhosted.org/packages/9e/b6/84adff6fffbe30b61abc12c348d5de3e9e298434ad3ea31d2b8da12cb8e3/signalfx_lambda-0.1.5-py2.py3-none-any.whl" } ] }