Skip to content

Commit 4f8e9a4

Browse files
committed
Add lavinmq version and extra connection requirement
1 parent 87cae8b commit 4f8e9a4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ServiceControl.Transports.RabbitMQ/RabbitMQQuery.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace ServiceControl.Transports.RabbitMQ;
77
using System.Linq;
88
using System.Net;
99
using System.Net.Http;
10+
using System.Net.Http.Headers;
1011
using System.Net.Http.Json;
1112
using System.Runtime.CompilerServices;
1213
using System.Text.Json;
@@ -93,6 +94,8 @@ protected override void InitializeCore(ReadOnlyDictionary<string, string> settin
9394
// so for now we are using a virtual method that can be overriden in tests
9495
// https://github.com/Particular/ServiceControl/issues/4493
9596
httpClient = CreateHttpClient(defaultCredential, apiUrl);
97+
var authToken = Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes($"{username}:{password}"));
98+
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authToken);
9699
}
97100
}
98101

@@ -154,7 +157,7 @@ public override async IAsyncEnumerable<QueueThroughput> GetThroughputPerDay(IBro
154157
throw new Exception("The RabbitMQ broker is configured with 'management.disable_stats = true' or 'management_agent.disable_metrics_collector = true' and as a result queue statistics cannot be collected using this tool. Consider changing the configuration of the RabbitMQ broker.");
155158
}
156159

157-
var rabbitVersion = obj["rabbitmq_version"] ?? obj["product_version"];
160+
var rabbitVersion = obj["rabbitmq_version"] ?? obj["product_version"] ?? obj["lavinmq_version"];
158161
var mgmtVersion = obj["management_version"];
159162

160163
return (rabbitVersion?.GetValue<string>() ?? "Unknown", mgmtVersion?.GetValue<string>() ?? "Unknown");

0 commit comments

Comments
 (0)