-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add a debug HTTP interface. (#860)
* feat: Add a debug HTTP interface.
- Loading branch information
Showing
25 changed files
with
415 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,10 @@ | |
*/ | ||
package org.jitsi.impl.protocol.xmpp; | ||
|
||
import org.jetbrains.annotations.*; | ||
import org.jitsi.jicofo.xmpp.*; | ||
import org.jitsi.jicofo.xmpp.muc.*; | ||
import org.jitsi.utils.*; | ||
import org.jitsi.utils.logging2.*; | ||
import org.jitsi.xmpp.extensions.jitsimeet.*; | ||
|
||
|
@@ -43,6 +45,7 @@ public class ChatMemberImpl | |
/** | ||
* The resource part of this {@link ChatMemberImpl}'s JID in the MUC. | ||
*/ | ||
@NotNull | ||
private final Resourcepart resourcepart; | ||
|
||
/** | ||
|
@@ -65,6 +68,7 @@ public class ChatMemberImpl | |
* Full MUC address: | ||
* [email protected]/nickname | ||
*/ | ||
@NotNull | ||
private final EntityFullJid occupantJid; | ||
|
||
/** | ||
|
@@ -368,4 +372,24 @@ public String toString() | |
{ | ||
return String.format("ChatMember[%s, jid: %s]@%s", occupantJid, jid, hashCode()); | ||
} | ||
|
||
@NotNull | ||
public OrderedJsonObject getDebugState() | ||
{ | ||
OrderedJsonObject o = new OrderedJsonObject(); | ||
o.put("resourcepart", resourcepart.toString()); | ||
o.put("region", String.valueOf(region)); | ||
o.put("join_order_number", joinOrderNumber); | ||
o.put("occupant_jid", occupantJid.toString()); | ||
o.put("jid", String.valueOf(jid)); | ||
o.put("robot", robot); | ||
o.put("is_jibri", isJibri); | ||
o.put("is_jigasi", isJigasi); | ||
o.put("role", String.valueOf(role)); | ||
o.put("stats_id", String.valueOf(statsId)); | ||
o.put("is_audio_muted", isAudioMuted); | ||
o.put("is_video_muted", isVideoMuted); | ||
|
||
return o; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright @ 2018 - present 8x8, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.jitsi.jicofo.rest; | ||
|
||
import org.jetbrains.annotations.*; | ||
import org.jitsi.jicofo.*; | ||
import org.jitsi.jicofo.conference.*; | ||
import org.jitsi.utils.*; | ||
import org.json.simple.*; | ||
|
||
import javax.ws.rs.*; | ||
import javax.ws.rs.core.MediaType; | ||
import java.util.*; | ||
|
||
/** | ||
* An interface which exposes detailed internal state for the purpose of debugging. | ||
*/ | ||
@Path("/debug") | ||
public class Debug | ||
{ | ||
@NotNull | ||
private final JicofoServices jicofoServices | ||
= Objects.requireNonNull(JicofoServices.jicofoServicesSingleton, "jicofoServices"); | ||
|
||
/** | ||
* Returns json string with statistics. | ||
* @return json string with statistics. | ||
*/ | ||
@GET | ||
@Produces(MediaType.APPLICATION_JSON) | ||
@NotNull | ||
public String getDebug(@DefaultValue("false") @QueryParam("full") boolean full) | ||
{ | ||
return jicofoServices.getDebugState(full).toJSONString(); | ||
} | ||
|
||
@GET | ||
@Path("conference/{confId}") | ||
@Produces(MediaType.APPLICATION_JSON) | ||
@NotNull | ||
public String confDebug(@PathParam("confId") String confId) | ||
{ | ||
OrderedJsonObject confJson = jicofoServices.getConferenceDebugState(confId); | ||
return confJson.toJSONString(); | ||
} | ||
|
||
@GET | ||
@Path("/conferences") | ||
@Produces(MediaType.APPLICATION_JSON) | ||
@NotNull | ||
public String conferences(@PathParam("confId") String confId) | ||
{ | ||
JSONArray conferencesJson = new JSONArray(); | ||
for (JitsiMeetConference c : jicofoServices.getFocusManager().getAllConferences()) | ||
{ | ||
conferencesJson.add(c.getRoomName().toString()); | ||
} | ||
return conferencesJson.toJSONString(); | ||
} | ||
} |
Oops, something went wrong.