Skip to content

Commit

Permalink
Fix typos in multiple files. (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkleiman authored and overvenus committed Aug 1, 2018
1 parent 40eddf8 commit 20d4553
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -60,8 +60,8 @@ counter.inc();
// Gather the metrics.
let mut buffer = vec![];
let encoder = TextEncoder::new();
let metric_familys = r.gather();
encoder.encode(&metric_familys, &mut buffer).unwrap();
let metric_families = r.gather();
encoder.encode(&metric_families, &mut buffer).unwrap();

// Output to the standard output.
println!("{}", String::from_utf8(buffer).unwrap());
Expand Down
4 changes: 2 additions & 2 deletions examples/example_embed.rs
Expand Up @@ -95,8 +95,8 @@ fn main() {
let mut buffer = Vec::<u8>::new();
let encoder = TextEncoder::new();
for _ in 0..5 {
let metric_familys = r.gather();
encoder.encode(&metric_familys, &mut buffer).unwrap();
let metric_families = r.gather();
encoder.encode(&metric_families, &mut buffer).unwrap();

// Output to the standard output.
println!("{}", String::from_utf8(buffer.clone()).unwrap());
Expand Down
4 changes: 2 additions & 2 deletions examples/example_hyper.rs
Expand Up @@ -51,9 +51,9 @@ fn main() {
HTTP_COUNTER.inc();
let timer = HTTP_REQ_HISTOGRAM.with_label_values(&["all"]).start_timer();

let metric_familys = prometheus::gather();
let metric_families = prometheus::gather();
let mut buffer = vec![];
encoder.encode(&metric_familys, &mut buffer).unwrap();
encoder.encode(&metric_families, &mut buffer).unwrap();
res.headers_mut()
.set(ContentType(encoder.format_type().parse::<Mime>().unwrap()));
res.send(&buffer).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions examples/example_process_collector.rs
Expand Up @@ -24,8 +24,8 @@ fn main() {
let mut buffer = Vec::new();
let encoder = prometheus::TextEncoder::new();
for _ in 0..5 {
let metric_familys = prometheus::gather();
encoder.encode(&metric_familys, &mut buffer).unwrap();
let metric_families = prometheus::gather();
encoder.encode(&metric_families, &mut buffer).unwrap();

// Output to the standard output.
println!("{}", String::from_utf8(buffer.clone()).unwrap());
Expand Down
4 changes: 2 additions & 2 deletions examples/example_push.rs
Expand Up @@ -63,13 +63,13 @@ fn main() {
for _ in 0..5 {
thread::sleep(time::Duration::from_secs(2));
PUSH_COUNTER.inc();
let metric_familys = prometheus::gather();
let metric_families = prometheus::gather();
let _timer = PUSH_REQ_HISTOGRAM.start_timer(); // drop as observe
prometheus::push_metrics(
"example_push",
labels!{"instance".to_owned() => "HAL-9000".to_owned(),},
&address,
metric_familys,
metric_families,
Some(prometheus::BasicAuthentication {
username: "user".to_owned(),
password: "pass".to_owned(),
Expand Down
4 changes: 2 additions & 2 deletions src/encoder/pb.rs
Expand Up @@ -36,8 +36,8 @@ impl ProtobufEncoder {
}

impl Encoder for ProtobufEncoder {
fn encode<W: Write>(&self, metric_familys: &[MetricFamily], writer: &mut W) -> Result<()> {
for mf in metric_familys {
fn encode<W: Write>(&self, metric_families: &[MetricFamily], writer: &mut W) -> Result<()> {
for mf in metric_families {
// Fail-fast checks.
check_metric_family(mf)?;
mf.write_length_delimited_to_writer(writer)?;
Expand Down
4 changes: 2 additions & 2 deletions src/encoder/text.rs
Expand Up @@ -37,8 +37,8 @@ impl TextEncoder {
}

impl Encoder for TextEncoder {
fn encode<W: Write>(&self, metric_familys: &[MetricFamily], writer: &mut W) -> Result<()> {
for mf in metric_familys {
fn encode<W: Write>(&self, metric_families: &[MetricFamily], writer: &mut W) -> Result<()> {
for mf in metric_families {
// Fail-fast checks.
check_metric_family(mf)?;

Expand Down
14 changes: 7 additions & 7 deletions src/registry.rs
Expand Up @@ -25,7 +25,7 @@ use metrics::Collector;
use proto;

struct RegistryCore {
pub colloctors_by_id: HashMap<u64, Box<Collector>>,
pub collectors_by_id: HashMap<u64, Box<Collector>>,
pub dim_hashes_by_name: HashMap<String, u64>,
pub desc_ids: HashSet<u64>,
}
Expand Down Expand Up @@ -78,7 +78,7 @@ impl RegistryCore {
}
}

match self.colloctors_by_id.entry(collector_id) {
match self.collectors_by_id.entry(collector_id) {
HEntry::Vacant(vc) => {
self.desc_ids.extend(desc_id_set);
vc.insert(c);
Expand All @@ -98,7 +98,7 @@ impl RegistryCore {
}
}

if self.colloctors_by_id.remove(&collector_id).is_none() {
if self.collectors_by_id.remove(&collector_id).is_none() {
return Err(Error::Msg(format!(
"collector {:?} is not registered",
c.desc()
Expand All @@ -113,7 +113,7 @@ impl RegistryCore {
fn gather(&self) -> Vec<proto::MetricFamily> {
let mut mf_by_name = BTreeMap::new();

for c in self.colloctors_by_id.values() {
for c in self.collectors_by_id.values() {
let mfs = c.collect();
for mut mf in mfs {
// Prune empty MetricFamilies.
Expand Down Expand Up @@ -191,7 +191,7 @@ pub struct Registry {
impl Default for Registry {
fn default() -> Registry {
let r = RegistryCore {
colloctors_by_id: HashMap::new(),
collectors_by_id: HashMap::new(),
dim_hashes_by_name: HashMap::new(),
desc_ids: HashSet::new(),
};
Expand Down Expand Up @@ -307,8 +307,8 @@ mod tests {

let r1 = r.clone();
let handler = thread::spawn(move || {
let metric_familys = r1.gather();
assert_eq!(metric_familys.len(), 1);
let metric_families = r1.gather();
assert_eq!(metric_families.len(), 1);
});

assert!(handler.join().is_ok());
Expand Down

0 comments on commit 20d4553

Please sign in to comment.