mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-19 16:55:02 +02:00
fix: Send n8n version on backend posthog flag retrieval (backport to release-candidate/2.34.x) (#35712)
Co-authored-by: Dimitri Lavrenük <20122620+dlavrenuek@users.noreply.github.com>
This commit is contained in:
parent
a944f62402
commit
6d65c4e27f
|
|
@ -6,6 +6,7 @@ import { PostHog } from 'posthog-node';
|
|||
import type { Mock } from 'vitest';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { N8N_VERSION } from '@/constants';
|
||||
import { PostHogClient } from '@/posthog';
|
||||
|
||||
vi.mock('posthog-node');
|
||||
|
|
@ -161,6 +162,8 @@ describe('PostHog', () => {
|
|||
expect(PostHog.prototype.evaluateFlags).toHaveBeenCalledWith(`${instanceId}#${userId}`, {
|
||||
personProperties: {
|
||||
created_at_timestamp: createdAt.getTime().toString(),
|
||||
instance_id: instanceId,
|
||||
version_cli: N8N_VERSION,
|
||||
},
|
||||
groups: { company: instanceId },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ import { InstanceSettings } from 'n8n-core';
|
|||
import type { FeatureFlags, ITelemetryTrackProperties } from 'n8n-workflow';
|
||||
import type { PostHog, FeatureFlagEvaluations } from 'posthog-node';
|
||||
|
||||
import { N8N_VERSION } from '@/constants';
|
||||
|
||||
/**
|
||||
* PostHog group type for instance-level properties.
|
||||
* Note: Aliased as "instance" on PostHog dashboard
|
||||
|
|
@ -136,6 +138,8 @@ export class PostHogClient {
|
|||
const evaluatedFlags = await this.postHog.evaluateFlags(fullId, {
|
||||
personProperties: {
|
||||
created_at_timestamp: user.createdAt.getTime().toString(),
|
||||
instance_id: instanceId,
|
||||
version_cli: N8N_VERSION,
|
||||
},
|
||||
...(instanceId && { groups: { [POSTHOG_GROUP_TYPE_INSTANCE]: instanceId } }),
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user