soumilshah1995 opened a new issue, #8229:
URL: https://github.com/apache/hudi/issues/8229

   Hello i am working on video for community where i want to teach community 
how to integrate DDOG with Hudi i dont see logs in DDOG
   
   ## Step 1: Define Imports 
   
   ```
   try:
   
       import os
       import sys
       import uuid
   
       import pyspark
       from pyspark.sql import SparkSession
       from pyspark import SparkConf, SparkContext
       from pyspark.sql.functions import col, asc, desc
       from pyspark.sql.functions import col, to_timestamp, 
monotonically_increasing_id, to_date, when
       from pyspark.sql.functions import *
       from pyspark.sql.types import *
       from datetime import datetime
       from functools import reduce
       from faker import Faker
       
   except Exception as e:
       pass
   
   ```
   
   ## Step 2 Define Spark Session
   
   ```
   SUBMIT_ARGS = "--packages org.apache.hudi:hudi-spark3.3-bundle_2.12:0.13.0 
pyspark-shell"
   os.environ["PYSPARK_SUBMIT_ARGS"] = SUBMIT_ARGS
   os.environ['PYSPARK_PYTHON'] = sys.executable
   os.environ['PYSPARK_DRIVER_PYTHON'] = sys.executable
       
   spark = SparkSession.builder \
       .config('spark.serializer', 
'org.apache.spark.serializer.KryoSerializer') \
       .config('className', 'org.apache.hudi') \
       .config('spark.sql.hive.convertMetastoreParquet', 'false') \
       .getOrCreate()
   ```
   
   ## Step 3: Define Hudi Settings 
   
   ```
   db_name = "hudidb"
   table_name = "hudi_table"
   
   recordkey = 'uuid,country'
   path = f"file:///C:/tmp/{db_name}/{table_name}"
   precombine = "date"
   method = 'upsert'
   table_type = "COPY_ON_WRITE"  # COPY_ON_WRITE | MERGE_ON_READ
   PARTITION_FIELD = "country"
   
   hudi_options = {
       'hoodie.table.name': table_name,
       'hoodie.datasource.write.table.type': table_type,
       'hoodie.datasource.write.recordkey.field': recordkey,
       'hoodie.datasource.write.table.name': table_name,
       'hoodie.datasource.write.operation': method,
       'hoodie.datasource.write.precombine.field': precombine
       ,"hoodie.datasource.write.partitionpath.field":PARTITION_FIELD
           
       ,"hoodie.metrics.on":"true"
       ,"hoodie.metrics.reporter.type":"DATADOG"
       ,"hoodie.metrics.datadog.api.site":"US"
       ,"hoodie.metrics.datadog.api.key":"KEY XXXXXXXXXXXX"
       ,"hoodie.metrics.datadog.metric.prefix":"hudi"
       
   }
   ```
   
   ## Step 4: Inserts 
   
   ```
   spark_df = spark.createDataFrame(
       data=[
       (1, "insert 1", "2020-01-06 12:12:12", "IN"),
       (2, "insert 2", "2020-01-06 12:12:13", "US"),
       (3, "insert 3", "2020-01-06 12:12:15", "IN"),
       (4, "insert 4", "2020-01-06 12:13:15", "US"),
   ], 
       schema=["uuid", "message",  "date", "country"])
   spark_df.show()
   
   spark_df.write.format("hudi"). \
       options(**hudi_options). \
       mode("append"). \
       save(path)
   ```
   
   ####  i dont see logs 
   
![image](https://user-images.githubusercontent.com/39345855/226114609-7bb3896d-9735-4189-92b0-88e32144782d.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to