[OPIK-6769] [BE] feat: exclude demo data from prompt version creation BI event#6948
Merged
BorisTkachenko merged 1 commit intoJun 2, 2026
Conversation
Comment on lines
+559
to
+560
| if (DemoData.PROMPTS.contains(promptName)) { | ||
| return; |
Contributor
There was a problem hiding this comment.
Should we normalize promptName here or use a case-insensitive check, otherwise DemoData.PROMPTS.contains(promptName) misses migrated casing and emits prompt_version_created for demo data.
Want Baz to fix this for you? Activate Fixer
Other fix methods
Prompt for AI Agents
Before applying, verify this suggestion against the current code. In
apps/opik-backend/src/main/java/com/comet/opik/domain/PromptService.java around lines
557-561, the `trackPromptVersionCreated(...)` method uses
`DemoData.PROMPTS.contains(promptName)` which is case-sensitive. Refactor the guard to
compare in a case-insensitive way by normalizing `promptName` (and/or precomputing a
normalized set from `DemoData.PROMPTS`) before the `contains` check. Also ensure the
normalization handles null/blank safely so demo prompts with different casing never leak
`prompt_version_created` events.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details
Prompt version creation emits a
prompt_version_createdBI event used for product analytics. Versions created for built-in demo prompts were inflating these metrics. This change skips the event when the prompt name matches a known demo prompt, so analytics reflect only real user activity.savePromptVersionintotrackPromptVersionCreated, which now returns early when the name is inDemoData.PROMPTS.support-agent-systemto the demo prompt list.Change checklist
Issues
AI-WATERMARK
AI-WATERMARK: yes
Testing
shouldCreatePromptVersion__whenDemoPrompt__thenDoesNotEmitEvent(one case per demo prompt name) inPromptResourceTest, verifying noprompt_version_createdevent is emitted for demo prompts. A sentinel real prompt is created afterward through the same async pipeline; once its event arrives, the absence of the demo event is conclusive.mvn test -Dtest=PromptResourceTestDocumentation
N/A