
At present, all time series are accumulated in the same database in InfluxDB. This makes queries slow for tenants that have less data. This patch enables the option to use separate database per tenancy. This changeset implements the changes on monasca-api which handles read requests to InfluxDB database. It also updates the relevant docs providing link to the migration tool which enables users to migrate their existing data to a database per tenant model. Change-Id: I7de6e0faf069b889d3953583b29a876c3d82c62c Story: 2006331 Task: 36073
55 lines
1.6 KiB
Python
55 lines
1.6 KiB
Python
# Copyright 2014 IBM Corp.
|
|
# Copyright 2016-2017 FUJITSU LIMITED
|
|
# (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
# implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
from oslo_config import cfg
|
|
|
|
influxdb_opts = [
|
|
cfg.StrOpt('database_name', default='mon',
|
|
help='''
|
|
Database name where metrics are stored
|
|
'''),
|
|
cfg.BoolOpt('db_per_tenant', default=False,
|
|
help='''
|
|
Whether to use a separate database per tenant
|
|
'''),
|
|
cfg.HostAddressOpt('ip_address', default='127.0.0.1',
|
|
help='''
|
|
IP address to Influxdb server
|
|
'''),
|
|
cfg.PortOpt('port', default=8086,
|
|
help='Port to Influxdb server'),
|
|
cfg.StrOpt('user', required=True,
|
|
sample_default='monasca-api', help='''
|
|
Influxdb user
|
|
'''),
|
|
cfg.StrOpt('password', secret=True, sample_default='password',
|
|
help='''
|
|
Influxdb password
|
|
''')
|
|
]
|
|
|
|
influxdb_group = cfg.OptGroup(name='influxdb', title='influxdb')
|
|
|
|
|
|
def register_opts(conf):
|
|
conf.register_group(influxdb_group)
|
|
conf.register_opts(influxdb_opts, influxdb_group)
|
|
|
|
|
|
def list_opts():
|
|
return influxdb_group, influxdb_opts
|