https://slingdata.io logo
Hi @flarco
# sling-help
s
Hi @flarco I was running replication from Prometheus to S3 and attached a replication file. I need to transform the timestamp column in the source data, extract the date from it, and store it as an additional column in the target data. I know how to do this with databases, but I’m not sure how to achieve it with Prometheus data. Could you please guide me? https://cdn.discordapp.com/attachments/1210406123744796705/1414478046794092624/repli.yml?ex=68c3ab56&is=68c259d6&hm=5f9cc7a9d4b98baad2bbd6b36885aaca0972e17eba87e5212646c35da85e9347&
f
look at the date functions: https://docs.slingdata.io/concepts/functions use something like
new_date_col: date_format(date_parse(record.timestamp, "auto"), "%Y-%m-%d")
s
Hey @flarco , Thanks for the input. I added the transformation in the replication file and I can see the logs in debug mode. However, in the final result, I’m not seeing any data in the payload — the column name is being created, but no data is appearing in the records. https://cdn.discordapp.com/attachments/1414478046928441398/1414646608771158098/logs.txt?ex=68c053d2&is=68bf0252&hm=5f024e4669df9bfcc8ed3be148af5eff1d11ad320d4f32854934b5ce7ae34ca5& https://cdn.discordapp.com/attachments/1414478046928441398/1414646609618141184/Screenshot_2025-09-08_at_12.19.20_PM.png?ex=68c053d2&is=68bf0252&hm=e524ded71b0ceeae178abd9426dc54b9f798f77c7bebd7f9dd8fafb3a994e1c1&
@User, I tried adding a simple string to the event_date column, but I’m still seeing the same issue. No data appears in the payload — only the column name is being created. streams: "miner_shares": sql: 'miner_shares{companyId="356"} # {"start": "2025-09-01T17:00:00Z", "end": "2025-09-01T17:59:00Z", "step": "1M"}' primary_key: [ timestamp, minerId, type ] transforms: - event_date: '"event_date"'
f
OK, took a look and it's because when reading from Prom, it follows a different logic than other DBs, which ends up "skipping" the transforms.. Ironically, it's the only one that does this. Will apply a fix soon and let you know.
s
Awesome, checking now..
@User , If I do a simple transformation without any column casting, it works fine. But when I try casting the columns, it throws an error. https://cdn.discordapp.com/attachments/1414478046928441398/1414690427227082792/logs.txt?ex=68c07ca1&is=68bf2b21&hm=466d828c5cfd6d086c001a68248839f305a0f9f4fd95f597043e5224a6436965&
Hey @flarco , Just to give some context — right now, my ingestion is running directly from Prometheus to Snowflake, and we’re seeing high infrastructure costs due to the large data volume. We’ve identified another approach to first land the data in S3 and then load it into Snowflake, which should reduce costs. I’m planning to complete new ingestion this in the next one to two days, but the only blocker at the moment is fixing the Sling issues. Do you have an estimate for when this issue might be fixed and a release date?
f
yes, looking at it today. Won't be releasing 1.4.21 this week, but you'd be able to use the dev build
OK, dev build was updated, feel free to re-download and give it another try.
f
ah 🤔 , I'll try to reproduce. Could you try casting using the first stage of transforms instead of columns?:
Copy code
transforms:
  - '*': 'cast(value, "string")'
  - event_date: 'date_format(date_parse(record.timestamp, "auto"), "%Y-%m-%d")'
f
OK, I was able to reproduce since you’re writing to parquet. Give it another try with the latest dev version. Or you can grab the new release, planning to release 1.4.21 tomorrow. The casting in transforms should work better.
s
Hi @flarco I’m trying to replicate with a large data set (~818,115 rows) and encountered an error. Could you please check this on high priority? We are almost ready to release the replication into production. Thanks https://cdn.discordapp.com/attachments/1414478046928441398/1418447026013864088/logs.log?ex=68ce273c&is=68ccd5bc&hm=fe684101693e00724d415251c10e0622dbbe451d9bdb858ca735b18e64084001&
f
hmm, that's intersting, this is the error when the duckdb binary is different architecture than machine. can you delete that folder?
rm -rf /root/.sling/bin/duckdb/1.3.2
and try again? sling will download a fresh duckb binary. Or you can specify a binary path you download with
DUCKDB_PATH
env var.
did you mess with that folder at all? strange.
s
No, I was running replication in ECS. Every time it starts, it pulls the new image and installs Sling inside it.
Container architecture: x86_64/Linux
Update - I tried limiting concurrency to 3 and file_max_rows to 10k still seeing smae error {"header":true,"compression":"gzip","concurrency":3,"datetime_format":"auto","delimiter":",","file_max_rows":10000,"file_max_bytes":0,"format":"parquet","max_decimals":-1,"use_bulk":true,"add_new_columns":true,"adjust_column_type":true,"column_casing":"upper"}
f
Quite strange, that's a first. Is it amazon linux? Another to try is to set env var
SLING_DUCKDB_COMPUTE=false
, so it doesn't use duckdb
did it use to work?
s
It’s running on Amazon Linux. I think the issue is related to transforms. I removed all the transforms and the run went smoothly. I’ll check the SLING_DUCKDB_COMPUTE setting. Did this use to work before - I’m trying this scenario for the first time.
f
can you try the same replication on your local machine? with transforms?
s
Do we have any parameter to query Prom in chunks?
f
no, that only works in SQL DBs at the moment
f
oh, I meant with Duckdb. But, did you end up killing the process?
s
It got killed automatically. Okay. i'll replicate with Duckdb
I’m seeing the same behavior with DuckDB locally — it got killed automatically. One observation: I tried the same test with 40K rows and it succeeded, but with higher row counts it is failing.
f
yeah memory
the current Prom connector uses the memory to store data before flushing (unlike the normal DB connectors), that needs improvement. You could reduce the time range?
but, my point to test locally was that duckdb works
I think amazon linux may cause issues with duckdb
what you can do is install duckdb manually on you VM, and pass the DUCKDB_PATH env var to the binary
I think you may need another flavor for amazon linux
and try with higher mem too?
s
I was running 1-hour chunks before, and now I’d like to try splitting them into smaller time ranges.
f
Indeed, that should work. Maybe 10mim chunks. Just write them in the hourly parent folder
s
Hi @flarco , I’ve tried multiple solutions to get replication working, but none of them have given confidence for a successful run: Time range split: Reduced from 1-hour to 15-minute intervals, but still seeing the same error (splitrange.logs attached). ECS memory increase: Increased from 48GB to 64GB, but no luck. Local DuckDB: Added the local DuckDB (v1.4.0) path to the replication file, but still no success (local_duckdb.logs). Added replication file for reference. cc : @daredevil_28922 https://cdn.discordapp.com/attachments/1414478046928441398/1420467611900051487/local_duckdb.logs?ex=68d5810d&is=68d42f8d&hm=c4896f0bf43efa015af875fe6f3de73bafbde49f8ed52457b4d1f1aebb35f123& https://cdn.discordapp.com/attachments/1414478046928441398/1420467612348846121/replication.yaml?ex=68d5810d&is=68d42f8d&hm=041afd820ae0004a19b3c3dc8cdd29d961d677061f541338fc134ff06bc8b7ea& https://cdn.discordapp.com/attachments/1414478046928441398/1420467612680454285/splitrange.logs?ex=68d5810d&is=68d42f8d&hm=0add31a499aeb524a216e688585381fe5353dc494dbc77c4d976e1b1d4989d2f&
f
Could you try
SLING_DUCKDB_COMPUTE: false
with the 15min interval? or 5min interval, which would generate 12 parquet files per hour, still not bad. The downloaded DuckDB binary by sling doesn't seem to work in Amazon Linux.
s
Sure, I’ll try with a lower interval. Just to be clear, the replication is running inside a Docker image (python:3.13-bookworm), and it’s being executed by Amazon ECS Fargate. It is not running directly on Amazon Linux. Sorry for the earlier incorrect info.
f
ah interesting, are you using arm64 (AWS Graviton) underneath?
s
No, we’re not using Graviton. The ECS tasks are running on Fargate with x86_64 (AMD64) Linux.
Hi @flarco , I disabled DuckDB and am running the replication. The files are not being stored in the provided object path; instead, they’re going directly to the S3 root path. Is there a way to configure a custom path? I’ve attached the logs for reference. https://cdn.discordapp.com/attachments/1414478046928441398/1422293381966729392/local_duckdb.logs?ex=68dc256f&is=68dad3ef&hm=4b8a3641ad44448b7774265a63f39a6562ebc6ba3e93c5526ffe6d71ae6d3ec4&
f
are you providing env var`S3_PATH`?
Copy code
source: PROMETHEUS
target: AWS_S3

defaults:
  object: "{S3_PATH}/data_{run_timestamp}.parquet"  # <-- uses env var S3_PATH
s
yeah, it worked when I enabled duck_db
f
here is my test: replication:
Copy code
source: prometheus
target: aws_s3

streams:
  prometheus_metrics:
    sql: |
      sum(go_gc_duration_seconds) by (job, instance, quantile) # {"start": "now-2M"}
    object: '{S3_PATH}/data_{run_timestamp}.parquet'
env:
  SLING_DUCKDB_COMPUTE: false
  S3_PATH: '${S3_PATH}'
log without providing
S3_PATH
log with providing
S3_PATH
Copy code
$ S3_PATH=test sling run -d -r r.test.2.yaml
2025-09-29 17:05:09 INF Sling CLI | https://slingdata.io
2025-09-29 17:05:09 DBG opened "s3" connection (conn-s3-1V1)
2025-09-29 17:05:09 INF Sling Replication | prometheus -> aws_s3 | prometheus_metrics
2025-09-29 17:05:09 DBG Sling version: 1.4.22 (darwin arm64)
2025-09-29 17:05:09 DBG type is db-file
2025-09-29 17:05:09 DBG using: {"columns":null,"mode":"full-refresh","select":null,"transforms":null}
2025-09-29 17:05:09 DBG using source options: {"empty_as_null":false,"datetime_format":"AUTO","max_decimals":-1}
2025-09-29 17:05:09 DBG using target options: {"header":true,"compression":"auto","concurrency":7,"datetime_format":"auto","delimiter":",","file_max_rows":0,"file_max_bytes":0,"max_decimals":-1,"use_bulk":true,"add_new_columns":true,"column_casing":"normalize"}
2025-09-29 17:05:09 INF connecting to source database (prometheus)
2025-09-29 17:05:09 DBG opened "prometheus" connection (conn-prometheus-DvG)
2025-09-29 17:05:09 INF reading from source database
2025-09-29 17:05:09 DBG using range {"Start":"2025-09-29T17:04:09.54199-03:00","End":"2025-09-29T17:05:09.541848-03:00","Step":60000000000}
2025-09-29 17:05:09 DBG applying column casing (normalize) for target type (s3)
2025-09-29 17:05:09 DBG query options: {"start":"now-2M"}
2025-09-29 17:05:09 DBG using range {"Start":"2025-07-29T17:05:09.553523-03:00","End":"2025-09-29T17:05:09.553522-03:00","Step":3600000000000}
2025-09-29 17:05:09 DBG applying column casing (normalize) for target type (s3)
2025-09-29 17:05:09 INF writing to target file system (s3)
2025-09-29 17:05:09 DBG opened "s3" connection (conn-s3-B9v)
2025-09-29 17:05:10 DBG writing to s3://ocral-data-1/test/data_2025_09_29_170509.parquet [fileRowLimit=0 fileBytesLimit=0 compression=auto concurrency=7 useBufferedStream=false fileFormat=parquet singleFile=true]
2025-09-29 17:05:10 DBG wrote 13 kB: 1875 rows [1,949 r/s]
2025-09-29 17:05:10 INF wrot
works fine...