1 /* 2 * Copyright 2018, OpenCensus Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package io.opencensus.contrib.spring.aop; 18 19 import java.sql.SQLException; 20 21 public class Sample { 22 @Traced() example1()23 void example1() { 24 // do work 25 } 26 27 @Traced(name = "custom-span-name") example2()28 void example2() { 29 // do moar work 30 } 31 32 @Traced() call(long delay)33 void call(long delay) throws Exception { 34 Thread.sleep(delay); 35 } 36 37 @Traced(name = "blah") custom(long delay)38 void custom(long delay) throws Exception { 39 Thread.sleep(delay); 40 } 41 42 @Traced() boom()43 void boom() throws Exception { 44 throw new Exception("boom"); 45 } 46 execute(String sql)47 public void execute(String sql) throws SQLException {} 48 executeQuery(String sql)49 public void executeQuery(String sql) throws SQLException {} 50 executeUpdate(String sql)51 public void executeUpdate(String sql) throws SQLException {} 52 executeLargeUpdate(String sql)53 public void executeLargeUpdate(String sql) throws SQLException {} 54 } 55