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

Add ga dimension for config cookie #515

Merged
merged 3 commits into from
Feb 13, 2020

Conversation

everett980
Copy link
Collaborator

Which problem is this PR solving?

  • Ability to specify custom dimensions.

Short description of the changes

  • Read cookie and dimension names from config, if cookie is present, set dimension to cookie value.

Signed-off-by: Everett Ross <reverett@uber.com>
@codecov
Copy link

codecov bot commented Feb 4, 2020

Codecov Report

Merging #515 into master will decrease coverage by 0.07%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #515      +/-   ##
==========================================
- Coverage   92.92%   92.85%   -0.08%     
==========================================
  Files         197      197              
  Lines        4808     4814       +6     
  Branches     1160     1162       +2     
==========================================
+ Hits         4468     4470       +2     
- Misses        299      303       +4     
  Partials       41       41              

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8cb13c4...881dd91. Read the comment docs.

@@ -45,6 +45,13 @@ const gaID = _get(config, 'tracking.gaID');
export const isGaEnabled = isTest || isDebugMode || (isProd && Boolean(gaID));
const isErrorsEnabled = isDebugMode || (isGaEnabled && Boolean(_get(config, 'tracking.trackErrors')));

const cookieToDimension = _get(config, 'tracking.cookieToDimension');
if (cookieToDimension) {
const match = ` ${document.cookie}`.match(new RegExp(`[; ]${cookieToDimension.cookie}=([^\\s;]*)`));
Copy link
Member

Choose a reason for hiding this comment

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

  • what is the meaning of the leading space?
  • are you forced to use regexp because there is no structured API to access cookies?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. Leading space because the regex looks for ; and/or as delimiter characters between cookies. and/or because the is optional in the spec. The leading space is necessary if the target cookie is the first cookie in the document.cookie string.
  2. Correct. There are npm libraries for this (of course) but a library for a simple RegEx is overkill, and libraries may make certain assumptions about the cookies that aren't relevant here, meanwhile it's easy to know what our own RegEx is precisely doing.

Signed-off-by: Everett Ross <reverett@uber.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.

Any tests we should add?

@everett980
Copy link
Collaborator Author

everett980 commented Feb 6, 2020

@yurishkuro

Any tests we should add?

The other code in the file run on JS load is also untested. I'm not sure of a good approach for it, so I'd leave it for now.

I'll dogfood it in staging w/ the config change before landing.

Signed-off-by: Everett Ross <reverett@uber.com>
@everett980
Copy link
Collaborator Author

Dogfooded successfully.

@everett980 everett980 merged commit fe083aa into jaegertracing:master Feb 13, 2020
vvvprabhakar pushed a commit to vvvprabhakar/jaeger-ui that referenced this pull request Jul 5, 2021
* Add ga dimension for config cookie
* Update cookiesToDimensions to an array
* Move when cookie dimensions are set

Signed-off-by: Everett Ross <reverett@uber.com>

Signed-off-by: vvvprabhakar <vvvprabhakar@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants