22
33import org .springframework .beans .factory .annotation .Autowired ;
44import org .springframework .context .annotation .Bean ;
5- import org .springframework .context .annotation .PropertySource ;
6- import org .springframework .core .env .Environment ;
75import org .springframework .http .HttpEntity ;
86import org .springframework .http .HttpHeaders ;
97import org .springframework .http .HttpMethod ;
1614
1715import com .fasterxml .jackson .databind .ObjectMapper ;
1816
19- import io .sentry .IHub ;
2017import io .sentry .ISpan ;
21- import io .sentry .ITransaction ;
2218import io .sentry .Sentry ;
2319import io .sentry .SpanStatus ;
2420import io .sentry .protocol .User ;
21+ import io .sentry .IScopes ;
2522
2623import java .util .ArrayList ;
27- import java .util .HashMap ;
2824import java .util .List ;
2925import java .util .Map ;
3026
@@ -53,7 +49,7 @@ public AppController(RestTemplate restTemplate) {
5349 private DatabaseHelper dbHelper = new DatabaseHelper ();
5450
5551 @ Autowired
56- private IHub hub ;
52+ private IScopes scopes ;
5753
5854 // headers passed by frontend
5955 @ Bean
@@ -166,37 +162,37 @@ public String Logback() {
166162 @ CrossOrigin
167163 @ GetMapping ("/products" )
168164 public String GetProductsDelay (HttpServletRequest request ) {
169- ISpan span = hub .getSpan ().startChild ("Overhead" , "Set tags" );
165+ ISpan span = scopes .getSpan ().startChild ("Overhead" , "Set tags" );
170166 setTags (request );
171167 span .finish ();
172168
173169 String fooResourceUrl = "https://application-monitoring-ruby-dot-sales-engineering-sf.appspot.com" ;
174170 ResponseEntity <String > response = restTemplate .exchange (fooResourceUrl + "/api" , HttpMethod .GET ,new HttpEntity <>(headers ), String .class );
175171
176- String allProducts = dbHelper .mapAllProducts (hub .getSpan ());
172+ String allProducts = dbHelper .mapAllProducts (scopes .getSpan ());
177173 return allProducts ;
178174 }
179175
180176 @ CrossOrigin
181177 @ GetMapping ("/products-join" )
182178 public String GetProducts (HttpServletRequest request ) {
183- ISpan span = hub .getSpan ().startChild ("Overhead" , "Set tags" );
179+ ISpan span = scopes .getSpan ().startChild ("Overhead" , "Set tags" );
184180 setTags (request );
185181 span .finish ();
186182
187183 String fooResourceUrl = "https://application-monitoring-ruby-dot-sales-engineering-sf.appspot.com" ;
188184 ResponseEntity <String > response = restTemplate .exchange (fooResourceUrl + "/api" , HttpMethod .GET ,new HttpEntity <>(headers ), String .class );
189185
190186
191- String allProducts = dbHelper .mapAllProductsJoin (hub .getSpan ());
187+ String allProducts = dbHelper .mapAllProductsJoin (scopes .getSpan ());
192188 return allProducts ;
193189 }
194190
195191 @ CrossOrigin
196192 @ PostMapping ("/checkout" )
197193 public String CheckoutCart (HttpServletRequest request , @ RequestBody String payload ) throws Exception {
198194
199- ISpan span = hub .getSpan ().startChild ("Overhead" , "Set tags and map payload to Cart object" );
195+ ISpan span = scopes .getSpan ().startChild ("Overhead" , "Set tags and map payload to Cart object" );
200196 setTags (request );
201197
202198 JSONObject json = new JSONObject (payload );
@@ -207,12 +203,12 @@ public String CheckoutCart(HttpServletRequest request, @RequestBody String paylo
207203
208204 span .finish ();
209205
210- ISpan checkoutSpan = hub .getSpan ().startChild ("Process Order" , "Checkout Cart quantities" );
206+ ISpan checkoutSpan = scopes .getSpan ().startChild ("Process Order" , "Checkout Cart quantities" );
211207
212208 checkout (cart .getQuantities (), checkoutSpan );
213209
214210 checkoutSpan .finish ();
215- return "success " ;
211+ return "Checkout completed " ;
216212 }
217213
218214 private void checkout (Map <String , Integer > quantities , ISpan span ) {
0 commit comments