mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
JS Agent: remove user email and add session id (#55767)
This commit is contained in:
parent
701f6d5436
commit
27f022283d
@ -2772,11 +2772,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"public/app/core/mod_defs.d.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
|
||||
],
|
||||
"public/app/core/navigation/GrafanaRoute.test.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
|
@ -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) || '',
|
||||
|
Loading…
Reference in New Issue
Block a user