# pyspark.sql.Observation.get blocking on pyspark.sql.Dataframe.writer.save()

**URL:** <https://discuss.elastic.co/t/pyspark-sql-observation-get-blocking-on-pyspark-sql-dataframe-writer-save/381362>\
**Category:** Elasticsearch\
**Created:** [August 27, 2025, 4:43am UTC](https://discuss.elastic.co/t/pyspark-sql-observation-get-blocking-on-pyspark-sql-dataframe-writer-save/381362 "2025-08-27T04:43:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaveLiddy](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@DaveLiddy](https://discuss.elastic.co/u/DaveLiddy)\
**Post date:** [August 27, 2025, 4:43am UTC](https://discuss.elastic.co/t/pyspark-sql-observation-get-blocking-on-pyspark-sql-dataframe-writer-save/381362/1 "2025-08-27T04:43:26Z")

</div>

I’m trying to add some metrics to a pyspark pipeline feeding an index. I’ve found that the get operation blocks on the write, which I can workaround by adding in another request on the dataframe, such as the count below. Is a workaround like this necessary or am I missing something with this code?

```auto
obs = Observation("metrics")
df = spark.read.load(format="jdbc", **pgoptions) \
    .withColumns(chpt_cols) \
    .select(*target_cols) \
    .observe(obs, 
             count(lit(1)).alias("metric1")
            )

df.write.save(mode='append', format='es', **esoptions)
df.count()
obs.get

```

Thanks in advance for your replies
