Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
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
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
TFS
controller
Commits
ada162bf
Commit
ada162bf
authored
2 years ago
by
Lluis Gifre Renom
Browse files
Options
Downloads
Patches
Plain Diff
Slice component:
- updated monitoring table name
parent
947de0bb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!142
Release TeraFlowSDN 2.1
,
!64
Slice Grouping
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/slice/service/slice_grouper/MetricsExporter.py
+6
-6
6 additions, 6 deletions
src/slice/service/slice_grouper/MetricsExporter.py
with
6 additions
and
6 deletions
src/slice/service/slice_grouper/MetricsExporter.py
+
6
−
6
View file @
ada162bf
...
...
@@ -31,7 +31,7 @@ MSG_ERROR_MAX_RETRIES = 'Maximum number of retries achieved: {:d}'
METRICSDB_HOSTNAME
=
os
.
environ
.
get
(
'
METRICSDB_HOSTNAME
'
)
METRICSDB_ILP_PORT
=
int
(
os
.
environ
.
get
(
'
METRICSDB_ILP_PORT
'
))
METRICSDB_REST_PORT
=
int
(
os
.
environ
.
get
(
'
METRICSDB_REST_PORT
'
))
METRICSDB_TABLE
=
'
slice_groups
'
METRICSDB_TABLE
_SLICE_GROUPS
=
os
.
environ
.
get
(
'
METRICSDB_TABLE_SLICE_GROUPS
'
)
COLORS
=
{
'
platinum
'
:
'
#E5E4E2
'
,
...
...
@@ -46,7 +46,7 @@ SQL_MARK_DELETED = "UPDATE {:s} SET is_deleted='true' WHERE slice_uuid='{:s}';"
class
MetricsExporter
():
def
create_table
(
self
)
->
None
:
sql_query
=
'
'
.
join
([
'
CREATE TABLE IF NOT EXISTS {:s} (
'
.
format
(
str
(
METRICSDB_TABLE
)),
'
CREATE TABLE IF NOT EXISTS {:s} (
'
.
format
(
str
(
METRICSDB_TABLE
_SLICE_GROUPS
)),
'
,
'
.
join
([
'
timestamp TIMESTAMP
'
,
'
slice_uuid SYMBOL
'
,
...
...
@@ -62,9 +62,9 @@ class MetricsExporter():
try
:
result
=
self
.
rest_request
(
sql_query
)
if
not
result
:
raise
Exception
LOGGER
.
info
(
'
Table {:s} created
'
.
format
(
str
(
METRICSDB_TABLE
)))
LOGGER
.
info
(
'
Table {:s} created
'
.
format
(
str
(
METRICSDB_TABLE
_SLICE_GROUPS
)))
except
Exception
as
e
:
LOGGER
.
warning
(
'
Table {:s} cannot be created. {:s}
'
.
format
(
str
(
METRICSDB_TABLE
),
str
(
e
)))
LOGGER
.
warning
(
'
Table {:s} cannot be created. {:s}
'
.
format
(
str
(
METRICSDB_TABLE
_SLICE_GROUPS
),
str
(
e
)))
raise
def
export_point
(
...
...
@@ -80,7 +80,7 @@ class MetricsExporter():
for
retry
in
range
(
MAX_RETRIES
):
try
:
with
Sender
(
METRICSDB_HOSTNAME
,
METRICSDB_ILP_PORT
)
as
sender
:
sender
.
row
(
METRICSDB_TABLE
,
symbols
=
symbols
,
columns
=
columns
,
at
=
dt_timestamp
)
sender
.
row
(
METRICSDB_TABLE
_SLICE_GROUPS
,
symbols
=
symbols
,
columns
=
columns
,
at
=
dt_timestamp
)
sender
.
flush
()
LOGGER
.
info
(
MSG_EXPORT_EXECUTED
.
format
(
str
(
dt_timestamp
),
str
(
symbols
),
str
(
columns
)))
return
...
...
@@ -91,7 +91,7 @@ class MetricsExporter():
raise
Exception
(
MSG_ERROR_MAX_RETRIES
.
format
(
MAX_RETRIES
))
def
delete_point
(
self
,
slice_uuid
:
str
)
->
None
:
sql_query
=
SQL_MARK_DELETED
.
format
(
str
(
METRICSDB_TABLE
),
slice_uuid
)
sql_query
=
SQL_MARK_DELETED
.
format
(
str
(
METRICSDB_TABLE
_SLICE_GROUPS
),
slice_uuid
)
try
:
result
=
self
.
rest_request
(
sql_query
)
if
not
result
:
raise
Exception
...
...
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