Skip to content

Commit

Permalink
Merge pull request dianping#885 from sesamezhu/master
Browse files Browse the repository at this point in the history
customize cat uri type
  • Loading branch information
youyong205 committed Sep 26, 2015
2 parents 415b071 + 54331de commit b946495
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cat-client/src/main/java/com/dianping/cat/CatConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class CatConstants {

public static final String CAT_PAGE_URI = "cat-page-uri";

public static final String CAT_PAGE_TYPE = "cat-page-type";

/**
* Pigeon Transation Type
*/
Expand Down
13 changes: 11 additions & 2 deletions cat-client/src/main/java/com/dianping/cat/servlet/CatFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,19 @@ private void customizeStatus(Transaction t, HttpServletRequest req) {
}

private void customizeUri(Transaction t, HttpServletRequest req) {
if(!(t instanceof DefaultTransaction)) {
return;
}

Object catPageUri = req.getAttribute(CatConstants.CAT_PAGE_URI);
DefaultTransaction transaction = (DefaultTransaction) t;
if (catPageUri != null) {
transaction.setName(catPageUri.toString());
}

if (t instanceof DefaultTransaction && catPageUri instanceof String) {
((DefaultTransaction) t).setName(catPageUri.toString());
Object catPageType = req.getAttribute(CatConstants.CAT_PAGE_TYPE);
if(catPageType != null) {
transaction.setType(catPageType.toString());
}
}

Expand Down

0 comments on commit b946495

Please sign in to comment.