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

[sampling] Fix merging of per-operation strategies into service strategies without them #5277

Merged
merged 16 commits into from
Apr 20, 2024

Conversation

kuujis
Copy link
Contributor

@kuujis kuujis commented Mar 15, 2024

Which problem is this PR solving?

Description of the changes

  • See issue for description of the bug and of the two changed behaviors
    • Default probabilistic operation level strategies will now be returned if service strategy is of ratelimiting type
    • If the service itself has probabilistic strategy, its sampling rate takes priority for operation-level definition

How was this change tested?

{
  "service_strategies": [
    {
      "service": "foobar",
      "type": "ratelimiting",
      "param": 2
    }
  ],
  "default_strategy": {
    "type": "probabilistic",
    "param": 0.2,
    "operation_strategies": [
      {
        "operation": "metrics",
        "type": "probabilistic",
        "param": 0.0
      }
    ]
  }
}

Checklist

…evel strategies for ratelimiting service configurations

Signed-off-by: Kazimieras Pociunas <kazimieras.pociunas@gmail.com>
Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, it's been quite a while since this code was written, and I am not able to follow either your change or your unit test changes. I would recommend unit tests to be structured as follows:

  1. define config file
  2. execute request to retrieve sampling strategy for a service
  3. compare it with a pre-constructed response that is easy to read

Steps 1 and 3 are best described via JSON docs under /fixtures, or embedded JSON strings

@kuujis
Copy link
Contributor Author

kuujis commented Mar 19, 2024

Sorry, it's been quite a while since this code was written, and I am not able to follow either your change or your unit test changes. I would recommend unit tests to be structured as follows:

  1. define config file
  2. execute request to retrieve sampling strategy for a service
  3. compare it with a pre-constructed response that is easy to read

Steps 1 and 3 are best described via JSON docs under /fixtures, or embedded JSON strings

After looking over the test - extracting expected response to separate file makes things a lot more readable :)

Signed-off-by: Kazimieras Pociunas <kazimieras.pociunas@gmail.com>
…id being treated as empty during marshaling/unmarshaling

Signed-off-by: Kazimieras Pociunas <kazimieras.pociunas@gmail.com>
@kuujis
Copy link
Contributor Author

kuujis commented Mar 21, 2024

Thank you for the comments, I will address them, but I'm a bit swamped with life things, so this gets a bit of a back seat for now :(

Signed-off-by: Kazimieras Pociunas <kazimieras.pociunas@gmail.com>
yurishkuro and others added 2 commits March 30, 2024 17:36
Signed-off-by: Yuri Shkuro <github@ysh.us>
@yurishkuro yurishkuro changed the title Fix for #5270 - return default probabilistic operation level sampling strategies for ratelimiting service level sampling configurations Return default probabilistic operation level sampling strategies for ratelimiting service level sampling configurations Mar 30, 2024
Signed-off-by: Yuri Shkuro <github@ysh.us>
Copy link

codecov bot commented Mar 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.22%. Comparing base (9d69adc) to head (db54fd0).
Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5277      +/-   ##
==========================================
+ Coverage   95.20%   95.22%   +0.02%     
==========================================
  Files         343      343              
  Lines       16777    16813      +36     
==========================================
+ Hits        15972    16010      +38     
  Misses        606      606              
+ Partials      199      197       -2     
Flag Coverage Δ
badger 10.47% <ø> (-0.04%) ⬇️
cassandra-3.x 18.38% <ø> (-0.06%) ⬇️
cassandra-4.x 18.38% <ø> (-0.06%) ⬇️
elasticsearch-5.x 20.89% <ø> (+<0.01%) ⬆️
elasticsearch-6.x 20.85% <ø> (-0.04%) ⬇️
elasticsearch-7.x 20.94% <ø> (-0.01%) ⬇️
elasticsearch-8.x 21.18% <ø> (+0.06%) ⬆️
grpc 14.55% <ø> (-0.05%) ⬇️
kafka 10.17% <ø> (+<0.01%) ⬆️
opensearch-1.x 21.01% <ø> (+0.02%) ⬆️
opensearch-2.x 20.98% <ø> (+<0.01%) ⬆️
unittests 91.75% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Yuri Shkuro <github@ysh.us>
@yurishkuro yurishkuro added changelog:breaking-change Change that is breaking public APIs or established behavior and removed changelog:bugfix-or-minor-feature labels Mar 30, 2024
Signed-off-by: Yuri Shkuro <github@ysh.us>
@yurishkuro yurishkuro changed the title Return default probabilistic operation level sampling strategies for ratelimiting service level sampling configurations [sampling] Fix merging of per-operation strategies into service strategies without them Mar 30, 2024
… enabling via sampling.strategies.bugfix-5270=true.

Signed-off-by: Kazimieras Pociunas <kazimieras.pociunas@gmail.com>
…arning to constructor, updated test names

Signed-off-by: Kazimieras Pociunas <kazimieras.pociunas@gmail.com>
kuujis and others added 2 commits April 14, 2024 21:50
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Signed-off-by: Kazimieras Pociunas <kazimieras.pociunas@gmail.com>
… available in the provided source, updated warning messages per MR suggestions.

Signed-off-by: Kazimieras Pociunas <kazimieras.pociunas@gmail.com>
Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@yurishkuro yurishkuro enabled auto-merge (squash) April 14, 2024 22:13
@yurishkuro
Copy link
Member

please revert ui submodule change, it's not related

git checkout main
git submodule update
git checkout your-branch
git commit -asm 'fix ui'

Signed-off-by: Kazimieras Pociunas <kazimieras.pociunas@gmail.com>
@kuujis
Copy link
Contributor Author

kuujis commented Apr 20, 2024

please revert ui submodule change, it's not related

git checkout main
git submodule update
git checkout your-branch
git commit -asm 'fix ui'

Done, sorry, should not have happened.

@yurishkuro
Copy link
Member

I edited description to NOT resolve the issue, to make sure we do the follow-ups.

@yurishkuro yurishkuro added changelog:bugfix-or-minor-feature and removed changelog:breaking-change Change that is breaking public APIs or established behavior labels Apr 20, 2024
@yurishkuro yurishkuro merged commit a72dfc3 into jaegertracing:main Apr 20, 2024
39 checks passed
varshith257 pushed a commit to varshith257/jaeger that referenced this pull request May 3, 2024
…egies without them (jaegertracing#5277)

## Which problem is this PR solving?
- Part 1 of [jaegertracing#5270]

## Description of the changes
- See issue for description of the bug and of the two changed behaviors
- Default `probabilistic` operation level strategies will now be
returned if service strategy is of `ratelimiting` type
- If the service itself has `probabilistic` strategy, its sampling rate
takes priority for operation-level definition

## How was this change tested?
- Via updated unit test
- By building local all-in-one executable and using it as a otel
instrumentation backend for simple java service
https://github.com/kuujis/opentelemetry-java-5504 and using the below
`sampling_strategies.json` from
open-telemetry/opentelemetry-java#5504
```
{
  "service_strategies": [
    {
      "service": "foobar",
      "type": "ratelimiting",
      "param": 2
    }
  ],
  "default_strategy": {
    "type": "probabilistic",
    "param": 0.2,
    "operation_strategies": [
      {
        "operation": "metrics",
        "type": "probabilistic",
        "param": 0.0
      }
    ]
  }
}
```

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Kazimieras Pociunas <kazimieras.pociunas@gmail.com>
Signed-off-by: Yuri Shkuro <github@ysh.us>
Co-authored-by: Yuri Shkuro <github@ysh.us>
Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
Signed-off-by: Vamshi Maskuri <gwcchintu@gmail.com>
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