Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[exporter/stefexporter] Fix a context cancellation bug in STEF exporter #37944

Merged
merged 1 commit into from
Feb 18, 2025

Conversation

tigrannajaryan
Copy link
Member

Description

STEF exporter used context that was passed to exportMetrics() as the context for the entire gRPC stream.

This was wrong since the context is cancelled immediately after exportMetrics returns.

The exporter now uses a separate context for the gRPC stream. This context has a longer duration, matching the duration of the gRPC stream.

The context passed to exportMetrics() continues to be used as the context for connection attempt. If connection is not established within the limits of that context then the attempt to connect is correctly aborted.

This now correctly decouples the context (and cancellation) for connection attempt from the context of the connected gRPC stream.

Testing

Added unit tests to verify the bug fix.

@tigrannajaryan tigrannajaryan requested review from dmitryax and a team as code owners February 14, 2025 22:53
@tigrannajaryan tigrannajaryan added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Feb 14, 2025
STEF exporter used context that was passed to exportMetrics() as
the context for the entire gRPC stream.

This was wrong since the context is cancelled immediately after
exportMetrics returns.

The exporter now uses a separate context for the gRPC stream. This
context has a longer duration, matching the duration of the gRPC stream.

The context passed to exportMetrics() continues to be used as the context
for connection attempt. If connection is not established within the limits
of that context then the attempt to connect is correctly aborted.

This now correctly decouples the context (and cancellation) for
connection attempt from the context of the connected gRPC stream.
@dmitryax dmitryax merged commit d983217 into open-telemetry:main Feb 18, 2025
162 checks passed
@github-actions github-actions bot added this to the next release milestone Feb 18, 2025
@tigrannajaryan tigrannajaryan deleted the tigran/fixstefbug branch February 18, 2025 18:15
yiquanzhou added a commit to dash0hq/opentelemetry-collector-contrib that referenced this pull request Feb 18, 2025
* main: (111 commits)
  fix(azuremonitorreceiver): Azure Monitor receiver should not produce gaps in data points for PT1M time grains (open-telemetry#37342)
  fix(deps): update module sigs.k8s.io/controller-runtime to v0.20.2 (open-telemetry#37996)
  fix(deps): update module github.com/hashicorp/consul/api to v1.31.2 (open-telemetry#38031)
  [processor/resourcedetection] add instructions for recommended use of the dynatrace detector (open-telemetry#37962)
  fix(deps): update module github.com/go-sql-driver/mysql to v1.9.0 (open-telemetry#38007)
  fix(deps): update module google.golang.org/api to v0.221.0 (open-telemetry#38027)
  prometheusreceiver: deprecate start time adjustment (open-telemetry#37879)
  fix(deps): update module github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common to v1.0.1100 (open-telemetry#37995)
  chore(deps): update golang docker tag to v1.24 (open-telemetry#37997)
  fix(deps): update all github.com/aws packages (open-telemetry#37983)
  chore(deps): update prom/prometheus docker tag to v3.2.0 (open-telemetry#37998)
  fix(deps): update kubernetes packages to v0.32.2 (open-telemetry#38004)
  fix(deps): update module github.com/clickhouse/clickhouse-go/v2 to v2.32.1 (open-telemetry#38006)
  fix(deps): update module github.com/google/go-github/v69 to v69.2.0 (open-telemetry#38014)
  fix(deps): update module github.com/sap/go-hdb to v1.13.3 (open-telemetry#38021)
  fix(deps): update module go.etcd.io/bbolt to v1.4.0 (open-telemetry#38024)
  [exporter/stefexporter] Fix a context cancellation bug in STEF exporter (open-telemetry#37944)
  fix(deps): update module github.com/spf13/cobra to v1.9.1 (open-telemetry#38023)
  fix(deps): update module github.com/envoyproxy/go-control-plane/envoy to v1.32.4 (open-telemetry#37990)
  fix(deps): update module github.com/hashicorp/consul/api to v1.31.1 (open-telemetry#37991)
  ...
yiquanzhou added a commit to dash0hq/opentelemetry-collector-contrib that referenced this pull request Feb 19, 2025
* main: (111 commits)
  fix(azuremonitorreceiver): Azure Monitor receiver should not produce gaps in data points for PT1M time grains (open-telemetry#37342)
  fix(deps): update module sigs.k8s.io/controller-runtime to v0.20.2 (open-telemetry#37996)
  fix(deps): update module github.com/hashicorp/consul/api to v1.31.2 (open-telemetry#38031)
  [processor/resourcedetection] add instructions for recommended use of the dynatrace detector (open-telemetry#37962)
  fix(deps): update module github.com/go-sql-driver/mysql to v1.9.0 (open-telemetry#38007)
  fix(deps): update module google.golang.org/api to v0.221.0 (open-telemetry#38027)
  prometheusreceiver: deprecate start time adjustment (open-telemetry#37879)
  fix(deps): update module github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common to v1.0.1100 (open-telemetry#37995)
  chore(deps): update golang docker tag to v1.24 (open-telemetry#37997)
  fix(deps): update all github.com/aws packages (open-telemetry#37983)
  chore(deps): update prom/prometheus docker tag to v3.2.0 (open-telemetry#37998)
  fix(deps): update kubernetes packages to v0.32.2 (open-telemetry#38004)
  fix(deps): update module github.com/clickhouse/clickhouse-go/v2 to v2.32.1 (open-telemetry#38006)
  fix(deps): update module github.com/google/go-github/v69 to v69.2.0 (open-telemetry#38014)
  fix(deps): update module github.com/sap/go-hdb to v1.13.3 (open-telemetry#38021)
  fix(deps): update module go.etcd.io/bbolt to v1.4.0 (open-telemetry#38024)
  [exporter/stefexporter] Fix a context cancellation bug in STEF exporter (open-telemetry#37944)
  fix(deps): update module github.com/spf13/cobra to v1.9.1 (open-telemetry#38023)
  fix(deps): update module github.com/envoyproxy/go-control-plane/envoy to v1.32.4 (open-telemetry#37990)
  fix(deps): update module github.com/hashicorp/consul/api to v1.31.1 (open-telemetry#37991)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exporter/stef Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants