Skip to content

Commit 23aff4a

Browse files
authored
Merge branch 'develop' into dependabot/docker/docs/squidfunk/mkdocs-material-00f9276315990b82f5af8c47bb2b71e2c69aef9f02a08f8dffd2515f42310753
2 parents 10d17fe + a138d5f commit 23aff4a

25 files changed

+3060
-255
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
# Initializes the CodeQL tools for scanning.
3737
- name: Initialize CodeQL
38-
uses: github/codeql-action/init@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5
38+
uses: github/codeql-action/init@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.29.5
3939
with:
4040
languages: ${{ matrix.language }}
4141

@@ -45,7 +45,7 @@ jobs:
4545
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
4646
# If this step fails, then you should remove it and run the build manually (see below)
4747
- name: Autobuild
48-
uses: github/codeql-action/autobuild@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5
48+
uses: github/codeql-action/autobuild@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.29.5
4949

5050
# ℹ️ Command-line programs to run using the OS shell.
5151
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -58,4 +58,4 @@ jobs:
5858
# ./location_of_script_within_repo/buildscript.sh
5959

6060
- name: Perform CodeQL Analysis
61-
uses: github/codeql-action/analyze@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5
61+
uses: github/codeql-action/analyze@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.29.5

.github/workflows/dispatch_analytics.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
environment: analytics
3232
steps:
3333
- name: Configure AWS credentials
34-
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838
34+
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8
3535
with:
3636
aws-region: eu-central-1
3737
role-to-assume: ${{ secrets.AWS_ANALYTICS_ROLE_ARN }}

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Build docs website
3737
run: make build-docs-website
3838
- name: Configure AWS credentials
39-
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 # v5.0.0
39+
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5.1.0
4040
with:
4141
aws-region: us-east-1
4242
role-to-assume: ${{ secrets.AWS_DOCS_ROLE_ARN }}
@@ -69,7 +69,7 @@ jobs:
6969
docfx apidocs/docfx.json
7070
7171
- name: Configure AWS credentials
72-
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 # v5.0.0
72+
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5.1.0
7373
with:
7474
aws-region: us-east-1
7575
role-to-assume: ${{ secrets.AWS_DOCS_ROLE_ARN }}

.github/workflows/e2e-tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
3535

3636
- name: Configure AWS credentials
37-
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 # v5.0.0
37+
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5.1.0
3838
with:
3939
role-to-assume: ${{ secrets.E2E_DEPLOY_ROLE }}
4040
aws-region: us-east-1
@@ -78,7 +78,7 @@ jobs:
7878
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
7979

8080
- name: Configure AWS credentials
81-
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 # v5.0.0
81+
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5.1.0
8282
with:
8383
role-to-assume: ${{ secrets.E2E_DEPLOY_ROLE }}
8484
aws-region: us-east-1
@@ -119,7 +119,7 @@ jobs:
119119
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
120120

121121
- name: Configure AWS credentials
122-
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 # v5.0.0
122+
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5.1.0
123123
with:
124124
role-to-assume: ${{ secrets.E2E_DEPLOY_ROLE }}
125125
aws-region: us-east-1
@@ -151,7 +151,7 @@ jobs:
151151
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
152152

153153
- name: Configure AWS credentials
154-
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 # v5.0.0
154+
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5.1.0
155155
with:
156156
role-to-assume: ${{ secrets.E2E_DEPLOY_ROLE }}
157157
aws-region: us-east-1
@@ -192,7 +192,7 @@ jobs:
192192
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
193193

194194
- name: Configure AWS credentials
195-
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 # v5.0.0
195+
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5.1.0
196196
with:
197197
role-to-assume: ${{ secrets.E2E_DEPLOY_ROLE }}
198198
aws-region: us-east-1

.github/workflows/ossf_scorecard.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
persist-credentials: false
2828

2929
- name: "Run analysis"
30-
uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
30+
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
3131
with:
3232
results_file: results.sarif
3333
results_format: sarif
@@ -43,6 +43,6 @@ jobs:
4343

4444
# Upload the results to GitHub's code scanning dashboard.
4545
- name: "Upload to code-scanning"
46-
uses: github/codeql-action/upload-sarif@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5
46+
uses: github/codeql-action/upload-sarif@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.29.5
4747
with:
4848
sarif_file: results.sarif

.github/workflows/reusable_publish_docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
poetry run mike set-default --push latest
6969
7070
- name: Configure AWS credentials
71-
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 # v5.0.0
71+
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5.1.0
7272
with:
7373
aws-region: us-east-1
7474
role-to-assume: ${{ secrets.AWS_DOCS_ROLE_ARN }}
@@ -99,7 +99,7 @@ jobs:
9999
brew install -f docfx --skip-cask-deps --ignore-dependencies
100100
docfx apidocs/docfx.json
101101
- name: Configure AWS credentials
102-
uses: aws-actions/configure-aws-credentials@a03048d87541d1d9fcf2ecf528a4a65ba9bd7838 # v5.0.0
102+
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5.1.0
103103
with:
104104
aws-region: us-east-1
105105
role-to-assume: ${{ secrets.AWS_DOCS_ROLE_ARN }}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Update Version File After Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
update-version:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
20+
21+
- name: Get version
22+
id: get_version
23+
run: |
24+
if [ "${{ github.event_name }}" = "release" ]; then
25+
VERSION="${{ github.event.release.tag_name }}"
26+
else
27+
VERSION=$(gh release list --limit 1 --json tagName -q '.[0].tagName')
28+
fi
29+
30+
# Remove 'v' prefix if present
31+
VERSION="${VERSION#v}"
32+
33+
echo "VERSION=${VERSION}" >> $GITHUB_ENV
34+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
35+
env:
36+
GH_TOKEN: ${{ github.token }}
37+
38+
- name: Write version to version.txt
39+
run: echo "${{ env.VERSION }}" > version.txt
40+
41+
- name: Check if changes exist
42+
id: check_changes
43+
run: |
44+
git add version.txt
45+
if git diff --staged --quiet; then
46+
echo "has_changes=false" >> $GITHUB_OUTPUT
47+
else
48+
echo "has_changes=true" >> $GITHUB_OUTPUT
49+
fi
50+
51+
- name: Create PR for version.txt update
52+
if: steps.check_changes.outputs.has_changes == 'true'
53+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
54+
with:
55+
commit-message: "chore: update version.txt to ${{ env.VERSION }}"
56+
branch: update-version-txt-${{ github.run_id }}
57+
title: "chore: update version to ${{ env.VERSION }}"
58+
body: |
59+
This PR updates version.txt to the latest release version.
60+
61+
**Version**: ${{ env.VERSION }}
62+
**Release**: ${{ github.event_name == 'release' && github.event.release.html_url || format('https://github.com/{0}/releases/tag/{1}', github.repository, env.VERSION) }}
63+
**Triggered by**: ${{ github.event_name }}
64+
labels: automation,version-update
65+
delete-branch: true
66+
67+
trigger-changelog:
68+
needs: update-version
69+
permissions:
70+
contents: write # create temporary branch to store changelog changes
71+
pull-requests: write # create PR with changelog changes
72+
uses: ./.github/workflows/reusable_publish_changelog.yml

docs/core/tracing.md

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,76 @@ context for an operation using any native object.
196196

197197
## Utilities
198198

199-
Tracing modules comes with certain utility method when you don't want to use attribute for capturing a code block
199+
Tracing modules comes with certain utility methods when you don't want to use attribute for capturing a code block
200200
under a subsegment, or you are doing multithreaded programming. Refer examples below.
201201

202+
### Using Statement Pattern
203+
204+
You can create subsegments using the familiar `using` statement pattern for automatic cleanup and exception safety.
205+
206+
=== "Basic Using Statement"
207+
208+
```c# hl_lines="8 9 10 11 12 13"
209+
using AWS.Lambda.Powertools.Tracing;
210+
211+
public class Function
212+
{
213+
public async Task<APIGatewayProxyResponse> FunctionHandler
214+
(APIGatewayProxyRequest apigProxyEvent, ILambdaContext context)
215+
{
216+
using var gatewaySegment = Tracing.BeginSubsegment("PaymentGatewayIntegration");
217+
gatewaySegment.AddAnnotation("Operation", "ProcessPayment");
218+
gatewaySegment.AddAnnotation("PaymentMethod", "CreditCard");
219+
220+
var result = await ProcessPaymentAsync();
221+
gatewaySegment.AddAnnotation("ProcessingTimeMs", result.ProcessingTimeMs);
222+
// Subsegment automatically ends when disposed
223+
}
224+
}
225+
```
226+
227+
=== "With Custom Namespace"
228+
229+
```c# hl_lines="8 9 10"
230+
using AWS.Lambda.Powertools.Tracing;
231+
232+
public class Function
233+
{
234+
public async Task<APIGatewayProxyResponse> FunctionHandler
235+
(APIGatewayProxyRequest apigProxyEvent, ILambdaContext context)
236+
{
237+
using var segment = Tracing.BeginSubsegment("MyCustomNamespace", "DatabaseOperation");
238+
segment.AddAnnotation("TableName", "Users");
239+
segment.AddMetadata("query", "SELECT * FROM Users WHERE Active = 1");
240+
}
241+
}
242+
```
243+
244+
=== "Nested Subsegments"
245+
246+
```c# hl_lines="8 9 10 11 12 13 14 15 16"
247+
using AWS.Lambda.Powertools.Tracing;
248+
249+
public class Function
250+
{
251+
public async Task<APIGatewayProxyResponse> FunctionHandler
252+
(APIGatewayProxyRequest apigProxyEvent, ILambdaContext context)
253+
{
254+
using var outerSegment = Tracing.BeginSubsegment("PaymentProcessing");
255+
outerSegment.AddAnnotation("Operation", "ProcessPayment");
256+
257+
var result = await ProcessPaymentAsync();
258+
259+
using var postProcessingSegment = Tracing.BeginSubsegment("PaymentPostProcessing");
260+
postProcessingSegment.AddAnnotation("PaymentId", result.PaymentId);
261+
262+
await PostProcessPaymentAsync(result);
263+
}
264+
}
265+
```
266+
267+
### Callback Pattern
268+
202269
=== "Functional Api"
203270

204271
```c# hl_lines="8 9 10 12 13 14"
@@ -244,6 +311,31 @@ under a subsegment, or you are doing multithreaded programming. Refer examples b
244311
}
245312
```
246313

314+
### Subsegment Methods
315+
316+
When using the `using` statement pattern, the returned `TracingSubsegment` object provides direct access to tracing methods:
317+
318+
=== "Available Methods"
319+
320+
```c# hl_lines="8 9 10 11 12 13 14 15 16"
321+
using var segment = Tracing.BeginSubsegment("PaymentProcessing");
322+
323+
// Add annotations (indexed by X-Ray)
324+
segment.AddAnnotation("PaymentMethod", "CreditCard");
325+
segment.AddAnnotation("Amount", 99.99);
326+
327+
// Add metadata (not indexed, for additional context)
328+
segment.AddMetadata("PaymentDetails", paymentObject);
329+
segment.AddMetadata("CustomNamespace", "RequestId", requestId);
330+
331+
// Add exception information
332+
segment.AddException(exception);
333+
334+
// Add HTTP information
335+
segment.AddHttpInformation("response_code", 200);
336+
segment.AddHttpInformation("url", "https://api.payment.com/process");
337+
```
338+
247339
## Instrumenting SDK clients
248340

249341
You should make sure to instrument the SDK clients explicitly based on the function dependency. You can instrument all of your AWS SDK for .NET clients by calling RegisterForAllServices before you create them.

0 commit comments

Comments
 (0)