Skip to content

Commit 4dd036c

Browse files
authored
Merge branch 'main' into dependabot/src_shipping-de0ad6d64d
2 parents 18cd5c5 + b58dc42 commit 4dd036c

3 files changed

Lines changed: 30 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ the release.
77

88
## Unreleased
99

10+
* [frontend-proxy] Pass `CHATBOT_HOST`/`CHATBOT_PORT` to the frontend-proxy in
11+
the base compose file. The chatbot upstream cluster lives in the base
12+
`envoy.tmpl.yaml` and `envsubst` runs in-container, so without these vars the
13+
proxy rendered an empty chatbot address and failed Envoy bootstrap validation
14+
whenever the agent stack was not layered on
15+
([#3570](https://github.com/open-telemetry/opentelemetry-demo/pull/3570))
1016
* [llm] Increase `llm` service memory limit from 50M to 100M to prevent a
1117
startup restart loop caused by the container exceeding its memory limit
1218
([#2944](https://github.com/open-telemetry/opentelemetry-demo/issues/2944))

compose.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,8 @@ services:
351351
- FLAGD_UI_PORT
352352
- TELEMETRY_DOCS_HOST
353353
- TELEMETRY_DOCS_PORT
354+
- CHATBOT_HOST
355+
- CHATBOT_PORT
354356
healthcheck:
355357
test: ["CMD", "bash", "-c", "echo > /dev/tcp/localhost/${ENVOY_PORT}"]
356358
start_period: 10s

src/currency/src/server.cpp

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "opentelemetry/trace/span_context_kv_iterable_view.h"
1313
#include "opentelemetry/baggage/baggage.h"
1414
#include "opentelemetry/nostd/string_view.h"
15+
#include "opentelemetry/logs/event_id.h"
1516
#include "logger_common.h"
1617
#include "meter_common.h"
1718
#include "tracer_common.h"
@@ -43,8 +44,16 @@ namespace metrics_api = opentelemetry::metrics;
4344
namespace nostd = opentelemetry::nostd;
4445
namespace semconv = opentelemetry::semconv;
4546

47+
using opentelemetry::logs::EventId;
48+
4649
namespace
4750
{
51+
EventId eventName(nostd::string_view name) {
52+
// The OTLP exporter ignores the numeric EventId and exports only the event name.
53+
// Use 0 to satisfy the C++ API; revisit when the C++ SDK provides guidance.
54+
return EventId{0, name};
55+
}
56+
4857
std::unordered_map<std::string, double> currency_conversion
4958
{
5059
{"EUR", 1.0},
@@ -134,7 +143,7 @@ class CurrencyService final : public oteldemo::CurrencyService::Service
134143
span->AddEvent("Currencies fetched, response sent back");
135144
span->SetStatus(StatusCode::kOk);
136145

137-
logger->Info(std::string(__func__) + " successful");
146+
logger->Info(eventName("currency.get_supported_currencies"), "GetSupportedCurrencies successful");
138147

139148
// Make sure to end your spans!
140149
span->End();
@@ -210,7 +219,11 @@ class CurrencyService final : public oteldemo::CurrencyService::Service
210219
span->AddEvent("Conversion successful, response sent back");
211220
span->SetStatus(StatusCode::kOk);
212221

213-
logger->Info(std::string(__func__) + " conversion successful");
222+
logger->Info(eventName("currency.conversion"),
223+
"conversion successful",
224+
opentelemetry::common::MakeAttributes(
225+
{{"currency.from", from_code.c_str()},
226+
{"currency.to", to_code.c_str()}}));
214227

215228
// End the span
216229
span->End();
@@ -220,7 +233,7 @@ class CurrencyService final : public oteldemo::CurrencyService::Service
220233
span->AddEvent("Conversion failed");
221234
span->SetStatus(StatusCode::kError);
222235

223-
logger->Error(std::string(__func__) + " conversion failure");
236+
logger->Error(eventName("currency.conversion_failed"), "conversion failure");
224237

225238
span->End();
226239
return Status::CANCELLED;
@@ -244,7 +257,9 @@ void RunServer(uint16_t port)
244257

245258
if (ipv6_enabled == "true") {
246259
ip = "[::]";
247-
logger->Info("Overwriting Localhost IP: " + ip);
260+
logger->Info(eventName("currency.server.ip_overwrite"),
261+
"Overwriting Localhost IP",
262+
opentelemetry::common::MakeAttributes({{"server.address", ip.c_str()}}));
248263
}
249264

250265
std::string address(ip + ":" + std::to_string(port));
@@ -258,7 +273,9 @@ void RunServer(uint16_t port)
258273
builder.AddListeningPort(address, grpc::InsecureServerCredentials());
259274

260275
std::unique_ptr<Server> server(builder.BuildAndStart());
261-
logger->Info("Currency Server listening on port: " + address);
276+
logger->Info(eventName("currency.server.started"),
277+
"Currency Server started",
278+
opentelemetry::common::MakeAttributes({{"server.address", address.c_str()}}));
262279
server->Wait();
263280
server->Shutdown();
264281
}

0 commit comments

Comments
 (0)