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

Strange adservice behavior. Is it intentional? #586

Closed
madhead opened this issue Nov 15, 2022 · 2 comments · Fixed by #600
Closed

Strange adservice behavior. Is it intentional? #586

madhead opened this issue Nov 15, 2022 · 2 comments · Fixed by #600
Labels
bug Something isn't working

Comments

@madhead
Copy link
Contributor

madhead commented Nov 15, 2022

Bug Report

Version: v1.1.0 / 9a66c3a7e490dc0a30c738b92d931d04ce42f479 / main (just plain git clone)

Symptom

It seems that the request for the ad is crafted incorrectly. It results in random ads being served.

After a quick looking at the docs and scenarios it's not clear whether it's intentional or not.

What is the expected behavior?

Appropriate adds are served for every request.

What is the actual behavior?

Random ad is served for every request.

Reproduce

  1. Open any product page. E.g. "Optical Tube Assembly": http://localhost:8080/product/9SIQT8TOJO. This 9SIQT8TOJO is a product id, right?
  2. A request is seen in browser's developers console: http://localhost:8080/api/data?productIds=9SIQT8TOJO
  3. This 9SIQT8TOJO is used to query adservice:
    const { ads: adList } = await AdGateway.listAds(productIds as string[]);
  4. A request arrives in adservice:
    ad-service               | 2022-11-15 20:57:22 - hipstershop.AdService - received ad request (context_words=[9, S, I, Q, T, 8, T, O, J, O]) trace_id=e8c29c9773b16a424d5383acb41a2f15 span_id=ecd925196c0ed6c9 trace_flags=01
    
    image
  5. So this 9SIQT8TOJO is treated as ten separate context words.
  6. The ads map doesn't contain any ads for any of these letters:
    return ImmutableListMultimap.<String, Ad>builder()
    .putAll("binoculars", binoculars)
    .putAll("telescopes", explorerTelescope)
    .putAll("accessories", colorImager, solarFilter, cleaningKit)
    .putAll("assembly", opticalTube)
    .putAll("travel", travelTelescope)
    .build();
  7. Thus, no ads found and the ads request falls back to the getRandomAds any time.
  8. This is also seen in Jaeger (all the requests have a call to the getRandomAds at the end):
    image

Additional Context

N/A

@madhead madhead added the bug Something isn't working label Nov 15, 2022
@breedx-splk
Copy link

Yeah, the adservice API is only designed to receive product categories, not IDs. I think the invoker should be passing product categories instead of ids.

The complexity of the client-side stack is a little beyond me, but this line is suspect, as is this Ad.provider which seems founded on product IDs.

In turn, that provider is used in 3 pages: cart, order, and product.

I cant follow the types enough to know how much work it would be to pass categories. Products definitely have categories as a list of strings, but I can't tell how item or query relate to products here.

@madhead
Copy link
Contributor Author

madhead commented Nov 20, 2022

@breedx-splk, correct. If you agree that current behavior is a bug, please, check out the linked PR. ☝️

madhead added a commit to madhead/opentelemetry-demo that referenced this issue Nov 21, 2022
madhead added a commit to madhead/opentelemetry-demo that referenced this issue Nov 22, 2022
madhead added a commit to madhead/opentelemetry-demo that referenced this issue Nov 22, 2022
puckpuck added a commit that referenced this issue Nov 26, 2022
…600)

Co-authored-by: Juliano Costa <julianocosta89@outlook.com>
Co-authored-by: Pierre Tessier <pierre@pierretessier.com>
jmichalak9 pushed a commit to jmichalak9/opentelemetry-demo that referenced this issue Mar 22, 2024
…he Ad service (open-telemetry#600)

Co-authored-by: Juliano Costa <julianocosta89@outlook.com>
Co-authored-by: Pierre Tessier <pierre@pierretessier.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants