-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Management new #705
Draft
woksin
wants to merge
66
commits into
master
Choose a base branch
from
management-new
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Management new #705
Changes from 64 commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
a80bd7b
Scaffolded React frontend with FluentUI
einari 8d14f5b
Up and running with basics of HotChocolate GraphQL
einari 9ba411e
Up and running with Apollo Client
einari 7171e7a
Cleanup
einari e3e31db
Layout up and running
einari 1d40636
Adding test data
einari 7bf6150
Changing foldername to layouts
einari 564bb11
Start of showing event handlers
einari d1a4d92
Testing out shimmering
einari 7314eec
Cleanup
einari 101349c
Merge branch 'eventhandler-service-ping-improvement' into management
einari 159c280
Change folder + up and running with tenancy
einari 2107d67
Basics up and running - event handlers + tenancy
einari 56487fb
Getting ready for some metrics
einari 1d1292d
Added ability to get a nicer view of the metrics
einari e35caf8
Added refresh button
einari 10387ae
Refactor: don't cancel the source within the handler, let it be cance…
einari f36d575
Adding XML Doc
einari bab7278
Changing from Func<> to FactoryFor<> to give a better indication of w…
einari f94d762
Changing to FactoryFor
einari cd92f72
Removing semaphore
einari 79c7a72
Using factory to create pinged connection
einari e69196a
Putting in sample of remote debugging
einari 1a432a2
Merge branch '6.0.0-timeout' into management
einari 3825504
Introducing a simple way of keeping track of event handlers for typic…
einari 26cd88d
Exposing current state as read only
einari 3029fda
Adding a way to get underlying abstract scoped stream processor for a…
einari 830dcd6
Exposing functionality for reading event store tail position
einari 7f1d182
Removing "old" uery
einari 929f154
Adding reference to events processing
einari 4caeaf8
Ignore enforcing of having to implement oldschool Exception constructors
einari c61c90e
Hooking up so tha twe get real event handlers output
einari bc3dce4
Displaying the correct properties + adding refresh
einari 4794f6f
Changing default dev to port 5000
einari 5809793
Removing - as these are now in the Web project
einari 4e85ed3
Adding wwwroot for ignore
einari b7e9e2e
Adding support for default files
einari 0aa2fe6
Putting in Management Web UI
einari fe05cca
Adding a simple proxy route to be used with our metrics
einari 79acbb7
Adding middleware that makes deeplinking work into the SPA
einari 24cb438
Update Source/Server/ProxyServerMiddleware.cs
einari 96a007f
Xml Comments
einari 61cafe3
Less eager Test Explorer (not draining the CPU on startup)
einari 654c64a
Putting the version numbers into versions.props
einari f62d413
Show actual tail number correctly, which is count - 1
einari 8826f81
Upgrading to latest Prometheus and leveraging their new AspNet endpoing
einari 177c73e
Update Source/Management.GraphQL/Management.GraphQL.csproj
einari db42923
Update Source/Management.Web/eventHandlers/EventHandlersOverview.tsx
einari e74b604
Update Source/Management.WebAPI/Management.WebAPI.csproj
einari d112790
Taking out remote debugging config
einari 0045ea6
Merge branch 'management' of github.com:dolittle-runtime/Runtime into…
einari 90e9ccb
Refactoring - splitting responsibilities
einari 67189b9
Disposing the event handler when exiting the service
einari ee45ed1
Moving Dispose to unregister
einari 2f7143a
Simplifying backend for event handlers- get for all tenants, filter i…
einari 74d5837
XML Docs
einari 3d4d886
Cleanup
einari 0aca585
XML Docs
einari 18b0245
Changing route to something that makes more sense
einari 696ec72
Fixing proxy config - its all on 5000 now
einari e27546a
Merge branch '6.0.0-timeout' of github.com:dolittle-runtime/Runtime i…
einari 6593c35
Merge branch '6.0.0-timeout' into management
einari 0d617dc
Merge branch 'master' of github.com:dolittle/Runtime into management
woksin 4f2dfb3
Merge branch 'master' of github.com:dolittle/Runtime into management-new
woksin 0f56a76
Delete RuntimeEnvironment.cs
woksin b6cdb70
Update Source/Events.Processing/EventHandlers/EventHandler.cs
woksin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ Benchmarks | |
Diagrams | ||
.vscode | ||
**/node_modules | ||
**/wwwroot | ||
.github |
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
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,29 @@ | ||
// Copyright (c) Dolittle. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Dolittle.Runtime.Management.GraphQL.EventHandlers | ||
{ | ||
/// <summary> | ||
/// Represents an event handler and its current state. | ||
/// </summary> | ||
public class EventHandler | ||
{ | ||
/// <summary> | ||
/// Gets the unique identifier of the <see cref="EventHandler"/> | ||
/// </summary> | ||
public Guid Id { get; set; } | ||
|
||
/// <summary> | ||
/// Gets the scope the unique handler works on. | ||
/// </summary> | ||
public Guid Scope { get; set; } | ||
|
||
/// <summary> | ||
/// Gets the collection of <see cref="EventHandlerStatusPerTenant">statuses per tenant</see>. | ||
/// </summary> | ||
public IEnumerable<EventHandlerStatusForTenant> StatusPerTenant { get; set; } | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
Source/Management.GraphQL/EventHandlers/EventHandlerStatusForTenant.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,33 @@ | ||
// Copyright (c) Dolittle. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
|
||
namespace Dolittle.Runtime.Management.GraphQL.EventHandlers | ||
{ | ||
/// <summary> | ||
/// Represents the status for a specific <see cref="EventHandler"/> for a specific tenant. | ||
/// </summary> | ||
public class EventHandlerStatusForTenant | ||
{ | ||
/// <summary> | ||
/// Gets or sets the identifier of the tenant. | ||
/// </summary> | ||
public Guid TenantId { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the last committed event sequence number. | ||
/// </summary> | ||
public int LastCommittedEventSequenceNumber { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the filter position. | ||
/// </summary> | ||
public int FilterPosition { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the vent processor position. | ||
/// </summary> | ||
public int EventProcessorPosition { get; set; } | ||
} | ||
} |
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,81 @@ | ||
// Copyright (c) Dolittle. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Dolittle.Runtime.ApplicationModel; | ||
using Dolittle.Runtime.DependencyInversion; | ||
using Dolittle.Runtime.Events.Processing.EventHandlers; | ||
using Dolittle.Runtime.Events.Store; | ||
using Dolittle.Runtime.Execution; | ||
using Dolittle.Runtime.Tenancy; | ||
|
||
namespace Dolittle.Runtime.Management.GraphQL.EventHandlers | ||
{ | ||
/// <summary> | ||
/// Represents an API endpoint for working with event handlers. | ||
/// </summary> | ||
public class EventHandlers | ||
{ | ||
readonly IEventHandlers _eventHandlers; | ||
readonly IExecutionContextManager _executionContextManager; | ||
readonly IContainer _container; | ||
readonly ITenants _tenants; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of <see cref="EventHandlers"/>. | ||
/// </summary> | ||
/// <param name="eventHandlers">The runtime <see cref="IEventHandlers"/>.</param> | ||
/// <param name="executionContextManager">The <see cref="IExecutionContextManager"/> for working with execution context.</param> | ||
/// <param name="container">The <see cref="IContainer"/> for service location.</param> | ||
/// <param name="tenants">The <see cref="ITenants"/> of the runtime.</param> | ||
public EventHandlers( | ||
IEventHandlers eventHandlers, | ||
IExecutionContextManager executionContextManager, | ||
IContainer container, | ||
ITenants tenants) | ||
{ | ||
_eventHandlers = eventHandlers; | ||
_executionContextManager = executionContextManager; | ||
_container = container; | ||
_tenants = tenants; | ||
} | ||
|
||
/// <summary> | ||
/// Get all event handlers and their statuses. | ||
/// </summary> | ||
public async Task<IEnumerable<EventHandler>> All() | ||
{ | ||
var lastCommittedEventSequenceNumberPerTenant = new Dictionary<TenantId, EventLogSequenceNumber>(); | ||
|
||
var tasks = _tenants.All.Select(async tenant => | ||
{ | ||
_executionContextManager.CurrentFor(Microservice.NotSet, tenant); | ||
var eventStore = _container.Get<FactoryFor<IEventStore>>()(); | ||
lastCommittedEventSequenceNumberPerTenant[tenant] = await eventStore.GetLastCommittedEventSequenceNumber().ConfigureAwait(false); | ||
}); | ||
await Task.WhenAll(tasks).ConfigureAwait(false); | ||
|
||
return _eventHandlers.All.Select(_ => | ||
{ | ||
var query = from filter in _.FilterStreamProcessor.StreamProcessorsPerTenant | ||
join eventProcessor in _.EventProcessorStreamProcessor.StreamProcessorsPerTenant on filter.Key equals eventProcessor.Key | ||
select new EventHandlerStatusForTenant | ||
{ | ||
TenantId = filter.Key, | ||
LastCommittedEventSequenceNumber = (int)lastCommittedEventSequenceNumberPerTenant[filter.Key].Value, | ||
FilterPosition = (int)filter.Value.CurrentState.Position.Value, | ||
EventProcessorPosition = (int)eventProcessor.Value.CurrentState.Position.Value | ||
}; | ||
|
||
return new EventHandler | ||
{ | ||
Id = _.EventProcessor, | ||
Scope = _.Scope, | ||
StatusPerTenant = query.ToArray() | ||
}; | ||
}); | ||
} | ||
} | ||
} |
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,29 @@ | ||
// Copyright (c) Dolittle. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using HotChocolate.Execution.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Dolittle.Runtime.Management.GraphQL | ||
{ | ||
/// <summary> | ||
/// Represents extension methods for working with exposing the GraphQL endpoints for management. | ||
/// </summary> | ||
public static class GraphQLEndpoints | ||
{ | ||
/// <summary> | ||
/// Adds the GraphQL API for management to the HotChocolate GraphQL builder. | ||
/// </summary> | ||
/// <param name="graphQLBuilder"><see cref="IRequestExecutorBuilder"/> to add to.</param> | ||
/// <returns><see cref="IRequestExecutorBuilder"/> for continuation.</returns> | ||
public static IRequestExecutorBuilder AddManagementAPI(this IRequestExecutorBuilder graphQLBuilder) | ||
{ | ||
graphQLBuilder.AddQueryType(_ => _ | ||
.Name("Query") | ||
.AddSubObject<EventHandlers.EventHandlers>("eventHandlers") | ||
.AddSubObject<Tenancy.Tenants>("tenancy") | ||
); | ||
return graphQLBuilder; | ||
} | ||
} | ||
} |
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,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Import Project="../../default.props"/> | ||
|
||
<PropertyGroup> | ||
<AssemblyName>Dolittle.Runtime.Management.GraphQL</AssemblyName> | ||
<RootNamespace>Dolittle.Runtime.Management.GraphQL</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="HotChocolate.AspNetCore" Version="$(HotChocolateVersion)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="../Tenancy/Tenancy.csproj"/> | ||
<ProjectReference Include="../Events.Processing/Events.Processing.csproj"/> | ||
</ItemGroup> | ||
|
||
</Project> |
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,30 @@ | ||
// Copyright (c) Dolittle. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using HotChocolate.Types; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Dolittle.Runtime.Management.GraphQL | ||
{ | ||
/// <summary> | ||
/// Extension methods for <see cref="IObjectTypeDescriptor"/> and fields. | ||
/// </summary> | ||
public static class ObjectFieldExtensions | ||
{ | ||
public static IServiceProvider ServiceProvider { get; set; } | ||
|
||
/// <summary> | ||
/// Add a sub field on a type, such as a Query / Mutation root object with a given name that will resolve to the given type. | ||
/// </summary> | ||
/// <param name="parent">Parent type (Query/Mutation).</param> | ||
/// <param name="name">Name of the field.</param> | ||
/// <typeparam name="T">Type that the field should resolve to.</typeparam> | ||
/// <returns><see cref="IObjectTypeDescriptor"/> for continuation.</returns> | ||
public static IObjectTypeDescriptor AddSubObject<T>(this IObjectTypeDescriptor parent, string name) | ||
{ | ||
parent.Field(name).Type(typeof(EventHandlers.EventHandlers)).Resolve(_ => ServiceProvider.GetService<T>()); | ||
return parent; | ||
} | ||
} | ||
} |
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,32 @@ | ||
// Copyright (c) Dolittle. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Dolittle.Runtime.Tenancy; | ||
|
||
namespace Dolittle.Runtime.Management.GraphQL.Tenancy | ||
{ | ||
/// <summary> | ||
/// Represents an API for getting all tenants. | ||
/// </summary> | ||
public class Tenants | ||
{ | ||
readonly ITenants _tenants; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of <see cref="Tenants"/>. | ||
/// </summary> | ||
/// <param name="tenants">The runtime <see cref="ITenants"/>.</param> | ||
public Tenants(ITenants tenants) | ||
{ | ||
_tenants = tenants; | ||
} | ||
|
||
/// <summary> | ||
/// Gets all the tenants registered with the runtime. | ||
/// </summary> | ||
public IEnumerable<Guid> All() => _tenants.All.Select(_ => _.Value); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.