Package io.sentry
Class Session
- java.lang.Object
-
- io.sentry.Session
-
- All Implemented Interfaces:
JsonSerializable
,JsonUnknown
public final class Session extends java.lang.Object implements JsonUnknown, JsonSerializable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Session.Deserializer
static class
Session.JsonKeys
static class
Session.State
Session state
-
Constructor Summary
Constructors Constructor Description Session(@NotNull Session.State status, @NotNull java.util.Date started, @Nullable java.util.Date timestamp, int errorCount, @Nullable java.lang.String distinctId, @Nullable java.util.UUID sessionId, @Nullable java.lang.Boolean init, @Nullable java.lang.Long sequence, @Nullable java.lang.Double duration, @Nullable java.lang.String ipAddress, @Nullable java.lang.String userAgent, @Nullable java.lang.String environment, @NotNull java.lang.String release)
Session(@Nullable java.lang.String distinctId, @Nullable User user, @Nullable java.lang.String environment, @NotNull java.lang.String release)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull Session
clone()
Ctor copy of the Sessionvoid
end()
Ends a session and update its valuesvoid
end(@Nullable java.util.Date timestamp)
Ends a session and update its valuesint
errorCount()
@Nullable java.lang.String
getDistinctId()
@Nullable java.lang.Double
getDuration()
@Nullable java.lang.String
getEnvironment()
@Nullable java.lang.Boolean
getInit()
@Nullable java.lang.String
getIpAddress()
@NotNull java.lang.String
getRelease()
@Nullable java.lang.Long
getSequence()
@Nullable java.util.UUID
getSessionId()
@Nullable java.util.Date
getStarted()
@NotNull Session.State
getStatus()
@Nullable java.util.Date
getTimestamp()
@Nullable java.util.Map<java.lang.String,java.lang.Object>
getUnknown()
@Nullable java.lang.String
getUserAgent()
void
serialize(@NotNull JsonObjectWriter writer, @NotNull ILogger logger)
void
setInitAsTrue()
Used for migrating the init flag when an session is gonna be deleted.void
setUnknown(@Nullable java.util.Map<java.lang.String,java.lang.Object> unknown)
boolean
update(@Nullable Session.State status, @Nullable java.lang.String userAgent, boolean addErrorsCount)
Updates the current session and set its values
-
-
-
Constructor Detail
-
Session
public Session(@NotNull @NotNull Session.State status, @NotNull @NotNull java.util.Date started, @Nullable @Nullable java.util.Date timestamp, int errorCount, @Nullable @Nullable java.lang.String distinctId, @Nullable @Nullable java.util.UUID sessionId, @Nullable @Nullable java.lang.Boolean init, @Nullable @Nullable java.lang.Long sequence, @Nullable @Nullable java.lang.Double duration, @Nullable @Nullable java.lang.String ipAddress, @Nullable @Nullable java.lang.String userAgent, @Nullable @Nullable java.lang.String environment, @NotNull @NotNull java.lang.String release)
-
Session
public Session(@Nullable @Nullable java.lang.String distinctId, @Nullable @Nullable User user, @Nullable @Nullable java.lang.String environment, @NotNull @NotNull java.lang.String release)
-
-
Method Detail
-
getStarted
@Nullable public @Nullable java.util.Date getStarted()
-
getDistinctId
@Nullable public @Nullable java.lang.String getDistinctId()
-
getSessionId
@Nullable public @Nullable java.util.UUID getSessionId()
-
getIpAddress
@Nullable public @Nullable java.lang.String getIpAddress()
-
getUserAgent
@Nullable public @Nullable java.lang.String getUserAgent()
-
getEnvironment
@Nullable public @Nullable java.lang.String getEnvironment()
-
getRelease
@NotNull public @NotNull java.lang.String getRelease()
-
getInit
@Nullable public @Nullable java.lang.Boolean getInit()
-
setInitAsTrue
@Internal public void setInitAsTrue()
Used for migrating the init flag when an session is gonna be deleted.
-
errorCount
public int errorCount()
-
getStatus
@NotNull public @NotNull Session.State getStatus()
-
getSequence
@Nullable public @Nullable java.lang.Long getSequence()
-
getDuration
@Nullable public @Nullable java.lang.Double getDuration()
-
getTimestamp
@Nullable public @Nullable java.util.Date getTimestamp()
-
end
public void end()
Ends a session and update its values
-
end
public void end(@Nullable @Nullable java.util.Date timestamp)
Ends a session and update its values- Parameters:
timestamp
- the timestamp or null
-
update
public boolean update(@Nullable @Nullable Session.State status, @Nullable @Nullable java.lang.String userAgent, boolean addErrorsCount)
Updates the current session and set its values- Parameters:
status
- the statususerAgent
- the userAgentaddErrorsCount
- true if should increase error count or not- Returns:
- if the session has been updated
-
clone
@NotNull public @NotNull Session clone()
Ctor copy of the Session- Overrides:
clone
in classjava.lang.Object
- Returns:
- a copy of the Session
-
serialize
public void serialize(@NotNull @NotNull JsonObjectWriter writer, @NotNull @NotNull ILogger logger) throws java.io.IOException
- Specified by:
serialize
in interfaceJsonSerializable
- Throws:
java.io.IOException
-
getUnknown
@Nullable public @Nullable java.util.Map<java.lang.String,java.lang.Object> getUnknown()
- Specified by:
getUnknown
in interfaceJsonUnknown
-
setUnknown
public void setUnknown(@Nullable @Nullable java.util.Map<java.lang.String,java.lang.Object> unknown)
- Specified by:
setUnknown
in interfaceJsonUnknown
-
-