mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 20:59:35 +08:00
JS Agent: remove user email and add session id (#55767)
This commit is contained in:
@ -115,7 +115,6 @@ describe('GrafanaJavascriptAgentEchoBackend', () => {
|
||||
expect(mockedSetUser).toHaveBeenCalledTimes(1);
|
||||
expect(mockedSetUser).toHaveBeenCalledWith({
|
||||
id: '504',
|
||||
email: 'darth.vader@sith.glx',
|
||||
attributes: {
|
||||
orgId: '1',
|
||||
},
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { BaseTransport } from '@grafana/agent-core';
|
||||
import {
|
||||
initializeAgent,
|
||||
defaultMetas,
|
||||
BrowserConfig,
|
||||
ErrorsInstrumentation,
|
||||
ConsoleInstrumentation,
|
||||
@ -63,12 +64,20 @@ export class GrafanaJavascriptAgentBackend
|
||||
'ResizeObserver loop completed',
|
||||
'Non-Error exception captured with keys',
|
||||
],
|
||||
metas: [
|
||||
...defaultMetas,
|
||||
{
|
||||
session: {
|
||||
// new session id for every page load
|
||||
id: (Math.random() + 1).toString(36).substring(2),
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
this.agentInstance = initializeAgent(grafanaJavaScriptAgentOptions);
|
||||
|
||||
if (options.user) {
|
||||
this.agentInstance.api.setUser({
|
||||
email: options.user.email,
|
||||
id: options.user.id,
|
||||
attributes: {
|
||||
orgId: String(options.user.orgId) || '',
|
||||
|
Reference in New Issue
Block a user