Skip to content

Commit 5d08008

Browse files
authored
Merge pull request #167 from amirkaws/amirkaws-feature-parameters
feat: Add Parameters Utility
2 parents 17de07e + f02a712 commit 5d08008

File tree

55 files changed

+9736
-17
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+9736
-17
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AWS Lambda Powertools for .NET
22

3-
![aws provider](https://img.shields.io/badge/provider-AWS-orange?logo=amazon-aws&color=ff9900)
3+
![aws provider](https://img.shields.io/badge/provider-AWS-orange?logo=amazon-aws&color=ff9900)
44
[![Build](https://github.com/awslabs/aws-lambda-powertools-dotnet/actions/workflows/build.yml/badge.svg?branch=develop)](https://github.com/awslabs/aws-lambda-powertools-dotnet/actions/workflows/build.yml)
55
[![Join our Discord](https://dcbadge.vercel.app/api/server/B8zZKbbyET)](https://discord.gg/B8zZKbbyET)
66

@@ -20,9 +20,11 @@ Lambda Powertools provides three core utilities:
2020

2121
* **[Tracing](https://awslabs.github.io/aws-lambda-powertools-dotnet/core/tracing/)** - provides a simple way to send traces from functions to AWS X-Ray to provide visibility into function calls, interactions with other AWS services, or external HTTP requests. Annotations can easily be added to traces to allow filtering traces based on key information. For example, when using Tracer, a ColdStart annotation is created for you so you can easily group and analyze traces where there was an initialization overhead.
2222

23+
* **[Parameters (developer preview)](https://awslabs.github.io/aws-lambda-powertools-dotnet/core/parameters/)** - provides high-level functionality to retrieve one or multiple parameter values from [AWS Systems Manager Parameter Store](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html){target="_blank"}, [AWS Secrets Manager](https://aws.amazon.com/secrets-manager/){target="_blank"}, or [Amazon DynamoDB](https://aws.amazon.com/dynamodb/){target="_blank"}. We also provide extensibility to bring your own providers.
24+
2325
### Installation
2426

25-
The AWS Lambda Powertools for .NET utilities (.NET 6) are available as NuGet packages. You can install the packages from the NuGet gallery or from within the Visual Studio IDE. Search `AWS.Lambda.Powertools*` to see various utilities available. Powertools is available on NuGet.
27+
The AWS Lambda Powertools for .NET utilities (.NET 6) are available as NuGet packages. You can install the packages from [NuGet Gallery](https://www.nuget.org/packages?q=AWS+Lambda+Powertools*){target="_blank"} or from Visual Studio editor by searching `AWS.Lambda.Powertools*` to see various utilities available.
2628

2729
* [AWS.Lambda.Powertools.Logging](https://www.nuget.org/packages?q=AWS.Lambda.Powertools.Logging):
2830

@@ -36,6 +38,10 @@ The AWS Lambda Powertools for .NET utilities (.NET 6) are available as NuGet pac
3638

3739
`dotnet add package AWS.Lambda.Powertools.Tracing`
3840

41+
* [AWS.Lambda.Powertools.Parameters](https://www.nuget.org/packages?q=AWS.Lambda.Powertools.Parameters):
42+
43+
`dotnet add package AWS.Lambda.Powertools.AWS.Lambda.Powertools.Parameters`
44+
3945
## Examples
4046

4147
We have provided examples focused specifically on each of the utilities. Each solution comes with an AWS Serverless Application Model (AWS SAM) templates to run your functions as a Zip package using the AWS Lambda .NET 6 managed runtime; or as a container package using the AWS base images for .NET.
@@ -66,7 +72,7 @@ We welcome contributions from developers of all levels to our open-source projec
6672
## Connect
6773

6874
* **AWS Lambda Powertools on Discord**: `#dotnet` - **[Invite link](https://discord.gg/B8zZKbbyET)**
69-
* **Email**: [email protected]
75+
* **Email**: <[email protected]>
7076

7177
## License
7278

docs/core/logging.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ The logging utility provides a Lambda optimized logger with output structured as
1212
* Log sampling enables DEBUG log level for a percentage of requests (disabled by default)
1313
* Append additional keys to structured log at any point in time
1414

15+
## Installation
16+
17+
Powertools are available as NuGet packages. You can install the packages from [NuGet Gallery](https://www.nuget.org/packages?q=AWS+Lambda+Powertools*){target="_blank"} or from Visual Studio editor by searching `AWS.Lambda.Powertools*` to see various utilities available.
18+
19+
* [AWS.Lambda.Powertools.Logging](https://www.nuget.org/packages?q=AWS.Lambda.Powertools.Logging):
20+
21+
`dotnet add package AWS.Lambda.Powertools.Logging`
22+
1523
## Getting started
1624

1725
Logging requires two settings:

docs/core/metrics.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ These metrics can be visualized through [Amazon CloudWatch Console](https://aws.
99

1010
## Key features
1111

12-
* Aggregate up to 100 metrics using a single CloudWatch EMF object (large JSON blob)
12+
* Aggregate up to 100 metrics using a single [CloudWatch EMF](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Embedded_Metric_Format_Specification.html){target="_blank"} object (large JSON blob)
1313
* Validating your metrics against common metric definitions mistakes (for example, metric unit, values, max dimensions, max metrics)
1414
* Metrics are created asynchronously by the CloudWatch service. You do not need any custom stacks, and there is no impact to Lambda function latency
1515
* Context manager to create a one off metric with a different dimension
@@ -21,6 +21,14 @@ These metrics can be visualized through [Amazon CloudWatch Console](https://aws.
2121
<figcaption>Metrics showcase - Metrics Explorer</figcaption>
2222
</figure>
2323

24+
## Installation
25+
26+
Powertools are available as NuGet packages. You can install the packages from [NuGet Gallery](https://www.nuget.org/packages?q=AWS+Lambda+Powertools*){target="_blank"} or from Visual Studio editor by searching `AWS.Lambda.Powertools*` to see various utilities available.
27+
28+
* [AWS.Lambda.Powertools.Metrics](https://www.nuget.org/packages?q=AWS.Lambda.Powertools.Metrics):
29+
30+
`dotnet nuget add AWS.Lambda.Powertools.Metrics`
31+
2432
## Terminologies
2533

2634
If you're new to Amazon CloudWatch, there are two terminologies you must be aware of before using this utility:
@@ -378,3 +386,21 @@ CloudWatch EMF uses the same dimensions across all your metrics. Use **`PushSing
378386
});
379387
...
380388
```
389+
390+
## Testing your code
391+
392+
### Environment variables
393+
394+
???+ tip
395+
Ignore this section, if:
396+
397+
* You are explicitly setting namespace/default dimension via `namespace` and `service` parameters
398+
* You're not instantiating `Metrics` in the global namespace
399+
400+
For example, `Metrics(namespace="ExampleApplication", service="booking")`
401+
402+
Make sure to set `POWERTOOLS_METRICS_NAMESPACE` and `POWERTOOLS_SERVICE_NAME` before running your tests to prevent failing on `SchemaValidation` exception. You can set it before you run tests by adding the environment variable.
403+
404+
```csharp title="Injecting Metric Namespace before running tests"
405+
Environment.SetEnvironmentVariable("POWERTOOLS_METRICS_NAMESPACE","AWSLambdaPowertools");
406+
```

docs/core/tracing.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,20 @@ a provides functionality to reduce the overhead of performing common tracing tas
1010

1111
## Key Features
1212

13-
* Helper methods to improve the developer experience for creating [custom AWS X-Ray subsegments](https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-dotnet-subsegments.html).
13+
* Helper methods to improve the developer experience for creating [custom AWS X-Ray subsegments](https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-dotnet-subsegments.html){target=blank}.
1414
* Capture cold start as annotation.
1515
* Capture function responses and full exceptions as metadata.
1616
* Better experience when developing with multiple threads.
1717
* Auto-patch supported modules by AWS X-Ray
1818

19+
## Installation
20+
21+
Powertools are available as NuGet packages. You can install the packages from [NuGet Gallery](https://www.nuget.org/packages?q=AWS+Lambda+Powertools*){target="_blank"} or from Visual Studio editor by searching `AWS.Lambda.Powertools*` to see various utilities available.
22+
23+
* [AWS.Lambda.Powertools.Tracing](https://www.nuget.org/packages?q=AWS.Lambda.Powertools.Tracing):
24+
25+
`dotnet nuget add AWS.Lambda.Powertools.Tracing`
26+
1927
## Getting Started
2028

2129
Before you use this utility, your AWS Lambda function [must have permissions](https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html#services-xray-permissions) to send traces to AWS X-Ray.

0 commit comments

Comments
 (0)