Class: Client

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(outconfiguration) ⇒ Client

Returns a new instance of Client.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/fluent/plugin/client.rb', line 18

def initialize(outconfiguration)
  # Set up queries for resource fetching
  @user_query_blob_container = '.get ingestion resources'
  @user_query_aad_token = '.get kusto identity token'
  # Use provided logger or default to stdout
  @logger = initialize_logger(outconfiguration)
  @data_endpoint = outconfiguration.kusto_endpoint
  @cached_resources = nil
  @resources_expiry_time = nil
  @outconfiguration = outconfiguration
  @token_provider = create_token_provider(outconfiguration)
  
  # Minimal state tracking for 12-hour reset
  @client_state = {
    creation_time: Time.now,
    resource_fetch_count: 0,
    last_successful_fetch: nil
  }
  
  # Simplified health configuration
  @health_config = {
    max_client_age: 43_200, # 12 hours - force reset after this time
    max_fetch_cycles: 200 # Force reset after too many fetch cycles
  }
end

Instance Attribute Details

#blob_rowsObject (readonly)

Returns the value of attribute blob_rows.



63
64
65
# File 'lib/fluent/plugin/client.rb', line 63

def blob_rows
  @blob_rows
end

#blob_sas_uriObject (readonly)

Returns the value of attribute blob_sas_uri.



63
64
65
# File 'lib/fluent/plugin/client.rb', line 63

def blob_sas_uri
  @blob_sas_uri
end

#data_endpointObject (readonly)

Returns the value of attribute data_endpoint.



63
64
65
# File 'lib/fluent/plugin/client.rb', line 63

def data_endpoint
  @data_endpoint
end

#identity_tokenObject (readonly)

Returns the value of attribute identity_token.



63
64
65
# File 'lib/fluent/plugin/client.rb', line 63

def identity_token
  @identity_token
end

#loggerObject (readonly)

Returns the value of attribute logger.



63
64
65
# File 'lib/fluent/plugin/client.rb', line 63

def logger
  @logger
end

#queue_sas_uriObject (readonly)

Returns the value of attribute queue_sas_uri.



63
64
65
# File 'lib/fluent/plugin/client.rb', line 63

def queue_sas_uri
  @queue_sas_uri
end

#token_providerObject (readonly)

Returns the value of attribute token_provider.



63
64
65
# File 'lib/fluent/plugin/client.rb', line 63

def token_provider
  @token_provider
end

Instance Method Details

#health_statusObject

Minimal health status for operational visibility



53
54
55
56
57
58
59
60
61
# File 'lib/fluent/plugin/client.rb', line 53

def health_status
  {
    resources_cached: !@cached_resources.nil?,
    cache_expires_at: @resources_expiry_time,
    fetch_cycles: @client_state[:resource_fetch_count],
    pod_age_hours: (Time.now - @client_state[:creation_time]) / 3600,
    last_successful_fetch: @client_state[:last_successful_fetch]
  }
end

#resourcesObject



44
45
46
47
48
49
50
# File 'lib/fluent/plugin/client.rb', line 44

def resources
  # Return cached resources if valid, otherwise fetch and cache
  return @cached_resources if resources_cached?

  fetch_and_cache_resources
  @cached_resources
end