Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

rename telemetry key names at the service level #769

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/agent/onefuzz-agent/src/tasks/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,8 @@ pub struct CommonConfig {

pub heartbeat_queue: Option<Url>,

// TODO: remove the alias once the service has been updated to match
#[serde(alias = "instrumentation_key")]
pub instance_telemetry_key: Option<InstanceTelemetryKey>,

// TODO: remove the alias once the service has been updated to match
#[serde(alias = "telemetry_key")]
pub microsoft_telemetry_key: Option<MicrosoftTelemetryKey>,

#[serde(default)]
Expand Down
8 changes: 0 additions & 8 deletions src/agent/onefuzz-supervisor/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@ pub struct StaticConfig {

pub multi_tenant_domain: Option<String>,

// TODO: remove the alias once the service has been updated to match
#[serde(alias = "instrumentation_key")]
pub instance_telemetry_key: Option<InstanceTelemetryKey>,

// TODO: remove the alias once the service has been updated to match
#[serde(alias = "telemetry_key")]
pub microsoft_telemetry_key: Option<MicrosoftTelemetryKey>,

pub heartbeat_queue: Option<Url>,
Expand All @@ -51,12 +47,8 @@ struct RawStaticConfig {

pub multi_tenant_domain: Option<String>,

// TODO: remove the alias once the service has been updated to match
#[serde(alias = "instrumentation_key")]
pub instance_telemetry_key: Option<InstanceTelemetryKey>,

// TODO: remove the alias once the service has been updated to match
#[serde(alias = "telemetry_key")]
pub microsoft_telemetry_key: Option<MicrosoftTelemetryKey>,

pub heartbeat_queue: Option<Url>,
Expand Down
4 changes: 2 additions & 2 deletions src/api-service/__app__/onefuzzlib/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ def build_pool_config(pool: Pool) -> str:
config = AgentConfig(
pool_name=pool.name,
onefuzz_url=get_instance_url(),
instrumentation_key=os.environ.get("APPINSIGHTS_INSTRUMENTATIONKEY"),
heartbeat_queue=get_queue_sas(
"node-heartbeat",
StorageType.config,
add=True,
),
telemetry_key=os.environ.get("ONEFUZZ_TELEMETRY"),
instance_telemetry_key=os.environ.get("APPINSIGHTS_INSTRUMENTATIONKEY"),
microsoft_telemetry_key=os.environ.get("ONEFUZZ_TELEMETRY"),
instance_id=get_instance_id(),
)

Expand Down
4 changes: 2 additions & 2 deletions src/api-service/__app__/onefuzzlib/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ def save_proxy_config(self) -> None:
),
forwards=forwards,
region=self.region,
instrumentation_key=os.environ.get("APPINSIGHTS_INSTRUMENTATIONKEY"),
telemetry_key=os.environ.get("ONEFUZZ_TELEMETRY"),
instance_telemetry_key=os.environ.get("APPINSIGHTS_INSTRUMENTATIONKEY"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, whenever we grab these key from the environment, we need to remember and preserve the mapping instance <-> instrumentation, microsoft <-> telemetry.

I suggest renaming the env vars elsewhere, but in the meantime, maybe we should define wrappers to os.environ.get, e.g.:

def get_microsoft_telemetry_key() -> str:
    return os.environ.get("ONEFUZZ_TELEMETRY")

We could also just exports constants.

microsoft_telemetry_key=os.environ.get("ONEFUZZ_TELEMETRY"),
bmc-msft marked this conversation as resolved.
Show resolved Hide resolved
instance_id=get_instance_id(),
)

Expand Down
4 changes: 2 additions & 2 deletions src/api-service/__app__/onefuzzlib/tasks/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ def build_task_config(
job_id=job_id,
task_id=task_id,
task_type=task_config.task.type,
instrumentation_key=os.environ.get("APPINSIGHTS_INSTRUMENTATIONKEY"),
telemetry_key=os.environ.get("ONEFUZZ_TELEMETRY"),
instance_telemetry_key=os.environ.get("APPINSIGHTS_INSTRUMENTATIONKEY"),
microsoft_telemetry_key=os.environ.get("ONEFUZZ_TELEMETRY"),
heartbeat_queue=get_queue_sas(
"task-heartbeat",
StorageType.config,
Expand Down
4 changes: 2 additions & 2 deletions src/api-service/__app__/pool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def set_config(pool: Pool) -> Pool:
pool.config = AgentConfig(
pool_name=pool.name,
onefuzz_url=get_instance_url(),
instrumentation_key=os.environ.get("APPINSIGHTS_INSTRUMENTATIONKEY"),
telemetry_key=os.environ.get("ONEFUZZ_TELEMETRY"),
instance_telemetry_key=os.environ.get("APPINSIGHTS_INSTRUMENTATIONKEY"),
microsoft_telemetry_key=os.environ.get("ONEFUZZ_TELEMETRY"),
heartbeat_queue=get_queue_sas(
"node-heartbeat",
StorageType.config,
Expand Down
7 changes: 0 additions & 7 deletions src/proxy-manager/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,8 @@ pub struct Forward {
#[derive(Debug, Deserialize, Serialize, PartialEq, Clone)]
pub struct ConfigData {
pub instance_id: Uuid,

// TODO: remove the alias once the service has been updated to match
#[serde(alias = "instrumentation_key")]
pub instance_telemetry_key: Option<InstanceTelemetryKey>,

// TODO: remove the alias once the service has been updated to match
#[serde(alias = "telemetry_key")]
pub microsoft_telemetry_key: Option<MicrosoftTelemetryKey>,

pub region: String,
pub url: Url,
pub notification: Url,
Expand Down
12 changes: 6 additions & 6 deletions src/pytypes/onefuzztypes/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ class AgentConfig(BaseModel):
onefuzz_url: str
pool_name: PoolName
heartbeat_queue: Optional[str]
instrumentation_key: Optional[str]
telemetry_key: Optional[str]
instance_telemetry_key: Optional[str]
microsoft_telemetry_key: Optional[str]
multi_tenant_domain: Optional[str]
instance_id: UUID

Expand All @@ -373,8 +373,8 @@ class TaskUnitConfig(BaseModel):
job_id: UUID
task_id: UUID
task_type: TaskType
instrumentation_key: Optional[str]
telemetry_key: Optional[str]
instance_telemetry_key: Optional[str]
microsoft_telemetry_key: Optional[str]
heartbeat_queue: str
# command_queue: str
input_queue: Optional[str]
Expand Down Expand Up @@ -433,8 +433,8 @@ class ProxyConfig(BaseModel):
notification: str
region: Region
forwards: List[Forward]
instrumentation_key: Optional[str]
telemetry_key: Optional[str]
instance_telemetry_key: Optional[str]
microsoft_telemetry_key: Optional[str]
instance_id: UUID


Expand Down