Commit graph

82 commits

Author SHA1 Message Date
Oleksandr Redko f10c3454e9 Enable perfsprint linter and fix up code
Signed-off-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
2024-05-15 17:51:05 +03:00
Bryan Boreham c6a42f8891
Merge pull request #13741 from bboreham/azure-test-labels
Azure Discovery tests: Add test for mapping VMs to labels
2024-03-27 11:36:17 +01:00
Jan-Otto Kröpke 302e151de8
{discovery,remote_write}/azure: Support default SDK authentication (#13099)
* discovery/azure: Offer default SDK authentication

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
2024-03-16 11:06:57 +00:00
Bryan Boreham ab9c544ec7 Azure Discovery tests: Add test for VMToLabelSet
Test fails due to bug in code on main.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-12 15:04:09 +00:00
Bryan Boreham 5f2c0c5283 Azure Discovery tests: mock the azure client interface
Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-12 15:04:09 +00:00
Bryan Boreham 4e24e5b1d1 Refactor: Azure Discovery: introduce an interface for the client
So we can mock it.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-12 15:04:09 +00:00
Bryan Boreham b8d428b753 Refactor: Azure Discovery: extract function to generate labelSet
This should make it easier to test.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2024-03-12 15:04:04 +00:00
michaelact eea6ab1cdd
[BUGFIX] Azure SD: Fix 'error: parameter virtualMachineScaleSetName cannot be empty' (#13702)
Erroneous code was introduced during a merge-back-to-main at #13399.

Signed-off-by: michaelact <86778470+michaelact@users.noreply.github.com>
2024-03-08 15:19:39 +00:00
Darshan Chaudhary 0e8a2e44a4
Azure SD: check for nil before accessing and dereferencing (#13578)
Signed-off-by: darshanime <deathbullet@gmail.com>
2024-02-14 17:59:01 +01:00
Paulin Todev 78411d5e8b
SD Managers taking over responsibility for registration of debug metrics (#13375)
SD Managers take over responsibility for SD metrics registration

---------

Signed-off-by: Paulin Todev <paulin.todev@gmail.com>
Signed-off-by: Björn Rabenstein <github@rabenste.in>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2024-01-23 16:53:55 +01:00
Bartlomiej Plotka db3544c552
Merge branch 'main' into merge-2.49.0-back
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
2024-01-15 12:38:36 +01:00
daniel-resdiary d79ad810aa Get VM Scale Set NIC (#13283)
Calling `*armnetwork.InterfacesClient.Get()` doesn't work for Scale Set
VM NIC, because these use a different Resource ID format.

Use `*armnetwork.InterfacesClient.GetVirtualMachineScaleSetNetworkInterface()`
instead.  This needs both the scale set name and the instance ID, so
add an `InstanceID` field to the `virtualMachine` struct.  `InstanceID`
is empty for a VM that isn't a ScaleSetVM.

Signed-off-by: Daniel Nicholls <daniel.nicholls@resdiary.com>
2023-12-19 19:20:02 +00:00
Julien Pivotto 5d5303c746
Merge pull request #13285 from daniel-resdiary/DedupGetNic
Dedup code handling getting network interface
2023-12-18 15:27:18 +01:00
Matthieu MOREL 952cb41373 build(deps): bump github.com/Azure/azure-sdk-for-go/sdk/resourcemanager
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-12-15 10:25:07 +00:00
Daniel Nicholls 0704c72548 Dedup code handling getting network interface
Signed-off-by: Daniel Nicholls <daniel.nicholls@resdiary.com>
2023-12-13 14:14:01 +00:00
daniel-resdiary 103133124a
Get VM Scale Set NIC (#13283)
Calling `*armnetwork.InterfacesClient.Get()` doesn't work for Scale Set
VM NIC, because these use a different Resource ID format.

Use `*armnetwork.InterfacesClient.GetVirtualMachineScaleSetNetworkInterface()`
instead.  This needs both the scale set name and the instance ID, so
add an `InstanceID` field to the `virtualMachine` struct.  `InstanceID`
is empty for a VM that isn't a ScaleSetVM.

Signed-off-by: Daniel Nicholls <daniel.nicholls@resdiary.com>
2023-12-13 12:38:16 +00:00
Paulin Todev 6de80d7fb0
Allow non-default registry to be used for metrics of SD components
Signed-off-by: Paulin Todev <paulin.todev@gmail.com>
2023-12-11 11:14:26 +00:00
Gavin Lam d5924f305b
Fix missing public IP addresses in Azure service discovery (#13241)
Fixes #5588, #9293

Signed-off-by: Gavin Lam <gavin.oss@tutamail.com>
2023-12-07 11:42:14 +00:00
Matthieu MOREL 9c4782f1cc
golangci-lint: enable testifylint linter (#13254)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-12-07 11:35:01 +00:00
Charles Korn 2329fba0e5
Fix linting issues in comments (#13178)
Signed-off-by: Charles Korn <charles.korn@grafana.com>
2023-11-23 09:07:23 +00:00
Etourneau Gwenn b37258c99b
Added Caching of network interface for Azure (#12622)
* Added Caching of network interface for Azure

Signed-off-by: Etourneau Gwenn <getourneau@yugabyte.com>

* Rename Counter for Azure cache

Signed-off-by: Etourneau Gwenn <getourneau@yugabyte.com>

* Format with goimports

Signed-off-by: Etourneau Gwenn <getourneau@yugabyte.com>

* Updated duration comparaison
Enabled cache by default with 5x the default refresh time

Signed-off-by: Etourneau Gwenn <getourneau@yugabyte.com>

* Change random function

Signed-off-by: Etourneau Gwenn <getourneau@yugabyte.com>

* Remove refresh interval

Signed-off-by: Etourneau Gwenn <getourneau@yugabyte.com>

* Remove from config as well

Signed-off-by: Etourneau Gwenn <getourneau@yugabyte.com>

* Reformat config_test
Removed uneeded error

Signed-off-by: Etourneau Gwenn <getourneau@yugabyte.com>

---------

Signed-off-by: Etourneau Gwenn <getourneau@yugabyte.com>
2023-11-21 11:59:17 +00:00
Oleksandr Redko fa90ca46e5 ci(lint): enable godot; append dot at the end of comments
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2023-10-31 19:53:38 +02:00
Matthieu MOREL bbdc7d5902 Update Azure SDK For Go
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-10-14 03:39:31 +00:00
Jayapriya Pai e44d5dfb3a
AZURE SD: Validate HTTP config
Related-to #12810

Signed-off-by: Jayapriya Pai <janantha@redhat.com>
2023-09-08 13:10:31 +05:30
David Fridman 52adf55631
Add VM size label to azure service discovery (#11575) (#11650)
* Add VM size label to azure service discovery (#11575)

Signed-off-by: davidifr <davidfr.mail@gmail.com>

* Add VM size label to azure service discovery (#11575)

Signed-off-by: davidifr <davidfr.mail@gmail.com>

* Add VM size label to azure service discovery (#11575)

Signed-off-by: davidifr <davidfr.mail@gmail.com>

Signed-off-by: davidifr <davidfr.mail@gmail.com>
2022-12-16 13:14:35 -05:00
Matthieu MOREL f43749e82f
refactor (discovery): move from github.com/pkg/errors to 'errors' and 'fmt' (#10807)
Signed-off-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>

Co-authored-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
2022-06-03 13:47:14 +02:00
David N Perkins ed0c68224e
Azure SD Failure metric and 404 Handling (#10476)
* For Azure sd, added failure counter and skipping of 404's from Nic lookup

Signed-off-by: David N Perkins <David.N.Perkins@ibm.com>
2022-03-31 14:50:17 +02:00
David N Perkins b13aec9167
Merge pull request #10365 from David-N-Perkins/azure-resource-group-filter
Azure Service Discovery resource group filter
2022-03-29 01:21:23 +02:00
Julien Pivotto b0d70557b7
Merge pull request #10285 from prometheus/release-2.33 2022-02-12 00:02:24 +01:00
Julien Pivotto 002ceb7232 Fix panic in Azure SD when no public interface is set.
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2022-02-11 21:25:45 +01:00
Levi Harrison 1b3443ede1
Azure: Fix panic when IP Address isn't set (#10280) 2022-02-11 00:31:18 +01:00
Julien Pivotto 18d737de3e
Azure SD: Set Prometheus user agent (#10209)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2022-01-28 13:36:04 +01:00
Mateusz Gozdek 1a6c2283a3 Format Go source files using 'gofumpt -w -s -extra'
Part of #9557

Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
2021-11-02 19:52:34 +01:00
Levi Harrison 89a6ebd799
Add common HTTP client to Azure SD (#9267)
* Add `proxy_url` option to Azure SD

Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-10-20 23:09:58 +02:00
Julien Pivotto 1681a8d539
Azure: Fix panic when no computername is set (#9387)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-09-25 00:30:18 +02:00
darshanime 898afa2fd9 Add nil checks
Signed-off-by: darshanime <deathbullet@gmail.com>
2021-07-28 19:23:17 +05:30
darshanime c8a2ffdb72 Add computer name to azure sd
Signed-off-by: darshanime <deathbullet@gmail.com>
2021-07-25 22:07:44 +05:30
Levi Harrison b5f6f8fb36 Switched to go-kit/log
Signed-off-by: Levi Harrison <git@leviharrison.dev>
2021-06-11 12:28:36 -04:00
code1305 9c705ffdfb err fix if target creation fails
return right error if any target creation fails. Need to wrap the right error.

Signed-off-by: Anshul <anshulkhandelwal.nitj@gmail.com>
2021-04-16 20:37:52 +05:30
Julien Pivotto 6c56a1faaa
Testify: move to require (#8122)
* Testify: move to require

Moving testify to require to fail tests early in case of errors.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

* More moves

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-10-29 09:43:23 +00:00
Julien Pivotto 4e5b1722b3
Move away from testutil, refactor imports (#8087)
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-10-22 11:00:08 +02:00
Andy Bursavich 4e6a94a27d
Invert service discovery dependencies (#7701)
This also fixes a bug in query_log_file, which now is relative to the config file like all other paths.

Signed-off-by: Andy Bursavich <abursavich@gmail.com>
2020-08-20 13:48:26 +01:00
Julien Pivotto e76c436e9c
Goleak in discoveries, scrape, rules (#7662)
* Add go leak tests for discoveries with goroutines

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

* Add go leak tests in rules

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

* Add go leak tests in scrape tests

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-07-27 09:38:08 +01:00
Hu Shuai a94b570dc6
Add a unit test for newAzureResourceFromID in discovery/azure/azure.go. (#7484)
This PR is about adding a unit test for newAzureResourceFromID in discovery/azure/azure.go.

Signed-off-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
2020-06-30 11:11:57 +01:00
Guangming Wang 5b4006ac86
cleanup: remove unnacessary nil check before range (#7194)
Signed-off-by: Guangming Wang <guangming.wang@daocloud.io>
2020-05-02 07:25:44 +01:00
Dmitry Shmulevich d81df5609d fix nil pointer dereference in azure discovery (#5587)
Signed-off-by: Dmitry Shmulevich <dmitry.shmulevich@sysdig.com>
2019-05-21 20:03:24 +01:00
EarthmanT 35be8c9e25 Add azure public ip label (#5475)
* Update Azure SD Config with Public IP label

Signed-off-by: earthmant <trammell@cloudify.co>
2019-04-17 16:05:44 +01:00
Tariq Ibrahim 8fdfa8abea refine error handling in prometheus (#5388)
i) Uses the more idiomatic Wrap and Wrapf methods for creating nested errors.
ii) Fixes some incorrect usages of fmt.Errorf where the error messages don't have any formatting directives.
iii) Does away with the use of fmt package for errors in favour of pkg/errors

Signed-off-by: tariqibrahim <tariq181290@gmail.com>
2019-03-26 00:01:12 +01:00
Simon Pasquier 782d00059a
discovery: factorize for SD based on refresh (#5381)
* discovery: factorize for SD based on refresh

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* discovery: use common metrics for refresh

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-03-25 11:54:22 +01:00
Tariq Ibrahim 0d7104b7eb discovery/azure:optimize iteration logic for VMScalesets, VMScalesetVMs, and VMs (#5363)
Signed-off-by: tariqibrahim <tariq181290@gmail.com>
2019-03-20 09:03:47 +00:00