-
Notifications
You must be signed in to change notification settings - Fork 81
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
[editor][client] Enable Telemetry based on User Config settings #899
Conversation
21065be
to
56d69aa
Compare
56d69aa
to
2ac5a00
Compare
Can you link diff? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally lgtm, just some comments and nits
service: "aiconfig-editor", | ||
site: "us5.datadoghq.com", | ||
forwardErrorsToLogs: true, | ||
sessionSampleRate: 100, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In diff summary, can you link to website for API docs so we can read more on what these mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops forgot to link docs. Generally, datadog docs are easily googleable and easily navigate able. Can just google "datadog <search term>"
"datadog browser logging" -> https://docs.datadoghq.com/logs/log_collection/javascript/
python/src/aiconfig/editor/client/src/components/AIConfigEditor.tsx
Outdated
Show resolved
Hide resolved
python/src/aiconfig/editor/client/src/components/AIConfigEditor.tsx
Outdated
Show resolved
Hide resolved
python/src/aiconfig/editor/client/src/components/AIConfigEditor.tsx
Outdated
Show resolved
Hide resolved
2ac5a00
to
5d2decc
Compare
|
Its the diff below this one, sapling created a new pr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but let's do the dev check & return before sending the request unnecessarily
const res = await ufetch.get(ROUTE_TABLE.GET_AICONFIGRC, {}); // change this to the endpoint used to get the config | ||
|
||
const enableTelemetry = res.allow_usage_data_sharing; | ||
const isDev = (process.env.NODE_ENV ?? "development") === "development"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do the dev check at the top so we don't need to make a request unnecessarily
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked for isDev before making the request, and if so return early.
Manually tested the flows and verified telemetry is only sent in prod and not dev
@@ -61,3 +61,6 @@ export function aiConfigToClientConfig(aiconfig: AIConfig): ClientAIConfig { | |||
}, | |||
}; | |||
} | |||
|
|||
export type LogEvent = "ADD_PROMPT" | "SAVE_BUTTON_CLICKED"; | |||
export type LogEventData = JSONObject; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should, TODOs were mainly from when it was pre-release
@@ -14,6 +14,7 @@ export const ROUTE_TABLE = { | |||
CANCEL: urlJoin(API_ENDPOINT, "/cancel"), | |||
CLEAR_OUTPUTS: urlJoin(API_ENDPOINT, "/clear_outputs"), | |||
DELETE_PROMPT: urlJoin(API_ENDPOINT, "/delete_prompt"), | |||
GET_AICONFIGRC: urlJoin(API_ENDPOINT, "/get_aiconfigrc"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does rc mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fairly certain that rc
stands for run commands. Most people will have multiple of these on their system already, you can see which rc files you have on your own computer by running this in terminal ls -a $HOME | grep rc
.
To define if telemetry is to be disabled, user will need to define their own .aiconfigrc
. Will need to add this to docs as well
rebased version of #804 onto main
This diff builds on top of @rholinshead's starting point for telemetry diff. Most of that looked good to me so I didn't touch it beside @rossdanlm 's . - Building off of #869, if `allow_usage_data_sharing` is set to True, initialize Datadog Browser logging with a session ID. - Disabled telemetry in dev mode as per @rholinshead 's comment that the hot reload spams the logs with something like "datadog logging already initialized" - Moved the initialization logic away from`index.tsx` into `editor.tsx` so that it can be configurable. ## Testplan: 1. yarn build 2. run in "prod" mode 3. Edit AIconfig 4. Hit Save button -> validate datadog log sent repeat with aiconfig.rc set with false logging |<img width="963" alt="Screenshot 2024-01-12 at 7 24 33 PM" src="https://github.com/lastmile-ai/aiconfig/assets/141073967/c2f979df-327e-40c4-9f06-034531437a65"> | <img width="1455" alt="Screenshot 2024-01-12 at 7 23 51 PM" src="https://github.com/lastmile-ai/aiconfig/assets/141073967/edb022b5-4abd-4ddc-b9bb-97713d32e5dc"> | | ------------- | ------------- | | <img width="604" alt="Screenshot 2024-01-12 at 7 26 35 PM" src="https://github.com/lastmile-ai/aiconfig/assets/141073967/4a2e49a3-061e-404c-9681-13a15aca8e9c"> | -> No logs | I tried taking a video but datadog doesn't immediately update with logs which made the video too long to upload
5d2decc
to
d881775
Compare
|
[editor][client] Enable Telemetry based on User Config settings
This diff builds on top of @rholinshead's starting point for telemetry diff. Most of that looked good to me so I didn't touch it beside @rossdanlm 's .
allow_usage_data_sharing
is set to True, initialize Datadog Browser logging with a session ID.index.tsx
intoeditor.tsx
so that it can be configurable.Testplan:
repeat with aiconfig.rc set with false logging
|
| -> No logs |
I tried taking a video but datadog doesn't immediately update with logs which made the video too long to upload
Stack created with Sapling. Best reviewed with ReviewStack.