Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
netobserv-ebpf-agent
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hdacloud
netobserv-ebpf-agent
Commits
5f3c1b2f
Unverified
Commit
5f3c1b2f
authored
1 year ago
by
Mohamed S. Mahmoud
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
NETOBSERV-1532: add TLS support to ebpf agent metrics config (#305)
Signed-off-by:
Mohamed Mahmoud
<
mmahmoud@redhat.com
>
parent
b63f1dd6
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
pkg/agent/agent.go
+6
-0
6 additions, 0 deletions
pkg/agent/agent.go
pkg/agent/config.go
+4
-0
4 additions, 0 deletions
pkg/agent/config.go
pkg/metrics/metrics.go
+6
-0
6 additions, 0 deletions
pkg/metrics/metrics.go
pkg/prometheus/prom_server.go
+6
-1
6 additions, 1 deletion
pkg/prometheus/prom_server.go
with
22 additions
and
1 deletion
pkg/agent/agent.go
+
6
−
0
View file @
5f3c1b2f
...
@@ -156,6 +156,12 @@ func FlowsAgent(cfg *Config) (*Flows, error) {
...
@@ -156,6 +156,12 @@ func FlowsAgent(cfg *Config) (*Flows, error) {
},
},
Prefix
:
cfg
.
MetricsPrefix
,
Prefix
:
cfg
.
MetricsPrefix
,
}
}
if
cfg
.
MetricsTLSCertPath
!=
""
&&
cfg
.
MetricsTLSKeyPath
!=
""
{
metricsSettings
.
PromConnectionInfo
.
TLS
=
&
metrics
.
PromTLS
{
CertPath
:
cfg
.
MetricsTLSCertPath
,
KeyPath
:
cfg
.
MetricsTLSKeyPath
,
}
}
m
:=
metrics
.
NewMetrics
(
metricsSettings
)
m
:=
metrics
.
NewMetrics
(
metricsSettings
)
// configure selected exporter
// configure selected exporter
...
...
This diff is collapsed.
Click to expand it.
pkg/agent/config.go
+
4
−
0
View file @
5f3c1b2f
...
@@ -175,6 +175,10 @@ type Config struct {
...
@@ -175,6 +175,10 @@ type Config struct {
MetricsServerAddress
string
`env:"METRICS_SERVER_ADDRESS"`
MetricsServerAddress
string
`env:"METRICS_SERVER_ADDRESS"`
// MetricsPort is the port of the server that collects ebpf agent metrics.
// MetricsPort is the port of the server that collects ebpf agent metrics.
MetricsPort
int
`env:"METRICS_SERVER_PORT" envDefault:"9090"`
MetricsPort
int
`env:"METRICS_SERVER_PORT" envDefault:"9090"`
// MetricsTLSCertPath is the path to the server certificate for TLS connections
MetricsTLSCertPath
string
`env:"METRICS_TLS_CERT_PATH"`
// MetricsTLSKeyPath is the path to the server private key for TLS connections
MetricsTLSKeyPath
string
`env:"METRICS_TLS_KEY_PATH"`
// MetricsPrefix is the prefix of the metrics that are sent to the server.
// MetricsPrefix is the prefix of the metrics that are sent to the server.
MetricsPrefix
string
`env:"METRICS_PREFIX" envDefault:"ebpf_agent_"`
MetricsPrefix
string
`env:"METRICS_PREFIX" envDefault:"ebpf_agent_"`
...
...
This diff is collapsed.
Click to expand it.
pkg/metrics/metrics.go
+
6
−
0
View file @
5f3c1b2f
...
@@ -14,9 +14,15 @@ type MetricDefinition struct {
...
@@ -14,9 +14,15 @@ type MetricDefinition struct {
Labels
[]
string
Labels
[]
string
}
}
type
PromTLS
struct
{
CertPath
string
KeyPath
string
}
type
PromConnectionInfo
struct
{
type
PromConnectionInfo
struct
{
Address
string
Address
string
Port
int
Port
int
TLS
*
PromTLS
}
}
type
Settings
struct
{
type
Settings
struct
{
...
...
This diff is collapsed.
Click to expand it.
pkg/prometheus/prom_server.go
+
6
−
1
View file @
5f3c1b2f
...
@@ -53,7 +53,12 @@ func StartServerAsync(conn *metrics.Settings, registry *prom.Registry) *http.Ser
...
@@ -53,7 +53,12 @@ func StartServerAsync(conn *metrics.Settings, registry *prom.Registry) *http.Ser
httpServer
=
defaultServer
(
httpServer
)
httpServer
=
defaultServer
(
httpServer
)
go
func
()
{
go
func
()
{
err
:=
httpServer
.
ListenAndServe
()
var
err
error
if
conn
.
TLS
!=
nil
{
err
=
httpServer
.
ListenAndServeTLS
(
conn
.
TLS
.
CertPath
,
conn
.
TLS
.
KeyPath
)
}
else
{
err
=
httpServer
.
ListenAndServe
()
}
if
err
!=
nil
&&
err
!=
http
.
ErrServerClosed
{
if
err
!=
nil
&&
err
!=
http
.
ErrServerClosed
{
maybePanic
(
"error in http.ListenAndServe: %v"
,
err
)
maybePanic
(
"error in http.ListenAndServe: %v"
,
err
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment