Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #23 from t3chguy/develop
Browse files Browse the repository at this point in the history
0.1.1
  • Loading branch information
t3chguy authored Aug 7, 2017
2 parents 9941340 + 88f8e3d commit 8ea7465
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func main() {
sanitizerFn := sanitizer.InitSanitizer()

router := gin.New()
router.RedirectTrailingSlash = false

if *enablePprof {
pprof.Register(router, nil)
Expand Down Expand Up @@ -108,7 +109,7 @@ func main() {
publicRouter.Use(gin.Logger(), gin.Recovery())

if *enablePrometheusMetrics {
ginProm := ginprometheus.NewPrometheus("gin")
ginProm := ginprometheus.NewPrometheus("http")
publicRouter.Use(ginProm.HandlerFunc())
router.GET(ginProm.MetricsPath, ginprometheus.PrometheusHandler())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ PrintPage prints Page p

Base page implementation. Other pages may inherit from it if they need overriding only certain Page methods
{% code type BasePage struct {} %}
{% func (p *BasePage) Title() %}Spiders Welcome{% endfunc %}
{% func (p *BasePage) Title() %}Matrix Static{% endfunc %}
{% func (p *BasePage) Head() %}{% endfunc %}
{% func (p *BasePage) Header() %}Default Header{% endfunc %}
{% func (p *BasePage) Body() %}Default Body{% endfunc %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@


{% func (p *RoomChatPage) Title() %}
Public Room Timeline - {% space %}{%s p.RoomInfo.Name %}{% space %} - Riot Static
Matrix Static - Public Room Timeline - {% space %}{%s p.RoomInfo.Name %}
{% endfunc %}

{% func (p *RoomChatPage) Head() %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
} %}



{% stripspace %}
{% func (p *RoomErrorPage) Title() %}
Public Room ERROR - {%s p.RoomInfo.Name %} - Riot Static
Matrix Static - Public Room ERROR - {% space %}{%s p.RoomInfo.Name %}
{% endfunc %}

{% func (p *RoomErrorPage) Head() %}
Expand All @@ -20,7 +20,6 @@
{%= PrintRoomHeader(p.RoomInfo) %}
{% endfunc %}

{% stripspace %}
{% func (p *RoomErrorPage) Body() %}

<div class="errMsg">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@



{% stripspace %}
{% func (p *RoomMemberInfoPage) Title() %}
Public Room Member Info ({%s p.MemberInfo.MXID %}) - {%s p.RoomInfo.Name %} - Riot Static
Matrix Static - Public Room Member Info - {% space %}{%s p.RoomInfo.Name %}{% space %} - {% space %}{%s p.MemberInfo.MXID %}
{% endfunc %}

{% func (p *RoomMemberInfoPage) Head() %}
Expand All @@ -21,7 +22,6 @@
{%= PrintRoomHeader(p.RoomInfo) %}
{% endfunc %}

{% stripspace %}
{% func (p *RoomMemberInfoPage) body() %}
MemberInfo of {% space %}{%s p.MemberInfo.GetName() %}{% space %} ({%s p.MemberInfo.MXID %})
<hr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
} %}



{% stripspace %}
{% func (p *RoomMembersPage) printMemberRow(Member *mxclient.MemberInfo) %}
<tr>
<td><a href="{%s p.BaseUrl() %}{%s Member.MXID %}">{%s Member.MXID %}</a></td>
Expand All @@ -29,7 +29,7 @@


{% func (p *RoomMembersPage) Title() %}
Public Room Members - {%s p.RoomInfo.Name %} - Riot Static
Matrix Static - Public Room Members - {% space %}{%s p.RoomInfo.Name %}{% space %} - {% space %}{%d p.RoomInfo.NumMembers %}{% space %} members
{% endfunc %}

{% func (p *RoomMembersPage) Head() %}
Expand All @@ -39,7 +39,6 @@
{%= PrintRoomHeader(p.RoomInfo) %}
{% endfunc %}

{% stripspace %}
{% func (p *RoomMembersPage) Body() %}

<div>{%d p.RoomInfo.NumMemberEvents %}{% space %} users have interacted with this room.</div>
Expand Down Expand Up @@ -78,7 +77,7 @@
return len(p.Members) == p.PageSize
}
func (p *RoomMembersPage) BaseUrl() string {
return RoomBaseUrl(p.RoomInfo.RoomID) + "/members/"
return RoomBaseUrl(p.RoomInfo.RoomID) + "/members"
}

%}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
} %}



{% stripspace %}
{% func printPLRow(name string, pl mxclient.PowerLevel) %}
<tr>
<td>{%s name %}</td>
Expand All @@ -19,7 +19,7 @@


{% func (p *RoomPowerLevelsPage) Title() %}
Public Room Servers - {%s p.RoomInfo.Name %} - Riot Static
Matrix Static - Public Room Powerlevels - {% space %}{%s p.RoomInfo.Name %}
{% endfunc %}

{% func (p *RoomPowerLevelsPage) Head() %}
Expand All @@ -29,7 +29,6 @@
{%= PrintRoomHeader(p.RoomInfo) %}
{% endfunc %}

{% stripspace %}
{% func (p *RoomPowerLevelsPage) Body() %}

Room Power Level Requirements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@



{% stripspace %}
{% func (p *RoomServersPage) printServer(server mxclient.ServerUserCount) %}
<tr>
<td><img class="avatar serverAvatar" src="./avatar/{%u server.ServerName %}" /> {%s server.ServerName %}</td>
Expand All @@ -21,7 +22,7 @@


{% func (p *RoomServersPage) Title() %}
Public Room Servers - {%s p.RoomInfo.Name %} - Riot Static
Matrix Static - Public Room Servers - {% space %}{%s p.RoomInfo.Name %}{% space %} - {% space %}{%d p.RoomInfo.NumServers %}{% space %} servers
{% endfunc %}

{% func (p *RoomServersPage) Head() %}
Expand All @@ -31,7 +32,6 @@
{%= PrintRoomHeader(p.RoomInfo) %}
{% endfunc %}

{% stripspace %}
{% func (p *RoomServersPage) Body() %}

{%= PaginatorCurPage(p) %}
Expand Down Expand Up @@ -66,7 +66,7 @@
return len(p.Servers) == p.PageSize
}
func (p *RoomServersPage) BaseUrl() string {
return RoomBaseUrl(p.RoomInfo.RoomID) + "/servers/"
return RoomBaseUrl(p.RoomInfo.RoomID) + "/servers"
}

%}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
%}

{% stripspace %}
{% func (p *RoomsPage) Title() %}
Matrix Static - Public Rooms
{% endfunc %}
{% func (p *RoomsPage) Head() %}
{%= PaginatorHeadLinks(p) %}
{% endfunc %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ func (p *Prometheus) registerMetrics(subsystem string) {
p.reqDur = prometheus.NewSummary(
prometheus.SummaryOpts{
Subsystem: subsystem,
Name: "request_duration_seconds",
Help: "The HTTP request latencies in seconds.",
Name: "request_duration_microseconds",
Help: "The HTTP request latencies in microseconds.",
},
)
prometheus.MustRegister(p.reqDur)
Expand Down Expand Up @@ -106,7 +106,7 @@ func (p *Prometheus) HandlerFunc() gin.HandlerFunc {
c.Next()

status := strconv.Itoa(c.Writer.Status())
elapsed := float64(time.Since(start)) / float64(time.Second)
elapsed := float64(time.Since(start)) / float64(time.Microsecond)
resSz := float64(c.Writer.Size())

p.reqDur.Observe(elapsed)
Expand Down

0 comments on commit 8ea7465

Please sign in to comment.