Skip to content

Commit

Permalink
Update package to jakarta9 to match module
Browse files Browse the repository at this point in the history
  • Loading branch information
shakuzen committed Oct 10, 2023
1 parent 9ba2264 commit 6fec15c
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
* limitations under the License.
*/

package io.micrometer.jakarta10.instrument.jms;
package io.micrometer.jakarta9.instrument.jms;

import io.micrometer.common.KeyValue;
import io.micrometer.common.KeyValues;
import jakarta.jms.*;

import io.micrometer.jakarta10.instrument.jms.JmsObservationDocumentation.*;

/**
* Default implementation for {@link JmsProcessObservationConvention}.
*
Expand All @@ -30,23 +28,23 @@
*/
public class DefaultJmsProcessObservationConvention implements JmsProcessObservationConvention {

private static final KeyValue DESTINATION_TEMPORARY = KeyValue.of(LowCardinalityKeyNames.DESTINATION_TEMPORARY,
private static final KeyValue DESTINATION_TEMPORARY = KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.DESTINATION_TEMPORARY,
"true");

private static final KeyValue DESTINATION_DURABLE = KeyValue.of(LowCardinalityKeyNames.DESTINATION_TEMPORARY,
private static final KeyValue DESTINATION_DURABLE = KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.DESTINATION_TEMPORARY,
"false");

private static final KeyValue EXCEPTION_NONE = KeyValue.of(LowCardinalityKeyNames.EXCEPTION, KeyValue.NONE_VALUE);
private static final KeyValue EXCEPTION_NONE = KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.EXCEPTION, KeyValue.NONE_VALUE);

private static final KeyValue OPERATION_PROCESS = KeyValue.of(LowCardinalityKeyNames.OPERATION, "process");
private static final KeyValue OPERATION_PROCESS = KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.OPERATION, "process");

private static final KeyValue DESTINATION_NAME_UNKNOWN = KeyValue.of(HighCardinalityKeyNames.DESTINATION_NAME,
private static final KeyValue DESTINATION_NAME_UNKNOWN = KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.DESTINATION_NAME,
"unknown");

private static final KeyValue MESSAGE_CONVERSATION_ID_UNKNOWN = KeyValue.of(HighCardinalityKeyNames.CONVERSATION_ID,
private static final KeyValue MESSAGE_CONVERSATION_ID_UNKNOWN = KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.CONVERSATION_ID,
"unknown");

private static final KeyValue MESSAGE_ID_UNKNOWN = KeyValue.of(HighCardinalityKeyNames.MESSAGE_ID, "unknown");
private static final KeyValue MESSAGE_ID_UNKNOWN = KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.MESSAGE_ID, "unknown");

@Override
public String getName() {
Expand All @@ -67,7 +65,7 @@ private KeyValue exception(JmsProcessObservationContext context) {
Throwable error = context.getError();
if (error != null) {
String simpleName = error.getClass().getSimpleName();
return KeyValue.of(LowCardinalityKeyNames.EXCEPTION,
return KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.EXCEPTION,
!simpleName.isEmpty() ? simpleName : error.getClass().getName());
}
return EXCEPTION_NONE;
Expand Down Expand Up @@ -98,7 +96,7 @@ protected KeyValue correlationId(JmsProcessObservationContext context) {
if (message.getJMSCorrelationID() == null) {
return MESSAGE_CONVERSATION_ID_UNKNOWN;
}
return KeyValue.of(HighCardinalityKeyNames.CONVERSATION_ID, message.getJMSCorrelationID());
return KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.CONVERSATION_ID, message.getJMSCorrelationID());
}
catch (JMSException exc) {
return MESSAGE_CONVERSATION_ID_UNKNOWN;
Expand All @@ -110,11 +108,11 @@ protected KeyValue destinationName(JmsProcessObservationContext context) {
Destination jmsDestination = context.getCarrier().getJMSDestination();
if (jmsDestination instanceof Queue) {
Queue queue = (Queue) jmsDestination;
return KeyValue.of(HighCardinalityKeyNames.DESTINATION_NAME, queue.getQueueName());
return KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.DESTINATION_NAME, queue.getQueueName());
}
if (jmsDestination instanceof Topic) {
Topic topic = (Topic) jmsDestination;
return KeyValue.of(HighCardinalityKeyNames.DESTINATION_NAME, topic.getTopicName());
return KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.DESTINATION_NAME, topic.getTopicName());
}
return DESTINATION_NAME_UNKNOWN;
}
Expand All @@ -129,7 +127,7 @@ protected KeyValue messageId(JmsProcessObservationContext context) {
if (message.getJMSMessageID() == null) {
return MESSAGE_ID_UNKNOWN;
}
return KeyValue.of(HighCardinalityKeyNames.MESSAGE_ID, message.getJMSMessageID());
return KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.MESSAGE_ID, message.getJMSMessageID());
}
catch (JMSException exc) {
return MESSAGE_ID_UNKNOWN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
* limitations under the License.
*/

package io.micrometer.jakarta10.instrument.jms;
package io.micrometer.jakarta9.instrument.jms;

import io.micrometer.common.KeyValue;
import io.micrometer.common.KeyValues;
import jakarta.jms.*;

import static io.micrometer.jakarta10.instrument.jms.JmsObservationDocumentation.*;

/**
* Default implementation for {@link JmsPublishObservationConvention}.
*
Expand All @@ -30,23 +28,23 @@
*/
public class DefaultJmsPublishObservationConvention implements JmsPublishObservationConvention {

private static final KeyValue DESTINATION_TEMPORARY = KeyValue.of(LowCardinalityKeyNames.DESTINATION_TEMPORARY,
private static final KeyValue DESTINATION_TEMPORARY = KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.DESTINATION_TEMPORARY,
"true");

private static final KeyValue DESTINATION_DURABLE = KeyValue.of(LowCardinalityKeyNames.DESTINATION_TEMPORARY,
private static final KeyValue DESTINATION_DURABLE = KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.DESTINATION_TEMPORARY,
"false");

private static final KeyValue EXCEPTION_NONE = KeyValue.of(LowCardinalityKeyNames.EXCEPTION, KeyValue.NONE_VALUE);
private static final KeyValue EXCEPTION_NONE = KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.EXCEPTION, KeyValue.NONE_VALUE);

private static final KeyValue OPERATION_PUBLISH = KeyValue.of(LowCardinalityKeyNames.OPERATION, "publish");
private static final KeyValue OPERATION_PUBLISH = KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.OPERATION, "publish");

private static final KeyValue MESSAGE_CONVERSATION_ID_UNKNOWN = KeyValue.of(HighCardinalityKeyNames.CONVERSATION_ID,
private static final KeyValue MESSAGE_CONVERSATION_ID_UNKNOWN = KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.CONVERSATION_ID,
"unknown");

private static final KeyValue DESTINATION_NAME_UNKNOWN = KeyValue.of(HighCardinalityKeyNames.DESTINATION_NAME,
private static final KeyValue DESTINATION_NAME_UNKNOWN = KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.DESTINATION_NAME,
"unknown");

private static final KeyValue MESSAGE_ID_UNKNOWN = KeyValue.of(HighCardinalityKeyNames.MESSAGE_ID, "unknown");
private static final KeyValue MESSAGE_ID_UNKNOWN = KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.MESSAGE_ID, "unknown");

@Override
public String getName() {
Expand All @@ -67,7 +65,7 @@ private KeyValue exception(JmsPublishObservationContext context) {
Throwable error = context.getError();
if (error != null) {
String simpleName = error.getClass().getSimpleName();
return KeyValue.of(LowCardinalityKeyNames.EXCEPTION,
return KeyValue.of(JmsObservationDocumentation.LowCardinalityKeyNames.EXCEPTION,
!simpleName.isEmpty() ? simpleName : error.getClass().getName());
}
return EXCEPTION_NONE;
Expand Down Expand Up @@ -100,7 +98,7 @@ protected KeyValue correlationId(JmsPublishObservationContext context) {
if (message == null || message.getJMSCorrelationID() == null) {
return MESSAGE_CONVERSATION_ID_UNKNOWN;
}
return KeyValue.of(HighCardinalityKeyNames.CONVERSATION_ID, message.getJMSCorrelationID());
return KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.CONVERSATION_ID, message.getJMSCorrelationID());
}
catch (JMSException exc) {
return MESSAGE_CONVERSATION_ID_UNKNOWN;
Expand All @@ -116,11 +114,11 @@ protected KeyValue destinationName(JmsPublishObservationContext context) {
Destination jmsDestination = message.getJMSDestination();
if (jmsDestination instanceof Queue) {
Queue queue = (Queue) jmsDestination;
return KeyValue.of(HighCardinalityKeyNames.DESTINATION_NAME, queue.getQueueName());
return KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.DESTINATION_NAME, queue.getQueueName());
}
if (jmsDestination instanceof Topic) {
Topic topic = (Topic) jmsDestination;
return KeyValue.of(HighCardinalityKeyNames.DESTINATION_NAME, topic.getTopicName());
return KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.DESTINATION_NAME, topic.getTopicName());
}
return DESTINATION_NAME_UNKNOWN;
}
Expand All @@ -135,7 +133,7 @@ protected KeyValue messageId(JmsPublishObservationContext context) {
if (message == null || message.getJMSMessageID() == null) {
return MESSAGE_ID_UNKNOWN;
}
return KeyValue.of(HighCardinalityKeyNames.MESSAGE_ID, message.getJMSMessageID());
return KeyValue.of(JmsObservationDocumentation.HighCardinalityKeyNames.MESSAGE_ID, message.getJMSMessageID());
}
catch (JMSException exc) {
return MESSAGE_ID_UNKNOWN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micrometer.jakarta10.instrument.jms;
package io.micrometer.jakarta9.instrument.jms;

import io.micrometer.observation.ObservationRegistry;
import jakarta.jms.Session;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.micrometer.jakarta10.instrument.jms;
package io.micrometer.jakarta9.instrument.jms;

import io.micrometer.common.KeyValue;
import io.micrometer.common.docs.KeyName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.micrometer.jakarta10.instrument.jms;
package io.micrometer.jakarta9.instrument.jms;

import io.micrometer.observation.transport.ReceiverContext;
import jakarta.jms.JMSException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.micrometer.jakarta10.instrument.jms;
package io.micrometer.jakarta9.instrument.jms;

import io.micrometer.observation.Observation;
import io.micrometer.observation.ObservationConvention;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.micrometer.jakarta10.instrument.jms;
package io.micrometer.jakarta9.instrument.jms;

import io.micrometer.common.lang.Nullable;
import io.micrometer.observation.transport.SenderContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.micrometer.jakarta10.instrument.jms;
package io.micrometer.jakarta9.instrument.jms;

import io.micrometer.observation.Observation;
import io.micrometer.observation.ObservationConvention;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micrometer.jakarta10.instrument.jms;
package io.micrometer.jakarta9.instrument.jms;

import io.micrometer.observation.Observation;
import io.micrometer.observation.ObservationRegistry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micrometer.jakarta10.instrument.jms;
package io.micrometer.jakarta9.instrument.jms;

import io.micrometer.common.lang.Nullable;
import io.micrometer.observation.Observation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micrometer.jakarta10.instrument.jms;
package io.micrometer.jakarta9.instrument.jms;

import io.micrometer.observation.ObservationRegistry;
import jakarta.jms.MessageConsumer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
@NonNullFields
@NonNullApi
package io.micrometer.jakarta10.instrument.jms;
package io.micrometer.jakarta9.instrument.jms;

import io.micrometer.common.lang.NonNullApi;
import io.micrometer.common.lang.NonNullFields;
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micrometer.jakarta10;
package io.micrometer.jakarta9;

import com.tngtech.archunit.junit.AnalyzeClasses;
import com.tngtech.archunit.junit.ArchTest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micrometer.jakarta10.instrument.jms;
package io.micrometer.jakarta9.instrument.jms;

import io.micrometer.common.KeyValue;
import jakarta.jms.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micrometer.jakarta10.instrument.jms;
package io.micrometer.jakarta9.instrument.jms;

import io.micrometer.common.KeyValue;
import jakarta.jms.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;

import io.micrometer.jakarta10.instrument.jms.JmsInstrumentation;
import io.micrometer.jakarta9.instrument.jms.JmsInstrumentation;
import io.micrometer.observation.tck.TestObservationRegistry;
import io.micrometer.observation.tck.TestObservationRegistryAssert;
import jakarta.jms.*;
Expand Down

0 comments on commit 6fec15c

Please sign in to comment.