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

Refactor Brave Ads global state #29657

Closed
aseren opened this issue Apr 12, 2023 · 1 comment · Fixed by brave/brave-core#18021
Closed

Refactor Brave Ads global state #29657

aseren opened this issue Apr 12, 2023 · 1 comment · Fixed by brave/brave-core#18021

Comments

@aseren
Copy link

aseren commented Apr 12, 2023

No description provided.

@aseren aseren self-assigned this Apr 12, 2023
@aseren aseren changed the title Cleanup Brave Ads manager classes Refactor Brave Ads global state Apr 13, 2023
@tmancey tmancey added QA/Yes priority/P4 Planned work. We expect to get to it "soon". and removed QA/No labels Apr 13, 2023
@brave-builds brave-builds added this to the 1.52.x - Nightly milestone Apr 18, 2023
@btlechowski
Copy link

Verification passed on

Brave 1.52.109 Chromium: 114.0.5735.26 (Official Build) beta (64-bit)
Revision 7075cbb66f0542ac3e01ddfde6b813e7d61118a5-refs/branch-heads/5735@{#454}
OS Ubuntu 18.04 LTS

Verified test plan from brave/brave-core#18021

Ad feature enabled on production

Verified ads are not shown:

[23008:23008:0525/192254.772797:VERBOSE2:permission_rule_util.cc(18)] Command-line arg is not supported
[23008:23008:0525/192254.774095:VERBOSE1:notification_ad_serving.cc(95)] Notification ad not served: Not allowed due to permission rules

Ad feature enabled on staging

Verified ads are shown:

[23456:23456:0525/193041.778468:VERBOSE2:epsilon_greedy_bandit_model.cc(147)] Exploiting epsilon greedy bandit segments:
[23456:23456:0525/193041.778658:VERBOSE1:eligible_notification_ads_v2.cc(38)] Get eligible notification ads
[23456:23456:0525/193041.789657:VERBOSE1:eligible_notification_ads_v2.cc(123)] 2 eligible ads out of 2 ads
[23456:23456:0525/193041.789932:VERBOSE1:notification_ad_handler.cc(122)] Opportunity arose to serve a notification ad
[23456:23456:0525/193041.790219:VERBOSE1:notification_ad_serving.cc(128)] Found 1 eligible ads
[23456:23456:0525/193041.790323:VERBOSE1:notification_ad_serving.cc(204)] Served notification ad:
  placementId: be2e269b-1397-44f3-ba9c-1058234a9c7d
  creativeInstanceId: 4cda5cb7-c4f8-4cbc-8898-58de12ece304
  creativeSetId: 45ea5952-37ca-41f0-88c2-4b546b0e6f4b
  campaignId: 1c1ac828-db13-49bb-9128-090132044b7f
  advertiserId: ecbcc833-8b1d-4867-98f7-ad2341396ce8
  segment: untargeted
  title: Ad5
  body: Ad5
  targetUrl: https://brave.com/
[23456:23456:0525/193041.790775:VERBOSE6:ads_service_impl.cc(820)] Timeout notification ad with placement id be2e269b-1397-44f3-ba9c-1058234a9c7d in 120 s
[23456:23456:0525/193041.791138:VERBOSE3:notification_ad_event_served.cc(19)] Served notification ad with placement id be2e269b-1397-44f3-ba9c-1058234a9c7d and creative instance id 4cda5cb7-c4f8-4cbc-8898-58de12ece304
[23456:23456:0525/193041.791473:VERBOSE9:client_state_manager.cc(506)] Saving client state
[23456:23456:0525/193041.799700:VERBOSE3:notification_ad_event_viewed.cc(19)] Viewed notification ad with placement id be2e269b-1397-44f3-ba9c-1058234a9c7d and creative instance id 4cda5cb7-c4f8-4cbc-8898-58de12ece304
[23456:23456:0525/193041.800204:VERBOSE9:client_state_manager.cc(506)] Saving client state
[23456:23456:0525/193041.823642:VERBOSE1:notification_ad_event_served.cc(28)] Successfully logged notification ad served event
[23456:23456:0525/193041.824532:VERBOSE9:client_state_manager.cc(88)] Successfully saved client state
[23456:23456:0525/193041.837711:VERBOSE6:notification_ad_event_viewed.cc(28)] Successfully logged notification ad viewed event
[23456:23456:0525/193041.838839:VERBOSE9:client_state_manager.cc(88)] Successfully saved client state
[23456:23456:0525/193041.853732:VERBOSE3:account.cc(215)] Successfully processed deposit for ad_notification with creative instance id 4cda5cb7-c4f8-4cbc-8898-58de12ece304 and view valued at 0.01
[23456:23456:0525/193041.853975:VERBOSE1:confirmations.cc(141)] Confirming view for ad_notification with transaction id ee5bb3aa-291b-49c8-b745-85dc7f763bdd and creative instance id 4cda5cb7-c4f8-4cbc-8898-58de12ece304
[23456:23456:0525/193041.855534:VERBOSE9:confirmation_state_manager.cc(208)] Saving confirmations state
[23456:23456:0525/193041.855535:VERBOSE1:redeem_opted_in_confirmation.cc(73)] Redeem opted-in confirmation
[23456:23456:0525/193041.872509:VERBOSE1:redeem_opted_in_confirmation.cc(94)] CreateConfirmation
[23456:23456:0525/193041.873394:VERBOSE2:redeem_opted_in_confirmation.cc(95)] POST /v3/confirmation/{transactionId}/{credential}
[23456:23456:0525/193041.873630:VERBOSE6:redeem_opted_in_confirmation.cc(100)] URL Request:
  URL: https://anonymous.ads.bravesoftware.com/v3/confirmation/ee5bb3aa-291b-49c8-b745-85dc7f763bdd/eyJzaWduYXR1cmUiOiJyaWg3aDFqb1ZhL2xBYkpLOWpFc3V0N3F4cGh5cXM2aVhYRHFiNGtodi9LZFVrV2pVQ3pETW0yL3VobzJlWE40L0RiVjlvb09rNFo5blFWU0tPZ1g4QT09IiwidCI6IlRtMXF4cHNyY0p5SDQzVGFWcEhtV3JKdnFJSU5HU3JmNWhpdTY0VzRUTEhOU0krTEhHQzBWSWRWMVQ2UnZ3a05BSm92VWRnN3FoSXNtQUl1VTA5UGZBPT0ifQ==
  Content: {"blindedPaymentTokens":["GHgFExzbZkMyRHIqUx9Dbte5qtTKxkNpXKF+cyQXjFA="],"buildChannel":"beta","catalog":[{"id":"8c6bda71281ddd208456147ee73b5e18c86de8e7"}],"createdAtTimestamp":"2023-05-25T17:00:00.000Z","creativeInstanceId":"4cda5cb7-c4f8-4cbc-8898-58de12ece304","platform":"linux","publicKey":"NODLA/galkjIPVQcjOaz58TkYDp4pGF6AAm/iKOAUVE=","rotating_hash":"l1i50ehPHI2JfX/nB6ghjpfP5f1Q+aU9MzJpMF5LWvw=","segment":"untargeted","studies":[],"systemTimestamp":"2023-05-25T17:00:00.000Z","transactionId":"ee5bb3aa-291b-49c8-b745-85dc7f763bdd","type":"view","versionNumber":"114.0.5735.26"}
  Content Type: application/json
  Method: kPost
[23456:23456:0525/193041.875394:VERBOSE7:redeem_opted_in_confirmation.cc(101)]   Headers:
    accept: application/json
[23456:23456:0525/193041.876626:VERBOSE9:confirmation_state_manager.cc(223)] Successfully saved confirmations state
[23456:23456:0525/193042.967695:VERBOSE1:redeem_opted_in_confirmation.cc(114)] OnCreateConfirmation
[23456:23456:0525/193042.967922:VERBOSE6:redeem_opted_in_confirmation.cc(116)] URL Response:
  URL: https://anonymous.ads.bravesoftware.com/v3/confirmation/ee5bb3aa-291b-49c8-b745-85dc7f763bdd/eyJzaWduYXR1cmUiOiJyaWg3aDFqb1ZhL2xBYkpLOWpFc3V0N3F4cGh5cXM2aVhYRHFiNGtodi9LZFVrV2pVQ3pETW0yL3VobzJlWE40L0RiVjlvb09rNFo5blFWU0tPZ1g4QT09IiwidCI6IlRtMXF4cHNyY0p5SDQzVGFWcEhtV3JKdnFJSU5HU3JmNWhpdTY0VzRUTEhOU0krTEhHQzBWSWRWMVQ2UnZ3a05BSm92VWRnN3FoSXNtQUl1VTA5UGZBPT0ifQ==
  Response Status Code: 201
  Response: {"id":"ee5bb3aa-291b-49c8-b745-85dc7f763bdd","payload":{},"createdAt":"2023-05-25T17:31:00.005Z","type":"view","modifiedAt":"2023-05-25T17:31:00.005Z","creativeInstanceId":"4cda5cb7-c4f8-4cbc-8898-58de12ece304"}
[23456:23456:0525/193042.968259:VERBOSE7:redeem_opted_in_confirmation.cc(117)]   Headers:
    accept-ranges: bytes
    access-control-allow-credentials: true
    cache-control: no-cache
    content-length: 211
    content-security-policy: default-src 'self';base-uri 'self';font-src 'self' https: data:;form-action 'self';frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests
    content-type: application/json; charset=utf-8
    cross-origin-opener-policy: same-origin
    cross-origin-resource-policy: same-origin
    date: Thu, 25 May 2023 17:31:00 GMT
    expires: 0
    origin-agent-cluster: ?1
    referrer-policy: no-referrer
    strict-transport-security: max-age=15552000; includeSubDomains
    vary: Origin
    via: 1.1 varnish
    x-cache: MISS
    x-cache-hits: 0
    x-content-type-options: nosniff
    x-dns-prefetch-control: off
    x-download-options: noopen
    x-frame-options: SAMEORIGIN
    x-permitted-cross-domain-policies: none
    x-served-by: cache-hel1410034-HEL
    x-xss-protection: 0
[23456:23456:0525/193042.968342:VERBOSE1:redeem_opted_in_confirmation.cc(129)] FetchPaymentToken
[23456:23456:0525/193042.968419:VERBOSE2:redeem_opted_in_confirmation.cc(130)] GET /v3/confirmation/{transactionId}/paymentToken
[23456:23456:0525/193042.968484:VERBOSE6:redeem_opted_in_confirmation.cc(134)] URL Request:
  URL: https://anonymous.ads.bravesoftware.com/v3/confirmation/ee5bb3aa-291b-49c8-b745-85dc7f763bdd/paymentToken
  Method: kGet
[23456:23456:0525/193042.968555:VERBOSE7:redeem_opted_in_confirmation.cc(135)]   Headers:

[23456:23456:0525/193043.705877:VERBOSE1:redeem_opted_in_confirmation.cc(148)] OnFetchPaymentToken
[23456:23456:0525/193043.706961:VERBOSE6:redeem_opted_in_confirmation.cc(150)] URL Response:
  URL: https://anonymous.ads.bravesoftware.com/v3/confirmation/ee5bb3aa-291b-49c8-b745-85dc7f763bdd/paymentToken
  Response Status Code: 202
  Response: {"error":"Payment Tokens are not ready","statusCode":202}
[23456:23456:0525/193043.707395:VERBOSE7:redeem_opted_in_confirmation.cc(151)]   Headers:
    accept-ranges: bytes
    access-control-allow-credentials: true
    cache-control: no-cache
    content-length: 57
    content-security-policy: default-src 'self';base-uri 'self';font-src 'self' https: data:;form-action 'self';frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests
    content-type: application/json; charset=utf-8
    cross-origin-opener-policy: same-origin
    cross-origin-resource-policy: same-origin
    date: Thu, 25 May 2023 17:31:00 GMT
    expires: 0
    origin-agent-cluster: ?1
    referrer-policy: no-referrer
    strict-transport-security: max-age=15552000; includeSubDomains
    vary: Origin
    via: 1.1 varnish
    x-cache: MISS
    x-cache-hits: 0
    x-content-type-options: nosniff
    x-dns-prefetch-control: off
    x-download-options: noopen
    x-frame-options: SAMEORIGIN
    x-permitted-cross-domain-policies: none
    x-served-by: cache-hel1410034-HEL
    x-xss-protection: 0
[23456:23456:0525/193043.708243:VERBOSE1:redeem_opted_in_confirmation.cc(174)] Payment token is not ready
[23456:23456:0525/193043.708457:VERBOSE1:redeem_opted_in_confirmation.cc(379)] Failed to redeem opted-in  view confirmation for ad_notification with transaction id ee5bb3aa-291b-49c8-b745-85dc7f763bdd and creative instance id 4cda5cb7-c4f8-4cbc-8898-58de12ece304
[23456:23456:0525/193043.708690:VERBOSE9:confirmation_state_manager.cc(208)] Saving confirmations state
[23456:23456:0525/193043.709803:VERBOSE1:confirmations.cc(46)] Added view confirmation for ad_notification with transaction id ee5bb3aa-291b-49c8-b745-85dc7f763bdd and creative instance id 4cda5cb7-c4f8-4cbc-8898-58de12ece304 to the confirmations queue
[23456:23456:0525/193043.716637:VERBOSE1:refill_unblinded_tokens.cc(99)] No need to refill unblinded tokens as we already have 49 unblinded tokens which is above the minimum threshold of 20
[23456:23456:0525/193043.718730:VERBOSE1:confirmations.cc(113)] Retry sending failed confirmations in 0 hours, 0 minutes, 21 seconds at 19:31:04.716
[23456:23456:0525/193043.719302:VERBOSE9:confirmation_state_manager.cc(223)] Successfully saved confirmations state
[23456:23456:0525/193053.416027:VERBOSE1:browser_manager.cc(109)] Browser did resign active
[23456:23456:0525/193053.416449:VERBOSE6:user_activity_manager.cc(42)] Triggered event: 17 (0:0:900 s)
[23456:23456:0525/193053.446938:VERBOSE1:browser_manager.cc(129)] Browser did enter background
[23456:23456:0525/193053.447616:VERBOSE6:user_activity_manager.cc(42)] Triggered event: 02 (0:0:900 s)
[23456:23456:0525/193104.722461:VERBOSE1:confirmations.cc(121)] Retry sending failed confirmations
[23456:23456:0525/193104.722948:VERBOSE1:confirmations.cc(69)] Removed view confirmation for ad_notification with transaction id ee5bb3aa-291b-49c8-b745-85dc7f763bdd and creative instance id 4cda5cb7-c4f8-4cbc-8898-58de12ece304 from the confirmations queue
[23456:23456:0525/193104.723199:VERBOSE9:confirmation_state_manager.cc(208)] Saving confirmations state
[23456:23456:0525/193104.727039:VERBOSE1:redeem_opted_in_confirmation.cc(73)] Redeem opted-in confirmation
[23456:23456:0525/193104.732793:VERBOSE1:redeem_opted_in_confirmation.cc(129)] FetchPaymentToken
[23456:23456:0525/193104.733051:VERBOSE2:redeem_opted_in_confirmation.cc(130)] GET /v3/confirmation/{transactionId}/paymentToken
[23456:23456:0525/193104.733912:VERBOSE6:redeem_opted_in_confirmation.cc(134)] URL Request:
  URL: https://anonymous.ads.bravesoftware.com/v3/confirmation/ee5bb3aa-291b-49c8-b745-85dc7f763bdd/paymentToken
  Method: kGet
[23456:23456:0525/193104.734218:VERBOSE7:redeem_opted_in_confirmation.cc(135)]   Headers:

[23456:23456:0525/193104.734787:VERBOSE9:confirmation_state_manager.cc(223)] Successfully saved confirmations state
[23456:23456:0525/193105.019550:VERBOSE1:redeem_opted_in_confirmation.cc(148)] OnFetchPaymentToken
[23456:23456:0525/193105.020876:VERBOSE6:redeem_opted_in_confirmation.cc(150)] URL Response:
  URL: https://anonymous.ads.bravesoftware.com/v3/confirmation/ee5bb3aa-291b-49c8-b745-85dc7f763bdd/paymentToken
  Response Status Code: 200
  Response: {"id":"ee5bb3aa-291b-49c8-b745-85dc7f763bdd","createdAt":"2023-05-25T17:31:00.005Z","type":"view","modifiedAt":"2023-05-25T17:31:02.470Z","creativeInstanceId":"4cda5cb7-c4f8-4cbc-8898-58de12ece304","paymentToken":{"publicKey":"wIX6mAc0l4UZ5f97Ap+j/owMwzNeUCHrP18mzJIXqkg=","batchProof":"HZxmUzwcwOZylB15CDYYv8HzTd5OYnFNX2UIwfxP7wwk31nzFJMnQuVZIsVbGda2O0UmnJvsqjo+VwztaV94Aw==","signedTokens":["qGlzCyRks4/s5ZJ0i8oCww8G6vjhtMaHPVo2upK0TG0="]}}
[23456:23456:0525/193105.021044:VERBOSE7:redeem_opted_in_confirmation.cc(151)]   Headers:
    accept-ranges: bytes
    access-control-allow-credentials: true
    cache-control: no-cache
    content-length: 442
    content-security-policy: default-src 'self';base-uri 'self';font-src 'self' https: data:;form-action 'self';frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests
    content-type: application/json; charset=utf-8
    cross-origin-opener-policy: same-origin
    cross-origin-resource-policy: same-origin
    date: Thu, 25 May 2023 17:31:22 GMT
    expires: 0
    origin-agent-cluster: ?1
    referrer-policy: no-referrer
    strict-transport-security: max-age=15552000; includeSubDomains
    vary: Origin, Accept-Encoding
    via: 1.1 varnish
    x-cache: MISS
    x-cache-hits: 0
    x-content-type-options: nosniff
    x-dns-prefetch-control: off
    x-download-options: noopen
    x-frame-options: SAMEORIGIN
    x-permitted-cross-domain-policies: none
    x-served-by: cache-hel1410034-HEL
    x-xss-protection: 0
[23456:23456:0525/193105.024296:VERBOSE1:redeem_opted_in_confirmation.cc(363)] Successfully redeemed opted-in view confirmation for ad_notification with transaction id ee5bb3aa-291b-49c8-b745-85dc7f763bdd and creative instance id 4cda5cb7-c4f8-4cbc-8898-58de12ece304
[23456:23456:0525/193105.024487:VERBOSE9:confirmation_state_manager.cc(208)] Saving confirmations state
[23456:23456:0525/193105.031390:VERBOSE1:confirmations.cc(231)] You have 1 unblinded payment tokens which will be redeemed in 3 hours, 7 minutes, 49 seconds at 22:38:53.729

Verified confirmations contains buildChannel and rotating_hash
image

@tmancey tmancey added this to Ads Jun 10, 2024
@tmancey tmancey moved this to Done in Ads Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants