Skip to content

Add request response logging and execution context#44

Merged
ognjenkatic merged 8 commits into
masterfrom
feat/master/performance-metrics
Sep 7, 2022
Merged

Add request response logging and execution context#44
ognjenkatic merged 8 commits into
masterfrom
feat/master/performance-metrics

Conversation

@ognjenkatic

Copy link
Copy Markdown
Collaborator

This PR adds a method to the workflow engine execution manager which adds request and response logging. The logging behavior logs request and response models, execution time, and execution context.
The execution context contains workflow id, name as well as task i and name. It should help us with filtering logs.

@ognjenkatic ognjenkatic requested a review from boma96 September 4, 2022 19:45
Comment thread src/ConductorSharp.Engine/Util/ConductorSharpExecutionContext.cs Outdated
Comment thread src/ConductorSharp.Engine/Behaviors/RequestResponseLoggingBehavior.cs Outdated
@ognjenkatic ognjenkatic requested a review from boma96 September 5, 2022 07:35
Comment thread src/ConductorSharp.Engine/Extensions/WorkflowEngineBuilder.cs Outdated
@ognjenkatic ognjenkatic requested a review from boma96 September 6, 2022 21:15
@ognjenkatic

Copy link
Copy Markdown
Collaborator Author

Added a pipeline builder, the ordering can still be bypassed with direct registrations. I would like to maybe disable this in the future and force all pipeline registrations through this method somehow.

builder.AddConductorSharp(
              baseUrl: configuration.GetValue<string>("Conductor:BaseUrl"),
              apiPath: configuration.GetValue<string>("Conductor:ApiUrl"),
              preventErrorOnBadRequest: configuration.GetValue<bool>("Conductor:PreventErrorOnBadRequest")
          )
          .AddExecutionManager(
              maxConcurrentWorkers: configuration.GetValue<int>("Conductor:MaxConcurrentWorkers"),
              sleepInterval: configuration.GetValue<int>("Conductor:SleepInterval"),
              longPollInterval: configuration.GetValue<int>("Conductor:LongPollInterval"),
              domain: configuration.GetValue<string>("Conductor:WorkerDomain")
          )
          .AddPipelines(pipelines =>
          {
              pipelines.AddRequestResponseLogging();
              pipelines.AddValidation();
          });

The old way is still supported, but will report a warning that the method has been deprecated

/// <summary>
        /// This method is deprecated. Use AddConductorSharp method instead. WARNING: AddExecutionManager method will change when you move to AddConductorSharp,
        /// it will no longer register validation pipeline by default, and you will have to do it manually using the AddPipelines method. Check
        /// <see href="https://github.com/codaxy/conductor-sharp/blob/master/examples/ConductorSharp.ApiEnabled/Extensions/HostConfiguration.cs">example</see>.
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="baseUrl"></param>
        /// <param name="apiPath"></param>
        /// <param name="preventErrorOnBadRequest"></param>
        /// <param name="createClient"></param>
        /// <returns></returns>
        [Obsolete("Use AddConductorSharp method instead")]
        public static IWorkflowEngineBuilder AddWorkflowEngine(

@ognjenkatic ognjenkatic merged commit 17c3bb6 into master Sep 7, 2022
@ognjenkatic ognjenkatic deleted the feat/master/performance-metrics branch September 7, 2022 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants