Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gostatsd
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ale
gostatsd
Commits
0e1ae461
Commit
0e1ae461
authored
Jun 02, 2012
by
Kamil Kisiel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split in to a library and application
parent
46c08a8f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
8 deletions
+22
-8
gostatsd/gostatsd.go
gostatsd/gostatsd.go
+13
-0
statsd/server.go
statsd/server.go
+9
-8
No files found.
gostatsd/gostatsd.go
0 → 100644
View file @
0e1ae461
package
main
import
(
"log"
"github.com/kisielk/gostatsd/statsd"
)
func
main
()
{
err
:=
statsd
.
ListenAndServe
(
":8125"
,
":8126"
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
}
statsd/
gostatsd
.go
→
statsd/
server
.go
View file @
0e1ae461
package
main
package
statsd
import
(
"bytes"
...
...
@@ -373,8 +373,8 @@ func handleMessage(metricChan chan Metric, msg string) {
}
}
func
metricListener
(
metricChan
chan
Metric
)
{
conn
,
err
:=
net
.
ListenPacket
(
"udp"
,
":8125"
)
func
metricListener
(
addr
string
,
metricChan
chan
Metric
)
{
conn
,
err
:=
net
.
ListenPacket
(
"udp"
,
addr
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
return
...
...
@@ -411,8 +411,8 @@ func consoleClient(conn net.Conn, consoleChan chan ConsoleRequest) {
}
}
func
consoleServer
(
consoleChan
chan
ConsoleRequest
)
{
ln
,
err
:=
net
.
Listen
(
"tcp"
,
":8126"
)
func
consoleServer
(
addr
string
,
consoleChan
chan
ConsoleRequest
)
{
ln
,
err
:=
net
.
Listen
(
"tcp"
,
addr
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
return
...
...
@@ -428,12 +428,13 @@ func consoleServer(consoleChan chan ConsoleRequest) {
}
}
func
main
()
{
func
ListenAndServe
(
metric_addr
string
,
console_addr
string
)
error
{
var
metricChan
=
make
(
chan
Metric
)
var
consoleChan
=
make
(
chan
ConsoleRequest
)
go
metricListener
(
metricChan
)
go
metricListener
(
metric
_addr
,
metric
Chan
)
go
metricAggregator
(
metricChan
,
consoleChan
)
go
consoleServer
(
consoleChan
)
go
consoleServer
(
console
_addr
,
console
Chan
)
// Run forever
select
{}
return
nil
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment