-
Notifications
You must be signed in to change notification settings - Fork 41
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
Telemetry #169
Telemetry #169
Conversation
6411f97
to
79cf077
Compare
5a6dc4e
to
242d352
Compare
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.
Not going to approve as it's better that Jeff or Florent or Stevan look at it.
LGTM, i'm just unsure about the telemetry event names. I remember that we needed to use the function name 🤔 So instead of using recipe.pull
we should use the name of the function we are into, but i'll wait for the comment of some expert
packages/shared/src/StudioAPI.ts
Outdated
@@ -25,4 +26,9 @@ export abstract class StudioAPI { | |||
abstract askPlayground(modelId: string, prompt: string): Promise<number>; | |||
abstract getPlaygroundQueriesState(): Promise<QueryState[]>; | |||
abstract getPlaygroundsState(): Promise<PlaygroundState[]>; | |||
|
|||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |||
abstract telemetryLogUsage(eventName: string, data?: Record<string, any | TelemetryTrustedValue>): Promise<void>; |
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.
Can't we use unknown
?
a78db26
to
893c7ef
Compare
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.
Also would be good to have timing info for the pull operation
{ | ||
logUsage: mocks.logUsageMock, | ||
logError: mocks.logErrorMock, | ||
} as unknown as TelemetryLogger, |
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.
Can't we have a shared variable to represent the telemetry logger ?
@@ -173,6 +175,7 @@ export class ModelsManager { | |||
}); | |||
|
|||
try { | |||
this.telemetry.logUsage('model.download', { 'model.id': model.id }); |
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.
Would be good to have a single event: here we will have 2 events in case of error
@@ -184,6 +187,7 @@ export class ModelsManager { | |||
'model-pulling': model.id, | |||
}, | |||
}); | |||
this.telemetry.logError('model.download', { message: 'error downloading model', error: e }); |
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.
model.id is missing.
@@ -173,6 +175,7 @@ export class ModelsManager { | |||
}); | |||
|
|||
try { | |||
this.telemetry.logUsage('model.download', { 'model.id': model.id }); |
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.
Also would be good to have execution time for the action (download)
@@ -107,6 +109,7 @@ export class PlayGroundManager { | |||
const connection = findFirstProvider(); | |||
if (!connection) { | |||
this.setPlaygroundStatus(modelId, 'error'); | |||
this.telemetry.logError('playground.start', { message: 'unable to find an engine to start playground' }); |
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.
add model.id
@@ -71,6 +72,8 @@ export class StudioApiImpl implements StudioAPI { | |||
const recipe = this.catalogManager.getRecipes().find(recipe => recipe.id === recipeId); | |||
if (!recipe) throw new Error('Not found'); | |||
|
|||
await this.telemetryLogUsage('recipe.pull', { 'recipe.id': recipe.id, 'recipe.name': recipe.name }); |
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.
Not sure the telemetry event should be located here which is a gateway or we need to better handle errors
47805b5
to
1533275
Compare
1533275
to
853e2ee
Compare
@@ -157,6 +161,7 @@ export class ApplicationManager { | |||
await timeout(5000); | |||
await this.restartContainerWhenModelServiceIsUp(engineId, modelServiceEndpoint, container).catch( | |||
(error: unknown) => { | |||
this.telemetry.logError('recipe.pull', { message: 'error monitoring endpoint', error: error }); |
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.
Event is not uniform here recipe id, recipe name and duration are not sent. I'm wondering if we should have a single point for sending this event (pullApplication) and handle exceptions there
853e2ee
to
37d8372
Compare
37d8372
to
0f048ce
Compare
6889845
to
fe979fa
Compare
@@ -237,6 +247,7 @@ export class PlayGroundManager { | |||
modelId, | |||
}); | |||
|
|||
this.telemetry.logUsage('playground.start', { 'model.id': modelId }); |
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.
Would be good to have the time to start playground as well
@@ -294,7 +312,7 @@ export class PlayGroundManager { | |||
this.sendQueriesState(); | |||
} | |||
})().catch((err: unknown) => console.warn(`Error while reading streamed response for model ${modelInfo.id}`, err)); | |||
|
|||
this.telemetry.logUsage('playground.ask', { 'model.id': modelInfo.id }); |
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.
Maybe we should also record the execution time for a request but that could be a follow up 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.
I've added an entry to #35 to track this on a follow up PR
8b5a1b2
to
1c420ea
Compare
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.
Execution time is missing for stopPlayground
15869e2
to
84c96e7
Compare
84c96e7
to
97e3915
Compare
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
update make bootc for chatbot, summarizer
Fixes partially #35