Skip to content

Commit

Permalink
Merge pull request #161 from xenit-eu/master
Browse files Browse the repository at this point in the history
ALFREDOPS-860: release Telemetry for ACS 23.x
  • Loading branch information
pvriel authored Jan 9, 2025
2 parents a04b258 + 4089300 commit dc52cd8
Show file tree
Hide file tree
Showing 37 changed files with 84 additions and 191 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
java-version: 17
- name: Test
uses: gradle/gradle-build-action@v2
with:
Expand All @@ -36,14 +36,14 @@ jobs:
fail-fast: false
matrix:
flavour: [ "community", "enterprise" ]
version: [ "61", "62", "70", "71", "72", "73","74" ]
version: [ "231" ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
java-version: 17
- name: Login to Docker
env:
DOCKER_HUB_USER: ${{ secrets.XENIT_DOCKER_REGISTRY_USERNAME }}
Expand All @@ -70,11 +70,11 @@ jobs:
if: ${{ startsWith(github.ref, 'refs/heads/master') || startswith(github.ref, 'refs/heads/release') }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
java-version: 17
- name: Publish
env:
ORG_GRADLE_PROJECT_sonatype_username: ${{ secrets.SONATYPE_S01_USERNAME }}
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ Version template:
-->

# Alfred Telemetry Changelog

## [1.0.0] - 2025-01-07
### Added
* Added support for Alfresco 23.1 [[#159]]
### Removed
* Dropped support for Alfresco 6.x and 7.x due to source incompatibility [[#159]]

[#159]: https://github.com/xenit-eu/alfred-telemetry/pull/159

## [0.10.1] - 2023-10-27
### Fixed
* re-fetch trackers on each call [[#153]]
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
Alfred Telemetry integrates various components of the Alfresco ecosystem with [Micrometer](https://micrometer.io/)
, an application metrics facade that supports numerous monitoring systems.

### Note regarding Alfresco 6.x and 7.x
Starting from version 1.0.0, Alfred Telemetry no longer supports Alfresco 6.x and 7.x due to source incompatibility.
If you are using Alfresco 6.x or 7.x, please use version 0.x.x of Alfred Telemetry.

## Alfred Telemetry for Alfresco

[![Maven Central](https://img.shields.io/maven-central/v/eu.xenit.alfred.telemetry/alfred-telemetry-platform.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22eu.xenit.alfred.telemetry%22%20AND%20a%3A%22alfred-telemetry-platform%22)
Expand Down
4 changes: 2 additions & 2 deletions alfred-telemetry-platform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ Please consult the official Alfresco documentation on how to install Simple Modu
### Supported Alfresco versions

Alfred Telemetry is systematically integration tested against:
* Alfresco Enterprise 5.2, 6.0, 6.1, 6.2 and 7.0
* Alfresco Community 5.2, 6.0, 6.1, 6.2 and 7.0
* Alfresco Enterprise 6.1, 6.2, 7.0, 7.1, 7.2, 7.3 and 7.4
* Alfresco Community 6.1, 6.2, 7.0, 7.1, 7.2, 7.3 and 7.4


## Configuration
Expand Down
20 changes: 11 additions & 9 deletions alfred-telemetry-platform/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@ tasks.withType(JavaCompile) {
}

java {
sourceCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
withJavadocJar()
withSourcesJar()
}

compileJava {
options.release = 17
}
compileTestJava {
options.release = 17
}

ext {
// Compiling against AEE 6.1 because:
// * Some MeterBinder implementations monitor Enterprise only components (e.g. Hazelcast caches)
// * Alfresco's Micrometer integration, (MetricsController, MetricsReporter) classes only available as of 6.1.
// Compatibility with 5.x should be covered with integration tests
alfrescoVersion = '6.1.1.11'
alfrescoVersion = '23.1.0'
}

dependencies {
Expand All @@ -39,7 +42,7 @@ dependencies {
alfrescoProvided("io.github.mweirauch:micrometer-jvm-extras:${jvmExtrasVersion}") {
exclude group: "org.slf4j", module: "*"
}
alfrescoProvided 'javax.servlet:javax.servlet-api'
alfrescoProvided 'jakarta.servlet:jakarta.servlet-api'
compileOnly 'org.apache.tomcat:tomcat-catalina:7.0.92'
alfrescoProvided "io.micrometer:micrometer-registry-graphite:${micrometerVersion}"
alfrescoProvided "io.micrometer:micrometer-registry-jmx:${micrometerVersion}"
Expand All @@ -55,7 +58,6 @@ dependencies {
testImplementation "org.mockito:mockito-junit-jupiter:${mockitoVersion}"
testImplementation "org.hamcrest:hamcrest-all:${hamcrestVersion}"
testImplementation "org.awaitility:awaitility:${awaitilityVersion}"
testImplementation "org.mockito:mockito-inline:${mockitoVersion}"
testRuntimeOnly 'org.alfresco:alfresco-remote-api'
}

Expand Down Expand Up @@ -90,4 +92,4 @@ publishing {
}
}

targetCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_17
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.binder.tomcat.TomcatMetrics;
import jakarta.servlet.ServletContext;
import org.alfresco.error.AlfrescoRuntimeException;
import org.apache.catalina.Manager;
import org.apache.catalina.core.ApplicationContext;
import org.apache.catalina.core.StandardContext;
import org.springframework.web.context.ServletContextAware;

import javax.annotation.Nonnull;
import javax.servlet.ServletContext;
import java.lang.reflect.Field;
import java.util.ArrayList;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package eu.xenit.alfred.telemetry.binder.cache;

import com.hazelcast.core.IMap;
import com.hazelcast.map.IMap;
import eu.xenit.alfred.telemetry.binder.EventTriggeredMeterBinder;
import eu.xenit.alfred.telemetry.binder.NamedMeterBinder;
import eu.xenit.alfred.telemetry.util.ReflectionUtil;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package eu.xenit.alfred.telemetry.alfrescointegration;

import org.apache.camel.spring.GenericBeansException;
import org.apache.camel.NoSuchBeanException;
import org.junit.jupiter.api.Test;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
Expand Down Expand Up @@ -91,7 +91,7 @@ private void validate(BeanDefinitionRegistry registry, ApplicationContext contex
if(hasDataSource) {
assertNotNull(context.getBean(DATASOURCE_BEAN_ID));
} else {
assertThrows(BeansException.class, () -> context.getBean(DATASOURCE_BEAN_ID));
assertThrows(NoSuchBeanException.class, () -> context.getBean(DATASOURCE_BEAN_ID));
}

assertThat(registry.containsBeanDefinition(BASIC_DATASOURCE_BEAN_ID), is(hasBasicDataSource));
Expand Down Expand Up @@ -131,7 +131,7 @@ private void setupAlfresco7Beans() {
private void setupNullBeans() {
beanDefinitionRegistry_null = new SimpleBeanDefinitionRegistry();
context_null = mock(ApplicationContext.class);
when(context_null.getBean(DATASOURCE_BEAN_ID)).thenThrow(new GenericBeansException(DATASOURCE_BEAN_ID));
when(context_null.getBean(DATASOURCE_BEAN_ID)).thenThrow(new NoSuchBeanException(DATASOURCE_BEAN_ID));
}

private DataSourceBeanPostProcessor createProcessor(ApplicationContext applicationContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertFalse;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package eu.xenit.alfred.telemetry.binder.cache;

import com.hazelcast.core.IMap;
import com.hazelcast.map.IMap;
import eu.xenit.alfred.telemetry.util.ReflectionUtil;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Tags;
import io.micrometer.core.instrument.binder.cache.HazelcastCacheMetrics;
import org.alfresco.enterprise.repo.cluster.cache.HazelcastSimpleCache;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.MockedStatic;
Expand Down Expand Up @@ -43,6 +44,15 @@ void setup() {
.thenReturn(Map.of("test", hazelcastSimpleCache));
}

@AfterEach
void teardown() {
/*
Don't remove this code.
We have no idea why this is necessary, or what it exactly does, or why it fixes all broken tests, but it does.
*/
Mockito.clearAllCaches();
}

@Test
void testMonitorCacheWithIMapReflection() throws InvocationTargetException, IllegalAccessException {
try (MockedStatic<ReflectionUtil> mock =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.Properties;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;

Expand All @@ -19,7 +20,7 @@ class ClusteringMetricsBeanPostProcessorTest {
ClusteringMetricsBeanPostProcessor clusteringMetricsBeanPostProcessor;

@BeforeEach
private void init() {
public void init() {
clusteringMetricsBeanPostProcessor = new ClusteringMetricsBeanPostProcessor();
}

Expand All @@ -39,6 +40,5 @@ void testCommunityAndClusteringMetricsEnabled() {
clusteringMetricsBeanPostProcessor.postProcessBeanDefinitionRegistry(beanDefinitionRegistry);
verify(beanDefinitionRegistry, times(0))
.registerBeanDefinition(eq(ClusteringMetricsBeanPostProcessor.CLUSTERING_METRICS_BEAN_ID), any());
;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void setup() {
@Test
void refresh() {
Floc floc = new Floc();
HashMap<Floc, HashMap<Shard, HashSet<ShardState>>> flocs = new HashMap<>();
Map<Floc, Map<Shard, Set<ShardState>>> flocs = new HashMap<>();
flocs.put(floc, new HashMap<>());
when(shardRegistry.getFlocs()).thenReturn(flocs);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ void testUpdateMetrics() {
shardState.setShardInstance(shardInstance);
HashSet<ShardState> shardStates = new HashSet<>();
shardStates.add(shardState);
HashMap<Shard, HashSet<ShardState>> shardHashSetHashMap = new HashMap<>();
Map<Shard, Set<ShardState>> shardHashSetHashMap = new HashMap<>();
shardHashSetHashMap.put(shard, shardStates);
HashMap<Floc, HashMap<Shard, HashSet<ShardState>>> metricsInformation = new HashMap<>();
Map<Floc, Map<Shard, Set<ShardState>>> metricsInformation = new HashMap<>();
metricsInformation.put(floc, shardHashSetHashMap);

ShardRegistry shardRegistry = Mockito.mock(ShardRegistry.class);
Expand Down Expand Up @@ -70,9 +70,9 @@ void testShardingStateNull() {
shardInstance.setHostName("myInstanceHost");
HashSet<ShardState> shardStates = new HashSet<>();
shardStates.add(null);
HashMap<Shard, HashSet<ShardState>> shardHashSetHashMap = new HashMap<>();
Map<Shard, Set<ShardState>> shardHashSetHashMap = new HashMap<>();
shardHashSetHashMap.put(shard, shardStates);
HashMap<Floc, HashMap<Shard, HashSet<ShardState>>> metricsInformation = new HashMap<>();
Map<Floc, Map<Shard, Set<ShardState>>> metricsInformation = new HashMap<>();
metricsInformation.put(floc, shardHashSetHashMap);
ShardRegistry shardRegistry = Mockito.mock(ShardRegistry.class);
MeterRegistry meterRegistry = new SimpleMeterRegistry();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.isEmptyString;
import static org.junit.Assert.assertThat;

import eu.xenit.alfred.telemetry.webscripts.console.AdminConsoleWebscriptResponseModel.TelemetryRegistryModel;
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static eu.xenit.alfred.telemetry.webscripts.stubs.ServerModelStub.enterprise_52;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.springframework.extensions.webscripts.DeclarativeRegistry.WEBSCRIPT_DESC_XML;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ java {
withSourcesJar()
}

compileJava {
options.release = 11
}
compileTestJava {
options.release = 11
}

dependencies {
// Micrometer libraries.
// API dependencies implementations are used by alfred-telemetry-solr4 and alfred-telemetry-solr6
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'eu.xenit.docker-compose' version '5.3.2' apply false
id 'eu.xenit.docker-compose' version '5.5.0' apply false
id "be.vbgn.ci-detect" version "0.5.0"
id "org.sonarqube" version "3.5.0.2730"
}
Expand All @@ -15,7 +15,7 @@ sonarqube {

allprojects {
group = 'eu.xenit.alfred.telemetry'
version = '0.10.1'
version = '1.0.0'

apply plugin: 'java'
apply plugin: 'jacoco'
Expand All @@ -38,11 +38,11 @@ allprojects {
micrometerVersion = '1.0.6'
jvmExtrasVersion = '0.1.2'

junitJupiterVersion = '5.4.2'
mockitoVersion = '2.27.0'
junitJupiterVersion = '5.10.2'
mockitoVersion = '5.11.0'
hamcrestVersion = '1.3'
awaitilityVersion = '4.1.0'
restAssuredVersion = '4.0.0'
restAssuredVersion = '5.3.0'
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext {
alfrescoBaseWarBom = 'org.alfresco:acs-community-packaging:7.3.0'
alfrescoBaseWarBom = 'org.alfresco:acs-community-packaging:23.1.0'
alfrescoBaseWar = 'org.alfresco:content-services-community@war'
alfrescoBaseImage = 'xenit/alfresco-repository-community:7.3.0'
alfrescoBaseImage = 'xenit/alfresco-repository-skeleton:23.1.0'
solrFlavor = 'solr6'

// postgresImage = 'postgres:13'
Expand Down
14 changes: 0 additions & 14 deletions integration-tests/alfresco-community-61/overload.gradle

This file was deleted.

14 changes: 0 additions & 14 deletions integration-tests/alfresco-community-62/overload.gradle

This file was deleted.

Loading

0 comments on commit dc52cd8

Please sign in to comment.