LocalStack Extension: LocalStack Extension: Platform observability
Project description
LocalStack Extension: Platform observability
LocalStack extension for providing insights into the LocalStack platform in the form of service-specific traces and metrics.
Install
localstack extensions install localstack-extension-platform-observability
Install local development version
To install the extension into localstack in developer mode, you will need Python 3.10, and create a virtual environment in the extensions project.
In the newly generated project, simply run
make install
Then, to enable the extension for LocalStack, run
localstack extensions dev enable .
You can then start LocalStack with EXTENSION_DEV_MODE=1
to load all enabled extensions:
EXTENSION_DEV_MODE=1 localstack start
Install from GitHub repository
To distribute your extension, simply upload it to your github account. Your extension can then be installed via:
localstack extensions install "git+https://github.com/localstack/localstack-extension-platform-observability/#egg=localstack-extension-platform-observability"
Usage
Metrics
Fetch all metrics
curl localhost:4566/_extension/observability/metrics
Fetch a specific instrument
curl localhost:4566/_extension/observability/metrics/<instrument>
The following instruments exist
system
: system metrics like number of threadssns
: sns topic statisticssqs
: sqs queue statisticsgateway
: HTTP gateway statistics on number of requests
Example:
curl -s "localhost:4566/_extension/observability/metrics" | jq .
{
"system": [
{
"active_thread_count": 15,
"max_rss": 15
}
],
"gateway": [
{
"total": 14,
"sqs.SendMessage": 2,
"sqs.ReceiveMessage": 1,
"sns.Publish": 1,
"dynamodb.PutItem": 0,
"dynamodb.GetItem": 0,
"dynamodb.BatchWriteItem": 0,
"dynamodb.BatchGetItem": 0,
"lambda.Invoke": 0
}
],
"sqs": [
{
"queue": "arn:aws:sqs:us-east-1:000000000000:input-dead-letter-queue",
"visible": 0,
"invisible": 0,
"delayed": 0
},
{
"queue": "arn:aws:sqs:us-east-1:000000000000:input-queue",
"visible": 2,
"invisible": 0,
"delayed": 0
},
{
"queue": "arn:aws:sqs:us-east-1:000000000000:recovery-queue",
"visible": 0,
"invisible": 0,
"delayed": 0
}
],
"sns": [
{
"topic_arn": "arn:aws:sns:us-east-1:000000000000:localstack-topic",
"published": 1,
"delivered": 0,
"failed": 0
}
],
"timestamp": 1704986115.3762584
}
Trace logs
Lambda
Find lambda traces in
/var/lib/localstack/cache/observability/traces-lambda-events/
Here is an example:
{"timestamp": 1704984270.1660516, "event": "enqueued", "request_id": "ad2df0ed-c952-4f48-881c-8b944dad44c6", "lambda_arn": "arn:aws:lambda:us-east-1:000000000000:function:test-lambda-perf-e0c504b2", "failure_cause": null}
{"timestamp": 1704984270.184178, "event": "enqueued", "request_id": "d5d2efb3-e781-411a-b718-e2345c118c39", "lambda_arn": "arn:aws:lambda:us-east-1:000000000000:function:test-lambda-perf-e0c504b2", "failure_cause": null}
{"timestamp": 1704984270.3365452, "event": "submitted", "request_id": "ad2df0ed-c952-4f48-881c-8b944dad44c6", "lambda_arn": "arn:aws:lambda:us-east-1:000000000000:function:test-lambda-perf-e0c504b2", "failure_cause": null}
{"timestamp": 1704984270.3368104, "event": "invoking", "request_id": "ad2df0ed-c952-4f48-881c-8b944dad44c6", "lambda_arn": "arn:aws:lambda:us-east-1:000000000000:function:test-lambda-perf-e0c504b2", "failure_cause": null}
{"timestamp": 1704984270.4253993, "event": "submitted", "request_id": "d5d2efb3-e781-411a-b718-e2345c118c39", "lambda_arn": "arn:aws:lambda:us-east-1:000000000000:function:test-lambda-perf-e0c504b2", "failure_cause": null}
Lambda SQS Event source listeners
Find traces that relate to lambda sqs event source listeners in
/var/lib/localstack/cache/observability/traces-lambda-sqs/
Here is an example of queueing two message to trigger a lambda.
{"timestamp": 1705009138.683765, "event": "message_queued", "message_id": "94c3e579-dd40-48a6-bfaa-5d1d04c79044", "event_source_arn": "arn:aws:sqs:us-east-1:000000000000:test-queue-a5d98750", "lambda_arn": null, "request_id": null, "failure_cause": null}
{"timestamp": 1705009138.6840491, "event": "message_queued", "message_id": "00787a9f-1d70-452d-9fec-f25bf7064e32", "event_source_arn": "arn:aws:sqs:us-east-1:000000000000:test-queue-a5d98750", "lambda_arn": null, "request_id": null, "failure_cause": null}
{"timestamp": 1705009139.6799114, "event": "message_dequeued", "message_id": "94c3e579-dd40-48a6-bfaa-5d1d04c79044", "event_source_arn": "arn:aws:sqs:us-east-1:000000000000:test-queue-a5d98750", "lambda_arn": "arn:aws:lambda:us-east-1:000000000000:function:test-lambda-perf-33b02082", "request_id": null, "failure_cause": null}
{"timestamp": 1705009139.6799738, "event": "invoke_queued", "message_id": "94c3e579-dd40-48a6-bfaa-5d1d04c79044", "event_source_arn": "arn:aws:sqs:us-east-1:000000000000:test-queue-a5d98750", "lambda_arn": "arn:aws:lambda:us-east-1:000000000000:function:test-lambda-perf-33b02082", "request_id": "0d616a5e-2511-4c88-a7b2-de0f0a7161ed", "failure_cause": null}
{"timestamp": 1705009139.6801724, "event": "invoke", "message_id": "94c3e579-dd40-48a6-bfaa-5d1d04c79044", "event_source_arn": "arn:aws:sqs:us-east-1:000000000000:test-queue-a5d98750", "lambda_arn": "arn:aws:lambda:us-east-1:000000000000:function:test-lambda-perf-33b02082", "request_id": "0d616a5e-2511-4c88-a7b2-de0f0a7161ed", "failure_cause": null}
{"timestamp": 1705009140.0882578, "event": "invoke_success", "message_id": "94c3e579-dd40-48a6-bfaa-5d1d04c79044", "event_source_arn": "arn:aws:sqs:us-east-1:000000000000:test-queue-a5d98750", "lambda_arn": "arn:aws:lambda:us-east-1:000000000000:function:test-lambda-perf-33b02082", "request_id": "0d616a5e-2511-4c88-a7b2-de0f0a7161ed", "failure_cause": null}
{"timestamp": 1705009140.6862357, "event": "message_dequeued", "message_id": "00787a9f-1d70-452d-9fec-f25bf7064e32", "event_source_arn": "arn:aws:sqs:us-east-1:000000000000:test-queue-a5d98750", "lambda_arn": "arn:aws:lambda:us-east-1:000000000000:function:test-lambda-perf-33b02082", "request_id": null, "failure_cause": null}
{"timestamp": 1705009140.6865497, "event": "invoke_queued", "message_id": "00787a9f-1d70-452d-9fec-f25bf7064e32", "event_source_arn": "arn:aws:sqs:us-east-1:000000000000:test-queue-a5d98750", "lambda_arn": "arn:aws:lambda:us-east-1:000000000000:function:test-lambda-perf-33b02082", "request_id": "101a0017-172b-401b-9381-34aa1a4d3e7c", "failure_cause": null}
{"timestamp": 1705009140.6868262, "event": "invoke", "message_id": "00787a9f-1d70-452d-9fec-f25bf7064e32", "event_source_arn": "arn:aws:sqs:us-east-1:000000000000:test-queue-a5d98750", "lambda_arn": "arn:aws:lambda:us-east-1:000000000000:function:test-lambda-perf-33b02082", "request_id": "101a0017-172b-401b-9381-34aa1a4d3e7c", "failure_cause": null}
{"timestamp": 1705009140.6951976, "event": "invoke_success", "message_id": "00787a9f-1d70-452d-9fec-f25bf7064e32", "event_source_arn": "arn:aws:sqs:us-east-1:000000000000:test-queue-a5d98750", "lambda_arn": "arn:aws:lambda:us-east-1:000000000000:function:test-lambda-perf-33b02082", "request_id": "101a0017-172b-401b-9381-34aa1a4d3e7c", "failure_cause": null}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file localstack_extension_platform_observability-0.0.3.tar.gz
.
File metadata
- Download URL: localstack_extension_platform_observability-0.0.3.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ff9a85957e819c9ae73a4a6da437e91c8b2b88cfb3399adc46d33ba2bd443ca |
|
MD5 | 3a3d808f848e74b5a8281676b4ac423d |
|
BLAKE2b-256 | 9c18ec86af77a5b2ff57cf614fdbf45d1dcf6d7d311be036ce2d0bbf90db1176 |
File details
Details for the file localstack_extension_platform_observability-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: localstack_extension_platform_observability-0.0.3-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80b3a521776ac1c3c7765892d725e208d3079b0f861901973ab6ccc155b1367e |
|
MD5 | 91bc154020c00d351ea6e85ecca7bca0 |
|
BLAKE2b-256 | 5c89c57909794904995dcabf24533b206c0730096bede3bbeb477e8d8987ce2e |