-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make HealthCheck compatible with ALV (#884)
* Make HealthCheck compatible with ALV * Add Unit Test for V3 Health conversion
- Loading branch information
Showing
12 changed files
with
105 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/Management/src/EndpointBase/Health/HealthConverterV3.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Steeltoe.Management.Endpoint.Health | ||
{ | ||
public class HealthConverterV3 : JsonConverter<HealthEndpointResponse> | ||
{ | ||
public override HealthEndpointResponse Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override void Write(Utf8JsonWriter writer, HealthEndpointResponse value, JsonSerializerOptions options) | ||
{ | ||
writer.WriteStartObject(); | ||
if (value is { } health) | ||
{ | ||
writer.WriteString("status", health.Status.ToString()); | ||
if (!string.IsNullOrEmpty(health.Description)) | ||
{ | ||
writer.WriteString("description", health.Description); | ||
} | ||
|
||
if (health.Details != null && health.Details.Count > 0) | ||
{ | ||
writer.WritePropertyName("components"); | ||
writer.WriteStartObject(); | ||
foreach (var detail in health.Details) | ||
{ | ||
writer.WritePropertyName(detail.Key); | ||
JsonSerializer.Serialize(writer, detail.Value, options); | ||
} | ||
|
||
writer.WriteEndObject(); | ||
} | ||
} | ||
|
||
writer.WriteEndObject(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ namespace Steeltoe.Management.Endpoint | |
public enum MediaTypeVersion | ||
{ | ||
V1, | ||
V2 | ||
V2, | ||
V3 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
src/Management/test/OpenTelemetry.Test/Steeltoe.OpenTelemetry.Test.csproj
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters