Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
bcf78437
Commit
bcf78437
authored
Sep 18, 2017
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make it possible to configure sampler type
parent
861843f4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
5 deletions
+13
-5
conf/defaults.ini
+2
-0
conf/sample.ini
+2
-0
pkg/tracing/tracing.go
+9
-5
No files found.
conf/defaults.ini
View file @
bcf78437
...
...
@@ -458,6 +458,8 @@ url = https://grafana.com
address
=
# tag that will always be included in when creating new spans. ex (tag1:value1,tag2:value2)
always_included_tag
=
# Type specifies the type of the sampler: const, probabilistic, rateLimiting, or remote
sampler_type
=
const
# jaeger samplerconfig param
# for "const" sampler, 0 or 1 for always false/true respectively
# for "probabilistic" sampler, a probability between 0 and 1
...
...
conf/sample.ini
View file @
bcf78437
...
...
@@ -397,6 +397,8 @@
;address = localhost:6831
# Tag that will always be included in when creating new spans. ex (tag1:value1,tag2:value2)
;always_included_tag = tag1:value1
# Type specifies the type of the sampler: const, probabilistic, rateLimiting, or remote
;sampler_type = const
# jaeger samplerconfig param
# for "const" sampler, 0 or 1 for always false/true respectively
# for "probabilistic" sampler, a probability between 0 and 1
...
...
pkg/tracing/tracing.go
View file @
bcf78437
...
...
@@ -2,14 +2,12 @@ package tracing
import
(
"io"
"io/ioutil"
"strings"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/setting"
opentracing
"github.com/opentracing/opentracing-go"
jaeger
"github.com/uber/jaeger-client-go"
jaegercfg
"github.com/uber/jaeger-client-go/config"
ini
"gopkg.in/ini.v1"
)
...
...
@@ -22,6 +20,7 @@ type TracingSettings struct {
Enabled
bool
Address
string
CustomTags
map
[
string
]
string
SamplerType
string
SamplerParam
float64
}
...
...
@@ -44,6 +43,7 @@ func parseSettings(file *ini.File) *TracingSettings {
}
settings
.
CustomTags
=
splitTagSettings
(
section
.
Key
(
"always_included_tag"
)
.
MustString
(
""
))
settings
.
SamplerType
=
section
.
Key
(
"sampler_type"
)
.
MustString
(
""
)
settings
.
SamplerParam
=
section
.
Key
(
"sampler_param"
)
.
MustFloat64
(
1
)
return
settings
...
...
@@ -51,13 +51,13 @@ func parseSettings(file *ini.File) *TracingSettings {
func
internalInit
(
settings
*
TracingSettings
)
(
io
.
Closer
,
error
)
{
if
!
settings
.
Enabled
{
return
ioutil
.
NopCloser
(
nil
)
,
nil
return
&
nullCloser
{}
,
nil
}
cfg
:=
jaegercfg
.
Configuration
{
Disabled
:
!
settings
.
Enabled
,
Sampler
:
&
jaegercfg
.
SamplerConfig
{
//we currently only support SamplerConfig. Open an issue if you need another.
Type
:
jaeger
.
SamplerTypeConst
,
Sampler
:
&
jaegercfg
.
SamplerConfig
{
Type
:
settings
.
SamplerType
,
Param
:
settings
.
SamplerParam
,
},
Reporter
:
&
jaegercfg
.
ReporterConfig
{
...
...
@@ -110,3 +110,7 @@ func (jlw *jaegerLogWrapper) Error(msg string) {
func
(
jlw
*
jaegerLogWrapper
)
Infof
(
msg
string
,
args
...
interface
{})
{
jlw
.
logger
.
Info
(
msg
,
args
)
}
type
nullCloser
struct
{}
func
(
*
nullCloser
)
Close
()
error
{
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