diff --git a/community/data-collector/src/main/java/org/neo4j/internal/collector/GraphCountsSection.java b/community/data-collector/src/main/java/org/neo4j/internal/collector/GraphCountsSection.java index 0e3856ac8a31e..eb64132c9847d 100644 --- a/community/data-collector/src/main/java/org/neo4j/internal/collector/GraphCountsSection.java +++ b/community/data-collector/src/main/java/org/neo4j/internal/collector/GraphCountsSection.java @@ -44,6 +44,7 @@ import org.neo4j.kernel.api.SilentTokenNameLookup; import org.neo4j.register.Register; import org.neo4j.register.Registers; +import org.neo4j.storageengine.api.EntityType; /** * The Graph Counts section holds all data that is available form the counts store, plus metadata @@ -178,16 +179,29 @@ private static List> constraints( TokenRead tokens, SchemaRea while ( iterator.hasNext() ) { ConstraintDescriptor constraint = iterator.next(); - + EntityType entityType = constraint.schema().entityType(); Map data = new HashMap<>(); - int labelId = constraint.schema().getEntityTokenIds()[0]; - data.put( "label", anonymizer.label( tokenLookup.labelGetName( labelId ), labelId ) ); data.put( "properties", map( constraint.schema().getPropertyIds(), - id -> anonymizer.propertyKey( tokenLookup.propertyKeyGetName( id ), id ) ) ); + id -> anonymizer.propertyKey( tokenLookup.propertyKeyGetName( id ), id ) ) ); data.put( "type", constraintType( constraint ) ); + int entityTokenId = constraint.schema().getEntityTokenIds()[0]; - constraints.add( data ); + switch ( entityType ) + { + case NODE: + data.put( "label", anonymizer.label( tokenLookup.labelGetName( entityTokenId ), entityTokenId ) ); + constraints.add( data ); + break; + case RELATIONSHIP: + data.put( "relationshipType", anonymizer.relationshipType( tokenLookup.relationshipTypeGetName( entityTokenId ), entityTokenId ) ); + constraints.add( data ); + break; + case GRAPH: + // Ignore + break; + default: + } } return constraints;