Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9eaae82
[update-marketplace-to-consume-metrics] - Add new endpoint configurat…
sergio-soria-bi Jun 15, 2026
60a2329
[update-marketplace-to-consume-metrics] - Add new endpoint configurat…
sergio-soria-bi Jun 15, 2026
ff9df9b
[update-marketplace-to-consume-metrics] - Whitelist new method so it …
sergio-soria-bi Jun 15, 2026
fe3d8c5
[update-marketplace-to-consume-metrics] - Add new endpoint to client …
sergio-soria-bi Jun 15, 2026
99243f7
[update-marketplace-to-consume-metrics] - Add unit tests.
sergio-soria-bi Jun 15, 2026
5721ecc
[update-marketplace-to-consume-metrics] - Fix missdefinition.
sergio-soria-bi Jun 15, 2026
4fc4869
[update-marketplace-to-consume-metrics] - Add JWT token generation co…
sergio-soria-bi Jun 15, 2026
119d8f4
[update-marketplace-to-consume-metrics] - Fix unit tests.
sergio-soria-bi Jun 16, 2026
f9a5ba2
Create api-marketplace-metrics module
jordivx Jun 17, 2026
0cb6827
Fixes to integrate metrics e2e
jordivx Jun 17, 2026
e01ea54
Feature/update marketplace client to consume new endpoint (#35)
sergio-soria-bi Jun 17, 2026
4bb965d
Add unit tests
jordivx Jun 18, 2026
b06b057
Rename properly properties
jordivx Jun 19, 2026
a069870
Add liquibasemigration to include new api in api_definitions
jordivx Jun 25, 2026
dea1628
Merge from develop to master (#42)
BraisVQ Jul 1, 2026
7ddf3f1
Upgrade version from 0.0.3 to 0.0.4
jordivx Jul 2, 2026
5faf796
Merge remote-tracking branch 'origin/master' into feature/create-api-…
jordivx Jul 2, 2026
770e18f
[all-catalog-items] - Set new/updated catalog items endpoint. (#40)
sergio-soria-bi Jul 2, 2026
ef995c9
Apply PR feedback
jordivx Jul 2, 2026
1bf2134
Feature/remove auto generated code from git repo (#41)
sergio-soria-bi Jul 7, 2026
9a4e968
Apply PR feedback about exception handling + override + cors configur…
jordivx Jul 10, 2026
4d35302
Use bad gateway exception instead of internal server when issues in m…
jordivx Jul 10, 2026
dc58d22
Apply PR feedback
jordivx Jul 16, 2026
c4c9d3c
Fix unit tests failing
jordivx Jul 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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ secring.gpg
*.yaml.dec
.scannerwork/
# Autogenerated API interface files
api-marketplace-metrics/src/main/java/org/opendevstack/apiservice/marketplacemetrics/api
api-marketplace-metrics/src/main/java/org/opendevstack/apiservice/marketplacemetrics/model
api-project-users/src/main/java/org/opendevstack/apiservice/projectusers/api
api-project-users/src/main/java/org/opendevstack/apiservice/projectusers/model
api-project-platform/src/main/java/org/opendevstack/apiservice/projectplatform/api
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Project variables
PROJECT_NAME := opendevstack-api-service
VERSION := 0.0.3
VERSION := 0.0.4
JAVA_VERSION := 21
MAIN_CLASS := org.opendevstack.apiservice.core.DevstackApiServiceApplication

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Build a traditional Spring Boot JAR file:
```bash
make jar
```
- Output: `core/target/core-0.0.3.jar`
- Output: `core/target/core-0.0.4.jar`
- Includes all dependencies
- Standard Spring Boot startup time

Expand Down
76 changes: 76 additions & 0 deletions api-marketplace-metrics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Marketplace Metrics API Module

This module provides REST API endpoint to obtain metrics from the Marketplace.

## Integration with Core Application

To integrate these modules with your core application:

1. **Add module dependencies** to your core `pom.xml`:

```xml

<dependency>
<groupId>org.opendevstack.apiservice</groupId>
<artifactId>api-marketplace-metrics</artifactId>
<version>${project.version}</version>
</dependency>

```
## Error Handling

The API provides comprehensive error handling with structured error responses:

- **400 Bad Request**: Invalid request data
- **404 Not Found**: Resource not found (project, user)
- **409 Conflict**: Resource already exists
- **500 Internal Server Error**: System errors, automation platform failures

## Monitoring and Observability

The modules provide comprehensive logging and can be monitored through:

1. **Application Logs**: Structured logging for all operations
2. **Metrics**: Integration with Spring Boot Actuator
3. **Health Checks**: Automation platform connectivity checks
4. **Distributed Tracing**: Support for distributed tracing systems with Opentelemetry and Dynatrace

## Testing

Both modules include comprehensive test suites:

- **Unit Tests**: Business logic validation
- **Integration Tests**: API endpoint testing
- **Mock Tests**: Automation platform interaction testing

Run tests with:

```bash
./mvnw test
```

## Development

### Building the Modules

```bash
# Build all modules
./mvnw clean install

# Build specific module
./mvnw clean install -pl api-project-users
./mvnw clean install -pl api-marketplace-metrics
./mvnw clean install -pl external-service-app
```

### Running Locally

```bash
# Run with dev profile
./mvnw spring-boot:run -Dspring-boot.run.profiles=dev
```

### API Documentation

Swagger UI is available at: `http://localhost:8080/swagger-ui.html`

289 changes: 289 additions & 0 deletions api-marketplace-metrics/openapi/api-marketplace-metrics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,289 @@
openapi: 3.0.3
info:
title: ODS API Server
description: API documentation for ODS (Open DevStack) API Service
contact:
name: ODS Team
version: v0.0.1
servers:
- url: http://{baseurl}/api/v1
variables:
baseurl:
default: localhost:8080
description: Development environment
tags:
- name: Marketplace metrics
description: API for managing marketplace metrics
paths:
/marketplace/project-components:
get:
tags:
- MarketplaceMetrics
summary: Get Marketplace metrics regarding project components.
description: Returns all the components that were provisioned from the Marketplace in all the projects.
operationId: getMarketplaceProjectComponentsMetrics
parameters:
- name: page
in: query
description: Page number (from 0 until limit)
required: false
schema:
type: integer
default: 0
- name: size
in: query
description: Page size
required: false
schema:
type: integer
default: 20
responses:
"200":
description: A paginated list of all the provisioned project components
content:
application/json:
schema:
$ref: "#/components/schemas/MarketplaceProjectComponentsMetrics"
"401":
$ref: "#/components/responses/UnauthorizedResponse"
"403":
$ref: "#/components/responses/ForbiddenResponse"
"404":
$ref: "#/components/responses/NotFoundResponse"
"500":
$ref: "#/components/responses/InternalErrorResponse"
Comment thread
jordivx marked this conversation as resolved.
"502":
$ref: "#/components/responses/BadGatewayResponse"

/marketplace/catalog-items:
get:
tags:
- MarketplaceMetrics
summary: Get Marketplace metrics regarding catalog items.
description: Returns usage metrics of catalog items available in the marketplace.
operationId: getMarketplaceCatalogItemsMetrics
responses:
"200":
description: A list of catalog items metrics
content:
application/json:
schema:
$ref: "#/components/schemas/MarketplaceCatalogItemsMetrics"
"401":
$ref: "#/components/responses/UnauthorizedResponse"
"403":
$ref: "#/components/responses/ForbiddenResponse"
"404":
$ref: "#/components/responses/NotFoundResponse"
"500":
$ref: "#/components/responses/InternalErrorResponse"
Comment thread
jordivx marked this conversation as resolved.
"502":
$ref: "#/components/responses/BadGatewayResponse"

components:
responses:
UnauthorizedResponse:
description: Invalid client token
content:
application/json:
schema:
$ref: '#/components/schemas/RestErrorMessage'
ForbiddenResponse:
description: Insufficient permissions
content:
application/json:
schema:
$ref: '#/components/schemas/RestErrorMessage'
NotFoundResponse:
description: Resource not found
content:
application/json:
schema:
$ref: '#/components/schemas/RestErrorMessage'
BadGatewayResponse:
description: Bad gateway
content:
application/json:
schema:
$ref: '#/components/schemas/RestErrorMessage'
InternalErrorResponse:
description: Server error
content:
application/json:
schema:
$ref: '#/components/schemas/RestErrorMessage'

schemas:
RestErrorMessage:
type: object
properties:
message:
type: string
required:
- message

MarketplaceProjectComponentsMetrics:
type: object
example:
data:
- projectKey: SOMEPROJECT
componentId: any-component-id-from-backend
caller: some-person@email.com
catalogItemSlug: some_technology-name
createdAt: 1707043200000
updatedAt: 1707043200000
- projectKey: ANOTHERPROJECT
componentId: another-component-id-from-backend
caller: some-person2@email.com
catalogItemSlug: another_technology-name
createdAt: 1707043200001
updatedAt: 1707043200002
pagination:
page: 0
size: 20
totalElements: 117
totalPages: 6
next: https://api.example.com/resources?page=1&size=20
previous: null
properties:
data:
type: array
items:
$ref: '#/components/schemas/MarketplaceProjectComponentMetrics'
pagination:
$ref: '#/components/schemas/MarketplaceProjectComponentsMetricsPagination'
MarketplaceProjectComponentMetrics:
type: object
example:
projectKey: SOMEPROJECT
componentId: any-component-id-from-backend
caller: some-person@email.com
catalogItemSlug: some_technology-name
createdAt: 1707043200000
updatedAt: 1707043200000
properties:
projectKey:
description: The projectKey which the component is provisioned for.
example: SOMEPROJECT
type: string
componentId:
description: The componentId set by the user.
example: any-component-id-from-backend
minLength: 1
pattern: ^(?!\s*$).+
type: string
caller:
description: The email of who provisioned the component.
example: some-person@email.com
type: string
catalogItemSlug:
description: The provisioned catalog item slug.
example: some_technology-name
type: string
createdAt:
description: The timestamp of the provision action.
example: 1707043200000
type: number
updatedAt:
description: The timestamp of the last change of the provisioned component.
example: 1707043200000
type: number
MarketplaceProjectComponentsMetricsPagination:
type: object
example:
page: 0
size: 20
totalElements: 117
totalPages: 6
next: "https://api.example.com/resources?page=1&size=20"
previous: null
properties:
page:
type: integer
example: 0
description: Current page of the response.
size:
type: integer
example: 20
description: Current page size of the response.
totalElements:
type: integer
format: integer
example: 117
description: Total number of elements.
totalPages:
type: integer
example: 6
description: Total number of pages of this exact size.
next:
type: string
format: uri
nullable: true
example: "https://api.example.com/resources?page=1&size=20"
description: URL of the next page (or null if the current is the last one)
previous:
type: string
format: uri
nullable: true
example: "https://api.example.com/resources?page=0&size=20"
description: URL of the previous page (or null if the current is the first one)

MarketplaceCatalogItemsMetrics:
type: object
example:
data:
- id: aSdFam...yCg==
slug: myproject_my-component-repo
title: An item title
shortDescription: Example description
date: "2021-07-01T00:00:00Z"
properties:
data:
type: array
items:
$ref: '#/components/schemas/CatalogItem'

CatalogItem:
type: object
properties:
id:
type: string
slug:
type: string
path:
type: string
title:
type: string
shortDescription:
type: string
descriptionFileId:
type: string
imageFileId:
type: string
description:
type: string
description: Resolved description content of the catalog item (e.g. markdown converted to plain text or HTML)
example: "This component provides a reusable service for handling..."
itemSrc:
type: string
tags:
type: array
items:
$ref: '#/components/schemas/CatalogItemTag'
authors:
type: array
items:
type: string
date:
type: string
format: date-time

CatalogItemTag:
type: object
properties:
label:
type: string
options:
type: array
items:
type: string
Loading
Loading