createSession (uygulama profili yöneticisi)

Oturum şablonunu temel alan bir oturum oluşturur ve oturumun benzersiz tanımlayıcısını döndürür.

Sözdizimi

Microsoft.Apm.createSession(SessionInput);

Parametreler

İsim Türü Gerekli Description
Oturum Girişi String Yes Oluşturulacak oturumun JSON giriş özellikleri.

JSON SessionInput parametresinin yapısı aşağıdaki gibidir:

{
        /**
         * Returns the name of the template used in the session
         */
        templateName: string;
        /**
         * additional information for session creation
         */
        sessionContext: Map<string, string>;
        /**
         * will focus after session is created
         */
        isFocused?: boolean;
        /**
         * Indicates whether the session should be restored after creation.
         * If set to true, the session is restored in the agent workspace. Else, the session is created without being restored.
         */
        shouldRestore?: boolean;
    }

Dönüş değeri

Dize olarak oturum tanımlayıcısı.

Örnekler

Bu örnekler, bir varlık kaydı tanımlayıcısını ve bir oturum şablonunu createSession parametre olarak geçiren yeni bir oturum oluşturmak için yöntemi kullanır.

Temel oturum oluşturma

Olayı varlık adı, olay kimliğini entityId ve oturum şablonunun benzersiz adını templateName olarak geçiren yeni bir oturum oluşturur.

Uyarı

Bu yöntemleri çağıran kullanıcı, oturum şablonunu içeren bir uygulama profiline atanmalıdır.

x=new Map();
x.set("parametersStr", '[["entityName", "incident"], ["entityId", "11bb11bb-cc22-dd33-ee44-55ff55ff55ff"]]');
Microsoft.Apm.createSession({templateName: "case_entity_session_default_template", sessionContext: x});

Odakta olmayan bir oturum oluşturma

x=new Map(); 
x.set("parametersStr", '[["entityName", "incident"], ["entityId", "22cc22cc-dd33-ee44-ff55-66aa66aa66aa"]]'); 
Microsoft.Apm.createSession({templateName: "case_entity_session_default_template", sessionContext: x, isFocused: false});