Skip to content

Extend telemetry demo to include logs and traces#73

Merged
eeisegn merged 3 commits intomainfrom
feat/add-logs-and-traces-examples
Mar 20, 2026
Merged

Extend telemetry demo to include logs and traces#73
eeisegn merged 3 commits intomainfrom
feat/add-logs-and-traces-examples

Conversation

@eeisegn
Copy link
Contributor

@eeisegn eeisegn commented Mar 20, 2026

Summary by CodeRabbit

  • New Features

    • Expanded telemetry stack to include log aggregation (Loki) and distributed tracing (Tempo) alongside existing metrics.
    • Added automatic Grafana datasource provisioning with pre-configured Prometheus, Loki, and Tempo connections.
  • Documentation

    • Updated demo guide with expanded observability architecture, new visualization steps, and separate log and trace viewing instructions.
  • Chores

    • Updated demo configuration for production environment, including disabled tracing and dynamic logging changes.
    • Improved CI/CD workflows for tag-based release handling.

@eeisegn eeisegn requested a review from dopicatto March 20, 2026 15:33
@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

📝 Walkthrough

Walkthrough

The PR expands the observability stack from OpenTelemetry + Prometheus + Grafana to include Promtail, Loki, and Tempo for logs and traces. Configuration files are added for the new services, docker-compose is updated to orchestrate them, documentation is revised to reflect the new stack, and minor GitHub Actions workflow updates are applied.

Changes

Cohort / File(s) Summary
Telemetry Stack Configuration
telemetry-demo/loki.yaml, telemetry-demo/tempo.yaml, telemetry-demo/promtail-config.yml, telemetry-demo/grafana-datasources.yaml
New configuration files for Loki (log aggregation), Tempo (trace backend), Promtail (log scraper), and Grafana datasources connecting all three with exemplar-to-trace linking and trace-to-logs integration.
Docker Compose Infrastructure
telemetry-demo/docker-compose.yml
Removed version declaration; added Promtail, Loki, and Tempo services; configured log volume mounts for scanoss-api; enabled anonymous Grafana access with datasource provisioning; added restart policies and networking for all services.
Telemetry Documentation
telemetry-demo/README.md, telemetry-demo/TELEMETRY_CONFIG.md
Updated demo documentation to describe expanded stack (logs + traces), revised Quick Start scanning intervals (0.5s → 2.0s) and added one-off scan command, replaced "Metrics" section with detailed Visualisation/Data Sources steps for Grafana, Loki, and Tempo.
Application Configuration
telemetry-demo/config/app-config-demo.json
Changed runtime values: App.Trace (true → false), App.Mode (dev → prod), Logging.DynamicLogging (true → false), extended logging output paths to include log file path, disabled ExtraMetrics.
Telemetry Pipeline
telemetry-demo/otel-collector-config.yml
Added OTLP/Tempo exporter (endpoint: tempo:4317); updated traces pipeline exporters to include Tempo alongside debug output.
GitHub Actions Workflows
.github/workflows/go-ci.yml, .github/workflows/golangci-lint.yml, .github/workflows/release.yml
Minor comment updates and whitespace fixes in go-ci and golangci-lint; added explicit ref: ${{ github.ref }} parameter to checkout step in release workflow.
Repository Organization
telemetry-demo/logs/scanoss/api/.gitignore
Added .log pattern to ignore application log files from version control.

Sequence Diagram

sequenceDiagram
    actor App as scanoss-api
    participant Promtail as Promtail<br/>(Log Scraper)
    participant Loki as Loki<br/>(Log Aggregation)
    participant OTEL as OTEL-Collector
    participant Tempo as Tempo<br/>(Trace Backend)
    participant Prometheus as Prometheus<br/>(Metrics)
    participant Grafana as Grafana<br/>(Visualization)

    rect rgba(100, 150, 200, 0.5)
        Note over App,Prometheus: Telemetry Collection Flow
        App->>App: Write logs & traces to stderr/file
        Promtail->>App: Scrape logs from /var/log/scanoss/api/*.log
        Promtail->>Loki: Push logs via HTTP
        Loki->>Loki: Store & index logs
        
        App->>OTEL: Send traces & metrics via OTLP
        OTEL->>Tempo: Forward traces to tempo:4317
        Tempo->>Tempo: Store traces (72h retention)
        OTEL->>Prometheus: Forward metrics
        Prometheus->>Prometheus: Store metrics
    end

    rect rgba(100, 200, 100, 0.5)
        Note over Grafana: Visualization & Analysis
        Grafana->>Prometheus: Query metrics (exemplars linked)
        Prometheus->>Grafana: Metrics + trace_id exemplars
        Grafana->>Tempo: Click exemplar → fetch trace
        Grafana->>Loki: Query logs via TraceQL or trace_id
        Loki->>Grafana: Display related log entries
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • scanoss-qg
  • agustingroh

Poem

🐰 Hops of joy through logs that flow,
Traces dancing to and fro,
Tempo keeps them safe at rest,
Loki proves observability's the best!
With Promtail scraping all the way,
Our telemetry brightens every day!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately summarizes the main objective of the pull request: extending the telemetry demo to add logs and traces support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-logs-and-traces-examples

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
telemetry-demo/docker-compose.yml (1)

61-67: ⚠️ Potential issue | 🟠 Major

Add --enable-feature=exemplar-storage to enable Prometheus exemplar support.

The grafana-datasources.yaml configures exemplarTraceIdDestinations to link Prometheus metrics to Tempo traces via exemplars. However, this feature requires the --enable-feature=exemplar-storage flag to be set on Prometheus. Without it, Prometheus won't store exemplars and the trace linking will silently produce no results.

🔧 Proposed fix
     command:
       - '--config.file=/etc/prometheus/prometheus.yml'
       - '--storage.tsdb.path=/prometheus'  
       - '--web.console.libraries=/etc/prometheus/console_libraries'
       - '--web.console.templates=/etc/prometheus/consoles'
       - '--storage.tsdb.retention.time=200h'
       - '--web.enable-lifecycle'
+      - '--enable-feature=exemplar-storage'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@telemetry-demo/docker-compose.yml` around lines 61 - 67, The Prometheus
container command block is missing the feature flag to store exemplars; add the
flag --enable-feature=exemplar-storage to the Prometheus process invocation (the
command list where '--config.file=...', '--storage.tsdb.path=...', etc. are
defined) so that exemplars will be persisted and Grafana's
exemplarTraceIdDestinations (in your grafana-datasources.yaml) can link metrics
to Tempo traces.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@telemetry-demo/grafana-datasources.yaml`:
- Around line 1-13: The Grafana datasource config enables
exemplarTraceIdDestinations for Prometheus but Prometheus must be started with
exemplar storage enabled; update the Prometheus service startup (the Prometheus
container/service that runs Prometheus) to include the flag
--enable-feature=exemplar-storage so exemplars are persisted and
exemplarTraceIdDestinations in Prometheus (the Prometheus datasource) will
produce data.

In `@telemetry-demo/logs/scanoss/api/.gititnore`:
- Around line 1-2: Rename the misnamed ignore file `.gititnore` to `.gitignore`
so Git applies the `*.log` rule; locate the file named `.gititnore` in the
project and move/rename it to `.gitignore` (preserve the file contents exactly),
then verify that `*.log` is now respected by Git.

In `@telemetry-demo/README.md`:
- Line 67: The numbered list item in README.md contains a missing space after
the numeral; update the list line that currently reads "3.Type `scanoss` into
the \"Search metric\" field to list all SCANOSS metrics" to include a space
after the period so it becomes "3. Type `scanoss` into the \"Search metric\"
field to list all SCANOSS metrics".
- Line 144: Fix the README table row that currently reads "`tempo.yml` | Defines
Temop traces setup" by correcting the typo "Temop" to "Tempo" and updating the
filename token from `tempo.yml` to `tempo.yaml` so the table entry reads
"`tempo.yaml` | Defines Tempo traces setup"; ensure the corrected text appears
in the README table cell that contains the original "`tempo.yml`" entry.
- Line 41: Fix the typo in the README sentence that currently reads "To logins
to Grafana, please browse the following URL:" by changing it to "To login to
Grafana, please browse the following URL:"; locate the exact line in
telemetry-demo/README.md containing that sentence and update the wording
accordingly.
- Around line 34-37: Fix the Markdown fence in the README example: the one-off
scan code block starts with three backticks but ends with four; update the
closing fence to three backticks so the block is properly fenced (the example
showing the curl command / echo 'file=056f9b... | curl -s -X POST ... -F
'file=@-;filename=test.wfp'' should be wrapped with matching ``` on both start
and end).

In `@telemetry-demo/tempo.yaml`:
- Around line 29-37: The Tempo config defines metrics_generator.remote_write to
push to Prometheus but Prometheus is missing the required remote-write receiver
flag; update the Prometheus service command in docker-compose.yml to include the
--web.enable-remote-write-receiver flag (alongside the existing --config.file
entry) so that Tempo's metrics_generator.remote_write endpoint is accepted and
remote writes are not rejected.

---

Outside diff comments:
In `@telemetry-demo/docker-compose.yml`:
- Around line 61-67: The Prometheus container command block is missing the
feature flag to store exemplars; add the flag --enable-feature=exemplar-storage
to the Prometheus process invocation (the command list where
'--config.file=...', '--storage.tsdb.path=...', etc. are defined) so that
exemplars will be persisted and Grafana's exemplarTraceIdDestinations (in your
grafana-datasources.yaml) can link metrics to Tempo traces.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bb29cd7d-2d89-49f5-8cc8-0bf8a5388a6c

📥 Commits

Reviewing files that changed from the base of the PR and between bef2708 and 53afeb5.

📒 Files selected for processing (10)
  • telemetry-demo/README.md
  • telemetry-demo/TELEMETRY_CONFIG.md
  • telemetry-demo/config/app-config-demo.json
  • telemetry-demo/docker-compose.yml
  • telemetry-demo/grafana-datasources.yaml
  • telemetry-demo/logs/scanoss/api/.gititnore
  • telemetry-demo/loki.yaml
  • telemetry-demo/otel-collector-config.yml
  • telemetry-demo/promtail-config.yml
  • telemetry-demo/tempo.yaml

| `promtail-config.yml` | Configures Promtail log Collector pipeline |
| `loki.yaml` | Defines Loki logging setup |
| `prometheus.yml` | Defines Prometheus scrape targets |
| `tempo.yml` | Defines Temop traces setup |
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Typo: "Temop" should be "Tempo".

📝 Proposed fix
-| `tempo.yml`                   | Defines Temop traces setup                   |
+| `tempo.yaml`                  | Defines Tempo traces setup                   |

Note: The filename in the table should also be tempo.yaml (not tempo.yml) to match the actual filename added in this PR.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| `tempo.yml` | Defines Temop traces setup |
| `tempo.yaml` | Defines Tempo traces setup |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@telemetry-demo/README.md` at line 144, Fix the README table row that
currently reads "`tempo.yml` | Defines Temop traces setup" by correcting the
typo "Temop" to "Tempo" and updating the filename token from `tempo.yml` to
`tempo.yaml` so the table entry reads "`tempo.yaml` | Defines Tempo traces
setup"; ensure the corrected text appears in the README table cell that contains
the original "`tempo.yml`" entry.

Copy link

@dopicatto dopicatto left a comment

Choose a reason for hiding this comment

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

Looks good overall — nice addition to the observability demo. A couple of functional things to address before merging:
Prometheus flags (both Major):
The metrics_generator in tempo.yaml does remote write to Prometheus, and grafana-datasources.yaml has exemplarTraceIdDestinations configured — but the Prometheus service in docker-compose.yml is missing both required flags:
yamlcommand:

  • '--config.file=/etc/prometheus/prometheus.yml'
  • '--web.enable-remote-write-receiver'
  • '--enable-feature=exemplar-storage'
    Without these, Tempo's remote write will silently 404 and exemplar trace linking won't produce any data.
    Minor typos (easy fixes):

logs/scanoss/api/.gititnore → rename to .gitignore
README: closing fence has 4 backticks instead of 3
README: "To logins to Grafana" → "To login to"
README: "Temop" → "Tempo", and tempo.yml → tempo.yaml to match actual filename
README: missing space after "3." in numbered list

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (3)
telemetry-demo/docker-compose.yml (3)

108-118: Remove commented-out code.

The commented-out GF_SECURITY_ADMIN_PASSWORD block (lines 111-112) is unnecessary clutter. Since anonymous admin access is now used for dev convenience, the old configuration can be deleted.

🧹 Proposed cleanup
     environment:
       - GF_AUTH_ANONYMOUS_ENABLED=true
       - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin   # dev convenience — lock down for prod
-#    environment:
-#      - GF_SECURITY_ADMIN_PASSWORD=admin
     volumes:
       - grafana_data:/var/lib/grafana
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@telemetry-demo/docker-compose.yml` around lines 108 - 118, Remove the
commented-out GF_SECURITY_ADMIN_PASSWORD environment block to clean up unused
configuration: delete the two comment lines containing "#    environment:" and
"#      - GF_SECURITY_ADMIN_PASSWORD=admin" (the commented
GF_SECURITY_ADMIN_PASSWORD entry) so only the active environment variables
(GF_AUTH_ANONYMOUS_ENABLED and GF_AUTH_ANONYMOUS_ORG_ROLE) remain.

128-133: Minor: inconsistent volume naming convention.

promtail-positions uses hyphens while other volumes use underscores (prometheus_data, grafana_data, loki_data, tempo_data). Consider using promtail_positions for consistency.

🧹 Proposed fix
 volumes:
   prometheus_data:
   grafana_data:
   loki_data:
   tempo_data:
-  promtail-positions:
+  promtail_positions:

Also update the reference in the promtail service:

     volumes:
       - ./promtail-config.yml:/etc/promtail/promtail-config.yml:ro
       - ./logs/scanoss/api:/var/log/scanoss/api:ro
-      - promtail-positions:/tmp
+      - promtail_positions:/tmp
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@telemetry-demo/docker-compose.yml` around lines 128 - 133, Rename the
inconsistent volume name promtail-positions to promtail_positions to match the
underscore convention used by prometheus_data, grafana_data, loki_data, and
tempo_data; then update the corresponding volume reference in the promtail
service definition (the promtail service's volumes entry that references
promtail-positions) so it uses promtail_positions instead.

32-37: Consider depending on tempo instead of loki.

The otel-collector exports traces to Tempo (per the config), so it should depend on tempo rather than loki. Loki receives logs from Promtail, not from the otel-collector.

♻️ Proposed fix
     depends_on:
       - prometheus
-      - loki
+      - tempo
     networks:
       - monitoring
     restart: unless-stopped
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@telemetry-demo/docker-compose.yml` around lines 32 - 37, The service's
depends_on currently lists 'loki' but the otel-collector exports traces to
Tempo; update the depends_on block to depend on 'tempo' instead of 'loki'
(replace the 'loki' entry with 'tempo' in the depends_on array) and verify there
is a 'tempo' service defined in the compose file so the dependency is valid
(adjust or add the 'tempo' service if missing).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@telemetry-demo/docker-compose.yml`:
- Around line 108-118: Remove the commented-out GF_SECURITY_ADMIN_PASSWORD
environment block to clean up unused configuration: delete the two comment lines
containing "#    environment:" and "#      - GF_SECURITY_ADMIN_PASSWORD=admin"
(the commented GF_SECURITY_ADMIN_PASSWORD entry) so only the active environment
variables (GF_AUTH_ANONYMOUS_ENABLED and GF_AUTH_ANONYMOUS_ORG_ROLE) remain.
- Around line 128-133: Rename the inconsistent volume name promtail-positions to
promtail_positions to match the underscore convention used by prometheus_data,
grafana_data, loki_data, and tempo_data; then update the corresponding volume
reference in the promtail service definition (the promtail service's volumes
entry that references promtail-positions) so it uses promtail_positions instead.
- Around line 32-37: The service's depends_on currently lists 'loki' but the
otel-collector exports traces to Tempo; update the depends_on block to depend on
'tempo' instead of 'loki' (replace the 'loki' entry with 'tempo' in the
depends_on array) and verify there is a 'tempo' service defined in the compose
file so the dependency is valid (adjust or add the 'tempo' service if missing).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 84ce180a-f7a5-4361-a86d-6646fe9268d4

📥 Commits

Reviewing files that changed from the base of the PR and between 53afeb5 and 94dc5b8.

📒 Files selected for processing (6)
  • .github/workflows/go-ci.yml
  • .github/workflows/golangci-lint.yml
  • .github/workflows/release.yml
  • telemetry-demo/README.md
  • telemetry-demo/docker-compose.yml
  • telemetry-demo/logs/scanoss/api/.gitignore
✅ Files skipped from review due to trivial changes (3)
  • telemetry-demo/logs/scanoss/api/.gitignore
  • .github/workflows/golangci-lint.yml
  • .github/workflows/go-ci.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • telemetry-demo/README.md

@eeisegn eeisegn merged commit 03c6e1b into main Mar 20, 2026
3 checks passed
@eeisegn eeisegn deleted the feat/add-logs-and-traces-examples branch March 20, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants