Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
03cc0d6
squash: starting
lholmquist Nov 12, 2025
2052ffa
squash: more things
lholmquist Nov 12, 2025
d964d88
squash: sort of works?
lholmquist Nov 14, 2025
179a77a
squash: working but needs tests and cleanup
lholmquist Nov 17, 2025
2ecef35
squash: making things prettier
lholmquist Nov 17, 2025
928831d
squash: api generate
lholmquist Nov 17, 2025
399d178
squash: api docs
lholmquist Nov 17, 2025
6820ac5
squash: syncing
lholmquist Nov 18, 2025
81fc68c
squash: .
lholmquist Nov 19, 2025
a96ed2c
squash: trying this out
lholmquist Nov 19, 2025
f2deb60
squash: updating the yan.lock
lholmquist Dec 3, 2025
3bbed50
squash: starting testing - LokiProvider
lholmquist Dec 5, 2025
2033a5e
squash: starting testing - LokiProvider
lholmquist Dec 5, 2025
1f324e0
squash: remove unneeded file
lholmquist Dec 5, 2025
7af1c22
squash: update yarn lock after rebase
lholmquist Jan 5, 2026
2182500
squash: adding return value in reduce should help?
lholmquist Jan 5, 2026
cddd72e
squash: use a flatmap instead?
lholmquist Jan 5, 2026
9ecf297
squash: using flatmap
lholmquist Jan 5, 2026
0f441fb
squash: add use of custom selectors in the appconfig
lholmquist Jan 6, 2026
8f76056
squash: cleanup
lholmquist Jan 6, 2026
dfd8270
squash: update readme for loki provider
lholmquist Jan 6, 2026
a3c45f4
squash: add config definition to the loki module
lholmquist Jan 6, 2026
4e2c8b5
squash: app-config update
lholmquist Jan 6, 2026
d4be6ca
squash: .
lholmquist Jan 6, 2026
54650a1
squash: some cleanup and code dedupe and better error handles
lholmquist Jan 6, 2026
7048c5e
squash: .
lholmquist Jan 6, 2026
bced3b0
squash: fix code style
lholmquist Jan 6, 2026
e36cf0a
squash: adding a changeset
lholmquist Jan 6, 2026
f861b26
squash: update reports
lholmquist Jan 13, 2026
d4cb987
squash: .
lholmquist Jan 13, 2026
b8a33e9
squash: .
lholmquist Jan 14, 2026
36b1def
squash: adding tests
lholmquist Jan 14, 2026
6d2f291
squash: more tests
lholmquist Jan 14, 2026
83039d3
squash: fixing tests
lholmquist Jan 14, 2026
11c8fee
squash: fixes
lholmquist Jan 14, 2026
495ecd2
squash: tests
lholmquist Jan 14, 2026
75b5fd0
squash: update yarn.lock after the rebase
lholmquist Jan 14, 2026
2e34cee
squash: fix tsc errors
lholmquist Jan 14, 2026
f4e3325
squash: fixing resolutions
lholmquist Jan 15, 2026
d8aa1e2
squash: fix issue with starting when we just want the defaults
lholmquist Jan 15, 2026
f4e101c
squash: fix tsc error
lholmquist Jan 15, 2026
5da89ed
squash: Update workspaces/orchestrator/plugins/orchestrator-backend-m…
lholmquist Jan 15, 2026
2d64353
squash: Update workspaces/orchestrator/plugins/orchestrator-backend-m…
lholmquist Jan 15, 2026
beeb16c
squash: spelling changes
lholmquist Jan 15, 2026
b00be99
squash: Update workspaces/orchestrator/plugins/orchestrator-backend/s…
lholmquist Jan 16, 2026
064509e
squash: Update workspaces/orchestrator/plugins/orchestrator-backend-m…
lholmquist Jan 16, 2026
0b97611
squash: Update workspaces/orchestrator/plugins/orchestrator-backend-m…
lholmquist Jan 16, 2026
189201d
squash: Update workspaces/orchestrator/plugins/orchestrator-backend-m…
lholmquist Jan 16, 2026
5e3be73
squash: Update workspaces/orchestrator/plugins/orchestrator-backend-m…
lholmquist Jan 16, 2026
5ea5140
squash: Update workspaces/orchestrator/packages/backend/src/index.ts
lholmquist Jan 16, 2026
3e83f9e
squash: updating yarn.lock after dep updates
lholmquist Jan 16, 2026
28c976f
squash: regenerate report
lholmquist Jan 16, 2026
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
2 changes: 2 additions & 0 deletions .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
sonar.cpd.exclusions=workspaces/*/packages/app/**, workspaces/*/packages/backend/**, workspaces/*/plugins/*test*/**, **/*.test.*, **/translations/*.ts, **/__fixtures__/*, **/playwright.config.ts
sonar.exclusions=workspaces/*/plugins/orchestrator-common/src/generated/**

9 changes: 9 additions & 0 deletions workspaces/orchestrator/.changeset/green-readers-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@red-hat-developer-hub/backstage-plugin-orchestrator-backend-module-loki': major
'@red-hat-developer-hub/backstage-plugin-orchestrator-backend': minor
'@red-hat-developer-hub/backstage-plugin-orchestrator-common': minor
'@red-hat-developer-hub/backstage-plugin-orchestrator-node': major
'@red-hat-developer-hub/backstage-plugin-orchestrator': minor
---

Adding Workflow Logs endpoint. Loki provider added
8 changes: 8 additions & 0 deletions workspaces/orchestrator/app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ catalog:
dynamicPlugins:
frontend: {}
orchestrator:
# Uncomment and configure to use the log viewer
# workflowLogProvider:
# loki:
# baseUrl: http://localhost:3100
# Uncomment if using a custom log stream selector
# logStreamSelectors:
# - label: 'selector'
# value: 'value'
sonataFlowService:
# uncomment the next line to use podman instead of docker
# runtime: podman
Expand Down
3 changes: 2 additions & 1 deletion workspaces/orchestrator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
"react": "^18",
"react-dom": "^18",
"refractor@npm:3.6.0/prismjs": "^1.30.0",
"zod-to-json-schema": "3.24.6"
"zod-to-json-schema": "3.24.6",
"@backstage/backend-plugin-api": "1.5.0"
},
"prettier": "@backstage/cli/config/prettier",
"lint-staged": {
Expand Down
1 change: 1 addition & 0 deletions workspaces/orchestrator/packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@backstage/plugin-signals-backend": "^0.3.10",
"@backstage/plugin-techdocs-backend": "^2.1.2",
"@red-hat-developer-hub/backstage-plugin-orchestrator-backend": "workspace:^",
"@red-hat-developer-hub/backstage-plugin-orchestrator-backend-module-loki": "workspace:^",
"@red-hat-developer-hub/backstage-plugin-scaffolder-backend-module-orchestrator": "workspace:^",
"app": "link:../app",
"better-sqlite3": "^12.0.0",
Expand Down
5 changes: 5 additions & 0 deletions workspaces/orchestrator/packages/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,9 @@ backend.add(import('@backstage/plugin-scaffolder-backend-module-gitlab'));
// custom authentication provider module
backend.add(import('custom-authentication-provider-module-backend'));

backend.add(
import(
'@red-hat-developer-hub/backstage-plugin-orchestrator-backend-module-loki'
),
);
backend.start();
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Orchestrator Backend Module for Loki

This is an extension module to the `backstage-plugin-orchestrator-backend` plugin. It provides access to the Loki log provider

## Prerequisites

Before installing this module, ensure that the Orchestrator backend plugin is integrated into your Backstage instance. Follow the [Orchestrator README](https://github.com/redhat-developer/rhdh-plugins/tree/main/workspaces/orchestrator) for setup instructions.

This module also requires a Loki `workflowLogProvider` integration to be configured in your `app-config.yaml`. This will be added to the `orchestrator` section and might look something like this:

```
orchestrator:
workflowLogProvider:
loki:
baseUrl: http://localhost:3100
# logStreamSelectors:
# - label: 'app'
# value: '=~".+"'
```

The `baseUrl` is required.

Multiple Log Stream Selectors can be specified in the `logStreamSelectors` section. See the loki docs to learn more about log stream selectors and their values: https://grafana.com/docs/loki/latest/query/log_queries/#log-stream-selector

## Installation

To install this backend module:

```bash
# From your root directory
yarn workspace backend add @red-hat-developer-hub/backstage-plugin-orchestrator-backend-module-loki
```

```ts
// packages/backend/src/index.ts
import { createBackend } from '@backstage/backend-defaults';

const backend = createBackend();

// orchestrator
backend.add(
import('@red-hat-developer-hub/backstage-plugin-orchestrator-backend'),
);
// orchestrator Log Provider
backend.add(
import(
'@red-hat-developer-hub/backstage-plugin-orchestrator-backend-module-loki'
),
);

backend.start();
```

## Usage

Once the module is successfully setup, a user can view an orchestrator workflows log. This can be accessed by the new backend endpoint here: RHDH_BACK_END_URL/api/orchestrator/v2/workflows/instances/WORKFLOW_INSTANCE_ID/logs

Or by clicking the "view log" link on the orchestrator front-end:![alt text](img/view-logs-button.png)

![alt text](img/viewing-log.png)
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const mockWorkflowLog = {
status: 'success',
data: {
resultType: 'streams',
result: [
{
stream: {
detected_level: 'error',
service_name: 'unknown_service',
},
values: [
[
'1764952546330041000',
'2025-12-05 16:35:14,644 9eb78e04f727 ERROR [org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl:1316] (executor-thread-14) Unexpected error while executing node createNotification in process instance 7a6d2622-a315-4737-9278-36311ba4583a: org.jbpm.workflow.instance.WorkflowRuntimeException: [sendnotification:7a6d2622-a315-4737-9278-36311ba4583a - createNotification:[uuid=7]] -- RESTEASY004655: Unable to invoke request: org.apache.http.client.ClientProtocolException',
],
],
},
{
stream: {
detected_level: 'info',
service_name: 'unknown_service',
},
values: [
[
'1764952546332968000',
"2025-12-05 16:35:14,668 9eb78e04f727 INFO [org.kie.kogito.serverless.workflow.devservices.DevModeServerlessWorkflowLogger:50] (executor-thread-14) Workflow 'sendnotification' (7a6d2622-a315-4737-9278-36311ba4583a) was started, now 'Error'",
],
[
'1764952546327277000',
'2025-12-05 16:35:14,626 9eb78e04f727 INFO [org.kie.kogito.process.workitems.impl.DefaultKogitoWorkItemHandler:105] (executor-thread-14) error workItem WorkItem 7ee1509a-03b4-47e2-891f-31f6d225e520 [name=notifications_createNotification, state=1, processInstanceId=7a6d2622-a315-4737-9278-36311ba4583a, parameters{Parameter={"recipients":["user:development/guest"],"title":"This is a notification","topic":"Manually sent"}, payload={severity=normal, link=https://www.redhat.com, description=Description of the notification, topic=Manually sent, title=This is a notification}, recipients={entityRef=[user:development/guest], type=entity}}] handled by notifications_createNotification transition DefaultWorkItemTransitionImpl [id=activate, data={}, policies=[], termination=null] : jakarta.ws.rs.ProcessingException: RESTEASY004655: Unable to invoke request: org.apache.http.client.ClientProtocolException',
],
[
'1764952546327248000',
"2025-12-05 16:35:13,632 9eb78e04f727 INFO [org.kie.kogito.serverless.workflow.devservices.DevModeServerlessWorkflowLogger:64] (executor-thread-14) Triggered node 'createNotification' for process 'sendnotification' (7a6d2622-a315-4737-9278-36311ba4583a)",
],
[
'1764952546327240000',
"2025-12-05 16:35:13,628 9eb78e04f727 INFO [org.kie.kogito.serverless.workflow.devservices.DevModeServerlessWorkflowLogger:64] (executor-thread-14) Triggered node 'SendNotification' for process 'sendnotification' (7a6d2622-a315-4737-9278-36311ba4583a)",
],
[
'1764952546327187000',
"2025-12-05 16:35:13,623 9eb78e04f727 INFO [org.kie.kogito.serverless.workflow.devservices.DevModeServerlessWorkflowLogger:64] (executor-thread-14) Triggered node 'Prepare' for process 'sendnotification' (7a6d2622-a315-4737-9278-36311ba4583a)",
],
[
'1764952546327177000',
"2025-12-05 16:35:13,622 9eb78e04f727 INFO [org.kie.kogito.serverless.workflow.devservices.DevModeServerlessWorkflowLogger:64] (executor-thread-14) Triggered node 'Start' for process 'sendnotification' (7a6d2622-a315-4737-9278-36311ba4583a)",
],
[
'1764952546327102000',
"2025-12-05 16:35:13,618 9eb78e04f727 INFO [org.kie.kogito.serverless.workflow.devservices.DevModeServerlessWorkflowLogger:40] (executor-thread-14) Starting workflow 'sendnotification' (7a6d2622-a315-4737-9278-36311ba4583a)",
],
],
},
],
},
};

export default mockWorkflowLog;
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export interface Config {
/**
* Configuration for the Orchestrator plugin.
*/
orchestrator?: {
workflowLogProvider?: {
loki?: {
/**
* Base URL of the Loki service.
*/
baseUrl: string;
logStreamSelectors?: Array<{
// label is the selector, something like 'app' or 'service_name', etc...
label: string;
// value is the label matching operator, so something like: '=~".+"'
value: string;
}>;
};
};
};
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "@red-hat-developer-hub/backstage-plugin-orchestrator-backend-module-loki",
"version": "0.1.0",
"license": "Apache-2.0",
"description": "The loki backend module for the orchestrator plugin.",
"main": "src/index.ts",
"types": "src/index.ts",
"publishConfig": {
"access": "public"
},
"backstage": {
"role": "backend-plugin-module",
"pluginId": "orchestrator",
"pluginPackage": "@red-hat-developer-hub/backstage-plugin-orchestrator-backend"
},
"exports": {
".": "./src/index.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"package.json": [
"package.json"
]
}
},
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
"lint": "backstage-cli package lint",
"test": "backstage-cli package test",
"clean": "backstage-cli package clean",
"prepack": "backstage-cli package prepack",
"postpack": "backstage-cli package postpack",
"tsc": "tsc",
"prettier:check": "prettier --ignore-unknown --check .",
"prettier:fix": "prettier --ignore-unknown --write ."
},
"dependencies": {
"@backstage/backend-plugin-api": "^1.5.0",
"@red-hat-developer-hub/backstage-plugin-orchestrator-common": "workspace:^",
"@red-hat-developer-hub/backstage-plugin-orchestrator-node": "workspace:^",
"luxon": "^3.7.2"
},
"devDependencies": {
"@backstage/backend-test-utils": "^1.10.0",
"@backstage/cli": "^0.34.5",
"@backstage/config": "^1.3.6"
},
"files": [
"dist",
"config.d.ts"
],
"repository": {
"type": "git",
"url": "https://github.com/redhat-developer/rhdh-plugins",
"directory": "workspaces/orchestrator/plugins/orchestrator-backend-module-loki"
},
"keywords": [
"backstage",
"plugin"
],
"homepage": "https://red.ht/rhdh",
"bugs": "https://github.com/redhat-developer/rhdh-plugins/issues",
"author": "Red Hat"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## API Report File for "@red-hat-developer-hub/backstage-plugin-orchestrator-backend-module-loki"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

import { BackendFeature } from '@backstage/backend-plugin-api';

// @public
const orchestratorModuleLoki: BackendFeature;
export default orchestratorModuleLoki;

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* The loki backend module for the orchestrator plugin.
*
* @packageDocumentation
*/

export { orchestratorModuleLoki as default } from './module';
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
coreServices,
createBackendModule,
} from '@backstage/backend-plugin-api';
import { workflowLogsExtensionEndpoint } from '@red-hat-developer-hub/backstage-plugin-orchestrator-node';
import { LokiProvider } from './workflowLogsProviders/LokiProvider';
/**

* Provides access to the Loki log provider for viewing Orchestrator workflow logs
*
* @public
*/
export const orchestratorModuleLoki = createBackendModule({
pluginId: 'orchestrator',
moduleId: 'loki',
register(reg) {
reg.registerInit({
deps: {
config: coreServices.rootConfig,
logger: coreServices.logger,
workflowLogs: workflowLogsExtensionEndpoint,
},
async init({ config, logger, workflowLogs }) {
logger.info('Initialize the Loki orchestrator backend module');
workflowLogs.addWorkflowLogProvider(LokiProvider.fromConfig(config));
},
});
},
});
Loading