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

[7.x] Extrapolate Jaeger transaction count from reported sampling rate (#3722) #3932

Merged
merged 1 commit into from
Jul 2, 2020

Conversation

axw
Copy link
Member

@axw axw commented Jul 1, 2020

Backports the following commits to 7.x:

…stic#3722)

* model: add Transaction.RepresentativeCount field

* jaeger: set Transaction.RepresentativeCount

Set Transaction.RepresentativeCount based on the
value of sampler.param if sampler.type=probabilistic.

* aggregation/txmetrics: use RepresentativeCount

* Update changelog

* docs: remove caveats about Jaeger sampling & RPMs

Once the UI side of this is in, the histograms will
be used for RPM graphs, which will take sampling into
account.

* Fix/add comments
@axw axw added the backport label Jul 1, 2020
@apmmachine
Copy link
Contributor

apmmachine commented Jul 1, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Branch indexing]

  • Start Time: 2020-07-01T18:51:55.135+0000

  • Duration: 27 min 29 sec

Test stats 🧪

Test Results
Failed 0
Passed 3004
Skipped 144
Total 3148

Steps errors

Expand to view the steps failures

  • Name: Compress

    • Description: tar --exclude=coverage-files.tgz -czf coverage-files.tgz coverage

    • Duration: 0 min 0 sec

    • Start Time: 2020-07-01T19:08:27.298+0000

    • log

  • Name: Compress

    • Description: tar --exclude=system-tests-linux-files.tgz -czf system-tests-linux-files.tgz system-tests

    • Duration: 0 min 0 sec

    • Start Time: 2020-07-01T19:19:21.132+0000

    • log

  • Name: Test Sync

    • Description: ./script/jenkins/sync.sh

    • Duration: 3 min 44 sec

    • Start Time: 2020-07-01T19:03:04.385+0000

    • log

@axw axw merged commit 800da06 into elastic:7.x Jul 2, 2020
@axw axw deleted the backport/7.x/pr-3722 branch July 2, 2020 02:06
@axw
Copy link
Member Author

axw commented Jul 23, 2020

Verified with BC2. Tested with this program:

package main                                                                            
                                                                                        
import (                                                                                
        "fmt"                                                                           
        "time"                                                                          
                                                                                        
        "github.com/uber/jaeger-client-go"                                              
        "github.com/uber/jaeger-client-go/config"                                       
)                                                                                       
                                                                                        
func main() {                                                                           
        cfg, _ := config.FromEnv()                                                      
        cfg.ServiceName = "schnozz"                                                     
        cfg.Sampler.Type = "remote"                                                     
        cfg.Sampler.Param = 0.1                                                         
        cfg.Sampler.SamplingRefreshInterval = 250 * time.Millisecond                    
                                                                                        
        tracer, _, _ := cfg.NewTracer()                                                 
        for i := 0; i < 1000; i++ {                                                     
                span := tracer.StartSpan("frozzlet")                                    
                fmt.Println("sampled:", span.Context().(jaeger.SpanContext).IsSampled())
                span.Finish()                                                           
                time.Sleep(100 * time.Millisecond)                                      
        }                                                                               
}                                                                                       

Then, confirmed that the number of recorded values per bucket is 10 (1/0.1) times the number of recorded transaction docs:

GET /apm-*/_search
{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "transaction.name": "frozzlet"
          }
        }
      ]
    }
  },
  "size": 0,
  "aggs": {
    "histo_raw": {
      "histogram": {
        "field": "transaction.duration.us",
        "interval": 100
      }
    },
    "histo_histo": {
      "histogram": {
        "field": "transaction.duration.histogram",
        "interval": 100
      }
    }
  }
}
{
  "took" : 3,
  "timed_out" : false,
  "_shards" : {
    "total" : 13,
    "successful" : 13,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 113,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "aggregations" : {
    "histo_histo" : {
      "buckets" : [
        {
          "key" : 0.0,
          "doc_count" : 970
        },
        {
          "key" : 100.0,
          "doc_count" : 30
        },
        {
          "key" : 200.0,
          "doc_count" : 0
        },
        {
          "key" : 300.0,
          "doc_count" : 10
        },
        {
          "key" : 400.0,
          "doc_count" : 0
        },
        {
          "key" : 500.0,
          "doc_count" : 0
        },
        {
          "key" : 600.0,
          "doc_count" : 10
        }
      ]
    },
    "histo_raw" : {
      "buckets" : [
        {
          "key" : 0.0,
          "doc_count" : 97
        },
        {
          "key" : 100.0,
          "doc_count" : 3
        },
        {
          "key" : 200.0,
          "doc_count" : 0
        },
        {
          "key" : 300.0,
          "doc_count" : 1
        },
        {
          "key" : 400.0,
          "doc_count" : 0
        },
        {
          "key" : 500.0,
          "doc_count" : 0
        },
        {
          "key" : 600.0,
          "doc_count" : 1
        }
      ]
    }
  }
}

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

Successfully merging this pull request may close these issues.

2 participants