### Adding a Telemetry Metric Together - Live Coding
Brian Bouterse
slide: https://hackmd.io/@pulp/ryxGIp9Ho
---
## Adding a metric
1. Write a [proposal](https://hackmd.io/@pulp/telemetry_template)
2. Discuss it with the working group, [post here](https://discourse.pulpproject.org/t/proposal-telemetry/259)
3. Write the code
---
## Writing the code
1. Data submission
2. Summarization
3. Visualization
---
## Data Submission
1. Add the definition to telemetry protobuf [here](https://github.com/pulp/analytics.pulpproject.org/blob/dev/telemetry.proto)
2. Compile and save the built protobuf code to pulpcore and telemetry repos
3. Write the pulpcore code to submit that
4. Write the telemetry code to receive and save that
---
## Adding a postgresql version string
[The proposal](https://hackmd.io/zJ1dJe8qQtmzr0JiM1jptw)
---
## Update the protobuf spec
`export SRC_DIR=~/devel/pulp3/analytics.pulpproject.org/`
`export DST_DIR=~/devel/pulp3/analytics.pulpproject.org/pulpanalytics/`
`protoc -I=$SRC_DIR --python_out=$DST_DIR $SRC_DIR/telemetry.proto`
---
## Summarization
1. Add the definition to the summarization protobuf [here](https://github.com/pulp/analytics.pulpproject.org/blob/dev/summary.proto)
2. Compile and save the built protobuf code to telemetry repo
3. Add code to the summarize command to do it
---
## Live Coding!
---
## Visualization
1. Create your chart in the template
2. Serialize the data from DailySummary to your template
---
## Pushing it
1. Open PR to 'dev'
2. Ask mini-team for review: @x9c4, @dkliban, @bmbouter
3. Let it run on dev site
4. mini-team will push to prod site periodically
{"metaMigratedAt":"2023-06-17T14:06:51.501Z","metaMigratedFrom":"YAML","title":"Adding a Telemetry Metric Together - Live Coding","breaks":true,"description":"Let's add a metric end-to-end together","contributors":"[{\"id\":\"dc40d541-bddd-4823-82c8-6e5276fe233a\",\"add\":4217,\"del\":2401}]"}