Skip to content

Conversation

asapple
Copy link

@asapple asapple commented Sep 27, 2025

Description

This PR addresses issue #7558 by enhancing the Go sampling documentation with comprehensive information about custom samplers.

Summary of Changes

  • Added a new "Custom Samplers" section to the Go sampling documentation
  • Provided detailed instructions on how to create custom samplers by implementing the Sampler interface
  • Included a complete code example demonstrating how to create a custom sampler that samples spans based on attribute values
  • Explained the ShouldSample method implementation with practical example
  • Documented the importance of custom sampling logic for specific requirements

Technical Details

The new section explains how developers can implement their own sampling logic by implementing the Sampler interface, which includes:

  • The ShouldSample method that takes SamplingParameters and returns a SamplingResult
  • The Description method for identifying the sampler

The example demonstrates creating a custom sampler that only samples spans with specific attribute values (e.g., environment=production), giving users full control over their sampling decision logic.

Related Links

These changes improve the documentation by providing practical examples that help users understand how to implement custom sampling strategies in their Go applications with OpenTelemetry.

Copy link

CLA Not Signed

@otelbot-docs otelbot-docs bot requested review from a team September 27, 2025 07:47
@svrnm svrnm added the CLA: no label Sep 29, 2025
@svrnm
Copy link
Member

svrnm commented Sep 29, 2025

@asapple please make sure that you sign the CLA, also please review our policy on genai usage: https://github.com/open-telemetry/community/blob/main/policies/genai.md

@vitorvasc
Copy link
Member

Hi @asapple!

Did you get a chance to review and sign the CLA yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[Page Feedback]: Add guidance for custom samplers

3 participants