Skip to content

Commit

Permalink
Added chloggen yaml file and did some modifications based on Contribu…
Browse files Browse the repository at this point in the history
…ting.MD
  • Loading branch information
leartbeqiraj1 committed Nov 10, 2023
1 parent 9151b1b commit 0bca6d2
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
27 changes: 27 additions & 0 deletions .chloggen/clickhouseexporter-ttl-enhancements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: deprecation & enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: clickhouseexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Currently, TTL flag supports only days, now we can specify it in seconds, minutes and hours as well (ttl).

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [28675]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: []
1 change: 1 addition & 0 deletions exporter/clickhouseexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type Config struct {
// MetricsTableName is the table name for metrics. default is `otel_metrics`.
MetricsTableName string `mapstructure:"metrics_table_name"`
// TTLDays is The data time-to-live in days, 0 means no ttl.
// Deprecated: Use 'ttl' instead
TTLDays uint `mapstructure:"ttl_days"`
// TTL is The data time-to-live example 30m, 48h. 0 means no ttl.
TTL time.Duration `mapstructure:"ttl"`
Expand Down
1 change: 0 additions & 1 deletion exporter/clickhouseexporter/exporter_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ func createLogsTable(ctx context.Context, cfg *Config, db *sql.DB) error {
func renderCreateLogsTableSQL(cfg *Config) string {
var ttlExpr string

// deprecated and will be removed
if cfg.TTLDays > 0 {
ttlExpr = fmt.Sprintf(`TTL toDateTime(Timestamp) + toIntervalDay(%d)`, cfg.TTLDays)
}
Expand Down
1 change: 0 additions & 1 deletion exporter/clickhouseexporter/exporter_traces.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ func renderCreateTracesTableSQL(cfg *Config) string {
func renderCreateTraceIDTsTableSQL(cfg *Config) string {
var ttlExpr string

// deprecated and will be removed
if cfg.TTLDays > 0 {
ttlExpr = fmt.Sprintf(`TTL toDateTime(Timestamp) + toIntervalDay(%d)`, cfg.TTLDays)
}
Expand Down
2 changes: 1 addition & 1 deletion exporter/clickhouseexporter/internal/metrics_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func SetLogger(l *zap.Logger) {
func NewMetricsTable(ctx context.Context, tableName string, ttlDays uint, ttl time.Duration, db *sql.DB) error {
var ttlExpr string

// deprecated and will be removed
// deprecated and will be removed. Use 'ttl' instead.
if ttlDays > 0 {
ttlExpr = fmt.Sprintf(`TTL toDateTime(Timestamp) + toIntervalDay(%d)`, ttlDays)
}
Expand Down

0 comments on commit 0bca6d2

Please sign in to comment.