Skip to content

Commit

Permalink
Merge branch 'master' into go_runtime_key
Browse files Browse the repository at this point in the history
  • Loading branch information
bhautikpip authored Aug 3, 2020
2 parents 74bd93d + 17f8b48 commit a0618c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func init() {
```

**Start a custom segment/subsegment**
Note that customers using xray.BeginSegment API directly will only be able to evaluate sampling rules based on service name.

```go
// Start a segment
Expand Down
4 changes: 2 additions & 2 deletions xray/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ func BeginSegmentWithSampling(ctx context.Context, name string, r *http.Request,
}

if r == nil || traceHeader == nil {
// Sampling strategy fallbacks to default sampling in the case of directly using BeginSegment API without any instrumentation
sd := seg.ParentSegment.GetConfiguration().SamplingStrategy.ShouldTrace(&sampling.Request{})
// No header or request information provided so we can only evaluate sampling based on the serviceName
sd := seg.ParentSegment.GetConfiguration().SamplingStrategy.ShouldTrace(&sampling.Request{ServiceName: name})
seg.Sampled = sd.Sample
logger.Debugf("SamplingStrategy decided: %t", seg.Sampled)
seg.AddRuleName(sd)
Expand Down

0 comments on commit a0618c1

Please sign in to comment.