Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSFUSE-391: f-m-p annotates services with prometheus.io annotations by default #623

Merged
merged 1 commit into from Oct 31, 2016

Conversation

lburgazzoli
Copy link
Contributor

No description provided.

Copy link
Contributor

@rhuss rhuss left a comment

Choose a reason for hiding this comment

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

Looks good to me. I wonder whether we shouldn't put the service port here as well ? Then we would everything Prometheus related in a single place which can easily be switched on and off.

Don't know though how easy this is because one would need to examing an exsiting service (it safe to assume that the prometheus enricher comes after after e.g. a default service creation).

Also I'm it might make sense to introduce two phases for enrichers: One 'create' phase where missing objects are created and an 'adapt' phase which only tune up existing objects. wdyt ?

Also, some unit test (I know we dont have that much yet, but enricher should be easy to unit test) would be super awesome as well a some docs (small paragraph with the possible config options).

}

private List<ImageConfiguration> getImageConfigurations() {
List<ImageConfiguration> images = getContext().getImages();
Copy link
Contributor

Choose a reason for hiding this comment

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

images should be always non-null (i.e. an empty list if nothing is configured)

@lburgazzoli
Copy link
Contributor Author

Yes, I think it would be nice to have Prometheus related stuff in a single place but this could be generic enough so that if we add new stuffs, they can be handled the same way.

I'm wondering if it could make sense to have a programmatic way to hook enrichers to a phase/event/object so that an enricher is triggered just after a service has been created.

@lburgazzoli
Copy link
Contributor Author

Added some small unit tests

@lburgazzoli
Copy link
Contributor Author

Added minimal dock

@rhuss
Copy link
Contributor

rhuss commented Oct 31, 2016

Thanks ! will merge it that evening.

w.r.t to enricher hooks: This is definitely something to consider. Up to now a lot of responsibility is put on the enricher to not mess up things. Maybe a bit more controlled flow would help, e.g. by splitting up into to phases as said, and then, when thing get created maybe some hooks. However, when enricher are modifying or 'enriching' existing objects, they possible want to do this on freshly created or already existing/configured objects.

Copy link
Contributor

@rhuss rhuss left a comment

Choose a reason for hiding this comment

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

Looks perfect (one minor nit-pick though ;-), thanks a lot for the unit test and docs.

If you could fix the log level, and push, then I'd merge immediately.

if (kind.isService()) {
String prometheusPort = findPrometheusPort();
if (Strings.isNotBlank(prometheusPort)) {
log.info("Add prometheus.io annotations: %s=%s, %s=%S",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you switch this to log.verbose() please ? (can be enabled by setting -Dfabric8.verbose or <verbose>true</verbose>. The reason is, that typically all concrete actions (like the commands in a Dockerfile) are logged with this level. We should probably enhance the interface a bit to provide more context information like the service name. but that's another story ;-)

info() should be reserved for important steps like 'Calling enrichers'.

@lburgazzoli
Copy link
Contributor Author

done

@rhuss
Copy link
Contributor

rhuss commented Oct 31, 2016

[merge]

@rhuss
Copy link
Contributor

rhuss commented Oct 31, 2016

thanks !

@fusesource-ci fusesource-ci merged commit 44a2ca1 into fabric8io:master Oct 31, 2016
@lburgazzoli lburgazzoli deleted the OSFUSE-391 branch October 31, 2016 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants