Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f893361
feat: support propagation of OpenTelemetry context from clients (#568)
pdecat Aug 19, 2025
4a9845c
feat: support propagation of OpenTelemetry context from clients with …
pdecat Aug 19, 2025
484f475
Merge pull request #585 from turbot/v2.1.x
pskrbasu Sep 1, 2025
a4d052d
fix: OpenTelemetry metric names must only contain [A-Za-z0-9_.-] (#595)
pdecat Sep 5, 2025
2c37950
Merge branch 'v2.1.x' into develop
pskrbasu Sep 24, 2025
4829b30
Merge branch 'v2.1.x' into develop
pskrbasu Sep 24, 2025
fcdd3d7
Update build instructions in README.md
pskrbasu Oct 17, 2025
9fdcce5
Merge branch 'v2.1.x' into develop
pskrbasu Nov 20, 2025
e379a46
Fix memory leak: free CString allocations in explain.go Property() (#…
e-gineer Feb 5, 2026
391ac1e
Fix memory leak: use pstrdup for CString in schema.go SchemaToSql() (…
e-gineer Feb 5, 2026
a682038
Fix memory leak: free CString in helpers.go valToBuffer() hot path (#…
e-gineer Feb 5, 2026
3d4fb50
Fix incorrect log message and document nested defer pattern in fdw.go…
e-gineer Feb 5, 2026
70892c8
Fix memory leak: free CString in helpers.go ValToDatum() initializati…
pskrbasu Feb 5, 2026
697888f
Merge branch 'v2.1.x' into develop (#632)
pskrbasu Feb 6, 2026
5e670a2
Add release process documentation to CLAUDE.md
pskrbasu Feb 6, 2026
6ccc2a5
Merge pull request #635 from turbot/v2.1.x
pskrbasu Feb 6, 2026
f48dbc1
[Dependabot](deps): Bump github.com/go-git/go-git/v5 from 5.16.2 to 5…
dependabot[bot] Feb 25, 2026
8d097cb
Update Go version to 1.26 (#637)
pskrbasu Feb 25, 2026
9a7f446
v2.2.0
pskrbasu Feb 27, 2026
217346c
v2.2.0
pskrbasu Feb 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Release Process

## Files to update
1. **`version/version.go`**: Update `fdwVersion` to the new version (e.g., `"2.2.0"`).
2. **`CHANGELOG.md`**: Add a new entry at the top for the release version with the current date.

## Commit
- Commit message for release changes should always be the release version number (e.g., `v2.2.0`).

## Release PRs
When creating PRs for a release, always create two:
1. Against `develop`: title should be `Merge branch '<branchname>' into develop`
2. Against `main`: title should be `Release steampipe-postgres-fdw v<version>`

## Tagging and Build
1. Create a git tag matching the version (e.g., `v2.2.0`) on the release branch commit.
2. Push the tag to origin. This triggers the **Build Draft Release** workflow (`.github/workflows/buildimage.yml`).
3. The workflow builds the FDW shared library for all four platforms:
- Darwin x86_64 (`macos-15-intel`)
- Darwin ARM64 (`macos-latest`)
- Linux x86_64 (`ubuntu-22.04`)
- Linux ARM64 (`ubuntu-22.04-arm`)
4. On success, it creates a **draft release** on GitHub with all build artifacts.
5. Verify all build jobs pass before proceeding.

## Publishing the FDW Image
1. Trigger the **Publish FDW Image** workflow (`.github/workflows/publish.yml`) manually via `workflow_dispatch`.
- **Branch:** `develop`
- **Input `release`:** the version tag (e.g., `v2.2.0`)
2. This workflow downloads the draft release assets and pushes the FDW image to `ghcr.io/turbot/steampipe/fdw:<version>`.
3. Non-RC versions are also tagged as `latest`.

## Testing a workflow change without releasing
1. Push a temporary test tag (e.g., `v0.0.0-test-runner`) from the branch with the workflow change.
2. Verify all build jobs pass.
3. Clean up: delete the test tag (`git push origin --delete <tag>`) and the draft release (`gh release delete <tag> --yes`).
8 changes: 4 additions & 4 deletions .github/workflows/buildimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Setup Golang
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
with:
go-version: 1.24
go-version: 1.26

- name: Fetching Go Cache Paths
id: go-cache-paths
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
- name: Setup Golang
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
with:
go-version: 1.24
go-version: 1.26

- name: Fetching Go Cache Paths
id: go-cache-paths
Expand Down Expand Up @@ -248,7 +248,7 @@ jobs:
- name: Setup GoLang
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
with:
go-version: 1.24
go-version: 1.26

- name: Fetching Go Cache Paths
id: go-cache-paths
Expand Down Expand Up @@ -333,7 +333,7 @@ jobs:
- name: Setup GoLang
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
with:
go-version: 1.24
go-version: 1.26

- name: Fetching Go Cache Paths
id: go-cache-paths
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
with:
go-version: 1.24
go-version: 1.26

- name: golangci-lint
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
Expand All @@ -30,7 +30,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
with:
go-version: 1.24
go-version: 1.26

- name: Checkout Steampipe
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
steampipe_postgres_fdw.h
# generated C imports
0_prebuild.go
prebuild.go

# Binaries for programs and plugins
*.exe
Expand All @@ -27,4 +28,4 @@ build-*/
# intermediate files from clang
*.bc
# work directory created by the standalone fdw building
/work
/work
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## v2.2.0 [2026-02-27]
_Whats new_
- Compiled with Go 1.26.
- Add support for propagation of OpenTelemetry context from clients. ([#568](https://github.com/turbot/steampipe-postgres-fdw/pull/568))
- Add support for propagation of OpenTelemetry context from clients with SQLcommenter. ([#569](https://github.com/turbot/steampipe-postgres-fdw/pull/569))

_Bug fixes_
- Fix OpenTelemetry metric names to only contain `[A-Za-z0-9_.-]`. ([#595](https://github.com/turbot/steampipe-postgres-fdw/pull/595))

_Dependencies_
- Bump `github.com/go-git/go-git/v5` to remediate vulnerabilities.

## v2.1.5 [2026-02-06]
_Bug fixes_
- 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))
Expand Down
32 changes: 32 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Release Process

## Changelog commits
- Commit message for release changelog changes should always be the release version number (e.g., `v2.1.5`).

## Release PRs
When creating PRs for a release, always create two:
1. Against `develop`: title should be `Merge branch '<branchname>' into develop`
2. Against `main`: title should be `Release steampipe-postgres-fdw v<version>`

## Tagging and Build
1. Create a git tag matching the version (e.g., `v2.1.5`) on the release branch commit.
2. Push the tag to origin. This triggers the **Build Draft Release** workflow (`.github/workflows/buildimage.yml`).
3. The workflow builds the FDW shared library for all four platforms:
- Darwin x86_64 (`macos-15-intel`)
- Darwin ARM64 (`macos-latest`)
- Linux x86_64 (`ubuntu-22.04`)
- Linux ARM64 (`ubuntu-22.04-arm`)
4. On success, it creates a **draft release** on GitHub with all build artifacts.
5. Verify all build jobs pass before proceeding.

## Publishing the FDW Image
1. Trigger the **Publish FDW Image** workflow (`.github/workflows/publish.yml`) manually via `workflow_dispatch`.
- **Branch:** `develop`
- **Input `release`:** the version tag (e.g., `v2.1.5`)
2. This workflow downloads the draft release assets and pushes the FDW image to `ghcr.io/turbot/steampipe/fdw:<version>`.
3. Non-RC versions are also tagged as `latest`.

## Testing a workflow change without releasing
1. Push a temporary test tag (e.g., `v0.0.0-test-runner`) from the branch with the workflow change.
2. Verify all build jobs pass.
3. Clean up: delete the test tag (`git push origin --delete <tag>`) and the draft release (`gh release delete <tag> --yes`).
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Steps:
1. Change to the cloned directory
1. Run the following commands:
```
$ make
$ make install
```

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.
Expand Down
40 changes: 40 additions & 0 deletions fdw.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"net"
"net/http"
"os"
"strings"
"time"
"unsafe"

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

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

// Extract trace context if available
var traceContext string
if state.trace_context_string != nil {
traceContext = C.GoString(state.trace_context_string)
log.Printf("[TRACE] Extracted trace context from session: %s", traceContext)

if len(traceContext) > 0 {
log.Printf("[DEBUG] Trace context length: %d characters", len(traceContext))
if strings.Contains(traceContext, "traceparent=") {
log.Printf("[DEBUG] Trace context contains traceparent field")
} else {
log.Printf("[WARN] Trace context missing traceparent field - may be malformed")
}
}
} else {
log.Printf("[DEBUG] No trace context found in session variables")
}

// Add trace context to options for hub layer
if traceContext != "" {
tableOpts["trace_context"] = traceContext
log.Printf("[DEBUG] Added trace context to table options")
}

// build columns
var columns []string
if state.target_list != nil {
Expand Down Expand Up @@ -299,6 +324,21 @@ func goFdwBeginForeignScan(node *C.ForeignScanState, eflags C.int) {
plan := (*C.ForeignScan)(unsafe.Pointer(node.ss.ps.plan))
var execState *C.FdwExecState = C.initializeExecState(unsafe.Pointer(plan.fdw_private))

// Extract trace context from session variables for scan operation
var traceContext string
if traceContextPtr := C.getTraceContext(); traceContextPtr != nil {
traceContext = C.GoString(traceContextPtr)
log.Printf("[TRACE] Extracted trace context from session for scan: %s", traceContext)
} else {
log.Printf("[DEBUG] No trace context found in session variables for scan")
}

// Add trace context to options for hub layer
if traceContext != "" {
opts["trace_context"] = traceContext
log.Printf("[DEBUG] Added trace context to scan options")
}

log.Printf("[INFO] goFdwBeginForeignScan, canPushdownAllSortFields %v", execState.canPushdownAllSortFields)
var columns []string
if execState.target_list != nil {
Expand Down
4 changes: 3 additions & 1 deletion fdw/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ typedef struct FdwPlanState
int width;
// the number of rows to return (limit+offset). -1 means no limit
int limit;
// OpenTelemetry trace context extracted from session variables
char *trace_context_string;

} FdwPlanState;

Expand Down Expand Up @@ -133,4 +135,4 @@ List *deserializeDeparsedSortGroup(List *items);
OpExpr *canonicalOpExpr(OpExpr *opExpr, Relids base_relids);
ScalarArrayOpExpr *canonicalScalarArrayOpExpr(ScalarArrayOpExpr *opExpr, Relids base_relids);
char *getOperatorString(Oid opoid);
#endif // FDW_COMMON_H
#endif // FDW_COMMON_H
Loading
Loading