/// <summary> /// Maps a counter's metadata and sampled value to the table schema. /// </summary> /// <param name="sample">The counter sample to map.</param> /// <param name="tableSchema">The DataTable to map the counter to.</param> /// <returns>DataRow with all fields from the sample correctly mapped.</returns> private static DataRow MapToSchema(ICounterSample sample, DataTable tableSchema) { var row = tableSchema.NewRow(); var counter = sample.Counter; row["cluster"] = counter.Host.Cluster; row["machine"] = counter.Host.Name.ToLower(); row["counter_type"] = counter.CounterType; row["source"] = counter.Source; row["category"] = counter.Category; row[counter.Counter.ToSnakeCase()] = sample.SampleValue; row["instance"] = counter.Instance; row["unit"] = counter.Unit; return(row); }
/// <summary> /// Maps a counter's metadata and sampled value to the table schema. /// </summary> /// <param name="sample">The counter sample to map.</param> /// <param name="tableSchema">The DataTable to map the counter to.</param> /// <returns>DataRow with all fields from the sample correctly mapped.</returns> private static DataRow MapToSchema(ICounterSample sample, DataTable tableSchema) { var row = tableSchema.NewRow(); var counter = sample.Counter; row["machine"] = counter.HostName; row["category"] = counter.Category; if (USE_STATIC_COLUMN_NAMES) { row["name"] = counter.Counter; row["value"] = sample.SampleValue; } else { // Oracle has a 30 char limit for columnNames. row[toOracleColumnName(counter.Counter.ToSnakeCase())] = sample.SampleValue; } row["instance"] = counter.Instance; return(row); }
/// <summary> /// Maps a counter's metadata and sampled value to the table schema. /// </summary> /// <param name="sample">The counter sample to map.</param> /// <param name="tableSchema">The DataTable to map the counter to.</param> /// <returns>DataRow with all fields from the sample correctly mapped.</returns> private static DataRow MapToSchema(ICounterSample sample, DataTable tableSchema) { var row = tableSchema.NewRow(); var counter = sample.Counter; row["cluster"] = counter.Host.Cluster; row["machine"] = counter.Host.Name.ToLower(); row["counter_type"] = counter.CounterType; row["source"] = counter.Source; row["category"] = counter.Category; row[counter.Counter.ToSnakeCase()] = sample.SampleValue; row["instance"] = counter.Instance; row["unit"] = counter.Unit; return row; }