Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/ServiceControl.Transports.RabbitMQ/RabbitMQQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace ServiceControl.Transports.RabbitMQ;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Runtime.CompilerServices;
using System.Text.Json;
Expand Down Expand Up @@ -93,6 +94,8 @@ protected override void InitializeCore(ReadOnlyDictionary<string, string> settin
// so for now we are using a virtual method that can be overriden in tests
// https://github.com/Particular/ServiceControl/issues/4493
httpClient = CreateHttpClient(defaultCredential, apiUrl);
var authToken = Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes($"{username}:{password}"));
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authToken);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This sends the credentials in plain text which is not what we want and we would want to change this.

Using PreAuthenticate = true, on the httpclient instead of setting this header directly does not work.

}
}

Expand Down Expand Up @@ -154,7 +157,7 @@ public override async IAsyncEnumerable<QueueThroughput> GetThroughputPerDay(IBro
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.");
}

var rabbitVersion = obj["rabbitmq_version"] ?? obj["product_version"];
var rabbitVersion = obj["rabbitmq_version"] ?? obj["product_version"] ?? obj["lavinmq_version"];
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this report the LavinMQ version number as the RabbitMQ version in the broker metadata?

I'm not sure that's what we want to do. Shouldn't we identify it's actually LavinMQ and not RabbitMQ somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At this stage - this is just a spike. It is all "wrong" as the transport is rabbitmq and all docs etc, including SP display will say rabbitmq

var mgmtVersion = obj["management_version"];

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