Commit Graph

38 Commits

Author SHA1 Message Date
Yuri Tsuprun
ca4c3133e5
Add multi-target support (#1063)
* Add multi-target support

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Update example-prometheus.yml

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Make `es.uri` optional by setting default to empty string check if it's empty and if so, don't parse it
Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Update README.md

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Add sanity target scheme validation

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Change yaml package to go.yaml.in/yaml/v3

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Update yaml package to go.yaml.in/yaml/v3

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Update CHANGELOG.md

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Remove whitespaces from README.md

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Add testing for apikey authentication module
Update examples/auth_modules.yml
Fix main.go to apply userpass credentials only if the module type is explicitly set to userpass.

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Add Load-time validation for the auth module config file during startup
Keep light-weight validation for the probe params during runtime
Add AWS SigV4 authentication module support

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Expose error in the logger

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Add TLS config per target support
Add TLS config validation
Update config test to include TLS config

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Indices and Shards collectors now fetch cluster_name once from GET / when no clusterinfo retriever is attached, avoiding the previous "unknown_cluster" label.

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Removed the special-case logic that redirected /metrics?target= requests to /probe.
Updated auth_modules.yml to include AWS SigV4 signing and mTLS support.

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Add license headers to all new files

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Fixes for relative paths in multi-target mode

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Bump github.com/prometheus/client_golang from 1.22.0 to 1.23.0 (#1065)

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.22.0 to 1.23.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.22.0...v1.23.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-version: 1.23.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Add target schema validation, http/https only
Add tls auth type support in multi-target mode
Update README.md, examples/auth_modules.yml, tests

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Cleanup

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Fix tls auth type validation

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Remove aws.region validation

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Add temp file cleanup in config_test.go

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Add copyright header to config_test.go

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

* Add version metric to the per-probe registry
Update roundtripper.go to use region from config or environment resolver if not provided in config file (AWS_REGION)
Update probe.go to accept module even if region omitted; environment resolver can provide it
Update config.go to use region as optional field
Update main.go to use region from config or environment resolver if not provided in config file (AWS_REGION) and update roundtripper.go to use region from config or environment resolver if not provided in config file (AWS_REGION)

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>

---------

Signed-off-by: pincher95 <yuri.tsuprun@logz.io>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Yuri Tsuprun <51751791+pincher95@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-18 21:43:53 -04:00
Joe Adams
00dfe058f4
Remove copyright dates (#1027)
This should help when PRs are open through a year change. These dates aren't necessary and the CNCF does not recommend keeping them.

https://github.com/cncf/foundation/blob/main/copyright-notices.md

Signed-off-by: Joe Adams <github@joeadams.io>
2025-06-17 21:11:22 -04:00
YenchangChan
8a1d851bdb
Fix memleak for create a TimeTicker without stop (#1049)
Signed-off-by: YenchangChan <chenyanchang1990@163.com>
2025-06-17 21:10:04 -04:00
Joe Adams
4a54705614
Update golangci-lint config for v2 (#1034)
This brings the common files in line with other prometheus repos. Most of these settings are coppied from prometheus/prometheus. Where it was a small change, I have enabled the new linte
rs and made the fixes. The remaining linters that are commented out deserve to be enabled and the fixes applied as independent changes.

Signed-off-by: Joe Adams <github@joeadams.io>
2025-05-06 22:22:12 -04:00
TJ Hoplock
7a09a847ab
chore!: adopt log/slog, drop go-kit/log (#942)
The bulk of this change set was automated by the following script which
is being used to aid in converting the various exporters/projects to use
slog:

https://gist.github.com/tjhop/49f96fb7ebbe55b12deee0b0312d8434

In addition to the parts that were straightforward conversions, this
also:
- refactors much of the logging config to adopt slog
    - removed custom `logger.go` setup for go-kit
    - adopt promslog/flag and use that to handle parsing log
      level/format flags
    - for consistent behavior, keep log output flag to allow toggle
      stdout/stderr for output
    - adopt promslog for logger setup
- enables sloglint in golangci-lint config
- drops go-kit/log exclusions from lint config
- tidies mods to drop go-kit/log and go-logfmt/logfmt deps

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>

* ci: update deprecated golangci-lint config

Fixes:

```
WARN [config_reader] The configuration option `linters.errcheck.exclude` is deprecated, please use `linters.errcheck.exclude-functions`.
```

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>

---------

Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
2024-10-17 12:03:17 -04:00
Aaron Delaney
1d5d44be41
collector: add tasks API collection (#778)
* collector: add tasks API collection

This commit adds simple aggregation of Elasticsearch Tasks API.
There are 4 new metrics; though 3 are just bookkeeping.

elasticsearch_task_stats_action_total is a gague reporting the total
number of tasks running for a given action. Because there are no stats
endpoints available for this, this change introduces an aggregation step
to group the number of tasks by action name.

This metric is useful for ensuring long running actions of a specific
kind stay within a specific limit. Of particular use to me is
the action: 'indices:data/write/delete/byquery'.

In my usecase, our ES access patterns mean we have a predefined limit
of these actions running on the cluster.

This change also adds two new CLI flags to manage the collection of tasks API:

	--es.tasks (to enable task collection)
	--es.tasks.actions (to filter tasks by action param)

Issue #525 proposed addition of collection of these tasks.

Signed-off-by: Aaron Delaney <apd@arista.com>

* collector: use collector interface for tasks

Signed-off-by: Aaron Delaney <apd@arista.com>

* all: fix issues reported by golangci-lint

Signed-off-by: Aaron Delaney <apd@arista.com>

* collector: make task structs private to package

Signed-off-by: Aaron Delaney <apd@arista.com>

* Fix task stats metric name

Signed-off-by: Aaron Delaney <apd@arista.com>

* Fix tasks test

Signed-off-by: Aaron Delaney <apd@arista.com>

---------

Signed-off-by: Aaron Delaney <apd@arista.com>
2024-03-13 22:26:39 -04:00
Ben Kochie
c52fc4235f
Merge pull request #714 from bagmeg/fix-comment-typo-error
fix: comment typo error
2023-06-22 06:11:36 +02:00
Jorge Luis Betancourt
d0d64e9c5e
fix: set the value of elasticsearch_clusterinfo_version_info to 1 (#728)
In the Prometheus ecosystem, info metrics (those with the `_info`
suffix) usually have a value of 1. Although not enforced, this has
become a standard pattern across Prometheus and several exporters (see
`prometheus_build_info`).

Signed-off-by: Jorge Luis Betancourt Gonzalez <jorge-luis.betancourt@trivago.com>
2023-06-21 20:44:44 -04:00
bagmeg
fda1b57ea8 Fix comment typo error
Fix comment typo error in Retriever struct of the clusterinfo package

Signed-off-by: bagmeg <joonsoo181005@gmail.com>
2023-05-09 23:40:23 +09:00
SuperQ
0008ee9768
Update build and cleanup
* Update Go to 1.20.
* Update Makefile.common
* Update golangci-lint.
* Update exporter-toolkit.
* Cleanup useless `_` assignment for go-kit/log.
* Cleanup deprecated and unused code.

Signed-off-by: SuperQ <superq@gmail.com>
2023-03-23 09:51:33 +01:00
Steve Teuber
d55d6d2b4d
Add support to assume an AWS role and renew expired credentials (#653)
Co-authored-by: Christoph Burmeister <christoph.burmeister@idealo.de>
Signed-off-by: Steve Teuber <steve.teuber@idealo.de>

Signed-off-by: Steve Teuber <steve.teuber@idealo.de>
Co-authored-by: Christoph Burmeister <christoph.burmeister@idealo.de>
2023-01-24 09:28:38 -05:00
Ben Kochie
73d75a3315
Update semver package (#606)
Use semver/v4 for better Go module compatibility.
* Update all Go modules.

Signed-off-by: SuperQ <superq@gmail.com>
2022-07-28 14:59:47 +02:00
Roshan Patil
a0993ec436
Support for AWS Elasticsearch using AWS SDK v2 (#597)
* Support for AWS Elasticsearch using AWS SDK v2 (#1)

Signed-off-by: Roshan Patil <patilroshan443@gmail.com>

* Fixes PR comments

Signed-off-by: Roshan Patil <patilroshan443@gmail.com>

* Resolved PR comments

Signed-off-by: Roshan Patil <patilroshan443@gmail.com>

* Fix PR comments

Signed-off-by: Roshan Patil <patilroshan443@gmail.com>
2022-07-19 19:21:38 -04:00
Yoan Blanc
b145118787
feat: replace go-kit/kit with go-kit/log (#479)
* feat: replace go-kit/kit with go-kit/log

Signed-off-by: Yoan Blanc <yblanc@edgelab.ch>

* fixup! feat: replace go-kit/kit with go-kit/log

Signed-off-by: Yoan Blanc <yblanc@edgelab.ch>

* fixup! fixup! feat: replace go-kit/kit with go-kit/log

Signed-off-by: Yoan Blanc <yblanc@edgelab.ch>
2021-10-04 08:59:14 -04:00
Carlos Alexandro Becker
a85dfc7f69
refactor: use json.Unmarshal instead of Decode (#316)
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2021-06-09 09:51:44 -03:00
Joe Adams
958502fe7e Fix one more unsynchronized read in test
Signed-off-by: Joe Adams <github@joeadams.io>
2021-06-02 22:58:16 -04:00
Joe Adams
8ddc6e6468 fix(test): resolve test race conditions
Fix a race condition in pkg/clusterinfo mockConsumer by protecting the data with a mutex. This resolves the issue where `make` fails to complete the build and tests.

Signed-off-by: Joe Adams <github@joeadams.io>
2021-06-02 10:01:30 -04:00
SuperQ
443ba8ff1f
Add license headers.
Signed-off-by: SuperQ <superq@gmail.com>
2021-05-30 11:20:14 +02:00
Christoph Oelmüller
94988034cb fix racy test 2019-08-28 10:26:50 +02:00
Andy Bursavich
bd1e266926 Remove credentials from URL in clusterinfo metrics 2019-07-10 15:59:17 +02:00
Christoph Oelmüller
ce4ef3ee17 fix clusterinfo_test after handling build date as string 2019-05-16 10:07:58 +02:00
Christoph Oelmüller
70a5654c04 handle clusterinfo.Version.BuildDate as string 2019-05-15 18:53:31 +02:00
Christoph Oelmüller
ca8d640837 parse clusterinfo.build_date as string, not time.Time. It's not evaluated as time anyways 2019-05-15 18:53:31 +02:00
Christoph Oelmüller
55790a80b1 remove unneeded debug line 2019-02-27 12:46:39 +01:00
Christoph Oelmüller
0b54cae5d7 linting 2019-02-27 12:46:39 +01:00
Christoph Oelmüller
5420159c4b linting 2019-02-27 12:46:39 +01:00
Christoph Oelmüller
474f3bd8ae rework clusterinfo startup mechanism 2019-02-27 12:46:39 +01:00
Christoph Oelmüller
35a888fb40 use cluster info retriever in main and add it to prometheus registry 2019-02-27 12:46:39 +01:00
Christoph Oelmüller
d9ac53af49 rework initial cluster info call again 2019-02-27 12:46:39 +01:00
Christoph Oelmüller
cf0d38f57e simplify initial block mechanism 2019-02-27 12:46:39 +01:00
Christoph Oelmüller
4772d87be3 block run until the first cluster info call was successful 2019-02-27 12:46:39 +01:00
Christoph Oelmüller
ceb4f6ffd5 initialize cluster info metrics 2019-02-27 12:46:39 +01:00
Christoph Oelmüller
69913a7080 add instrumentation to clusterinfo retriever 2019-02-27 12:46:39 +01:00
marthjod@gmail.com
f62dae90f8 minor test improvements 2019-02-27 12:46:39 +01:00
marthjod@gmail.com
00f13146dd range over channel (megacheck) 2019-02-27 12:46:39 +01:00
marthjod@gmail.com
44934f04c2 comply with errcheck 2019-02-27 12:46:39 +01:00
marthjod@gmail.com
6d45899e0a lint fixes 2019-02-27 12:46:39 +01:00
Christoph Oelmüller
31685082b4 work in progress: add cluster label retriever 2019-02-27 12:46:39 +01:00