#
# 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.

UNITS_BY_METRIC = {
    'bandwidth': 'B',
    'cluster.create': 'cluster',
    'cluster.delete': 'cluster',
    'cluster.update': 'cluster',
    'compute.node.cpu.frequency': 'MHz',
    'compute.node.cpu.idle.percent': '%',
    'compute.node.cpu.idle.time': 'ns',
    'compute.node.cpu.iowait.percent': '%',
    'compute.node.cpu.iowait.time': 'ns',
    'compute.node.cpu.kernel.percent': '%',
    'compute.node.cpu.kernel.time': 'ns',
    'compute.node.cpu.percent': '%',
    'compute.node.cpu.user.percent': '%',
    'compute.node.cpu.user.time': 'ns',
    'cpu': 'ns',
    'cpu.delta': 'ns',
    'cpu_l3_cache': 'B',
    'cpu_util': '%',
    'disk.allocation': 'B',
    'disk.capacity': 'B',
    'disk.device.allocation': 'B',
    'disk.device.capacity': 'B',
    'disk.device.iops': 'count/s',
    'disk.device.latency': 'ms',
    'disk.device.read.bytes .rate': 'B/s',
    'disk.device.read.bytes': 'B',
    'disk.device.read.requests': 'request',
    'disk.device.read.requests.rate': 'request/s',
    'disk.device.usage': 'B',
    'disk.device.write.bytes .rate': 'B/s',
    'disk.device.write.bytes': 'B',
    'disk.device.write.requests': 'request',
    'disk.device.write.requests.rate': 'request/s',
    'disk.ephemeral.size': 'GB',
    'disk.iops': 'count/s',
    'disk.latency': 'ms',
    'disk.read.bytes': 'B',
    'disk.read.bytes.rate': 'B/s',
    'disk.read.requests': 'request',
    'disk.read.requests.rate': 'request/s',
    'disk.root.size': 'GB',
    'disk.usage': 'B',
    'disk.write.bytes': 'B',
    'disk.write.bytes.rate': 'B/s',
    'disk.write.requests': 'request',
    'disk.write.requests.rate': 'request/s',
    'hardware.cpu.load.10min': 'process',
    'hardware.cpu.load.1min': 'process',
    'hardware.cpu.load.5min': 'process',
    'hardware.disk.size.total': 'KB',
    'hardware.disk.size.used': 'KB',
    'hardware.ipmi.current': 'W',
    'hardware.ipmi.fan': 'RPM',
    'hardware.ipmi.node.airflow': 'CFM',
    'hardware.ipmi.node.cpu_util': '%',
    'hardware.ipmi.node.cups': 'CUPS',
    'hardware.ipmi.node.inlet_temperature': 'C',
    'hardware.ipmi.node.io_util': '%',
    'hardware.ipmi.node.mem_util': '%',
    'hardware.ipmi.node.outlet_temperature': 'C',
    'hardware.ipmi.node.power': 'W',
    'hardware.ipmi.node.temperature': 'C',
    'hardware.ipmi.temperature': 'C',
    'hardware.ipmi.voltage': 'V',
    'hardware.memory.buffer': 'KB',
    'hardware.memory.cached': 'KB',
    'hardware.memory.swap.avail': 'KB',
    'hardware.memory.swap.total': 'KB',
    'hardware.memory.total': 'KB',
    'hardware.memory.used': 'KB',
    'hardware.network.incoming.bytes': 'B',
    'hardware.network.ip.incoming.datagrams': 'datagrams',
    'hardware.network.ip.outgoing.datagrams': 'datagrams',
    'hardware.network.outgoing.bytes': 'B',
    'hardware.network.outgoing.errors': 'packet',
    'hardware.system_stats.cpu.idle': '%',
    'hardware.system_stats.io.incoming.blocks': 'blocks',
    'hardware.system_stats.io.outgoing.blocks': 'blocks',
    'identity.authenticate.failure': 'user',
    'identity.authenticate.pending': 'user',
    'identity.authenticate.success': 'user',
    'identity.group.created': 'group',
    'identity.group.deleted': 'group',
    'identity.group.updated': 'group',
    'identity.project.created': 'project',
    'identity.project.deleted': 'project',
    'identity.project.updated': 'project',
    'identity.role.created': 'role',
    'identity.role.deleted': 'role',
    'identity.role.updated': 'role',
    'identity.role_assignment.created': 'role_assignment',
    'identity.role_assignment.deleted': 'role_assignment',
    'identity.trust.created': 'trust',
    'identity.trust.deleted': 'trust',
    'identity.user.created': 'user',
    'identity.user.deleted': 'user',
    'identity.user.updated': 'user',
    'image': 'image',
    'image.delete': 'image',
    'image.download': 'B',
    'image.serve': 'B',
    'image.size': 'image',
    'image.update': 'image',
    'image.upload': 'image',
    'instance': 'instance',
    'ip.floating': 'ip',
    'ip.floating.create': 'ip',
    'ip.floating.update': 'ip',
    'memory': 'MB',
    'memory.bandwidth.local': 'B/s',
    'memory.bandwidth.total': 'B/s',
    'memory.resident': 'MB',
    'memory.usage': 'MB',
    'network': 'network',
    'network.create': 'network',
    'network.incoming.bytes': 'B',
    'network.incoming.bytes.rate': 'B/s',
    'network.incoming.packets': 'packet',
    'network.incoming.packets.rate': 'packet/s',
    'network.outgoing.bytes': 'B',
    'network.outgoing.bytes.rate': 'B/s',
    'network.outgoing.packets': 'packet',
    'network.outgoing.packets.rate': 'packet/s',
    'network.services.firewall': 'firewall',
    'network.services.firewall.create': 'firewall',
    'network.services.firewall.policy': 'firewall_policy',
    'network.services.firewall.policy.create': 'firewall_policy',
    'network.services.firewall.policy.update': 'firewall_policy',
    'network.services.firewall.rule': 'firewall_rule',
    'network.services.firewall.rule.create': 'firewall_rule',
    'network.services.firewall.rule.update': 'firewall_rule',
    'network.services.firewall.update': 'firewall',
    'network.services.lb.active.connections': 'connection',
    'network.services.lb.health_monitor': 'health_monitor',
    'network.services.lb.health_monitor.create': 'health_monitor',
    'network.services.lb.health_monitor.update': 'health_monitor',
    'network.services.lb.healthmonitor.create': 'health_monitor',
    'network.services.lb.healthmonitor.update': 'health_monitor',
    'network.services.lb.incoming.bytes': 'B',
    'network.services.lb.listener': 'listener',
    'network.services.lb.listener.create': 'listener',
    'network.services.lb.listener.update': 'listener',
    'network.services.lb.loadbalancer': 'loadbalancer',
    'network.services.lb.loadbalancer.create': 'loadbalancer',
    'network.services.lb.loadbalancer.update': 'loadbalancer',
    'network.services.lb.member': 'member',
    'network.services.lb.member.create': 'member',
    'network.services.lb.member.update': 'member',
    'network.services.lb.outgoing.bytes': 'B',
    'network.services.lb.pool': 'pool',
    'network.services.lb.pool.create': 'pool',
    'network.services.lb.pool.update': 'pool',
    'network.services.lb.total.connections': 'connection',
    'network.services.lb.vip': 'vip',
    'network.services.lb.vip.create': 'vip',
    'network.services.lb.vip.update': 'vip',
    'network.services.vpn': 'vpnservice',
    'network.services.vpn.connections': 'ipsec_site_connection',
    'network.services.vpn.connections.create': 'ipsec_site_connection',
    'network.services.vpn.connections.update': 'ipsec_site_connection',
    'network.services.vpn.create': 'vpnservice',
    'network.services.vpn.ikepolicy': 'ikepolicy',
    'network.services.vpn.ikepolicy.create': 'ikepolicy',
    'network.services.vpn.ikepolicy.update': 'ikepolicy',
    'network.services.vpn.ipsecpolicy': 'ipsecpolicy',
    'network.services.vpn.ipsecpolicy.create': 'ipsecpolicy',
    'network.services.vpn.ipsecpolicy.update': 'ipsecpolicy',
    'network.services.vpn.update': 'vpnservice',
    'network.update': 'network',
    'perf.cache.misses': 'count',
    'perf.cache.references': 'count',
    'perf.cpu.cycles': 'cycle',
    'perf.instructions': 'instruction',
    'port': 'port',
    'port.create': 'port',
    'port.update': 'port',
    'router': 'router',
    'router.create': 'router',
    'router.update': 'router',
    'snapshot': 'snapshot',
    'snapshot.create.start': 'snapshot',
    'snapshot.create.end': 'snapshot',
    'snapshot.delete.start': 'snapshot',
    'snapshot.delete.end': 'snapshot',
    'snapshot.size': 'GB',
    'stack.create': 'stack',
    'stack.delete': 'stack',
    'stack.resume': 'stack',
    'stack.suspend': 'stack',
    'stack.update': 'stack',
    'storage.api.request': 'request',
    'storage.containers.objects': 'object',
    'storage.containers.objects.size': 'B',
    'storage.objects': 'object',
    'storage.objects.containers': 'container',
    'storage.objects.incoming.bytes': 'B',
    'storage.objects.outgoing.bytes': 'B',
    'storage.objects.size': 'B',
    'subnet': 'subnet',
    'subnet.create': 'subnet',
    'subnet.update': 'subnet',
    'switch': 'switch',
    'switch.flow': 'flow',
    'switch.flow.bytes': 'B',
    'switch.flow.duration.nanoseconds': 'ns',
    'switch.flow.duration.seconds': 's',
    'switch.flow.packets': 'packet',
    'switch.port': 'port',
    'switch.port.collision.count': 'count',
    'switch.port.receive.bytes': 'B',
    'switch.port.receive.crc_error': 'packet',
    'switch.port.receive.drops': 'packet',
    'switch.port.receive.errors': 'packet',
    'switch.port.receive.frame_error': 'packet',
    'switch.port.receive.overrun_error': 'packet',
    'switch.port.receive.packets': 'packet',
    'switch.port.transmit.bytes': 'B',
    'switch.port.transmit.drops': 'packet',
    'switch.port.transmit.errors': 'packet',
    'switch.port.transmit.packets': 'packet',
    'switch.table': 'table',
    'switch.table.active.entries': 'entry',
    'switch.table.lookup.packets': 'packet',
    'switch.table.matched.packets': 'packet',
    'vcpus': 'vcpu',
    'volume': 'volume',
    'volume.attach.start': 'volume',
    'volume.attach.end': 'volume',
    'volume.backup.create.start': 'volume',
    'volume.backup.create.end': 'volume',
    'volume.backup.delete.start': 'volume',
    'volume.backup.delete.end': 'volume',
    'volume.backup.restore.start': 'volume',
    'volume.backup.restore.end': 'volume',
    'volume.create.start': 'volume',
    'volume.create.end': 'volume',
    'volume.delete.start': 'volume',
    'volume.delete.end': 'volume',
    'volume.detach.start': 'volume',
    'volume.detach.end': 'volume',
    'volume.resize.start': 'volume',
    'volume.resize.end': 'volume',
    'volume.size': 'GB',
    'volume.update.start': 'volume',
    'volume.update.end': 'volume'
}
