Skip to content

Conversation

SomilJain0112
Copy link
Contributor

Which problem is this PR solving?

#7223

Description of the changes

a. Add IndexSpanAlias and IndexServiceAlias config fields
b. Use explicit aliases when provided instead of prefix pattern

c.When explicit aliases are configured, Jaeger will use them directly
without time-based index selection or suffix appending, allowing
users to integrate with existing Elasticsearch setups and avoid
wildcard patterns."

How was this change tested?

Through local testing

Checklist

Comment on lines 129 to 133
if p.SpanAlias != "" || p.ServiceAlias != "" {
return func(_ time.Time) (string, string) {
return spanIndexPrefix, serviceIndexPrefix
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a logical issue in this conditional block. When either p.SpanAlias or p.ServiceAlias is set (but not both), the function will return both indices without date suffixes. This creates inconsistent behavior where an index without an explicit alias will lose its date suffix.

Consider refactoring to handle each index type independently:

return func(date time.Time) (string, string) {
    spanIndex := spanIndexPrefix
    serviceIndex := serviceIndexPrefix
    
    // Only apply date suffix to indices without explicit aliases
    if p.SpanAlias == "" {
        spanIndex = indexWithDate(spanIndexPrefix, p.SpanIndex.DateLayout, date)
    }
    if p.ServiceAlias == "" {
        serviceIndex = indexWithDate(serviceIndexPrefix, p.ServiceIndex.DateLayout, date)
    }
    
    return spanIndex, serviceIndex
}

This ensures that date suffixes are only omitted for indices with explicit aliases configured.

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Copy link

codecov bot commented Oct 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.49%. Comparing base (4a7c358) to head (bcc7b86).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7550   +/-   ##
=======================================
  Coverage   96.49%   96.49%           
=======================================
  Files         385      385           
  Lines       23316    23368   +52     
=======================================
+ Hits        22498    22550   +52     
  Misses        629      629           
  Partials      189      189           
Flag Coverage Δ
badger_v1 8.97% <0.00%> (-0.05%) ⬇️
badger_v2 1.58% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v1-manual 11.62% <0.00%> (-0.06%) ⬇️
cassandra-4.x-v2-auto 1.57% <0.00%> (-0.01%) ⬇️
cassandra-4.x-v2-manual 1.57% <0.00%> (-0.01%) ⬇️
cassandra-5.x-v1-manual 11.62% <0.00%> (-0.06%) ⬇️
cassandra-5.x-v2-auto 1.57% <0.00%> (-0.01%) ⬇️
cassandra-5.x-v2-manual 1.57% <0.00%> (-0.01%) ⬇️
clickhouse 1.52% <0.00%> (-0.01%) ⬇️
elasticsearch-6.x-v1 16.63% <45.45%> (+0.06%) ⬆️
elasticsearch-7.x-v1 16.67% <45.45%> (+0.06%) ⬆️
elasticsearch-8.x-v1 16.81% <45.45%> (+0.06%) ⬆️
elasticsearch-8.x-v2 1.58% <0.00%> (-0.01%) ⬇️
elasticsearch-9.x-v2 1.58% <0.00%> (-0.01%) ⬇️
grpc_v1 10.17% <0.00%> (-0.05%) ⬇️
grpc_v2 1.58% <0.00%> (-0.01%) ⬇️
kafka-3.x-v1 9.61% <0.00%> (-0.05%) ⬇️
kafka-3.x-v2 1.58% <0.00%> (-0.01%) ⬇️
memory_v2 1.58% <0.00%> (-0.01%) ⬇️
opensearch-1.x-v1 16.71% <45.45%> (+0.06%) ⬆️
opensearch-2.x-v1 16.71% <45.45%> (+0.06%) ⬆️
opensearch-2.x-v2 1.58% <0.00%> (-0.01%) ⬇️
opensearch-3.x-v2 1.58% <0.00%> (-0.01%) ⬇️
query 1.58% <0.00%> (-0.01%) ⬇️
tailsampling-processor 0.43% <0.00%> (-0.01%) ⬇️
unittests 95.49% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

github-actions bot commented Oct 10, 2025

Metrics Comparison Summary

Total changes across all snapshots: 53

Detailed changes per snapshot

summary_metrics_snapshot_cassandra

📊 Metrics Diff Summary

Total Changes: 53

  • 🆕 Added: 53 metrics
  • ❌ Removed: 0 metrics
  • 🔄 Modified: 0 metrics

🆕 Added Metrics

  • http_server_request_body_size_bytes (18 variants)
View diff sample
+http_server_request_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="+Inf",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_request_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="0",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_request_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="10",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_request_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="100",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_request_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="1000",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_request_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="10000",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_request_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="25",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
...
- `http_server_request_duration_seconds` (17 variants)
View diff sample
+http_server_request_duration_seconds{http_request_method="GET",http_response_status_code="503",le="+Inf",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_request_duration_seconds{http_request_method="GET",http_response_status_code="503",le="0.005",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_request_duration_seconds{http_request_method="GET",http_response_status_code="503",le="0.01",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_request_duration_seconds{http_request_method="GET",http_response_status_code="503",le="0.025",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_request_duration_seconds{http_request_method="GET",http_response_status_code="503",le="0.05",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_request_duration_seconds{http_request_method="GET",http_response_status_code="503",le="0.075",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_request_duration_seconds{http_request_method="GET",http_response_status_code="503",le="0.1",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
...
- `http_server_response_body_size_bytes` (18 variants)
View diff sample
+http_server_response_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="+Inf",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_response_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="0",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_response_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="10",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_response_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="100",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_response_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="1000",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_response_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="10000",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
+http_server_response_body_size_bytes{http_request_method="GET",http_response_status_code="503",le="25",network_protocol_name="http",network_protocol_version="1.1",otel_scope_name="go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp",otel_scope_schema_url="",otel_scope_version="0.62.0",server_address="localhost",server_port="13133",url_scheme="http"}
...

➡️ View full metrics file

Comment on lines 122 to 126
if p.UseReadWriteAliases {
return func(_ time.Time) (string, string) {
return spanIndexPrefix + writeAlias, serviceIndexPrefix + writeAlias
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

When both UseReadWriteAliases and explicit aliases are configured, the current implementation will append the write alias suffix to the explicit aliases. This behavior may be inconsistent with the purpose of explicit aliases, which are typically intended to be used exactly as provided.

Consider one of these approaches:

  1. Check for explicit aliases before checking UseReadWriteAliases to prioritize the explicit alias behavior
  2. Add logic to handle the combination of both settings explicitly
  3. Document the current behavior in the configuration comments to clarify that explicit aliases will still receive the write suffix when UseReadWriteAliases is enabled

This would ensure the behavior is either consistent with user expectations or clearly documented.

Suggested change
if p.UseReadWriteAliases {
return func(_ time.Time) (string, string) {
return spanIndexPrefix + writeAlias, serviceIndexPrefix + writeAlias
}
}
if p.SpanIndexAlias != "" && p.ServiceIndexAlias != "" {
return func(_ time.Time) (string, string) {
return p.SpanIndexAlias, p.ServiceIndexAlias
}
}
if p.UseReadWriteAliases {
return func(_ time.Time) (string, string) {
return spanIndexPrefix + writeAlias, serviceIndexPrefix + writeAlias
}
}

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@SomilJain0112
Copy link
Contributor Author

Hii @yurishkuro,
Please review the PR. Please let me know if any changes are required and I am going in the right direction for solving this issue or not.
Thanks!

@SomilJain0112
Copy link
Contributor Author

Hii @yurishkuro,
Please review this PR.
Thanks!

@SomilJain0112
Copy link
Contributor Author

Hii @yurishkuro ,
Please review this PR as well.
Thanks!

// IndexSpanAlias is an explicit alias name for span indices.
// When set, Jaeger will use this alias directly instead of the prefix+wildcard pattern.
// This allows integration with existing Elasticsearch setups and custom index management.
IndexSpanAlias string `mapstructure:"index_span_alias"`
Copy link
Member

Choose a reason for hiding this comment

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

Let's call this span_index_override

Suggested change
IndexSpanAlias string `mapstructure:"index_span_alias"`
// SpanIndexOverride allows full control over the name of the index alias.
// Overrides any index prefix / suffix settings.
// Can only be used with UseReadWriteAliases=true.
SpanIndexOverride string `mapstructure:"span_index_override"`

// UseReadWriteAliases, if set to true, will use read and write aliases for indices.
// Use this option with Elasticsearch rollover API. It requires an external component
// to create aliases before startup and then performing its management.
UseReadWriteAliases bool `mapstructure:"use_aliases"`
Copy link
Member

Choose a reason for hiding this comment

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

add validation that if SpanIndexOverride is not empty then UseReadWriteAliases must be true, otherwise throw an error

Copy link
Member

Choose a reason for hiding this comment

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

similarly, add validation that if any of the other fields like prefix / suffix are defined that an error is thrown saying they are incompatible with Override setting.


// When using explicit aliases, treat them like read/write aliases
// (no time-based index selection)
useAliasMode := p.UseReadWriteAliases || hasSpanAlias || hasServiceAlias
Copy link
Member

Choose a reason for hiding this comment

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

don't introduce this implicit behavior, instead raise an error overrides are provided but UseReadWriteAliases is false.

ReadAliasSuffix: f.config.ReadAliasSuffix,
RemoteReadClusters: f.config.RemoteReadClusters,
SpanAlias: f.config.IndexSpanAlias,
ServiceAlias: f.config.IndexServiceAlias,
Copy link
Member

Choose a reason for hiding this comment

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

use the same field names as in the config struct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants