You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 3, 2023. It is now read-only.
* Update README.rst
* Update README.rst
* Update README.rst
* Update README.rst
Updating installation instructions
* Update README.rst
Updating python wrapper installation instructions
* Change the order of options, cleanup the instructions for SIGNALFX_INGEST_ENDPOINT
* Update README.rst
Revised step 2 and 3
* Update README.rst
Placed metrics information to the bottom of the document
* Update README.rst
Updating based on feedback from Marta
* Update README.rst
Made various updates, including in step 3: Set environment variables
* Update README.rst
Made updates based on feedback from Mark. Most importantly, I rearranged the options:
- Previous Option 1, is now Option 3.
- Previous Option 2, is now Option 1
- Previous Option 3, is now Option 2
* Update README.rst
Making style changes
* Update README.rst
Making minor style changes
* Update README.rst
python ==> Python
* Update README.rst
lambda ==> Lambda
* Update README.rst
Updated "step 3" to include the different options for updating environment variables.
* Update README.rst
variable ==> variables
* Update README.rst
Added 2020, and added "include the following code in your function:"
* updated copyrights for splunk
* correct form of a copyright
Co-authored-by: Marta Musik <[email protected]>
The SignalFx Python Lambda Wrapper is a wrapper around an AWS Lambda
10
-
Python function handler, used to instrument execution of the function
11
-
and send metrics and traces to SignalFx.
12
-
13
-
Installation
14
-
~~~~~~~~~~~~
15
-
16
-
To install from PyPi
2
+
===============================
3
+
4
+
Overview
5
+
---------
6
+
7
+
You can use this document to add a SignalFx wrapper to your AWS Lambda for Python.
8
+
9
+
The SignalFx Python Lambda Wrapper wraps around an AWS Lambda Python function handler, which allows metrics and traces to be sent to SignalFx.
10
+
11
+
At a high-level, to add a SignalFx Python Lambda wrapper, you can package the code yourself, or you can use a Lambda layer containing the wrapper and then attach the layer to a Lambda function.
12
+
13
+
To learn more about Lambda Layers, please visit the AWS documentation site and see [AWS Lambda Layers](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html).
14
+
15
+
Step 1: Add the Lambda wrapper in AWS
16
+
-----------------------------------------
17
+
18
+
To add the SignalFx wrapper, you have the following options:
19
+
20
+
* Option 1: In AWS, create a Lambda function, then attach a SignalFx-hosted layer with a wrapper.
21
+
* If you are already using Lambda layers, then SignalFx recommends that you follow this option.
22
+
* In this option, you will use a Lambda layer created and hosted by SignalFx.
23
+
* Option 2: In AWS, create a Lambda function, then create and attach a layer based on a SignalFx SAM (Serverless Application Model) template.
24
+
* If you are already using Lambda layers, then SignalFx also recommends that you follow this option.
25
+
* In this option, you will choose a SignalFx template, and then deploy a copy of the layer.
26
+
* Option 3: Use the wrapper as a regular dependency, and then create a Lambda function based on your artifact containing both code and dependencies.
27
+
28
+
Option 1: Create a Lambda function, then attach the SignalFx-hosted Lambda layer
In this option, you will use a Lambda layer created and hosted by SignalFx.
32
+
33
+
1. To verify compatibility, review the list of supported regions. See [Lambda Layer Versions](https://github.com/signalfx/lambda-layer-versions/blob/master/python/PYTHON.md).
34
+
2. Open your AWS console.
35
+
3. In the landing page, under **Compute**, click **Lambda**.
36
+
4. Click **Create function** to create a layer with SignalFx's capabilities.
37
+
5. Click **Author from scratch**.
38
+
6. In **Function name**, enter a descriptive name for the wrapper.
39
+
7. In **Runtime**, select the desired language.
40
+
8. Click **Create function**.
41
+
9. Click on **Layers**, then add a layer.
42
+
10. Mark **Provide a layer version**.
43
+
11. Enter an ARN number.
44
+
* To locate the ARN number, see [Lambda Layer Versions](https://github.com/signalfx/lambda-layer-versions/blob/master/python/PYTHON.md).
45
+
46
+
Option 2: Create a Lambda function, then create and attach a layer based on a SignalFx template
In this option, you will choose a SignalFx template, and then deploy a copy of the layer.
50
+
51
+
1. Open your AWS console.
52
+
2. In the landing page, under **Compute**, click **Lambda**.
53
+
3. Click **Create function** to create a layer with SignalFx's capabilities.
54
+
4. Click **Browse serverless app repository**.
55
+
5. Click **Public applications**.
56
+
6. In the search field, enter and select **signalfx-lambda-python-wrapper**.
57
+
7. Review the template, permissions, licenses, and then click **Deploy**.
58
+
* A copy of the layer will now be deployed into your account.
59
+
8. Return to the previous screen to add a layer to the function, select from list of runtime compatible layers, and then select the name of the copy.
60
+
61
+
Option 3: Install the wrapper package with pip
62
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63
+
64
+
Run the following installation script in your command line:
17
65
18
66
.. code::
19
67
20
68
pip install signalfx_lambda
21
69
22
-
Configuring the ingest endpoint
23
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24
70
25
-
By default, this function wrapper will send to the ``us0`` realm. If you are
26
-
not in this realm you will need to set the ``SIGNALFX_INGEST_ENDPOINT`` environment
27
-
variable to the correct realm ingest endpoint (``https://ingest.{REALM}.signalfx.com``).
28
-
To determine what realm you are in, check your profile page in the SignalFx
29
-
web application (click the avatar in the upper right and click My Profile).
71
+
Step 2: Locate and set the ingest endpoint
72
+
-------------------------------------------
73
+
By default, this function wrapper will send data to the us0 realm. As a result, if you are not in us0 realm and you want to use the ingest endpoint directly, then you must explicitly set your realm. To set your realm, use a subdomain, such as ingest.us1.signalfx.com or ingest.eu0.signalfx.com.
30
74
75
+
To locate your realm:
31
76
32
-
Environment Variables
33
-
~~~~~~~~~~~~~~~~~~~~~
77
+
1. Open SignalFx and in the top, right corner, click your profile icon.
78
+
2. Click **My Profile**.
79
+
3. Next to **Organizations**, review the listed realm.
34
80
35
-
**Note: the environment variables ``SIGNALFX_INGEST_ENDPOINT`` and ``SIGNALFX_AUTH_TOKEN`` are being deprecated and will not be supported in future releases.**
36
81
37
-
.. code:: bash
38
-
39
-
SIGNALFX_ACCESS_TOKEN=access token
40
-
41
-
# endpoint for both metrics and tracer. Overridden by SIGNALFX_METRICS_URL
42
-
# and SIGNALFX_TRACING_URL if set
43
-
SIGNALFX_ENDPOINT_URL=http://<my_gateway>:8080
82
+
Step 3: Set environment variables
83
+
----------------------------------
44
84
45
-
# optional metrics and tracing configuration
85
+
1. Set SIGNALFX_ACCESS_TOKEN with your correct access token. Review the following example.
``SIGNALFX_ENDPOINT_URL`` can be used to configure a common endpoint for metrics and
53
-
traces, as is the case when forwarding with the Smart Gateway. The path ``/v1/trace``
54
-
will automatically be added to the endpoint for traces.
91
+
2. If you use POPS, Smart Gateway, or want to ingest directly from a realm other than us0, then you must set at least one endpoint variable. (For environment variables, SignalFx defaults to the us0 realm. As a result, if you are not in the us0 realm, you may need to set your environment variables.) There are two options:
55
92
56
-
If either ``SIGNALFX_TRACING_URL`` or ``SIGNALFX_METRICS_URL`` are set, they will take
57
-
precendence over ``SIGNALFX_ENDPOINT_URL`` for their respective components.
93
+
**Option 1**
58
94
59
-
For example, if only ``SIGNALFX_ENDPOINT_URL`` is set:
95
+
You can update ``SIGNALFX_ENDPOINT_URL`` where both metrics and traces will be sent to the gateway address. Note that the path ``/v1/trace`` will be automatically added to the endpoint for traces.
60
96
61
97
.. code:: bash
62
98
63
99
SIGNALFX_ENDPOINT_URL=http://<my_gateway>:8080
100
+
64
101
65
-
Both metrics and traces will be sent to the gateway address.
102
+
**Option 2**
66
103
67
-
If ``SIGNALFX_ENDPOINT_URL`` and ``SIGNALFX_METRICS_URL`` are set:
104
+
You can update ``SIGNALFX_ENDPOINT_URL`` and ``SIGNALFX_METRICS_URL`` where traces will be sent to the gateway and metrics will go through POPS, respectively.
68
105
69
106
.. code:: bash
70
107
71
108
SIGNALFX_METRICS_URL=https://pops.signalfx.com
72
109
SIGNALFX_ENDPOINT_URL=http://<my_gateway>:8080
110
+
111
+
To learn more, see:
112
+
* [SignalFx Point of Presence Service (POPS)](https://docs.signalfx.com/en/latest/integrations/integrations-reference/integrations.signalfx.point.of.presence.service.(pops).html)
113
+
* [Deploying the SignalFx Smart Gateway](https://docs.signalfx.com/en/latest/apm/apm-deployment/smart-gateway.html)
114
+
115
+
116
+
3. (Optional) Set additional environment variables. Review the following examples.
117
+
118
+
.. code:: bash
73
119
74
-
Traces will be sent to the gateway and metrics will go through POPS.
120
+
SIGNALFX_SEND_TIMEOUT=timeout in seconds for sending datapoint [ default: 0.3 ]
0 commit comments