From 128f78f87b6396fb1e95b90828ab23dbd6015abd Mon Sep 17 00:00:00 2001 From: Pierre Tessier Date: Fri, 5 Aug 2022 00:39:20 -0400 Subject: [PATCH] [currency] - add span attributes (#265) * add conversion from/to attributes * currency service attributes --- CHANGELOG.md | 2 ++ docs/manual_span_attributes.md | 3 ++- src/currencyservice/src/server.cpp | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc38c355b8..750785af29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,3 +55,5 @@ significant modifications will be credited to OpenTelemetry Authors. ([#255](https://github.com/open-telemetry/opentelemetry-demo/pull/255)) * Added spanmetrics processor to otelcol ([#212](https://github.com/open-telemetry/opentelemetry-demo/pull/212)) +* Added span attributes to currency service +([#265](https://github.com/open-telemetry/opentelemetry-demo/pull/265)) diff --git a/docs/manual_span_attributes.md b/docs/manual_span_attributes.md index 8988b19a5d..f2c4fa5762 100644 --- a/docs/manual_span_attributes.md +++ b/docs/manual_span_attributes.md @@ -28,7 +28,8 @@ This document contains the list of manual Span Attributes used throughout the de ## CurrencyService -* None yet +* `app.currency.conversion.from` +* `app.currency.conversion.to` ## EmailService diff --git a/src/currencyservice/src/server.cpp b/src/currencyservice/src/server.cpp index 28f5200031..9d60b7abbd 100644 --- a/src/currencyservice/src/server.cpp +++ b/src/currencyservice/src/server.cpp @@ -185,6 +185,9 @@ class CurrencyService final : public hipstershop::CurrencyService::Service getUnitsAndNanos(*response, final); response->set_currency_code(to_code); + span->SetAttribute("app.currency.conversion.from", from_code); + span->SetAttribute("app.currency.conversion.to", to_code); + // End the span span->AddEvent("Conversion successful, response sent back"); span->SetStatus(StatusCode::kOk);