Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce a new data-collector module which holds new Data Collector functionality. There will eventually exist one Collector per database, with the ability to collect various statistical operational data on the database and it's usage pattern. Collection is controlled via procedures, and a stub of the most fundamental procedure (retrieve) is included here.
- Loading branch information
Showing
13 changed files
with
1,517 additions
and
0 deletions.
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
30 changes: 30 additions & 0 deletions
30
...t/cypher-it/src/test/scala/org/neo4j/internal/collector/DataCollectorAcceptanceTest.scala
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) 2002-2018 "Neo4j," | ||
* Neo4j Sweden AB [http://neo4j.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.internal.collector | ||
|
||
import org.neo4j.cypher.ExecutionEngineFunSuite | ||
|
||
class DataCollectorAcceptanceTest extends ExecutionEngineFunSuite { | ||
|
||
test("should retrieve correct section") { | ||
val res = execute("CALL db.stats.retrieve('teddybear')") | ||
res.toList should be(Seq(Map("section" -> "teddybear", "data" -> Map()))) | ||
} | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,62 @@ | ||
Neo4j | ||
Copyright © 2002-2018 Neo4j Sweden AB (referred to in this notice as "Neo4j") | ||
[http://neo4j.com] | ||
|
||
This product includes software ("Software") developed by Neo4j. | ||
|
||
The copyright in the bundled Neo4j graph database (including the | ||
Software) is owned by Neo4j. The Software developed and owned | ||
by Neo4j is licensed under the GNU GENERAL PUBLIC LICENSE Version 3 | ||
(http://www.fsf.org/licensing/licenses/gpl-3.0.html) ("GPL") | ||
to all third parties and that license, as required by the GPL, is | ||
included in the LICENSE.txt file. | ||
|
||
However, if you have executed an End User Software License and Services | ||
Agreement or an OEM Software License and Support Services Agreement, or | ||
another commercial license agreement with Neo4j or one of its | ||
affiliates (each, a "Commercial Agreement"), the terms of the license in | ||
such Commercial Agreement will supersede the GPL and you may use the | ||
software solely pursuant to the terms of the relevant Commercial | ||
Agreement. | ||
|
||
Full license texts are found in LICENSES.txt. | ||
|
||
|
||
Third-party licenses | ||
-------------------- | ||
|
||
Apache Software License, Version 2.0 | ||
Apache Commons Lang | ||
Lucene Core | ||
Lucene Memory | ||
Netty/All-in-One | ||
|
||
BSD - Scala License | ||
Scala Library | ||
|
||
BSD License | ||
Scala Compiler | ||
|
||
Bouncy Castle License | ||
Bouncy Castle PKIX, CMS, EAC, TSP, PKCS, OCSP, CMP, and CRMF APIs | ||
Bouncy Castle Provider | ||
|
||
Eclipse Distribution License - v 1.0 | ||
Eclipse Collections API | ||
Eclipse Collections Main Library | ||
|
||
Eclipse Public License - v 1.0 | ||
Eclipse Collections API | ||
Eclipse Collections Main Library | ||
|
||
Dependencies with multiple licenses | ||
----------------------------------- | ||
|
||
Eclipse Collections API | ||
Eclipse Distribution License - v 1.0 | ||
Eclipse Public License - v 1.0 | ||
|
||
Eclipse Collections Main Library | ||
Eclipse Distribution License - v 1.0 | ||
Eclipse Public License - v 1.0 | ||
|
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,145 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<parent> | ||
<groupId>org.neo4j</groupId> | ||
<artifactId>parent</artifactId> | ||
<version>3.5.0-SNAPSHOT</version> | ||
<relativePath>../..</relativePath> | ||
</parent> | ||
|
||
<properties> | ||
<license-text.header>headers/GPL-3-header.txt</license-text.header> | ||
<licensing.prepend.text>licensing/notice-gpl-prefix.txt</licensing.prepend.text> | ||
<moduleName>org.neo4j.common</moduleName> | ||
</properties> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>neo4j-data-collector</artifactId> | ||
<version>3.5.0-SNAPSHOT</version> | ||
|
||
<packaging>jar</packaging> | ||
<name>Neo4j - Data Collector</name> | ||
<description>The Neo4j data collector deamon.</description> | ||
<url>http://components.neo4j.org/${project.artifactId}/${project.version}</url> | ||
|
||
<scm> | ||
<connection>scm:git:git://github.com/neo4j/neo4j.git</connection> | ||
<developerConnection>scm:git:git@github.com:neo4j/neo4j.git</developerConnection> | ||
<url>https://github.com/neo4j/neo4j</url> | ||
</scm> | ||
|
||
<licenses> | ||
<license> | ||
<name>GNU General Public License, Version 3</name> | ||
<url>http://www.gnu.org/licenses/gpl-3.0-standalone.html</url> | ||
<comments>The software ("Software") developed and owned by Neo4j Sweden AB (referred to in this notice as "Neo4j") is | ||
licensed under the GNU GENERAL PUBLIC LICENSE Version 3 to all third | ||
parties and that license is included below. | ||
|
||
However, if you have executed an End User Software License and Services | ||
Agreement or an OEM Software License and Support Services Agreement, or | ||
another commercial license agreement with Neo4j or one of its | ||
affiliates (each, a "Commercial Agreement"), the terms of the license in | ||
such Commercial Agreement will supersede the GNU GENERAL PUBLIC LICENSE | ||
Version 3 and you may use the Software solely pursuant to the terms of | ||
the relevant Commercial Agreement. | ||
</comments> | ||
</license> | ||
</licenses> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>net.alchim31.maven</groupId> | ||
<artifactId>scala-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
|
||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.scalastyle</groupId> | ||
<artifactId>scalastyle-maven-plugin</artifactId> | ||
<version>1.0.0</version> | ||
<configuration> | ||
<verbose>false</verbose> | ||
<failOnViolation>true</failOnViolation> | ||
<includeTestSourceDirectory>true</includeTestSourceDirectory> | ||
<failOnWarning>false</failOnWarning> | ||
<inputEncoding>UTF-8</inputEncoding> | ||
<sourceDirectory>${basedir}/src/main/scala</sourceDirectory> | ||
<testSourceDirectory>${basedir}/src/test/scala</testSourceDirectory> | ||
<configLocation>${project.basedir}/../scalastyle_config.xml</configLocation> | ||
<outputFile>${basedir}/target/scalastyle-output.xml</outputFile> | ||
<outputEncoding>UTF-8</outputEncoding> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>check</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
|
||
<dependencies> | ||
|
||
<!-- scala --> | ||
|
||
<dependency> | ||
<groupId>org.scala-lang</groupId> | ||
<artifactId>scala-library</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.scala-lang</groupId> | ||
<artifactId>scala-reflect</artifactId> | ||
</dependency> | ||
|
||
<!-- neo4j --> | ||
|
||
<dependency> | ||
<groupId>org.neo4j</groupId> | ||
<artifactId>neo4j-procedure-api</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.neo4j</groupId> | ||
<artifactId>neo4j-kernel</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<!-- neo4j testing --> | ||
|
||
<!-- Test are located with other IT tests to solve problems with depending of TestGraphDatabaseFactory et.c. --> | ||
|
||
<!-- tests --> | ||
|
||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-migrationsupport</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.vintage</groupId> | ||
<artifactId>junit-vintage-engine</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-library</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
39 changes: 39 additions & 0 deletions
39
community/data-collector/src/main/java/org/neo4j/internal/collector/CollectorProcedures.java
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,39 @@ | ||
/* | ||
* Copyright (c) 2002-2018 "Neo4j," | ||
* Neo4j Sweden AB [http://neo4j.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.internal.collector; | ||
|
||
import java.util.Collections; | ||
import java.util.stream.Stream; | ||
|
||
import org.neo4j.procedure.Description; | ||
import org.neo4j.procedure.Mode; | ||
import org.neo4j.procedure.Name; | ||
import org.neo4j.procedure.Procedure; | ||
|
||
@SuppressWarnings( "WeakerAccess" ) | ||
public class CollectorProcedures | ||
{ | ||
@Description( "Retrieve statistical data about the current database." ) | ||
@Procedure( name = "db.stats.retrieve", mode = Mode.READ ) | ||
public Stream<RetrieveResult> retrieve( @Name( value = "section", defaultValue = "all" ) String section ) | ||
{ | ||
return Stream.of( new RetrieveResult( section, Collections.emptyMap() ) ); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
community/data-collector/src/main/java/org/neo4j/internal/collector/DataCollectorModule.java
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,41 @@ | ||
/* | ||
* Copyright (c) 2002-2018 "Neo4j," | ||
* Neo4j Sweden AB [http://neo4j.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.internal.collector; | ||
|
||
import org.neo4j.internal.kernel.api.Kernel; | ||
import org.neo4j.internal.kernel.api.exceptions.KernelException; | ||
import org.neo4j.kernel.impl.proc.Procedures; | ||
import org.neo4j.scheduler.JobScheduler; | ||
import org.neo4j.util.Preconditions; | ||
|
||
public class DataCollectorModule | ||
{ | ||
private DataCollectorModule() | ||
{ | ||
} | ||
|
||
public static void setupDataCollector( Procedures procedures, | ||
JobScheduler jobScheduler, | ||
Kernel kernel ) throws KernelException | ||
{ | ||
Preconditions.checkState( kernel != null, "Kernel was null" ); | ||
procedures.registerProcedure( CollectorProcedures.class ); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
community/data-collector/src/main/java/org/neo4j/internal/collector/RetrieveResult.java
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) 2002-2018 "Neo4j," | ||
* Neo4j Sweden AB [http://neo4j.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.internal.collector; | ||
import java.util.Map; | ||
|
||
@SuppressWarnings( "WeakerAccess" ) | ||
public class RetrieveResult | ||
{ | ||
public final String section; | ||
public final Map<String, Object> data; | ||
public RetrieveResult( String section, Map<String,Object> data ) | ||
{ | ||
this.section = section; | ||
this.data = data; | ||
} | ||
} |
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
Oops, something went wrong.