Skip to content

Commit c74a817

Browse files
authored
Merge pull request #1369 from jdcasey/master
Add metrics around content storage path
2 parents c377204 + cccfa62 commit c74a817

6 files changed

Lines changed: 35 additions & 3 deletions

File tree

core/src/main/java/org/commonjava/indy/core/content/ContentGeneratorManager.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.commonjava.indy.IndyWorkflowException;
1919
import org.commonjava.indy.content.ContentGenerator;
2020
import org.commonjava.indy.content.StoreResource;
21+
import org.commonjava.indy.measure.annotation.Measure;
2122
import org.commonjava.indy.model.core.ArtifactStore;
2223
import org.commonjava.indy.model.core.Group;
2324
import org.commonjava.indy.util.LocationUtils;
@@ -67,6 +68,7 @@ public void initialize()
6768
}
6869
}
6970

71+
@Measure
7072
public Transfer generateFileContentAnd( final ArtifactStore store, final String path,
7173
final EventMetadata eventMetadata, Consumer<Transfer> consumer )
7274
throws IndyWorkflowException
@@ -85,6 +87,7 @@ public Transfer generateFileContentAnd( final ArtifactStore store, final String
8587
return item;
8688
}
8789

90+
@Measure
8891
public Transfer generateGroupFileContent( Group group, List<ArtifactStore> members, String path,
8992
EventMetadata eventMetadata ) throws IndyWorkflowException
9093
{
@@ -108,6 +111,7 @@ public Transfer generateGroupFileContent( Group group, List<ArtifactStore> membe
108111
return item;
109112
}
110113

114+
@Measure
111115
public void generateGroupFileContentAnd( Group group, List<ArtifactStore> members, String path,
112116
EventMetadata eventMetadata, Consumer<Transfer> consumer )
113117
throws IndyWorkflowException
@@ -122,6 +126,7 @@ public void generateGroupFileContentAnd( Group group, List<ArtifactStore> member
122126
}
123127
}
124128

129+
@Measure
125130
public void handleContentStorage( ArtifactStore transferStore, String path, Transfer txfr,
126131
EventMetadata eventMetadata ) throws IndyWorkflowException
127132
{
@@ -132,6 +137,7 @@ public void handleContentStorage( ArtifactStore transferStore, String path, Tran
132137
}
133138
}
134139

140+
@Measure
135141
public void handleContentDeletion( ArtifactStore member, String path, EventMetadata eventMetadata )
136142
throws IndyWorkflowException
137143
{
@@ -141,6 +147,7 @@ public void handleContentDeletion( ArtifactStore member, String path, EventMetad
141147
}
142148
}
143149

150+
@Measure
144151
public void generateGroupDirectoryContentAnd( Group group, List<ArtifactStore> members, String path,
145152
EventMetadata eventMetadata, Consumer<List<StoreResource>> consumer )
146153
throws IndyWorkflowException
@@ -156,6 +163,7 @@ public void generateGroupDirectoryContentAnd( Group group, List<ArtifactStore> m
156163
}
157164
}
158165

166+
@Measure
159167
public void generateDirectoryContentAnd( ArtifactStore store, String path, List<StoreResource> listed,
160168
EventMetadata metadata, Consumer<List<StoreResource>> consumer )
161169
throws IndyWorkflowException

core/src/main/java/org/commonjava/indy/core/content/DefaultContentManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ public Transfer store( final ArtifactStore store, final String path, final Input
376376
return txfr;
377377
}
378378

379-
private void clearNFCEntries( final KeyedLocation kl, final String path )
379+
@Measure
380+
protected void clearNFCEntries( final KeyedLocation kl, final String path )
380381
{
381382
try
382383
{

core/src/main/java/org/commonjava/indy/core/content/DefaultDownloadManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.commonjava.indy.data.StoreDataManager;
3131
import org.commonjava.indy.measure.annotation.Measure;
3232
import org.commonjava.indy.measure.annotation.MetricNamed;
33+
import org.commonjava.indy.metrics.IndyMetricsManager;
3334
import org.commonjava.indy.model.core.ArtifactStore;
3435
import org.commonjava.indy.model.core.HostedRepository;
3536
import org.commonjava.indy.model.core.RemoteRepository;
@@ -561,7 +562,7 @@ public Transfer store( final ArtifactStore store, final String path, final Input
561562
* java.lang.String, java.io.InputStream)
562563
*/
563564
@Override
564-
@Measure( timers = @MetricNamed() )
565+
@Measure
565566
public Transfer store( final ArtifactStore store, final String path, final InputStream stream,
566567
final TransferOperation op, final EventMetadata eventMetadata )
567568
throws IndyWorkflowException
@@ -631,6 +632,7 @@ else if ( !deploy.isAllowReleases() )
631632
( (CacheOnlyLocation) loc ).setReadonly( false );
632633
}
633634
final ConcreteResource resource = new ConcreteResource( loc, path );
635+
634636
Transfer txfr = transfers.store( resource, stream, eventMetadata );
635637
nfc.clearMissing( resource );
636638
return txfr;

core/src/main/java/org/commonjava/indy/core/inject/IspnNotFoundCache.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package org.commonjava.indy.core.inject;
1717

1818
import org.commonjava.indy.conf.IndyConfiguration;
19+
import org.commonjava.indy.measure.annotation.Measure;
1920
import org.commonjava.indy.model.core.StoreKey;
2021
import org.commonjava.indy.model.galley.KeyedLocation;
2122
import org.commonjava.indy.model.galley.RepositoryLocation;
@@ -80,7 +81,7 @@ public IspnNotFoundCache( final IndyConfiguration config )
8081
}
8182

8283
@PostConstruct
83-
private void start()
84+
public void start()
8485
{
8586
nfcCache.executeCache( (cache) -> {
8687
queryFactory = Search.getQueryFactory( cache ); // Obtain a query factory for the cache
@@ -102,6 +103,7 @@ private int getTimeoutInSeconds( ConcreteResource resource )
102103
}
103104

104105
@Override
106+
@Measure
105107
public void addMissing( final ConcreteResource resource )
106108
{
107109
boolean withTimeout = true;
@@ -138,6 +140,7 @@ private void addMissing( final ConcreteResource resource, final boolean withTime
138140
}
139141

140142
@Override
143+
@Measure
141144
public boolean isMissing( final ConcreteResource resource )
142145
{
143146
String key = getResourceKey( resource );
@@ -153,6 +156,7 @@ public boolean isMissing( final ConcreteResource resource )
153156
}
154157

155158
@Override
159+
@Measure
156160
public void clearMissing( final Location location )
157161
{
158162
nfcCache.execute( (cache) -> {
@@ -163,19 +167,22 @@ public void clearMissing( final Location location )
163167
}
164168

165169
@Override
170+
@Measure
166171
public void clearMissing( final ConcreteResource resource )
167172
{
168173
String key = getResourceKey( resource );
169174
nfcCache.execute( cache -> cache.remove( key ) );
170175
}
171176

172177
@Override
178+
@Measure
173179
public void clearAllMissing()
174180
{
175181
nfcCache.execute( (cache) -> { cache.clear(); return null; } );
176182
}
177183

178184
@Override
185+
@Measure
179186
public Map<Location, Set<String>> getAllMissing()
180187
{
181188
logger.debug( "[NFC] getAllMissing start" );
@@ -199,6 +206,7 @@ public Map<Location, Set<String>> getAllMissing()
199206
}
200207

201208
@Override
209+
@Measure
202210
public Set<String> getMissing( final Location location )
203211
{
204212
logger.debug( "[NFC] getMissing for {} start", location );
@@ -219,6 +227,7 @@ public Set<String> getMissing( final Location location )
219227
}
220228

221229
@Override
230+
@Measure
222231
public Map<Location, Set<String>> getAllMissing( int pageIndex, int pageSize )
223232
{
224233
logger.debug( "[NFC] getAllMissing start, pageIndex: {}, pageSize: {}", pageIndex, pageSize );
@@ -255,6 +264,7 @@ public Map<Location, Set<String>> getAllMissing( int pageIndex, int pageSize )
255264
* @return
256265
*/
257266
@Override
267+
@Measure
258268
public Set<String> getMissing( Location location, int pageIndex, int pageSize )
259269
{
260270
logger.debug( "[NFC] getMissing for {} start, pageIndex: {}, pageSize: {}", location, pageIndex, pageSize );
@@ -280,6 +290,7 @@ public Set<String> getMissing( Location location, int pageIndex, int pageSize )
280290
}
281291

282292
@Override
293+
@Measure
283294
public long getSize( StoreKey storeKey )
284295
{
285296
Query query = queryFactory.from( NfcConcreteResourceWrapper.class )
@@ -295,6 +306,7 @@ public long getSize( StoreKey storeKey )
295306
}
296307

297308
@Override
309+
@Measure
298310
public long getSize()
299311
{
300312
return nfcCache.execute( (cache) -> new Long( cache.size() ) );

db/common/src/main/java/org/commonjava/indy/db/common/AbstractStoreDataManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public ArtifactStoreQuery<ArtifactStore> query()
6262
protected abstract ArtifactStore getArtifactStoreInternal( final StoreKey key );
6363

6464
@Override
65+
@Measure
6566
public ArtifactStore getArtifactStore( final StoreKey key )
6667
throws IndyDataException
6768
{
@@ -154,6 +155,7 @@ protected void postDelete( final ArtifactStore store, final ChangeSummary summar
154155
protected abstract ArtifactStore removeArtifactStoreInternal( StoreKey key );
155156

156157
@Override
158+
@Measure
157159
public void deleteArtifactStore( final StoreKey key, final ChangeSummary summary,
158160
final EventMetadata eventMetadata )
159161
throws IndyDataException

db/common/src/main/java/org/commonjava/indy/db/common/DefaultArtifactStoreQuery.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ public boolean isEmpty()
154154
}
155155

156156
@Override
157+
@Measure
157158
public List<T> getAll()
158159
throws IndyDataException
159160
{
@@ -210,6 +211,7 @@ public Stream<T> stream( Predicate<ArtifactStore> filter )
210211
}
211212

212213
@Override
214+
@Measure
213215
public List<T> getAll( Predicate<ArtifactStore> filter )
214216
throws IndyDataException
215217
{
@@ -245,6 +247,7 @@ public boolean containsByName( String name )
245247
}
246248

247249
@Override
250+
@Measure
248251
public Set<Group> getGroupsContaining( StoreKey storeKey )
249252
throws IndyDataException
250253
{
@@ -254,6 +257,7 @@ public Set<Group> getGroupsContaining( StoreKey storeKey )
254257
}
255258

256259
@Override
260+
@Measure
257261
public List<RemoteRepository> getRemoteRepositoryByUrl( String url )
258262
throws IndyDataException
259263
{
@@ -366,6 +370,7 @@ public List<RemoteRepository> getRemoteRepositoryByUrl( String url )
366370
}
367371

368372
@Override
373+
@Measure
369374
public List<ArtifactStore> getOrderedConcreteStoresInGroup( final String groupName )
370375
throws IndyDataException
371376
{
@@ -376,6 +381,7 @@ public List<ArtifactStore> getOrderedConcreteStoresInGroup( final String groupNa
376381
}
377382

378383
@Override
384+
@Measure
379385
public List<ArtifactStore> getOrderedStoresInGroup( final String groupName )
380386
throws IndyDataException
381387
{
@@ -386,6 +392,7 @@ public List<ArtifactStore> getOrderedStoresInGroup( final String groupName )
386392
}
387393

388394
@Override
395+
@Measure
389396
public Set<Group> getGroupsAffectedBy( StoreKey... keys )
390397
throws IndyDataException
391398
{

0 commit comments

Comments
 (0)