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

Put RUNDECK_URL into the label instance #34

Closed
rdoering opened this issue Mar 2, 2022 · 14 comments
Closed

Put RUNDECK_URL into the label instance #34

rdoering opened this issue Mar 2, 2022 · 14 comments
Assignees
Labels
enhancement New feature or request

Comments

@rdoering
Copy link

rdoering commented Mar 2, 2022

We are using multiple rundeck instances and it would be nice to distinguish between this per instance-label. Therefore it would be greate put the env RUNDECK_URL into the instance-label.

@phsmith
Copy link
Owner

phsmith commented Mar 2, 2022

@rdoering, the exporter already provides the label instance for all metrics, I think that could resolve your case, below is a example of a metric:

rundeck_system_stats_uptime_since{instance="rundeck-01:9620", job="rundeck_exporter"} 1645107677981
rundeck_system_stats_uptime_since{instance="rundeck-02:9620", job="rundeck_exporter"} 1643728122380

@phsmith phsmith self-assigned this Mar 2, 2022
@rdoering
Copy link
Author

rdoering commented Mar 3, 2022

@phsmith Thanks for your fast reply.

This is not the case on my end :-)
https://rundeck-cust-sie-run-01-prometheus-deployment.monitoring-***/metrics

# HELP rundeck_system_stats_uptime_since Rundeck system stats
# TYPE rundeck_system_stats_uptime_since gauge
rundeck_system_stats_uptime_since 1.639385175006e+012

The instance I encounter in prometheus is the container-name only, added by scrapping metrics.

Would you say i should update my docker-image, updated 2 months ago?

Or maybe my docker-compose-config is bad.

 80   rundeck-run-04:
 81     #build: ./rundeck_exporter
 82     image: phsmith/rundeck-exporter
 83     environment:
 84       RUNDECK_TOKEN: 5nQjozpSPJrV6bXs28IjafGcrRxoPGDu
 85       RUNDECK_URL: "https://run-04.prod.***"
 86       RUNDECK_EXPORTER_HOST: 0.0.0.0
 87       RUNDECK_SKIP_SSL: "True"
 88       RUNDECK_PROJECTS_EXECUTIONS: "True"
 89       RUNDECK_PROJECTS_EXECUTIONS_CACHE: "True"
 90     restart: unless-stopped
 91     ports:
 92       - 9620
 93     networks:
 94       - traefik
 95       - default
 96     labels:
 97       - "traefik.enable=true"

phsmith added a commit that referenced this issue Mar 3, 2022
phsmith added a commit that referenced this issue Mar 3, 2022
* docs: Update README.md

* fix: Remove  token requirement if user/pass options are used

* fix: docker-compose.yml

* fix: Issue #34 add node label in metrics
@phsmith
Copy link
Owner

phsmith commented Mar 3, 2022

Oh man, sorry. My example shows instance and job labels, but they are automatically added by Prometheus not by the exporter.

I'm just published a new version that has a label named node in the metrics:

rundeck_system_stats_uptime_since{node="e95f20a5cf9b"} 1.646301608169e+012

I've decided to put node label because the URL could be a cluster address.

@phsmith phsmith added the enhancement New feature or request label Mar 3, 2022
@rdoering
Copy link
Author

rdoering commented Mar 4, 2022

Thanks for the fast response.

I pulled the image and discovered that the label "node" holds the hostname of the host where the prometheus-exporter is running. This hostname is added as label "instance" by prometheus itself, if the label "instance" is not provided by the exporter.

I am looking for the URL of the rundeck-instance, provided to exporter by env RUNDECK_URL. I would appreciate if we could set the label "instance" to the value of self.args.rundeck_url. If you want we could optionally suppress this label but I in my mind it is more likly that the metric consumer is more interested on the rundeck-url rather than the exporter-url.

@rdoering
Copy link
Author

rdoering commented Mar 4, 2022

I you wish to, I could try to write it. But I guess I wouldn't that keen as you are :-).

@phsmith
Copy link
Owner

phsmith commented Mar 4, 2022

I see your point of view now and I agree with it.

What do you think about that output:

rundeck_system_stats_uptime_since{instance_address="rundeck.local:4440"} 1.646387503677e+012
rundeck_system_stats_scheduler_running{instance_address="rundeck.local:4440"} 0.0

@rdoering
Copy link
Author

rdoering commented Mar 4, 2022

That would be fine for me. I would configure my prometheus by using relabel_config to use the label "instance" as my connected tools like the alertmanager, grafana and team-client expecting the label "instance" to hold the hostname where the metrics are related to.

As some metrics like "python_info" are more related to the host running the exporter, it would fine to set the label "instance" the exporter-host. But the most important metrics are related to the host RUNDECK_URL. I would suggest to set rundeck-host-related metrics to RUNDECK_URL and leave exporter-host-related metrics without the label "instance" as this set by prometheus by default.

@phsmith
Copy link
Owner

phsmith commented Mar 4, 2022

Great, that makes sense.
My only fear at the moment is change the instance label and break for users that already using that label as is. That's why I've suggested the label instance_address.

@rdoering
Copy link
Author

rdoering commented Mar 4, 2022

My only fear at the moment is change the instance label and break for users that already using that label as is. That's why I've suggested the label instance_address.

That a good point. I would suggest to add an option to disable this feature. If it is disabled, no label will be given by the exporter and the behaviour is unchanged. Why optional off: Because the default behaviour is more related to the default what prometheus is expecting to get. And if you are using the docker-tag "lastest" you have expect breaking changes, which in the case could be managed per option also.

@phsmith
Copy link
Owner

phsmith commented Mar 4, 2022

Good! That's a good suggestion and could work flawlessly.
I'll work on that.

@phsmith
Copy link
Owner

phsmith commented Mar 5, 2022

@rdoering, reading more about the instance label I think that add it to the rundeck_exporter labels won't be the best approach, because, for that to really take place over the default instance label placed by prometheus the honor_labels config must be set to true so, in my opinion, it's better to have the instance_address label and, if the user want, use the relabel_config, as you mention before.

And about make the label optional, it's not a good practice to have that configurable through options.

So, if you agree, I'll publish the code with the label instance_address.

@rdoering
Copy link
Author

rdoering commented Mar 5, 2022

Ah, I already configured honor_labels, but I wan't aware of it :-). Then you are right. I will use relabel_config to the instance on prometheus.

@phsmith
Copy link
Owner

phsmith commented Mar 5, 2022

Great! So, I've just published a new version with the instance_address label in the metrics.

Thanks for using the rundeck_exporter and providing feedback's about it.

@rdoering
Copy link
Author

rdoering commented Mar 6, 2022

I pulled the new image and the new label is shown as expected.

Than I configured the scraper by

103     metric_relabel_configs:
104       - source_labels: [__name__]
105         regex: python_*
106         action: drop
107       - source_labels: [instance_address]
108         action: replace
109         target_label: instance
110       - action: labeldrop                                                                                                                                                                                                     111         regex: "instance_address"

And it works like a charm. I thank you a lot.

@phsmith phsmith closed this as completed Mar 6, 2022
phsmith added a commit that referenced this issue Apr 20, 2022
* fix: Issue #34, added `instance_address` label in metrics

* fix: Issue #40, negative job_execution_duration value
phsmith added a commit that referenced this issue May 9, 2022
* fix: Issue #34, added `instance_address` label in metrics

* fix: Issue #40, negative job_execution_duration value

* ISSUE-42 avoid duplicating metric definitions (#43)

Co-authored-by: Wilson Britten <wbritten@sofi.org>

* docs: Update README.md

Co-authored-by: WilsonSunBritten <wilsunb@gmail.com>
Co-authored-by: Wilson Britten <wbritten@sofi.org>
phsmith added a commit that referenced this issue May 10, 2022
* fix: Issue #34, added `instance_address` label in metrics

* fix: Issue #40, negative job_execution_duration value

* ISSUE-42 avoid duplicating metric definitions (#43)

Co-authored-by: Wilson Britten <wbritten@sofi.org>

* docs: Update README.md

* fix: Issue #42 Further fix duplicates (#46)

* ISSUE-42 avoid duplicating metric definitions

* Fix duplicate entry of project fields

* Further fix duplicates

* feat: Change classes for namedtuple

Co-authored-by: Wilson Britten <wbritten@sofi.org>
Co-authored-by: Phillipe Chaves <phsmithcc@gmail.com>

Co-authored-by: WilsonSunBritten <wilsunb@gmail.com>
Co-authored-by: Wilson Britten <wbritten@sofi.org>
phsmith pushed a commit that referenced this issue Sep 26, 2022
use instance_address variable in grafana dashboard instead of instance, as changed in #34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants