Skip to content

Commit

Permalink
fix(orca): fix NPE caused by late assignment of pipeline id
Browse files Browse the repository at this point in the history
  • Loading branch information
robfletcher committed Aug 23, 2017
1 parent 1e4c9cf commit ceed4c9
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,14 @@

class AlertOnAccessMap<E extends Execution<E>> extends ForwardingMap<String, Object> {

private final Execution<E> execution;
private final Map<String, Object> delegate;
private final Registry registry;
private final Id counterId;

AlertOnAccessMap(Execution<E> execution, Registry registry, Map<String, Object> delegate) {
private AlertOnAccessMap(Execution<E> execution, Registry registry, Map<String, Object> delegate) {
this.execution = execution;
this.registry = registry;
this.delegate = delegate;
counterId = registry
.createId("global.context.access")
.withTag("execution", execution.getId())
.withTag("application", execution.getApplication())
.withTag("name", execution.getName());
}

AlertOnAccessMap(Execution<E> execution, Registry registry) {
Expand All @@ -46,8 +42,14 @@ class AlertOnAccessMap<E extends Execution<E>> extends ForwardingMap<String, Obj
@Override protected Map<String, Object> delegate() { return delegate; }

@Override public Object get(@Nullable Object key) {
Id counterId = registry
.createId("global.context.access")
.withTag("execution", execution.getId())
.withTag("application", execution.getApplication())
.withTag("name", execution.getName())
.withTag("key", String.valueOf(key));
registry
.counter(counterId.withTag("key", String.valueOf(key)))
.counter(counterId)
.increment();
return super.get(key);
}
Expand Down

0 comments on commit ceed4c9

Please sign in to comment.