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

Fetch locale information for Telemetry #5066

Merged
merged 6 commits into from
Sep 27, 2021
Merged

Fetch locale information for Telemetry #5066

merged 6 commits into from
Sep 27, 2021

Conversation

dharmit
Copy link
Member

@dharmit dharmit commented Sep 13, 2021

What type of PR is this?

/kind feature

What does this PR do / why we need it:
$subject

Which issue(s) this PR fixes:

Fixes part of #4994

PR acceptance criteria:

How to test changes / Special notes to the reviewer:
Look at the data being captured in Segment. You should see "locale" information in the "Raw" data.

@dharmit dharmit requested a review from kadel September 13, 2021 06:26
@openshift-ci openshift-ci bot added the kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation label Sep 13, 2021
@dharmit dharmit removed the request for review from mohammedzee1000 September 13, 2021 12:18
@dharmit dharmit mentioned this pull request Sep 14, 2021
2 tasks
@kadel
Copy link
Member

kadel commented Sep 14, 2021

Not sure why, but I don't see any locale data in segment console.

In order to have this as one of the traits you should it to following function as well https://github.com/openshift/odo/blob/44c35d5390ff0979310df44680619475cec9a871/pkg/segment/segment.go#L144-L147

@dharmit
Copy link
Member Author

dharmit commented Sep 15, 2021

Not sure why, but I don't see any locale data in segment console.

Did you check in the "Raw" tab? Even the time zone data that's added via #5067 shows in the "Raw" tab in context. I'm curious to understand why we're using traits when context struct already provides keys of our interest:

// This type provides the representation of the `context` object as defined in
// https://segment.com/docs/spec/common/#context
type Context struct {
	App       AppInfo      `json:"app,omitempty"`
	Campaign  CampaignInfo `json:"campaign,omitempty"`
	Device    DeviceInfo   `json:"device,omitempty"`
	Library   LibraryInfo  `json:"library,omitempty"`
	Location  LocationInfo `json:"location,omitempty"`
	Network   NetworkInfo  `json:"network,omitempty"`
	OS        OSInfo       `json:"os,omitempty"`    <------------------------------
	Page      PageInfo     `json:"page,omitempty"`
	Referrer  ReferrerInfo `json:"referrer,omitempty"`
	Screen    ScreenInfo   `json:"screen,omitempty"`
	IP        net.IP       `json:"ip,omitempty"`
	Locale    string       `json:"locale,omitempty"`    <------------------------------
	Timezone  string       `json:"timezone,omitempty"`    <------------------------------
	UserAgent string       `json:"userAgent,omitempty"`
	Traits    Traits       `json:"traits,omitempty"`

	// This map is used to allow extensions to the context specifications that
	// may not be documented or could be introduced in the future.
	// The fields of this map are inlined in the serialized context object,
	// there is no actual "extra" field in the JSON representation.
	Extra map[string]interface{} `json:"-"`
}

@kadel
Copy link
Member

kadel commented Sep 15, 2021

I'm curious to understand why we're using traits when context struct already provides keys of our interest:

Have you been able to get to the context data from Woopra? I was not able to see it there.

If you check how vscode telemetry does it, they send locale and timezone info in both context and traits. I assume that the reason is that you can't see the all the context data in Woopra.

Location might be a different story, that one is send only in context and it shows up in Woopra. I think that it might be because Woopra has a "native" location field, but no standard fieds for timezone and locale

@dharmit
Copy link
Member Author

dharmit commented Sep 15, 2021

Have you been able to get to the context data from Woopra? I was not able to see it there.

Woopra is not making much sense to me, tbh. In the sense, I'm not good at using it, yet.

If you check how vscode telemetry does it, they send locale and timezone info in both context and traits. I assume that the reason is that you can't see the all the context data in Woopra.

Yeah, I assumed the same that adding it to traits could be for Woopra. I can add it to traits as well in the same PR if it helps.

@kadel
Copy link
Member

kadel commented Sep 15, 2021

Yeah, I assumed the same that adding it to traits could be for Woopra. I can add it to traits as well in the same PR if it helps.

yes please

// get the locale information
tag, err := locale.Detect()
if err != nil {
return nil, err
Copy link
Member

Choose a reason for hiding this comment

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

If locale detection fails, the whole telemetry will fail, and nothing will be send, do we want that?

Copy link
Member Author

Choose a reason for hiding this comment

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

Snap. I did it correctly when I added locale info in traits. Fixed now.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Sep 24, 2021
@feloy
Copy link
Contributor

feloy commented Sep 24, 2021

/approve

@openshift-ci
Copy link

openshift-ci bot commented Sep 24, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: feloy

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Sep 24, 2021
@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Sep 25, 2021
@openshift-ci openshift-ci bot removed lgtm Indicates that a PR is ready to be merged. Required by Prow. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. labels Sep 27, 2021
pkg/segment/segment.go Outdated Show resolved Hide resolved
pkg/segment/segment.go Outdated Show resolved Hide resolved
dharmit and others added 2 commits September 27, 2021 13:49
Co-authored-by: Philippe Martin <[email protected]>
Co-authored-by: Philippe Martin <[email protected]>
@feloy
Copy link
Contributor

feloy commented Sep 27, 2021

@dharmit It seems that %w is not supported by Infof

pkg/segment/segment.go:171:3: Infof call has error-wrapping directive %w

@dharmit
Copy link
Member Author

dharmit commented Sep 27, 2021

@dharmit It seems that %w is not supported by Infof

pkg/segment/segment.go:171:3: Infof call has error-wrapping directive %w

I think I should revert it to the way it was, that is, use err.Error() in that call. WDYT?

@feloy
Copy link
Contributor

feloy commented Sep 27, 2021

@dharmit It seems that %w is not supported by Infof

pkg/segment/segment.go:171:3: Infof call has error-wrapping directive %w

I think I should revert it to the way it was, that is, use err.Error() in that call. WDYT?

Yes, and also using %s instead of %w I think

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@openshift-ci
Copy link

openshift-ci bot commented Sep 27, 2021

@dharmit: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/psi-k8s-ibmc-integration-e2e 8388a73 link false /test psi-k8s-ibmc-integration-e2e

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@feloy
Copy link
Contributor

feloy commented Sep 27, 2021

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Sep 27, 2021
@openshift-merge-robot openshift-merge-robot merged commit 0b735ae into redhat-developer:main Sep 27, 2021
@dharmit dharmit deleted the fix-4994-local branch September 28, 2021 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation lgtm Indicates that a PR is ready to be merged. Required by Prow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants