简体   繁体   English

用于存储指标的数据库架构/设计

[英]Database schema/design for storing metrics

For clarification, I don't want to store metrics on the database itself - rather, I want to build a database to store metrics from the various controls we measure at my organization for easy reporting. 为了澄清起见,我不想将指标存储在数据库本身上,而是希望构建一个数据库来存储来自我们在组织中测量的各种控件的指标,以便于报告。 A little background: as manager, I pull metrics from various applications - our two ticketing systems (yeah, I know), our phone system, alerts from our event management software (ie, Nagios), etc. I report on these on a weekly basis and keep an Excel spreadsheet with the historical data. 背景:作为经理,我从各种应用程序中获取指标-我们的两个票务系统(是的,我知道),电话系统,事件管理软件(即Nagios)的警报等。我每周都会报告这些情况根据并保留带有历史数据的Excel电子表格。 The spreadsheet is really, really big and inflexible. 电子表格非常大而且不灵活。

I'm not new at writing web apps, but I'm still new to the database design arena. 我不是写Web应用程序的新手,但我仍然是数据库设计领域的新手。 I want to code an app with some awesome rickshaw javascript graphs for some great historical data (and to wow the senior management team with crazy colors and interactivity). 我想用一些很棒的人力车javascript图形编写一个应用程序,以获取一些很棒的历史数据(并用疯狂的色彩和交互性让高级管理团队赞叹不已)。

Where do I start with the database? 我从哪里开始数据库? I could create one table for all metrics, but how to index those into the various types (for instance, phone metrics has abandon rate, total inbound calls, total outbound calls, total time on call, average talk time, average hold time, max hold time, etc.). 我可以为所有指标创建一个表,但是如何将这些指标编入各种类型(例如,电话指标具有放弃率,入站呼叫总数,出站呼叫总数,通话总时间,平均通话时间,平均保持时间,最大值保持时间等)。 That's one messy, unorganized table. 那是一张杂乱无章的桌子。

I could create one table for each type (phone, ticket, event, etc.) but that seems hard to add metrics to the pile later. 我可以为每种类型(电话,票证,事件等)创建一个表,但是稍后似乎很难向该堆添加指标。

I'm hoping someone here has some experience and can give me some pointers on what direction I should head. 我希望这里的人有一些经验,可以给我一些指示,指示我应该朝哪个方向前进。

PS: It will need to be SQLite or MySQL, just due to the resources I have available at this time. PS:由于我目前可用的资源,它必须是SQLite或MySQL。

MySQL design for such a system can be made considering following: 可以考虑以下因素来设计此类系统的MySQL:

  1. A Table for each type of metrics group for example an entity of ticket system can be a single ticket 每种类型的度量标准组的表(例如,票证系统的实体)可以是单个票证
  2. If a ticket is connected to single user you may include user name in the previous ticket table otherwise to keep it flexible i would say create a table for each connected element for example ticket is assinged to staff and has multiple telephone calls associated to it so you would need calls table and staff table. 如果将票证连接到单个用户,则可以在上一个票证表中包括用户名,否则为了保持灵活性,我会说为每个连接的元素创建一个表,例如,票证已分配给员工,并且有多个电话与之关联,因此您需要呼叫表和人员表。
  3. In order to map multiple items create mapping tables for example stafftickets and ticketcalls to associate staff with multiple tickets and tickets with multiple calls 为了映射多个项目,请创建映射表(例如职员票和票证呼叫)以将员工与多个票证关联,并将票证与多个电话关联

Once you have defined these entities then you can sit on mySQL phpmyadmin and create tables that will work. 一旦定义了这些实体,就可以坐在mySQL phpmyadmin上并创建可以使用的表。

For charting side of things use D3.js and just spit out json and use javascript or json2 to bind it to your graphs etc. 对于图表方面,请使用D3.js并吐出json并使用javascript或json2将其绑定到图形等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM