Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ the release.
([#2614](https://github.com/open-telemetry/opentelemetry-demo/pull/2614))
* [grafana] Update grafana version to 12.2.0
([#2615](https://github.com/open-telemetry/opentelemetry-demo/pull/2615))
* [chore] Make containers of components (e.g. `ad`, `fraud-detection`)
capable of starting without being injected `OTEL_*` environment variables
([#2621](https://github.com/open-telemetry/opentelemetry-demo/pull/2621))

## 2.1.3

Expand Down
3 changes: 3 additions & 0 deletions src/flagd-ui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/flagd_ui ./

EXPOSE ${FLAGD_UI_PORT}

# Set default value for OTEL_* config if not provided by Docker Compose or K8s
ENV OTEL_SERVICE_NAME="flagd-ui"

# If using an environment that doesn't automatically reap zombie processes, it is
# advised to add an init process such as tini via `apt-get install`
# above and adding an entrypoint. See https://github.com/krallin/tini for details
Expand Down
6 changes: 6 additions & 0 deletions src/frontend-proxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ WORKDIR /home/envoy

COPY ./src/frontend-proxy/envoy.tmpl.yaml envoy.tmpl.yaml

# Set default value for OTEL_* config if not provided by Docker Compose or K8s
ENV OTEL_SERVICE_NAME="frontend-proxy"
ENV OTEL_COLLECTOR_HOST=localhost
ENV OTEL_COLLECTOR_PORT_GRPC=4317
ENV OTEL_COLLECTOR_PORT_HTTP=4318

EXPOSE ${ENVOY_PORT}
EXPOSE ${ENVOY_ADMIN_PORT}
ENTRYPOINT ["/bin/sh", "-c", "envsubst < envoy.tmpl.yaml > envoy.yaml && envoy -c envoy.yaml;"]
5 changes: 5 additions & 0 deletions src/image-provider/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ USER 101
COPY src/image-provider/static/ /static/
COPY src/image-provider/nginx.conf.template /nginx.conf.template

# Set default value for OTEL_* config if not provided by Docker Compose or K8s
ENV OTEL_SERVICE_NAME="image-provider"
ENV OTEL_COLLECTOR_HOST=localhost
ENV OTEL_COLLECTOR_PORT_GRPC=4317

EXPOSE ${IMAGE_PROVIDER_PORT}

STOPSIGNAL SIGQUIT
Expand Down
2 changes: 1 addition & 1 deletion src/payment/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const transport = pino.transport({
const logger = pino(transport, {
mixin() {
return {
'service.name': process.env['OTEL_SERVICE_NAME'],
'service.name': process.env['OTEL_SERVICE_NAME'] || 'payment',
}
},
formatters: {
Expand Down
13 changes: 3 additions & 10 deletions src/recommendation/recommendation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,23 +127,16 @@ def check_feature_flag(flag_name: str):


if __name__ == "__main__":
service_name = must_map_env('OTEL_SERVICE_NAME')
api.set_provider(FlagdProvider(host=os.environ.get('FLAGD_HOST', 'flagd'), port=os.environ.get('FLAGD_PORT', 8013)))
api.add_hooks([TracingHook()])

# Initialize Traces and Metrics
tracer = trace.get_tracer_provider().get_tracer(service_name)
meter = metrics.get_meter_provider().get_meter(service_name)
tracer = trace.get_tracer_provider().get_tracer("recommendation-server")
meter = metrics.get_meter_provider().get_meter("recommendation-server")
Comment on lines +134 to +135
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this parameter is the instrumentation scope nam, not the service name.

rec_svc_metrics = init_metrics(meter)

# Initialize Logs
logger_provider = LoggerProvider(
resource=Resource.create(
{
'service.name': service_name,
}
),
)
logger_provider = LoggerProvider()
set_logger_provider(logger_provider)
log_exporter = OTLPLogExporter(insecure=True)
logger_provider.add_log_record_processor(BatchLogRecordProcessor(log_exporter))
Expand Down
Loading