-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Added IndexSpanAlias and IndexServiceAlias for explicit aliases #7550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Added IndexSpanAlias and IndexServiceAlias for explicit aliases #7550
Conversation
Signed-off-by: Somil Jain <[email protected]>
if p.SpanAlias != "" || p.ServiceAlias != "" { | ||
return func(_ time.Time) (string, string) { | ||
return spanIndexPrefix, serviceIndexPrefix | ||
} | ||
} |
There was a problem hiding this comment.
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
Is this helpful? React 👍 or 👎 to let us know.
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Metrics Comparison SummaryTotal changes across all snapshots: 53 Detailed changes per snapshotsummary_metrics_snapshot_cassandra📊 Metrics Diff SummaryTotal Changes: 53
🆕 Added Metrics
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"}
... 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"}
... 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"}
... |
…ndices Signed-off-by: Somil Jain <[email protected]>
if p.UseReadWriteAliases { | ||
return func(_ time.Time) (string, string) { | ||
return spanIndexPrefix + writeAlias, serviceIndexPrefix + writeAlias | ||
} | ||
} |
There was a problem hiding this comment.
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:
- Check for explicit aliases before checking
UseReadWriteAliases
to prioritize the explicit alias behavior - Add logic to handle the combination of both settings explicitly
- 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.
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
Is this helpful? React 👍 or 👎 to let us know.
Signed-off-by: Somil Jain <[email protected]>
Hii @yurishkuro, |
Hii @yurishkuro, |
Hii @yurishkuro , |
// 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"` |
There was a problem hiding this comment.
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
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"` |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
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
jaeger
:make lint test
jaeger-ui
:npm run lint
andnpm run test