Skip to content

Commit 602b5de

Browse files
authored
Merge pull request #639 from turbot/v2.2.x
Release steampipe-postgres-fdw v2.2.0
2 parents 3989044 + 217346c commit 602b5de

20 files changed

Lines changed: 727 additions & 32 deletions

.claude/CLAUDE.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Release Process
2+
3+
## Files to update
4+
1. **`version/version.go`**: Update `fdwVersion` to the new version (e.g., `"2.2.0"`).
5+
2. **`CHANGELOG.md`**: Add a new entry at the top for the release version with the current date.
6+
7+
## Commit
8+
- Commit message for release changes should always be the release version number (e.g., `v2.2.0`).
9+
10+
## Release PRs
11+
When creating PRs for a release, always create two:
12+
1. Against `develop`: title should be `Merge branch '<branchname>' into develop`
13+
2. Against `main`: title should be `Release steampipe-postgres-fdw v<version>`
14+
15+
## Tagging and Build
16+
1. Create a git tag matching the version (e.g., `v2.2.0`) on the release branch commit.
17+
2. Push the tag to origin. This triggers the **Build Draft Release** workflow (`.github/workflows/buildimage.yml`).
18+
3. The workflow builds the FDW shared library for all four platforms:
19+
- Darwin x86_64 (`macos-15-intel`)
20+
- Darwin ARM64 (`macos-latest`)
21+
- Linux x86_64 (`ubuntu-22.04`)
22+
- Linux ARM64 (`ubuntu-22.04-arm`)
23+
4. On success, it creates a **draft release** on GitHub with all build artifacts.
24+
5. Verify all build jobs pass before proceeding.
25+
26+
## Publishing the FDW Image
27+
1. Trigger the **Publish FDW Image** workflow (`.github/workflows/publish.yml`) manually via `workflow_dispatch`.
28+
- **Branch:** `develop`
29+
- **Input `release`:** the version tag (e.g., `v2.2.0`)
30+
2. This workflow downloads the draft release assets and pushes the FDW image to `ghcr.io/turbot/steampipe/fdw:<version>`.
31+
3. Non-RC versions are also tagged as `latest`.
32+
33+
## Testing a workflow change without releasing
34+
1. Push a temporary test tag (e.g., `v0.0.0-test-runner`) from the branch with the workflow change.
35+
2. Verify all build jobs pass.
36+
3. Clean up: delete the test tag (`git push origin --delete <tag>`) and the draft release (`gh release delete <tag> --yes`).

.github/workflows/buildimage.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
- name: Setup Golang
4444
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
4545
with:
46-
go-version: 1.24
46+
go-version: 1.26
4747

4848
- name: Fetching Go Cache Paths
4949
id: go-cache-paths
@@ -162,7 +162,7 @@ jobs:
162162
- name: Setup Golang
163163
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
164164
with:
165-
go-version: 1.24
165+
go-version: 1.26
166166

167167
- name: Fetching Go Cache Paths
168168
id: go-cache-paths
@@ -248,7 +248,7 @@ jobs:
248248
- name: Setup GoLang
249249
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
250250
with:
251-
go-version: 1.24
251+
go-version: 1.26
252252

253253
- name: Fetching Go Cache Paths
254254
id: go-cache-paths
@@ -333,7 +333,7 @@ jobs:
333333
- name: Setup GoLang
334334
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
335335
with:
336-
go-version: 1.24
336+
go-version: 1.26
337337

338338
- name: Fetching Go Cache Paths
339339
id: go-cache-paths

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Set up Go
1414
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
1515
with:
16-
go-version: 1.24
16+
go-version: 1.26
1717

1818
- name: golangci-lint
1919
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
@@ -30,7 +30,7 @@ jobs:
3030
- name: Set up Go
3131
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
3232
with:
33-
go-version: 1.24
33+
go-version: 1.26
3434

3535
- name: Checkout Steampipe
3636
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
steampipe_postgres_fdw.h
88
# generated C imports
99
0_prebuild.go
10+
prebuild.go
1011

1112
# Binaries for programs and plugins
1213
*.exe
@@ -27,4 +28,4 @@ build-*/
2728
# intermediate files from clang
2829
*.bc
2930
# work directory created by the standalone fdw building
30-
/work
31+
/work

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## v2.2.0 [2026-02-27]
2+
_Whats new_
3+
- Compiled with Go 1.26.
4+
- Add support for propagation of OpenTelemetry context from clients. ([#568](https://github.com/turbot/steampipe-postgres-fdw/pull/568))
5+
- Add support for propagation of OpenTelemetry context from clients with SQLcommenter. ([#569](https://github.com/turbot/steampipe-postgres-fdw/pull/569))
6+
7+
_Bug fixes_
8+
- Fix OpenTelemetry metric names to only contain `[A-Za-z0-9_.-]`. ([#595](https://github.com/turbot/steampipe-postgres-fdw/pull/595))
9+
10+
_Dependencies_
11+
- Bump `github.com/go-git/go-git/v5` to remediate vulnerabilities.
12+
113
## v2.1.5 [2026-02-06]
214
_Bug fixes_
315
- Fix memory leaks caused by unfreed `C.CString()` allocations across multiple functions. ([#618](https://github.com/turbot/steampipe-postgres-fdw/pull/618), [#620](https://github.com/turbot/steampipe-postgres-fdw/pull/620), [#622](https://github.com/turbot/steampipe-postgres-fdw/pull/622), [#624](https://github.com/turbot/steampipe-postgres-fdw/pull/624), [#631](https://github.com/turbot/steampipe-postgres-fdw/pull/631))

CLAUDE.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Release Process
2+
3+
## Changelog commits
4+
- Commit message for release changelog changes should always be the release version number (e.g., `v2.1.5`).
5+
6+
## Release PRs
7+
When creating PRs for a release, always create two:
8+
1. Against `develop`: title should be `Merge branch '<branchname>' into develop`
9+
2. Against `main`: title should be `Release steampipe-postgres-fdw v<version>`
10+
11+
## Tagging and Build
12+
1. Create a git tag matching the version (e.g., `v2.1.5`) on the release branch commit.
13+
2. Push the tag to origin. This triggers the **Build Draft Release** workflow (`.github/workflows/buildimage.yml`).
14+
3. The workflow builds the FDW shared library for all four platforms:
15+
- Darwin x86_64 (`macos-15-intel`)
16+
- Darwin ARM64 (`macos-latest`)
17+
- Linux x86_64 (`ubuntu-22.04`)
18+
- Linux ARM64 (`ubuntu-22.04-arm`)
19+
4. On success, it creates a **draft release** on GitHub with all build artifacts.
20+
5. Verify all build jobs pass before proceeding.
21+
22+
## Publishing the FDW Image
23+
1. Trigger the **Publish FDW Image** workflow (`.github/workflows/publish.yml`) manually via `workflow_dispatch`.
24+
- **Branch:** `develop`
25+
- **Input `release`:** the version tag (e.g., `v2.1.5`)
26+
2. This workflow downloads the draft release assets and pushes the FDW image to `ghcr.io/turbot/steampipe/fdw:<version>`.
27+
3. Non-RC versions are also tagged as `latest`.
28+
29+
## Testing a workflow change without releasing
30+
1. Push a temporary test tag (e.g., `v0.0.0-test-runner`) from the branch with the workflow change.
31+
2. Verify all build jobs pass.
32+
3. Clean up: delete the test tag (`git push origin --delete <tag>`) and the draft release (`gh release delete <tag> --yes`).

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Steps:
3232
1. Change to the cloned directory
3333
1. Run the following commands:
3434
```
35-
$ make
35+
$ make install
3636
```
3737

3838
This will compile the FDW (`steampipe_postgres_fdw.so`) along with the `control` and `sql` file in the `build-$PLATFORM` directory. This will install the compiled FDW into the default Steampipe installation directory (`~/.steampipe`) - if it exists.

fdw.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"net"
2020
"net/http"
2121
"os"
22+
"strings"
2223
"time"
2324
"unsafe"
2425

@@ -172,6 +173,30 @@ func goFdwGetRelSize(state *C.FdwPlanState, root *C.PlannerInfo, rows *C.double,
172173

173174
tableOpts := GetFTableOptions(types.Oid(state.foreigntableid))
174175

176+
// Extract trace context if available
177+
var traceContext string
178+
if state.trace_context_string != nil {
179+
traceContext = C.GoString(state.trace_context_string)
180+
log.Printf("[TRACE] Extracted trace context from session: %s", traceContext)
181+
182+
if len(traceContext) > 0 {
183+
log.Printf("[DEBUG] Trace context length: %d characters", len(traceContext))
184+
if strings.Contains(traceContext, "traceparent=") {
185+
log.Printf("[DEBUG] Trace context contains traceparent field")
186+
} else {
187+
log.Printf("[WARN] Trace context missing traceparent field - may be malformed")
188+
}
189+
}
190+
} else {
191+
log.Printf("[DEBUG] No trace context found in session variables")
192+
}
193+
194+
// Add trace context to options for hub layer
195+
if traceContext != "" {
196+
tableOpts["trace_context"] = traceContext
197+
log.Printf("[DEBUG] Added trace context to table options")
198+
}
199+
175200
// build columns
176201
var columns []string
177202
if state.target_list != nil {
@@ -299,6 +324,21 @@ func goFdwBeginForeignScan(node *C.ForeignScanState, eflags C.int) {
299324
plan := (*C.ForeignScan)(unsafe.Pointer(node.ss.ps.plan))
300325
var execState *C.FdwExecState = C.initializeExecState(unsafe.Pointer(plan.fdw_private))
301326

327+
// Extract trace context from session variables for scan operation
328+
var traceContext string
329+
if traceContextPtr := C.getTraceContext(); traceContextPtr != nil {
330+
traceContext = C.GoString(traceContextPtr)
331+
log.Printf("[TRACE] Extracted trace context from session for scan: %s", traceContext)
332+
} else {
333+
log.Printf("[DEBUG] No trace context found in session variables for scan")
334+
}
335+
336+
// Add trace context to options for hub layer
337+
if traceContext != "" {
338+
opts["trace_context"] = traceContext
339+
log.Printf("[DEBUG] Added trace context to scan options")
340+
}
341+
302342
log.Printf("[INFO] goFdwBeginForeignScan, canPushdownAllSortFields %v", execState.canPushdownAllSortFields)
303343
var columns []string
304344
if execState.target_list != nil {

fdw/common.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ typedef struct FdwPlanState
6767
int width;
6868
// the number of rows to return (limit+offset). -1 means no limit
6969
int limit;
70+
// OpenTelemetry trace context extracted from session variables
71+
char *trace_context_string;
7072

7173
} FdwPlanState;
7274

@@ -133,4 +135,4 @@ List *deserializeDeparsedSortGroup(List *items);
133135
OpExpr *canonicalOpExpr(OpExpr *opExpr, Relids base_relids);
134136
ScalarArrayOpExpr *canonicalScalarArrayOpExpr(ScalarArrayOpExpr *opExpr, Relids base_relids);
135137
char *getOperatorString(Oid opoid);
136-
#endif // FDW_COMMON_H
138+
#endif // FDW_COMMON_H

0 commit comments

Comments
 (0)