Skip to content

Conversation

@bpetit
Copy link
Contributor

@bpetit bpetit commented Feb 27, 2021

Work in progress for #22

@bpetit bpetit self-assigned this Feb 27, 2021
@bpetit bpetit changed the title feat: warp10 exporter with first base metrics sent feat: warp10 exporter Feb 27, 2021
@bpetit bpetit requested a review from uggla March 1, 2021 18:21
@bpetit bpetit linked an issue Mar 1, 2021 that may be closed by this pull request
@uggla
Copy link
Collaborator

uggla commented Mar 2, 2021

That's sounds good to me so far. But I have only done a quick review.

As proposed in the rieman client MR:

@bpetit, if it is ok for you, as soon as this PR will be merged, I will open a new one to do the proposed changes to reduce duplication.
This may also simplify implementations of new exporters.
How do you want to proceed, would you like to discuss the idea upfront or would you like me to propose an example MR first.

I had a lack of time to propose something here. :(

Basically, we are doing almost the same stuffs in prom, riemann and warp10 exporters. This led to duplicated code and long methods so errors .
So I wonder if we should not make an effort to factorize code now because each time we will have a new exporter it will make the task harder and harder.

If it is possible for you, we could do a pair programming session to get rid of this issue. I think it will be the fastest way to progress on this.
What do you think about it ?

let minor_version = version_parts.next().unwrap();
format!("{}.{}{}", major_version, patch_version, minor_version)
}
// Copyright 2020 The scaphandre authors.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh great to add the licence !

ExporterOption {
default_value: None,
help: String::from("Time step between measurements, in seconds."),
long: String::from("qemu"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum I guess there is an issue in the option name, or more likely this option is not required.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not yet pushed the code attached to it, sorry :)
I'm actually using it in the exporter (and I'm currently trying to fix some issues related to the label resulting from it)

takes_value: true,
},
);
options.insert(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really fan of this option, I would merge with the host one and create an url option maybe.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done it like that because another option to send data to warp10 is websockets. Because the uri for that would look like ws://host/api/v0...
I thought it would be cleaner to have a separate variable to manage the protocol. 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sens in that case.

topo_procs_len,
);

//TODO: metric sent twice ?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep looks like it is the case :)

socket.stat_buffer.len(),
);

//TODO: fix metric
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe provide a bit more details here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the value is socket.stat_buffer.len() for both scaph_self_socket_stats_nb and scaph_self_socket_records_nb.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep pitfall here. :(

None
}

pub fn get_scaphandre_version() -> String {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

takes_value: true,
},
);
options.insert(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum i guess it is a secret. I think it is "safer" to pass it in a file and not cmdline.
We may allow to pass it from cmdline with a warning saying it is dangerous.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, it's a very dumb way to do it. I've done it like that first to bootstrap the feature quickly. I'll fix that prior merging.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an env var and a file option could be nice. An env var will probably make it easier to integrate with docker, k8s secrets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added the env var option, let's create the file option when someone asks for it explicitely :)

None,
String::from("scaph_self_version"),
labels.clone(),
warp10::Value::Double(scaphandre_version.parse::<f64>().unwrap()),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing we could factorize maybe. Maybe, we could leverage the Metric trait to send something whatever the type it will select the appropriate method (Double, Long, ...).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have a point here. This would be much cleaner. I don't yet imagine how it would integrate with the warp10 lib however.

@uggla
Copy link
Collaborator

uggla commented Mar 2, 2021

You should prefix the MR with WIP: this will avoid to accidentally merge it.

@bpetit bpetit changed the title feat: warp10 exporter WIP: feat: warp10 exporter Mar 3, 2021
@bpetit
Copy link
Contributor Author

bpetit commented Mar 3, 2021

That's sounds good to me so far. But I have only done a quick review.

Thanks a lot !

As proposed in the rieman client MR:

@bpetit, if it is ok for you, as soon as this PR will be merged, I will open a new one to do the proposed changes to reduce duplication.
This may also simplify implementations of new exporters.
How do you want to proceed, would you like to discuss the idea upfront or would you like me to propose an example MR first.

I had a lack of time to propose something here. :(

Basically, we are doing almost the same stuffs in prom, riemann and warp10 exporters. This led to duplicated code and long methods so errors .
So I wonder if we should not make an effort to factorize code now because each time we will have a new exporter it will make the task harder and harder.

I agree, it would be much cleaner.

If it is possible for you, we could do a pair programming session to get rid of this issue. I think it will be the fastest way to progress on this.
What do you think about it ?

Great idea, let's discuss about a meeting schedule that fits both of our agendas to work on that :)


## Metrics exposed

Typically the Warp10 exporter is working in the same way as the riemann exporter regarding metrics. Please look at details in [Prometheus exporter](exporter-prometheus.md) documentations to get the extensive list of metrics available. No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically the Warp10 exporter is working in the same way as the prometheus and riemann exporters regarding metrics.

@bpetit bpetit merged commit f47f332 into main Mar 11, 2021
@bpetit bpetit changed the title WIP: feat: warp10 exporter feat: warp10 exporter Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Previous releases

Development

Successfully merging this pull request may close these issues.

Warp10 exporter

3 participants