in apm-sniffer/optional-plugins/nacos-client-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/nacos/v2/NacosRequestOpt.java [47:120]
static {
OPTS.put(InstanceRequest.class, (request, peer) -> {
AbstractSpan span = getNacosExitSpan(peer);
span.setOperationName(span.getOperationName() + ((InstanceRequest) request).getType());
span.tag(NacosConstants.NAME_SPACE_TAG, ((InstanceRequest) request).getNamespace());
span.tag(NacosConstants.GROUP_TAG, ((InstanceRequest) request).getGroupName());
span.tag(NacosConstants.SERVICE_NAME_TAG, ((InstanceRequest) request).getServiceName());
});
OPTS.put(ServiceQueryRequest.class, (request, peer) -> {
AbstractSpan span = getNacosExitSpan(peer);
span.setOperationName(span.getOperationName() + NacosConstants.QUERY_SERVICE);
span.tag(NacosConstants.NAME_SPACE_TAG, ((ServiceQueryRequest) request).getNamespace());
span.tag(NacosConstants.GROUP_TAG, ((ServiceQueryRequest) request).getGroupName());
span.tag(NacosConstants.SERVICE_NAME_TAG, ((ServiceQueryRequest) request).getServiceName());
});
OPTS.put(SubscribeServiceRequest.class, (request, peer) -> {
AbstractSpan span = getNacosExitSpan(peer);
span.setOperationName(span.getOperationName() + (((SubscribeServiceRequest) request).isSubscribe() ?
NacosConstants.SUBSCRIBE_SERVICE : NacosConstants.UNSUBSCRIBE_SERVICE));
span.tag(NacosConstants.NAME_SPACE_TAG, ((SubscribeServiceRequest) request).getNamespace());
span.tag(NacosConstants.GROUP_TAG, ((SubscribeServiceRequest) request).getGroupName());
span.tag(NacosConstants.SERVICE_NAME_TAG, ((SubscribeServiceRequest) request).getServiceName());
});
OPTS.put(ServiceListRequest.class, (request, peer) -> {
AbstractSpan span = getNacosExitSpan(peer);
span.setOperationName(span.getOperationName() + NacosConstants.GET_SERVICE_LIST);
span.tag(NacosConstants.NAME_SPACE_TAG, ((ServiceListRequest) request).getNamespace());
span.tag(NacosConstants.GROUP_TAG, ((ServiceListRequest) request).getGroupName());
span.tag(NacosConstants.SERVICE_NAME_TAG, ((ServiceListRequest) request).getServiceName());
});
OPTS.put(ConfigQueryRequest.class, (request, peer) -> {
AbstractSpan span = getNacosExitSpan(peer);
span.setOperationName(span.getOperationName() + NacosConstants.QUERY_CONFIG);
span.tag(NacosConstants.DATA_ID_TAG, ((ConfigQueryRequest) request).getDataId());
span.tag(NacosConstants.GROUP_TAG, ((ConfigQueryRequest) request).getGroup());
span.tag(NacosConstants.TENANT_TAG, ((ConfigQueryRequest) request).getTenant());
});
OPTS.put(ConfigPublishRequest.class, (request, peer) -> {
AbstractSpan span = getNacosExitSpan(peer);
span.setOperationName(span.getOperationName() + NacosConstants.PUBLISH_CONFIG);
span.tag(NacosConstants.DATA_ID_TAG, ((ConfigPublishRequest) request).getDataId());
span.tag(NacosConstants.GROUP_TAG, ((ConfigPublishRequest) request).getGroup());
span.tag(NacosConstants.TENANT_TAG, ((ConfigPublishRequest) request).getTenant());
});
OPTS.put(ConfigRemoveRequest.class, (request, peer) -> {
AbstractSpan span = getNacosExitSpan(peer);
span.setOperationName(span.getOperationName() + NacosConstants.REMOVE_CONFIG);
span.tag(NacosConstants.DATA_ID_TAG, ((ConfigRemoveRequest) request).getDataId());
span.tag(NacosConstants.GROUP_TAG, ((ConfigRemoveRequest) request).getGroup());
span.tag(NacosConstants.TENANT_TAG, ((ConfigRemoveRequest) request).getTenant());
});
OPTS.put(NotifySubscriberRequest.class, (request, peer) -> {
AbstractSpan span = getNacosEntrySpan(peer);
span.setOperationName(span.getOperationName() + NacosConstants.NOTIFY_SUBSCRIBE_CHANGE);
ServiceInfo serviceInfo = ((NotifySubscriberRequest) request).getServiceInfo();
span.tag(NacosConstants.GROUP_TAG, serviceInfo.getGroupName());
span.tag(NacosConstants.SERVICE_NAME_TAG, serviceInfo.getName());
});
OPTS.put(ConfigChangeNotifyRequest.class, (request, peer) -> {
AbstractSpan span = getNacosEntrySpan(peer);
span.setOperationName(span.getOperationName() + NacosConstants.NOTIFY_CONFIG_CHANGE);
span.tag(NacosConstants.DATA_ID_TAG, ((ConfigChangeNotifyRequest) request).getDataId());
span.tag(NacosConstants.GROUP_TAG, ((ConfigChangeNotifyRequest) request).getGroup());
span.tag(NacosConstants.TENANT_TAG, ((ConfigChangeNotifyRequest) request).getTenant());
});
}