Tabnine Logo
ConfigurationResolver.getInstrumentationApplier
Code IndexAdd Tabnine to your IDE (free)

How to use
getInstrumentationApplier
method
in
rocks.inspectit.server.instrumentation.config.ConfigurationResolver

Best Java code snippets using rocks.inspectit.server.instrumentation.config.ConfigurationResolver.getInstrumentationApplier (Showing top 13 results out of 315)

origin: inspectIT/inspectIT

@Test
public void specialAssignments() {
  SpecialMethodSensorAssignment assignment = mock(SpecialMethodSensorAssignment.class);
  IInstrumentationApplier applier = configurationResolver.getInstrumentationApplier(assignment, environment);
  assertThat(applier, is(instanceOf(SpecialInstrumentationApplier.class)));
  assertThat((SpecialMethodSensorAssignment) applier.getSensorAssignment(), is(assignment));
}
origin: inspectIT/inspectIT

@Test
public void methodSensorAssignment() throws BusinessException {
  MethodSensorAssignment assignment = mock(MethodSensorAssignment.class);
  IInstrumentationApplier applier = configurationResolver.getInstrumentationApplier(assignment, environment);
  assertThat(applier, is(instanceOf(MethodSensorInstrumentationApplier.class)));
  assertThat((MethodSensorAssignment) applier.getSensorAssignment(), is(assignment));
}
origin: inspectIT/inspectIT

@Test
public void timerSensorAssignment() throws BusinessException {
  TimerMethodSensorAssignment assignment = mock(TimerMethodSensorAssignment.class);
  IInstrumentationApplier applier = configurationResolver.getInstrumentationApplier(assignment, environment);
  assertThat(applier, is(instanceOf(TimerMethodSensorInstrumentationApplier.class)));
  assertThat((TimerMethodSensorAssignment) applier.getSensorAssignment(), is(assignment));
}
origin: inspectIT/inspectIT

@Test
public void exceptionSensorAssignment() throws BusinessException {
  ExceptionSensorAssignment assignment = mock(ExceptionSensorAssignment.class);
  IInstrumentationApplier applier = configurationResolver.getInstrumentationApplier(assignment, environment);
  assertThat(applier, is(instanceOf(ExceptionSensorInstrumentationApplier.class)));
  assertThat((ExceptionSensorAssignment) applier.getSensorAssignment(), is(assignment));
}
origin: inspectIT/inspectIT

    if (CollectionUtils.isNotEmpty(assignments)) {
      for (AbstractClassSensorAssignment<?> assignment : assignments) {
        appliers.add(getInstrumentationApplier(assignment, environment));
appliers.add(getInstrumentationApplier(functionalAssignment, environment));
origin: inspectIT/inspectIT

  @Test
  public void removedAssignmentNoChange() throws RemoteException {
    Collection<ClassType> types = ImmutableList.of(classTypeOne, classTypeTwo);
    doReturn(instrumentationApplier).when(configurationResolver).getInstrumentationApplier(sensorAssignment, environment);
    doReturn(types).when(classCacheSearchNarrower).narrowByClassSensorAssignment(classCache, sensorAssignment);
    doReturn(Collections.emptyList()).when(instrumentationService).removeInstrumentationPoints(eq(types), Matchers.<Collection<IInstrumentationApplier>> any());
    doReturn(Collections.singleton(sensorAssignment)).when(event).getRemovedSensorAssignments();
    job.setProfileUpdateEvent(event);
    job.run();
    ArgumentCaptor<Collection> captor = ArgumentCaptor.forClass(Collection.class);
    verify(instrumentationService, times(1)).removeInstrumentationPoints(eq(types), captor.capture());
    assertThat((Collection<IInstrumentationApplier>) captor.getValue(), hasSize(1));
    assertThat(((Collection<IInstrumentationApplier>) captor.getValue()).iterator().next(), is(instrumentationApplier));
    verifyNoMoreInteractions(instrumentationService);
    verifyZeroInteractions(environment, eventPublisher);
  }
}
origin: inspectIT/inspectIT

  @Test
  public void removedAssignmentNoChange() {
    Collection<ClassType> types = Collections.singleton(classType);
    doReturn(instrumentationApplier).when(configurationResolver).getInstrumentationApplier(sensorAssignment, environment);
    doReturn(types).when(classCacheSearchNarrower).narrowByClassSensorAssignment(classCache, sensorAssignment);
    doReturn(Collections.emptyList()).when(instrumentationService).removeInstrumentationPoints(eq(types), Matchers.<Collection<IInstrumentationApplier>> any());
    doReturn(Collections.singletonList(sensorAssignment)).when(event).getRemovedSensorAssignments(functionalAssignmentFactory);
    job.setEnvironmentUpdateEvent(event);
    job.run();
    verify(configurationHolder, times(1)).update(updateEnvironment, PLATFORM_ID);
    ArgumentCaptor<Collection> captor = ArgumentCaptor.forClass(Collection.class);
    verify(instrumentationService, times(1)).removeInstrumentationPoints(types, Collections.singleton(instrumentationApplier));
    verifyNoMoreInteractions(instrumentationService);
    verifyZeroInteractions(environment, agentConfiguration, eventPublisher);
  }
}
origin: inspectIT/inspectIT

/**
 * Process the added assignments. New instrumentation points will be added to all the classes in
 * the class cache that fit to the given assignments.
 *
 * @param classSensorAssignments
 *            Collection of added {@link AbstractClassSensorAssignment}s.
 * @return Returns a {@link Collection} of {@link ImmutableClassType} which have been added.
 */
protected Collection<ImmutableClassType> processAddedAssignments(Collection<? extends AbstractClassSensorAssignment<?>> classSensorAssignments) {
  Collection<ImmutableClassType> changedClassTypes = new ArrayList<>();
  // process all class sensor assignments for adding
  for (AbstractClassSensorAssignment<?> assignment : classSensorAssignments) {
    // narrow the search
    Collection<? extends ImmutableClassType> classTypes = classCacheSearchNarrower.narrowByClassSensorAssignment(getClassCache(), assignment);
    // get the applier
    IInstrumentationApplier instrumentationApplier = configurationResolver.getInstrumentationApplier(assignment, getEnvironment());
    // execute
    Collection<? extends ImmutableClassType> instrumentedClassTypes = getClassCache().getInstrumentationService().addInstrumentationPoints(classTypes, getAgentConfiguration(),
        Collections.singleton(instrumentationApplier));
    changedClassTypes.addAll(instrumentedClassTypes);
  }
  return changedClassTypes;
}
origin: inspectIT/inspectIT

@Test
public void addedAssignment() throws RemoteException, BusinessException {
  Collection<ClassType> types = Collections.singleton(classType);
  doReturn(instrumentationApplier).when(configurationResolver).getInstrumentationApplier(sensorAssignment, environment);
  doReturn(types).when(classCacheSearchNarrower).narrowByClassSensorAssignment(classCache, sensorAssignment);
  doReturn(types).when(instrumentationService).addInstrumentationPoints(eq(types), eq(agentConfiguration), Matchers.<Collection<IInstrumentationApplier>> any());
  doReturn(Collections.singletonList(sensorAssignment)).when(event).getAddedSensorAssignments(functionalAssignmentFactory);
  job.setEnvironmentUpdateEvent(event);
  job.run();
  verify(configurationHolder, times(1)).update(updateEnvironment, PLATFORM_ID);
  ArgumentCaptor<Collection> captor = ArgumentCaptor.forClass(Collection.class);
  verify(instrumentationService, times(1)).addInstrumentationPoints(eq(types), eq(agentConfiguration), captor.capture());
  assertThat((Collection<IInstrumentationApplier>) captor.getValue(), hasSize(1));
  assertThat(((Collection<IInstrumentationApplier>) captor.getValue()).iterator().next(), is(instrumentationApplier));
  ArgumentCaptor<ClassInstrumentationChangedEvent> eventCaptor = ArgumentCaptor.forClass(ClassInstrumentationChangedEvent.class);
  verify(eventPublisher).publishEvent(eventCaptor.capture());
  assertThat(eventCaptor.getValue().getAgentId(), is(equalTo(PLATFORM_ID)));
  assertThat(eventCaptor.getValue().getInstrumentationDefinitions(), contains(org.hamcrest.Matchers.<InstrumentationDefinition> hasProperty("className", equalTo("fqn"))));
  verifyNoMoreInteractions(eventPublisher);
  verifyZeroInteractions(environment, agentConfiguration);
}
origin: inspectIT/inspectIT

@Test
public void removedAssignment() throws RemoteException, BusinessException {
  Collection<ClassType> types = Collections.singleton(classType);
  doReturn(instrumentationApplier).when(configurationResolver).getInstrumentationApplier(sensorAssignment, environment);
  doReturn(types).when(classCacheSearchNarrower).narrowByClassSensorAssignment(classCache, sensorAssignment);
  doReturn(types).when(instrumentationService).removeInstrumentationPoints(eq(types), Matchers.<Collection<IInstrumentationApplier>> any());
  doReturn(Collections.singletonList(sensorAssignment)).when(event).getRemovedSensorAssignments(functionalAssignmentFactory);
  job.setEnvironmentUpdateEvent(event);
  job.run();
  verify(configurationHolder, times(1)).update(updateEnvironment, PLATFORM_ID);
  verify(instrumentationService, times(1)).removeInstrumentationPoints(types, Collections.singleton(instrumentationApplier));
  ArgumentCaptor<Collection> captor = ArgumentCaptor.forClass(Collection.class);
  Collection<IInstrumentationApplier> appliers = configurationHolder.getInstrumentationAppliers();
  verify(instrumentationService, times(1)).addInstrumentationPoints(captor.capture(), eq(agentConfiguration), eq(appliers));
  assertThat((Collection<ClassType>) captor.getValue(), hasSize(1));
  assertThat(((Collection<ClassType>) captor.getValue()).iterator().next(), is(classType));
  ArgumentCaptor<ClassInstrumentationChangedEvent> eventCaptor = ArgumentCaptor.forClass(ClassInstrumentationChangedEvent.class);
  verify(eventPublisher).publishEvent(eventCaptor.capture());
  assertThat(eventCaptor.getValue().getAgentId(), is(equalTo(PLATFORM_ID)));
  assertThat(eventCaptor.getValue().getInstrumentationDefinitions(), contains(org.hamcrest.Matchers.<InstrumentationDefinition> hasProperty("className", equalTo("fqn"))));
  verifyNoMoreInteractions(eventPublisher);
  verifyZeroInteractions(environment, agentConfiguration);
}
origin: inspectIT/inspectIT

@Test
public void addedAssignment() throws RemoteException {
  Collection<ClassType> types = ImmutableList.of(classTypeOne, classTypeTwo);
  doReturn(instrumentationApplier).when(configurationResolver).getInstrumentationApplier(sensorAssignment, environment);
  doReturn(types).when(classCacheSearchNarrower).narrowByClassSensorAssignment(classCache, sensorAssignment);
  doReturn(types).when(instrumentationService).addInstrumentationPoints(eq(types), eq(agentConfiguration), Matchers.<Collection<IInstrumentationApplier>> any());
  doReturn(Collections.singleton(sensorAssignment)).when(event).getAddedSensorAssignments();
  job.setProfileUpdateEvent(event);
  job.run();
  ArgumentCaptor<Collection> captor = ArgumentCaptor.forClass(Collection.class);
  verify(instrumentationService, times(1)).addInstrumentationPoints(eq(types), eq(agentConfiguration), captor.capture());
  assertThat((Collection<IInstrumentationApplier>) captor.getValue(), hasSize(1));
  assertThat(((Collection<IInstrumentationApplier>) captor.getValue()).iterator().next(), is(instrumentationApplier));
  ArgumentCaptor<Collection> typeCaptor = ArgumentCaptor.forClass(Collection.class);
  verify(instrumentationService).getInstrumentationResults(typeCaptor.capture());
  assertThat((Collection<ClassType>) typeCaptor.getValue(), hasItems(classTypeOne, classTypeTwo));
  ArgumentCaptor<ClassInstrumentationChangedEvent> eventCaptor = ArgumentCaptor.forClass(ClassInstrumentationChangedEvent.class);
  verify(eventPublisher).publishEvent(eventCaptor.capture());
  assertThat(eventCaptor.getValue().getAgentId(), is(equalTo(10L)));
  Matcher<InstrumentationDefinition> matcherOne = org.hamcrest.Matchers.<InstrumentationDefinition> hasProperty("className", equalTo("fqnOne"));
  Matcher<InstrumentationDefinition> matcherTwo = org.hamcrest.Matchers.<InstrumentationDefinition> hasProperty("className", equalTo("fqnTwo"));
  assertThat(eventCaptor.getValue().getInstrumentationDefinitions(), hasItems(matcherOne, matcherTwo));
  verifyNoMoreInteractions(instrumentationService, eventPublisher);
  verifyZeroInteractions(environment);
}
origin: inspectIT/inspectIT

@Test
public void removedAssignment() throws RemoteException {
  Collection<ClassType> types = ImmutableList.of(classTypeOne, classTypeTwo);
  doReturn(instrumentationApplier).when(configurationResolver).getInstrumentationApplier(sensorAssignment, environment);
  doReturn(types).when(classCacheSearchNarrower).narrowByClassSensorAssignment(classCache, sensorAssignment);
  doReturn(types).when(instrumentationService).removeInstrumentationPoints(eq(types), Matchers.<Collection<IInstrumentationApplier>> any());
  doReturn(Collections.singleton(sensorAssignment)).when(event).getRemovedSensorAssignments();
  job.setProfileUpdateEvent(event);
  job.run();
  ArgumentCaptor<Collection> captor = ArgumentCaptor.forClass(Collection.class);
  verify(instrumentationService, times(1)).removeInstrumentationPoints(eq(types), captor.capture());
  assertThat((Collection<IInstrumentationApplier>) captor.getValue(), hasSize(1));
  assertThat(((Collection<IInstrumentationApplier>) captor.getValue()).iterator().next(), is(instrumentationApplier));
  ArgumentCaptor<Collection> typeCaptor = ArgumentCaptor.forClass(Collection.class);
  verify(instrumentationService).getInstrumentationResults(typeCaptor.capture());
  assertThat((Collection<ClassType>) typeCaptor.getValue(), hasItems(classTypeOne, classTypeTwo));
  Collection<IInstrumentationApplier> appliers = configurationHolder.getInstrumentationAppliers();
  verify(instrumentationService, times(1)).addInstrumentationPoints(captor.capture(), eq(agentConfiguration), eq(appliers));
  assertThat((Collection<ClassType>) captor.getValue(), hasSize(2));
  assertThat(((Collection<ClassType>) captor.getValue()).iterator().next(), is(classTypeOne));
  ArgumentCaptor<ClassInstrumentationChangedEvent> eventCaptor = ArgumentCaptor.forClass(ClassInstrumentationChangedEvent.class);
  verify(eventPublisher).publishEvent(eventCaptor.capture());
  assertThat(eventCaptor.getValue().getAgentId(), is(equalTo(10L)));
  Matcher<InstrumentationDefinition> matcherOne = org.hamcrest.Matchers.<InstrumentationDefinition> hasProperty("className", equalTo("fqnOne"));
  Matcher<InstrumentationDefinition> matcherTwo = org.hamcrest.Matchers.<InstrumentationDefinition> hasProperty("className", equalTo("fqnTwo"));
  assertThat(eventCaptor.getValue().getInstrumentationDefinitions(), hasItems(matcherOne, matcherTwo));
  verifyNoMoreInteractions(instrumentationService, eventPublisher);
  verifyZeroInteractions(environment);
}
origin: inspectIT/inspectIT

/**
 * Process the removed assignments. All instrumentation points affected by the any of these
 * assignments are first completely removed. All classes that have any point removed will be
 * re-analyzed against complete configuration in order to reset the possible points coming not
 * from removed assignments.
 *
 * @param classSensorAssignments
 *            Collection of removed {@link AbstractClassSensorAssignment}s.
 * @return Returns a {@link Collection} of {@link ImmutableClassType} which have been removed.
 */
protected Collection<ImmutableClassType> processRemovedAssignments(Collection<? extends AbstractClassSensorAssignment<?>> classSensorAssignments) {
  Collection<ImmutableClassType> changedClassTypes = new ArrayList<>();
  // process all class sensor assignments for removal
  for (AbstractClassSensorAssignment<?> assignment : classSensorAssignments) {
    // narrow the search
    Collection<? extends ImmutableClassType> classTypes = classCacheSearchNarrower.narrowByClassSensorAssignment(getClassCache(), assignment);
    // get the applier
    IInstrumentationApplier instrumentationApplier = configurationResolver.getInstrumentationApplier(assignment, getEnvironment());
    changedClassTypes.addAll(getClassCache().getInstrumentationService().removeInstrumentationPoints(classTypes, Collections.singleton(instrumentationApplier)));
  }
  // if no class was affected just return
  if (CollectionUtils.isNotEmpty(changedClassTypes)) {
    // if any class was affected re-check those classes against complete configuration
    // because we removed all instrumentation points
    Collection<IInstrumentationApplier> instrumentationAppliers = getConfigurationHolder().getInstrumentationAppliers();
    getClassCache().getInstrumentationService().addInstrumentationPoints(changedClassTypes, getAgentConfiguration(), instrumentationAppliers);
  }
  return changedClassTypes;
}
rocks.inspectit.server.instrumentation.configConfigurationResolvergetInstrumentationApplier

Javadoc

Returns the IInstrumentationApplier for the given sensor assignment and the Environment it's being used in.

Popular methods of ConfigurationResolver

  • getAllExcludeRules
    Returns all ExcludeRules contained in all profiles for the given environment.
  • getEnvironmentForAgent
    Tries to locate one Environment for the given agent name and IPs. If only one Environment fits the a
  • getInstrumentationAppliers
    Returns all instrumentation appliers for one environment.
  • getJmxMonitoringAppliers
    Returns all JMX monitoring appliers for one environment.
  • getConfigurationInfo
    Returns the configuration info based on the given Environment.
  • matches
    Checks if the specified AgentMapping is matching the agent name and IPs.

Popular in Java

  • Updating database using SQL prepared statement
  • onCreateOptionsMenu (Activity)
  • getExternalFilesDir (Context)
  • getContentResolver (Context)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Notification (javax.management)
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now